• Home
  • Raw
  • Download

Lines Matching +full:cpu +full:- +full:centric

4  * Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term *
6 * Copyright (C) 2004-2016 Emulex. All rights reserved. *
9 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
17 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
74 " trunk - link was \"low\" speed",
76 " existing trunk - link was \"middle\" speed",
78 " trunk - link was \"high\" speed",
79 "Attached to non-trunking port - F_Port",
80 "Attached to non-trunking port - N_Port",
82 "non-FLOGI frame received",
89 * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules
97 * Hex 0-9 becomes ascii '0' to '9'.
98 * Hex a-f becomes ascii '=' to 'B' capital B.
110 hdw[7 - i] = 0x30 + j; in lpfc_jedec_to_ascii()
112 hdw[7 - i] = 0x61 + j - 10; in lpfc_jedec_to_ascii()
120 * lpfc_drvr_version_show - Return the Emulex driver string with version number
135 * lpfc_enable_fip_show - Return the fip mode of the HBA
147 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_enable_fip_show()
148 struct lpfc_hba *phba = vport->phba; in lpfc_enable_fip_show()
150 if (phba->hba_flag & HBA_FIP_SUPPORT) in lpfc_enable_fip_show()
162 struct lpfc_hba *phba = vport->phba; in lpfc_nvme_info_show()
177 if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) { in lpfc_nvme_info_show()
181 if (phba->nvmet_support) { in lpfc_nvme_info_show()
182 if (!phba->targetport) { in lpfc_nvme_info_show()
185 wwn_to_u64(vport->fc_portname.u.wwn)); in lpfc_nvme_info_show()
189 if (phba->targetport->port_id) in lpfc_nvme_info_show()
202 phba->brd_no, in lpfc_nvme_info_show()
203 wwn_to_u64(vport->fc_portname.u.wwn), in lpfc_nvme_info_show()
204 wwn_to_u64(vport->fc_nodename.u.wwn), in lpfc_nvme_info_show()
205 phba->targetport->port_id); in lpfc_nvme_info_show()
213 tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private; in lpfc_nvme_info_show()
216 atomic_read(&tgtp->rcv_ls_req_in), in lpfc_nvme_info_show()
217 atomic_read(&tgtp->rcv_ls_req_drop), in lpfc_nvme_info_show()
218 atomic_read(&tgtp->xmt_ls_abort)); in lpfc_nvme_info_show()
222 if (atomic_read(&tgtp->rcv_ls_req_in) != in lpfc_nvme_info_show()
223 atomic_read(&tgtp->rcv_ls_req_out)) { in lpfc_nvme_info_show()
226 atomic_read(&tgtp->rcv_ls_req_in), in lpfc_nvme_info_show()
227 atomic_read(&tgtp->rcv_ls_req_out)); in lpfc_nvme_info_show()
234 atomic_read(&tgtp->xmt_ls_rsp), in lpfc_nvme_info_show()
235 atomic_read(&tgtp->xmt_ls_drop), in lpfc_nvme_info_show()
236 atomic_read(&tgtp->xmt_ls_rsp_cmpl)); in lpfc_nvme_info_show()
242 atomic_read(&tgtp->xmt_ls_rsp_aborted), in lpfc_nvme_info_show()
243 atomic_read(&tgtp->xmt_ls_rsp_xb_set), in lpfc_nvme_info_show()
244 atomic_read(&tgtp->xmt_ls_rsp_error)); in lpfc_nvme_info_show()
251 atomic_read(&tgtp->rcv_fcp_cmd_in), in lpfc_nvme_info_show()
252 atomic_read(&tgtp->rcv_fcp_cmd_defer), in lpfc_nvme_info_show()
253 atomic_read(&tgtp->xmt_fcp_release), in lpfc_nvme_info_show()
254 atomic_read(&tgtp->rcv_fcp_cmd_drop)); in lpfc_nvme_info_show()
258 if (atomic_read(&tgtp->rcv_fcp_cmd_in) != in lpfc_nvme_info_show()
259 atomic_read(&tgtp->rcv_fcp_cmd_out)) { in lpfc_nvme_info_show()
262 atomic_read(&tgtp->rcv_fcp_cmd_in), in lpfc_nvme_info_show()
263 atomic_read(&tgtp->rcv_fcp_cmd_out)); in lpfc_nvme_info_show()
271 atomic_read(&tgtp->xmt_fcp_read), in lpfc_nvme_info_show()
272 atomic_read(&tgtp->xmt_fcp_read_rsp), in lpfc_nvme_info_show()
273 atomic_read(&tgtp->xmt_fcp_write), in lpfc_nvme_info_show()
274 atomic_read(&tgtp->xmt_fcp_rsp), in lpfc_nvme_info_show()
275 atomic_read(&tgtp->xmt_fcp_drop)); in lpfc_nvme_info_show()
281 atomic_read(&tgtp->xmt_fcp_rsp_cmpl), in lpfc_nvme_info_show()
282 atomic_read(&tgtp->xmt_fcp_rsp_error), in lpfc_nvme_info_show()
283 atomic_read(&tgtp->xmt_fcp_rsp_drop)); in lpfc_nvme_info_show()
289 atomic_read(&tgtp->xmt_fcp_rsp_aborted), in lpfc_nvme_info_show()
290 atomic_read(&tgtp->xmt_fcp_rsp_xb_set), in lpfc_nvme_info_show()
291 atomic_read(&tgtp->xmt_fcp_xri_abort_cqe)); in lpfc_nvme_info_show()
297 atomic_read(&tgtp->xmt_fcp_abort), in lpfc_nvme_info_show()
298 atomic_read(&tgtp->xmt_fcp_abort_cmpl)); in lpfc_nvme_info_show()
304 atomic_read(&tgtp->xmt_abort_sol), in lpfc_nvme_info_show()
305 atomic_read(&tgtp->xmt_abort_unsol), in lpfc_nvme_info_show()
306 atomic_read(&tgtp->xmt_abort_rsp), in lpfc_nvme_info_show()
307 atomic_read(&tgtp->xmt_abort_rsp_error)); in lpfc_nvme_info_show()
313 atomic_read(&tgtp->defer_ctx), in lpfc_nvme_info_show()
314 atomic_read(&tgtp->defer_fod), in lpfc_nvme_info_show()
315 atomic_read(&tgtp->defer_wqfull)); in lpfc_nvme_info_show()
320 tot = atomic_read(&tgtp->rcv_fcp_cmd_drop); in lpfc_nvme_info_show()
321 tot += atomic_read(&tgtp->xmt_fcp_release); in lpfc_nvme_info_show()
322 tot = atomic_read(&tgtp->rcv_fcp_cmd_in) - tot; in lpfc_nvme_info_show()
327 phba->sli4_hba.nvmet_xri_cnt, in lpfc_nvme_info_show()
328 phba->sli4_hba.nvmet_io_wait_cnt, in lpfc_nvme_info_show()
329 phba->sli4_hba.nvmet_io_wait_total, in lpfc_nvme_info_show()
335 localport = vport->localport; in lpfc_nvme_info_show()
339 wwn_to_u64(vport->fc_portname.u.wwn)); in lpfc_nvme_info_show()
342 lport = (struct lpfc_nvme_lport *)localport->private; in lpfc_nvme_info_show()
348 phba->brd_no, in lpfc_nvme_info_show()
349 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_nvme_info_show()
350 phba->sli4_hba.io_xri_max, in lpfc_nvme_info_show()
356 if (localport->port_id) in lpfc_nvme_info_show()
364 phba->brd_no, in lpfc_nvme_info_show()
365 wwn_to_u64(vport->fc_portname.u.wwn), in lpfc_nvme_info_show()
366 wwn_to_u64(vport->fc_nodename.u.wwn), in lpfc_nvme_info_show()
367 localport->port_id, statep); in lpfc_nvme_info_show()
371 spin_lock_irq(shost->host_lock); in lpfc_nvme_info_show()
373 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_nvme_info_show()
375 spin_lock(&vport->phba->hbalock); in lpfc_nvme_info_show()
378 nrport = rport->remoteport; in lpfc_nvme_info_show()
379 spin_unlock(&vport->phba->hbalock); in lpfc_nvme_info_show()
384 switch (nrport->port_state) { in lpfc_nvme_info_show()
399 if (phba->brd_no >= 10) { in lpfc_nvme_info_show()
405 nrport->port_name); in lpfc_nvme_info_show()
410 nrport->node_name); in lpfc_nvme_info_show()
415 nrport->port_id); in lpfc_nvme_info_show()
420 if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR) { in lpfc_nvme_info_show()
424 if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET) { in lpfc_nvme_info_show()
428 if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY) { in lpfc_nvme_info_show()
432 if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR | in lpfc_nvme_info_show()
436 nrport->port_role); in lpfc_nvme_info_show()
445 spin_unlock_irq(shost->host_lock); in lpfc_nvme_info_show()
455 atomic_read(&lport->fc4NvmeLsRequests), in lpfc_nvme_info_show()
456 atomic_read(&lport->fc4NvmeLsCmpls), in lpfc_nvme_info_show()
457 atomic_read(&lport->xmt_ls_abort)); in lpfc_nvme_info_show()
463 atomic_read(&lport->xmt_ls_err), in lpfc_nvme_info_show()
464 atomic_read(&lport->cmpl_ls_xb), in lpfc_nvme_info_show()
465 atomic_read(&lport->cmpl_ls_err)); in lpfc_nvme_info_show()
471 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_nvme_info_show()
472 cstat = &phba->sli4_hba.hdwq[i].nvme_cstat; in lpfc_nvme_info_show()
473 tot = cstat->io_cmpls; in lpfc_nvme_info_show()
475 data1 = cstat->input_requests; in lpfc_nvme_info_show()
476 data2 = cstat->output_requests; in lpfc_nvme_info_show()
477 data3 = cstat->control_requests; in lpfc_nvme_info_show()
483 totin, totout, totout - totin); in lpfc_nvme_info_show()
490 atomic_read(&lport->xmt_fcp_abort), in lpfc_nvme_info_show()
491 atomic_read(&lport->xmt_fcp_noxri), in lpfc_nvme_info_show()
492 atomic_read(&lport->xmt_fcp_bad_ndlp), in lpfc_nvme_info_show()
493 atomic_read(&lport->xmt_fcp_qdepth), in lpfc_nvme_info_show()
494 atomic_read(&lport->xmt_fcp_err), in lpfc_nvme_info_show()
495 atomic_read(&lport->xmt_fcp_wqerr)); in lpfc_nvme_info_show()
501 atomic_read(&lport->cmpl_fcp_xb), in lpfc_nvme_info_show()
502 atomic_read(&lport->cmpl_fcp_err)); in lpfc_nvme_info_show()
509 spin_unlock_irq(shost->host_lock); in lpfc_nvme_info_show()
514 if (unlikely(len >= (PAGE_SIZE - 1))) { in lpfc_nvme_info_show()
519 strlcpy(buf + PAGE_SIZE - 1 - in lpfc_nvme_info_show()
520 strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1), in lpfc_nvme_info_show()
522 strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1) in lpfc_nvme_info_show()
535 struct lpfc_hba *phba = vport->phba; in lpfc_scsi_stat_show()
543 if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_FCP) || in lpfc_scsi_stat_show()
544 (phba->sli_rev != LPFC_SLI_REV4)) in lpfc_scsi_stat_show()
551 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_scsi_stat_show()
552 cstat = &phba->sli4_hba.hdwq[i].scsi_cstat; in lpfc_scsi_stat_show()
553 tot = cstat->io_cmpls; in lpfc_scsi_stat_show()
555 data1 = cstat->input_requests; in lpfc_scsi_stat_show()
556 data2 = cstat->output_requests; in lpfc_scsi_stat_show()
557 data3 = cstat->control_requests; in lpfc_scsi_stat_show()
566 tot, ((data1 + data2 + data3) - tot)); in lpfc_scsi_stat_show()
571 "OutIO %016llx\n", totin, totout, totout - totin); in lpfc_scsi_stat_show()
585 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_info_show()
586 struct lpfc_hba *phba = vport->phba; in lpfc_bg_info_show()
588 if (phba->cfg_enable_bg) { in lpfc_bg_info_show()
589 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_bg_info_show()
605 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_guard_err_show()
606 struct lpfc_hba *phba = vport->phba; in lpfc_bg_guard_err_show()
609 (unsigned long long)phba->bg_guard_err_cnt); in lpfc_bg_guard_err_show()
617 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_apptag_err_show()
618 struct lpfc_hba *phba = vport->phba; in lpfc_bg_apptag_err_show()
621 (unsigned long long)phba->bg_apptag_err_cnt); in lpfc_bg_apptag_err_show()
629 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_reftag_err_show()
630 struct lpfc_hba *phba = vport->phba; in lpfc_bg_reftag_err_show()
633 (unsigned long long)phba->bg_reftag_err_cnt); in lpfc_bg_reftag_err_show()
637 * lpfc_info_show - Return some pci info about the host in ascii
654 * lpfc_serialnum_show - Return the hba serial number in ascii
666 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_serialnum_show()
667 struct lpfc_hba *phba = vport->phba; in lpfc_serialnum_show()
669 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->SerialNumber); in lpfc_serialnum_show()
673 * lpfc_temp_sensor_show - Return the temperature sensor level
689 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_temp_sensor_show()
690 struct lpfc_hba *phba = vport->phba; in lpfc_temp_sensor_show()
691 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->temp_sensor_support); in lpfc_temp_sensor_show()
695 * lpfc_modeldesc_show - Return the model description of the hba
707 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_modeldesc_show()
708 struct lpfc_hba *phba = vport->phba; in lpfc_modeldesc_show()
710 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelDesc); in lpfc_modeldesc_show()
714 * lpfc_modelname_show - Return the model name of the hba
726 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_modelname_show()
727 struct lpfc_hba *phba = vport->phba; in lpfc_modelname_show()
729 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelName); in lpfc_modelname_show()
733 * lpfc_programtype_show - Return the program type of the hba
745 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_programtype_show()
746 struct lpfc_hba *phba = vport->phba; in lpfc_programtype_show()
748 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ProgramType); in lpfc_programtype_show()
752 * lpfc_mlomgmt_show - Return the Menlo Maintenance sli flag
763 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_mlomgmt_show()
764 struct lpfc_hba *phba = vport->phba; in lpfc_mlomgmt_show()
767 (phba->sli.sli_flag & LPFC_MENLO_MAINT)); in lpfc_mlomgmt_show()
771 * lpfc_vportnum_show - Return the port number in ascii of the hba
783 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_vportnum_show()
784 struct lpfc_hba *phba = vport->phba; in lpfc_vportnum_show()
786 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->Port); in lpfc_vportnum_show()
790 * lpfc_fwrev_show - Return the firmware rev running in the hba
802 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_fwrev_show()
803 struct lpfc_hba *phba = vport->phba; in lpfc_fwrev_show()
810 if_type = phba->sli4_hba.pc_sli4_params.if_type; in lpfc_fwrev_show()
811 sli_family = phba->sli4_hba.pc_sli4_params.sli_family; in lpfc_fwrev_show()
813 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_fwrev_show()
814 len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d\n", in lpfc_fwrev_show()
815 fwrev, phba->sli_rev); in lpfc_fwrev_show()
817 len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d:%d:%x\n", in lpfc_fwrev_show()
818 fwrev, phba->sli_rev, if_type, sli_family); in lpfc_fwrev_show()
824 * lpfc_hdw_show - Return the jedec information about the hba
836 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_hdw_show()
837 struct lpfc_hba *phba = vport->phba; in lpfc_hdw_show()
838 lpfc_vpd_t *vp = &phba->vpd; in lpfc_hdw_show()
840 lpfc_jedec_to_ascii(vp->rev.biuRev, hdw); in lpfc_hdw_show()
842 vp->rev.smRev, vp->rev.smFwRev); in lpfc_hdw_show()
846 * lpfc_option_rom_version_show - Return the adapter ROM FCode version
858 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_option_rom_version_show()
859 struct lpfc_hba *phba = vport->phba; in lpfc_option_rom_version_show()
862 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_option_rom_version_show()
864 phba->OptionROMVersion); in lpfc_option_rom_version_show()
871 * lpfc_state_show - Return the link state of the port
886 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_state_show()
887 struct lpfc_hba *phba = vport->phba; in lpfc_link_state_show()
890 switch (phba->link_state) { in lpfc_link_state_show()
897 if (phba->hba_flag & LINK_DISABLED) in lpfc_link_state_show()
898 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
899 "Link Down - User disabled\n"); in lpfc_link_state_show()
901 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
907 len += scnprintf(buf + len, PAGE_SIZE-len, "Link Up - "); in lpfc_link_state_show()
909 switch (vport->port_state) { in lpfc_link_state_show()
911 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
921 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
925 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
930 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
935 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
939 if (phba->sli.sli_flag & LPFC_MENLO_MAINT) in lpfc_link_state_show()
940 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
942 else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_state_show()
943 if (vport->fc_flag & FC_PUBLIC_LOOP) in lpfc_link_state_show()
944 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
947 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
950 if (vport->fc_flag & FC_FABRIC) in lpfc_link_state_show()
951 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
954 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
955 " Point-2-Point\n"); in lpfc_link_state_show()
959 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_link_state_show()
961 &phba->sli4_hba.sli_intf) == in lpfc_link_state_show()
963 struct lpfc_trunk_link link = phba->trunk_link; in lpfc_link_state_show()
965 if (bf_get(lpfc_conf_trunk_port0, &phba->sli4_hba)) in lpfc_link_state_show()
966 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
972 if (bf_get(lpfc_conf_trunk_port1, &phba->sli4_hba)) in lpfc_link_state_show()
973 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
979 if (bf_get(lpfc_conf_trunk_port2, &phba->sli4_hba)) in lpfc_link_state_show()
980 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
986 if (bf_get(lpfc_conf_trunk_port3, &phba->sli4_hba)) in lpfc_link_state_show()
987 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
999 * lpfc_sli4_protocol_show - Return the fip mode of the HBA
1011 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sli4_protocol_show()
1012 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_protocol_show()
1014 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_sli4_protocol_show()
1017 if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL) { in lpfc_sli4_protocol_show()
1018 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_GE) in lpfc_sli4_protocol_show()
1020 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC) in lpfc_sli4_protocol_show()
1027 * lpfc_oas_supported_show - Return whether or not Optimized Access Storage
1040 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_oas_supported_show()
1041 struct lpfc_hba *phba = vport->phba; in lpfc_oas_supported_show()
1044 phba->sli4_hba.pc_sli4_params.oas_supported); in lpfc_oas_supported_show()
1048 * lpfc_link_state_store - Transition the link_state on an HBA port
1055 * -EINVAL if the buffer is not "up" or "down"
1056 * return from link state change function if non-zero
1064 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_state_store()
1065 struct lpfc_hba *phba = vport->phba; in lpfc_link_state_store()
1067 int status = -EINVAL; in lpfc_link_state_store()
1069 if ((strncmp(buf, "up", sizeof("up") - 1) == 0) && in lpfc_link_state_store()
1070 (phba->link_state == LPFC_LINK_DOWN)) in lpfc_link_state_store()
1071 status = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_link_state_store()
1072 else if ((strncmp(buf, "down", sizeof("down") - 1) == 0) && in lpfc_link_state_store()
1073 (phba->link_state >= LPFC_LINK_UP)) in lpfc_link_state_store()
1074 status = phba->lpfc_hba_down_link(phba, MBX_NOWAIT); in lpfc_link_state_store()
1083 * lpfc_num_discovered_ports_show - Return sum of mapped and unmapped vports
1099 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_num_discovered_ports_show()
1102 vport->fc_map_cnt + vport->fc_unmap_cnt); in lpfc_num_discovered_ports_show()
1106 * lpfc_issue_lip - Misnomer, name carried over from long ago
1110 * Bring the link down gracefully then re-init the link. The firmware will
1111 * re-init the fiber channel interface as required. Does not issue a LIP.
1114 * -EPERM port offline or management commands are being blocked
1115 * -ENOMEM cannot allocate memory for the mailbox command
1116 * -EIO error sending the mailbox command
1122 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_issue_lip()
1123 struct lpfc_hba *phba = vport->phba; in lpfc_issue_lip()
1131 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_issue_lip()
1132 (phba->hba_flag & LINK_DISABLED) || in lpfc_issue_lip()
1133 (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO)) in lpfc_issue_lip()
1134 return -EPERM; in lpfc_issue_lip()
1136 pmboxq = mempool_alloc(phba->mbox_mem_pool,GFP_KERNEL); in lpfc_issue_lip()
1139 return -ENOMEM; in lpfc_issue_lip()
1142 pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK; in lpfc_issue_lip()
1143 pmboxq->u.mb.mbxOwner = OWN_HOST; in lpfc_issue_lip()
1145 if ((vport->fc_flag & FC_PT2PT) && (vport->fc_flag & FC_PT2PT_NO_NVME)) in lpfc_issue_lip()
1146 vport->fc_flag &= ~FC_PT2PT_NO_NVME; in lpfc_issue_lip()
1151 (pmboxq->u.mb.mbxStatus == 0 || in lpfc_issue_lip()
1152 pmboxq->u.mb.mbxStatus == MBXERR_LINK_DOWN)) { in lpfc_issue_lip()
1154 lpfc_init_link(phba, pmboxq, phba->cfg_topology, in lpfc_issue_lip()
1155 phba->cfg_link_speed); in lpfc_issue_lip()
1157 phba->fc_ratov * 2); in lpfc_issue_lip()
1159 (pmboxq->u.mb.mbxStatus == MBXERR_SEC_NO_PERMISSION)) in lpfc_issue_lip()
1167 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_issue_lip()
1170 return -EIO; in lpfc_issue_lip()
1198 * lpfc_do_offline - Issues a mailbox command to bring the link down
1206 * lpfc_workq_post_event() returns a non-zero return code if call fails.
1209 * -EIO error posting the event
1227 return -ENOMEM; in lpfc_do_offline()
1232 return -EIO; in lpfc_do_offline()
1234 psli = &phba->sli; in lpfc_do_offline()
1241 spin_lock_irq(&phba->hbalock); in lpfc_do_offline()
1242 if (!(psli->sli_flag & LPFC_QUEUE_FREE_INIT)) { in lpfc_do_offline()
1243 psli->sli_flag |= LPFC_QUEUE_FREE_WAIT; in lpfc_do_offline()
1245 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1248 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1253 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_do_offline()
1254 for (i = 0; i < psli->num_rings; i++) { in lpfc_do_offline()
1255 pring = &psli->sli3_ring[i]; in lpfc_do_offline()
1256 if (!lpfc_emptyq_wait(phba, &pring->txcmplq, in lpfc_do_offline()
1257 &phba->hbalock)) in lpfc_do_offline()
1261 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_do_offline()
1262 pring = qp->pring; in lpfc_do_offline()
1265 if (!lpfc_emptyq_wait(phba, &pring->txcmplq, in lpfc_do_offline()
1266 &pring->ring_lock)) in lpfc_do_offline()
1271 spin_lock_irq(&phba->hbalock); in lpfc_do_offline()
1272 psli->sli_flag &= ~LPFC_QUEUE_FREE_WAIT; in lpfc_do_offline()
1273 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1279 return -ENOMEM; in lpfc_do_offline()
1284 return -EIO; in lpfc_do_offline()
1290 * lpfc_reset_pci_bus - resets PCI bridge controller's secondary bus of an HBA
1294 * Issues a PCI secondary bus reset for the phba->pcidev.
1303 * -ENOTSUPP, cfg_enable_hba_reset must be of value 2
1304 * -ENODEV, NULL ptr to pcidev
1305 * -EBADSLT, detected invalid device
1306 * -EBUSY, port is not in offline state
1312 struct pci_dev *pdev = phba->pcidev; in lpfc_reset_pci_bus()
1318 if (phba->cfg_enable_hba_reset != 2) in lpfc_reset_pci_bus()
1319 return -ENOTSUPP; in lpfc_reset_pci_bus()
1323 return -ENODEV; in lpfc_reset_pci_bus()
1331 list_for_each_entry(ptr, &pdev->bus->devices, bus_list) { in lpfc_reset_pci_bus()
1336 ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_reset_pci_bus()
1337 if (!(phba_other->pport->fc_flag & FC_OFFLINE_MODE)) { in lpfc_reset_pci_bus()
1342 phba_other->wwpn[0], in lpfc_reset_pci_bus()
1343 phba_other->wwpn[1], in lpfc_reset_pci_bus()
1344 phba_other->wwpn[2], in lpfc_reset_pci_bus()
1345 phba_other->wwpn[3], in lpfc_reset_pci_bus()
1346 phba_other->wwpn[4], in lpfc_reset_pci_bus()
1347 phba_other->wwpn[5], in lpfc_reset_pci_bus()
1348 phba_other->wwpn[6], in lpfc_reset_pci_bus()
1349 phba_other->wwpn[7]); in lpfc_reset_pci_bus()
1350 return -EBUSY; in lpfc_reset_pci_bus()
1366 * lpfc_selective_reset - Offline then onlines the port
1379 * -EIO reset not configured or error posting the event
1389 if (!phba->cfg_enable_hba_reset) in lpfc_selective_reset()
1390 return -EACCES; in lpfc_selective_reset()
1392 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE)) { in lpfc_selective_reset()
1403 return -ENOMEM; in lpfc_selective_reset()
1408 return -EIO; in lpfc_selective_reset()
1414 * lpfc_issue_reset - Selectively resets an adapter
1430 * -EINVAL if the buffer does not contain the string "selective"
1431 * length of buf if lpfc-selective_reset() if the call succeeds
1439 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_issue_reset()
1440 struct lpfc_hba *phba = vport->phba; in lpfc_issue_reset()
1441 int status = -EINVAL; in lpfc_issue_reset()
1443 if (!phba->cfg_enable_hba_reset) in lpfc_issue_reset()
1444 return -EACCES; in lpfc_issue_reset()
1446 if (strncmp(buf, "selective", sizeof("selective") - 1) == 0) in lpfc_issue_reset()
1447 status = phba->lpfc_selective_reset(phba); in lpfc_issue_reset()
1456 * lpfc_sli4_pdev_status_reg_wait - Wait for pdev status register for readyness
1460 * SLI4 interface type-2 device to wait on the sliport status register for
1464 * zero for success, -EPERM when port does not have privilege to perform the
1465 * reset, -EIO when port timeout from recovering from the reset.
1478 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1480 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1485 return -EPERM; in lpfc_sli4_pdev_status_reg_wait()
1490 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1505 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1509 * lpfc_sli4_pdev_reg_request - Request physical dev to perform a register acc
1513 * Request SLI4 interface type-2 device to perform a physical register set
1523 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pdev_reg_request()
1530 if (!phba->cfg_enable_hba_reset) in lpfc_sli4_pdev_reg_request()
1531 return -EACCES; in lpfc_sli4_pdev_reg_request()
1533 if ((phba->sli_rev < LPFC_SLI_REV4) || in lpfc_sli4_pdev_reg_request()
1534 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_pdev_reg_request()
1536 return -EPERM; in lpfc_sli4_pdev_reg_request()
1539 before_fc_flag = phba->pport->fc_flag; in lpfc_sli4_pdev_reg_request()
1540 sriov_nr_virtfn = phba->cfg_sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1544 phba->fw_dump_cmpl = &online_compl; in lpfc_sli4_pdev_reg_request()
1546 /* Disable SR-IOV virtual functions if enabled */ in lpfc_sli4_pdev_reg_request()
1547 if (phba->cfg_sriov_nr_virtfn) { in lpfc_sli4_pdev_reg_request()
1549 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_pdev_reg_request()
1561 reg_val = readl(phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1571 writel(reg_val, phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1574 readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); in lpfc_sli4_pdev_reg_request()
1579 if (rc == -EPERM) { in lpfc_sli4_pdev_reg_request()
1584 } else if (rc == -EIO) { in lpfc_sli4_pdev_reg_request()
1589 if (phba->fw_dump_cmpl) in lpfc_sli4_pdev_reg_request()
1590 phba->fw_dump_cmpl = NULL; in lpfc_sli4_pdev_reg_request()
1596 if (phba->fw_dump_cmpl) in lpfc_sli4_pdev_reg_request()
1597 phba->fw_dump_cmpl = NULL; in lpfc_sli4_pdev_reg_request()
1606 wait_for_completion(phba->fw_dump_cmpl); in lpfc_sli4_pdev_reg_request()
1622 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_pdev_reg_request()
1628 phba->cfg_sriov_nr_virtfn = sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1634 rc = -ENOMEM; in lpfc_sli4_pdev_reg_request()
1636 rc = -EIO; in lpfc_sli4_pdev_reg_request()
1642 * lpfc_nport_evt_cnt_show - Return the number of nport events
1654 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nport_evt_cnt_show()
1655 struct lpfc_hba *phba = vport->phba; in lpfc_nport_evt_cnt_show()
1657 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); in lpfc_nport_evt_cnt_show()
1678 return -EINVAL; /* Invalid command */ in lpfc_set_trunking()
1692 return -EINVAL; in lpfc_set_trunking()
1698 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_set_trunking()
1700 return -ENOMEM; in lpfc_set_trunking()
1707 &mbox->u.mqe.un.set_trunk_mode, in lpfc_set_trunking()
1714 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_set_trunking()
1720 * lpfc_board_mode_show - Return the state of the board
1732 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_show()
1733 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_show()
1736 if (phba->link_state == LPFC_HBA_ERROR) in lpfc_board_mode_show()
1738 else if (phba->link_state == LPFC_WARM_START) in lpfc_board_mode_show()
1740 else if (phba->link_state == LPFC_INIT_START) in lpfc_board_mode_show()
1749 * lpfc_board_mode_store - Puts the hba in online, offline, warm or error state
1756 * -EACCES if enable hba reset not enabled
1757 * -EINVAL if the buffer does not contain a valid string (see above)
1758 * -EIO if lpfc_workq_post_event() or lpfc_do_offline() fails
1766 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_store()
1767 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_store()
1773 if (!phba->cfg_enable_hba_reset) { in lpfc_board_mode_store()
1774 status = -EACCES; in lpfc_board_mode_store()
1783 if(strncmp(buf, "online", sizeof("online") - 1) == 0) { in lpfc_board_mode_store()
1787 status = -ENOMEM; in lpfc_board_mode_store()
1792 status = -EIO; in lpfc_board_mode_store()
1793 } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) in lpfc_board_mode_store()
1795 else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) in lpfc_board_mode_store()
1796 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
1797 status = -EINVAL; in lpfc_board_mode_store()
1800 else if (strncmp(buf, "error", sizeof("error") - 1) == 0) in lpfc_board_mode_store()
1801 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
1802 status = -EINVAL; in lpfc_board_mode_store()
1805 else if (strncmp(buf, "dump", sizeof("dump") - 1) == 0) in lpfc_board_mode_store()
1807 else if (strncmp(buf, "fw_reset", sizeof("fw_reset") - 1) == 0) in lpfc_board_mode_store()
1809 else if (strncmp(buf, "dv_reset", sizeof("dv_reset") - 1) == 0) in lpfc_board_mode_store()
1811 else if (strncmp(buf, "pci_bus_reset", sizeof("pci_bus_reset") - 1) in lpfc_board_mode_store()
1814 else if (strncmp(buf, "trunk", sizeof("trunk") - 1) == 0) in lpfc_board_mode_store()
1817 status = -EINVAL; in lpfc_board_mode_store()
1829 buf, status, phba->pport->fc_flag); in lpfc_board_mode_store()
1835 * lpfc_get_hba_info - Return various bits of informaton about the adapter
1868 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_hba_info()
1869 !phba->mbox_mem_pool || in lpfc_get_hba_info()
1870 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_hba_info()
1873 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_hba_info()
1876 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_hba_info()
1881 pmb = &pmboxq->u.mb; in lpfc_get_hba_info()
1882 pmb->mbxCommand = MBX_READ_CONFIG; in lpfc_get_hba_info()
1883 pmb->mbxOwner = OWN_HOST; in lpfc_get_hba_info()
1884 pmboxq->ctx_buf = NULL; in lpfc_get_hba_info()
1886 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_hba_info()
1889 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_hba_info()
1893 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
1897 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_get_hba_info()
1898 rd_config = &pmboxq->u.mqe.un.rd_config; in lpfc_get_hba_info()
1902 *arpi = bf_get(lpfc_mbx_rd_conf_rpi_count, rd_config) - in lpfc_get_hba_info()
1903 phba->sli4_hba.max_cfg_param.rpi_used; in lpfc_get_hba_info()
1907 *axri = bf_get(lpfc_mbx_rd_conf_xri_count, rd_config) - in lpfc_get_hba_info()
1908 phba->sli4_hba.max_cfg_param.xri_used; in lpfc_get_hba_info()
1910 /* Account for differences with SLI-3. Get vpi count from in lpfc_get_hba_info()
1914 (bf_get(lpfc_mbx_rd_conf_vpi_count, rd_config) - 1) : 0; in lpfc_get_hba_info()
1922 *avpi = max_vpi - phba->sli4_hba.max_cfg_param.vpi_used; in lpfc_get_hba_info()
1925 *mrpi = pmb->un.varRdConfig.max_rpi; in lpfc_get_hba_info()
1927 *arpi = pmb->un.varRdConfig.avail_rpi; in lpfc_get_hba_info()
1929 *mxri = pmb->un.varRdConfig.max_xri; in lpfc_get_hba_info()
1931 *axri = pmb->un.varRdConfig.avail_xri; in lpfc_get_hba_info()
1933 *mvpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
1936 if (phba->link_state == LPFC_HBA_READY) in lpfc_get_hba_info()
1937 *avpi = pmb->un.varRdConfig.avail_vpi; in lpfc_get_hba_info()
1939 *avpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
1943 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
1948 * lpfc_max_rpi_show - Return maximum rpi
1966 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_rpi_show()
1967 struct lpfc_hba *phba = vport->phba; in lpfc_max_rpi_show()
1976 * lpfc_used_rpi_show - Return maximum rpi minus available rpi
1994 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_rpi_show()
1995 struct lpfc_hba *phba = vport->phba; in lpfc_used_rpi_show()
1999 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_rpi_show()
2004 * lpfc_max_xri_show - Return maximum xri
2022 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_xri_show()
2023 struct lpfc_hba *phba = vport->phba; in lpfc_max_xri_show()
2032 * lpfc_used_xri_show - Return maximum xpi minus the available xpi
2050 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_xri_show()
2051 struct lpfc_hba *phba = vport->phba; in lpfc_used_xri_show()
2055 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_xri_show()
2060 * lpfc_max_vpi_show - Return maximum vpi
2078 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_vpi_show()
2079 struct lpfc_hba *phba = vport->phba; in lpfc_max_vpi_show()
2088 * lpfc_used_vpi_show - Return maximum vpi minus the available vpi
2106 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_vpi_show()
2107 struct lpfc_hba *phba = vport->phba; in lpfc_used_vpi_show()
2111 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_vpi_show()
2116 * lpfc_npiv_info_show - Return text about NPIV support for the adapter
2133 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_npiv_info_show()
2134 struct lpfc_hba *phba = vport->phba; in lpfc_npiv_info_show()
2136 if (!(phba->max_vpi)) in lpfc_npiv_info_show()
2138 if (vport->port_type == LPFC_PHYSICAL_PORT) in lpfc_npiv_info_show()
2140 return scnprintf(buf, PAGE_SIZE, "NPIV Virtual (VPI %d)\n", vport->vpi); in lpfc_npiv_info_show()
2144 * lpfc_poll_show - Return text about poll support for the adapter
2159 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_show()
2160 struct lpfc_hba *phba = vport->phba; in lpfc_poll_show()
2162 return scnprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); in lpfc_poll_show()
2166 * lpfc_poll_store - Set the value of cfg_poll for the adapter
2176 * -EINVAL if the buffer connot be converted or is out of range
2184 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_store()
2185 struct lpfc_hba *phba = vport->phba; in lpfc_poll_store()
2191 return -EINVAL; in lpfc_poll_store()
2194 return -EINVAL; in lpfc_poll_store()
2197 return -EINVAL; in lpfc_poll_store()
2199 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_poll_store()
2204 phba->cfg_poll, val); in lpfc_poll_store()
2206 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2208 old_val = phba->cfg_poll; in lpfc_poll_store()
2213 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2214 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2215 return -EINVAL; in lpfc_poll_store()
2218 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2219 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2224 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2225 return -EINVAL; in lpfc_poll_store()
2231 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2232 del_timer(&phba->fcp_poll_timer); in lpfc_poll_store()
2233 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2234 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2235 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2236 return -EINVAL; in lpfc_poll_store()
2239 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2240 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2243 phba->cfg_poll = val; in lpfc_poll_store()
2245 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2251 * lpfc_sriov_hw_max_virtfn_show - Return maximum number of virtual functions
2268 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sriov_hw_max_virtfn_show()
2269 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_hw_max_virtfn_show()
2293 * -EINVAL if val is invalid
2298 if (lpfc_rangecheck(val, 0, 1) && phba->sli_rev == LPFC_SLI_REV4) { in lpfc_enable_bbcr_set()
2301 LPFC_DRIVER_NAME, phba->cfg_enable_bbcr, val); in lpfc_enable_bbcr_set()
2302 phba->cfg_enable_bbcr = val; in lpfc_enable_bbcr_set()
2308 return -EINVAL; in lpfc_enable_bbcr_set()
2312 * lpfc_param_show - Return a cfg attribute value in decimal
2331 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2332 struct lpfc_hba *phba = vport->phba;\
2334 phba->cfg_##attr);\
2338 * lpfc_param_hex_show - Return a cfg attribute value in hex
2357 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2358 struct lpfc_hba *phba = vport->phba;\
2360 val = phba->cfg_##attr;\
2362 phba->cfg_##attr);\
2366 * lpfc_param_init - Initializes a cfg attribute
2382 * -EINVAL if default used
2389 phba->cfg_##attr = val;\
2395 phba->cfg_##attr = default;\
2396 return -EINVAL;\
2400 * lpfc_param_set - Set a cfg attribute value
2417 * -EINVAL if val is invalid
2426 phba->cfg_##attr, val); \
2427 phba->cfg_##attr = val;\
2433 return -EINVAL;\
2437 * lpfc_param_store - Set a vport attribute value
2454 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2463 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2464 struct lpfc_hba *phba = vport->phba;\
2467 return -EINVAL;\
2469 return -EINVAL;\
2473 return -EINVAL;\
2477 * lpfc_vport_param_show - Return decimal formatted cfg attribute value
2496 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2497 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
2501 * lpfc_vport_param_hex_show - Return hex formatted attribute value
2521 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2522 return scnprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
2526 * lpfc_vport_param_init - Initialize a vport cfg attribute
2541 * -EINVAL if default used
2548 vport->cfg_##attr = val;\
2554 vport->cfg_##attr = default;\
2555 return -EINVAL;\
2559 * lpfc_vport_param_set - Set a vport cfg attribute
2573 * -EINVAL if val is invalid
2583 vport->cfg_##attr, vport->cfg_##attr, \
2585 vport->cfg_##attr = val;\
2591 return -EINVAL;\
2595 * lpfc_vport_param_store - Set a vport attribute
2608 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2617 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2620 return -EINVAL;\
2622 return -EINVAL;\
2626 return -EINVAL;\
2673 * lpfc_wwn_set - Convert string to the 8 byte WWN value.
2679 * -EINVAL if the buffer does not contain a valid wwn
2688 if (buf[cnt-1] == '\n') in lpfc_wwn_set()
2689 cnt--; in lpfc_wwn_set()
2693 return -EINVAL; in lpfc_wwn_set()
2700 j = ((j << 4) | ((*buf++ - 'a') + 10)); in lpfc_wwn_set()
2702 j = ((j << 4) | ((*buf++ - 'A') + 10)); in lpfc_wwn_set()
2704 j = ((j << 4) | (*buf++ - '0')); in lpfc_wwn_set()
2706 return -EINVAL; in lpfc_wwn_set()
2715 * lpfc_soft_wwn_enable_store - Allows setting of the wwn if the key is valid
2722 * -EINVAL if the buffer does not contain lpfc_soft_wwn_key
2730 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwn_enable_store()
2731 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwn_enable_store()
2733 uint8_t vvvl = vport->fc_sparam.cmn.valid_vendor_ver_level; in lpfc_soft_wwn_enable_store()
2734 u32 *fawwpn_key = (uint32_t *)&vport->fc_sparam.un.vendorVersion[0]; in lpfc_soft_wwn_enable_store()
2741 * desired, the key must be written again to re-enable the in lpfc_soft_wwn_enable_store()
2744 * The "key" is not secret - it is a hardcoded string shown in lpfc_soft_wwn_enable_store()
2752 return -EINVAL; in lpfc_soft_wwn_enable_store()
2756 if (buf[cnt-1] == '\n') in lpfc_soft_wwn_enable_store()
2757 cnt--; in lpfc_soft_wwn_enable_store()
2761 return -EINVAL; in lpfc_soft_wwn_enable_store()
2763 phba->soft_wwn_enable = 1; in lpfc_soft_wwn_enable_store()
2765 dev_printk(KERN_WARNING, &phba->pcidev->dev, in lpfc_soft_wwn_enable_store()
2767 phba->brd_no); in lpfc_soft_wwn_enable_store()
2768 dev_printk(KERN_WARNING, &phba->pcidev->dev, in lpfc_soft_wwn_enable_store()
2776 * lpfc_soft_wwpn_show - Return the cfg soft ww port name of the adapter
2788 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwpn_show()
2789 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwpn_show()
2792 (unsigned long long)phba->cfg_soft_wwpn); in lpfc_soft_wwpn_show()
2796 * lpfc_soft_wwpn_store - Set the ww port name of the adapter
2803 * -EACCES hba reset not enabled, adapter over temp
2804 * -EINVAL soft wwn not enabled, count is invalid, invalid wwpn byte invalid
2805 * -EIO error taking adapter offline or online
2813 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwpn_store()
2814 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwpn_store()
2821 if (!phba->cfg_enable_hba_reset) in lpfc_soft_wwpn_store()
2822 return -EACCES; in lpfc_soft_wwpn_store()
2823 spin_lock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2824 if (phba->over_temp_state == HBA_OVER_TEMP) { in lpfc_soft_wwpn_store()
2825 spin_unlock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2826 return -EACCES; in lpfc_soft_wwpn_store()
2828 spin_unlock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2830 if (buf[cnt-1] == '\n') in lpfc_soft_wwpn_store()
2831 cnt--; in lpfc_soft_wwpn_store()
2833 if (!phba->soft_wwn_enable) in lpfc_soft_wwpn_store()
2834 return -EINVAL; in lpfc_soft_wwpn_store()
2837 phba->soft_wwn_enable = 0; in lpfc_soft_wwpn_store()
2842 phba->soft_wwn_enable = 1; in lpfc_soft_wwpn_store()
2846 phba->cfg_soft_wwpn = wwn_to_u64(wwpn); in lpfc_soft_wwpn_store()
2847 fc_host_port_name(shost) = phba->cfg_soft_wwpn; in lpfc_soft_wwpn_store()
2848 if (phba->cfg_soft_wwnn) in lpfc_soft_wwpn_store()
2849 fc_host_node_name(shost) = phba->cfg_soft_wwnn; in lpfc_soft_wwpn_store()
2851 dev_printk(KERN_NOTICE, &phba->pcidev->dev, in lpfc_soft_wwpn_store()
2852 "lpfc%d: Reinitializing to use soft_wwpn\n", phba->brd_no); in lpfc_soft_wwpn_store()
2858 "reinit adapter - %d\n", stat1); in lpfc_soft_wwpn_store()
2863 return -ENOMEM; in lpfc_soft_wwpn_store()
2869 "reinit adapter - %d\n", stat2); in lpfc_soft_wwpn_store()
2870 return (stat1 || stat2) ? -EIO : count; in lpfc_soft_wwpn_store()
2875 * lpfc_soft_wwnn_show - Return the cfg soft ww node name for the adapter
2887 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_soft_wwnn_show()
2889 (unsigned long long)phba->cfg_soft_wwnn); in lpfc_soft_wwnn_show()
2893 * lpfc_soft_wwnn_store - sets the ww node name of the adapter
2899 * -EINVAL soft wwn not enabled, count is invalid, invalid wwnn byte invalid
2907 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_soft_wwnn_store()
2913 if (buf[cnt-1] == '\n') in lpfc_soft_wwnn_store()
2914 cnt--; in lpfc_soft_wwnn_store()
2916 if (!phba->soft_wwn_enable) in lpfc_soft_wwnn_store()
2917 return -EINVAL; in lpfc_soft_wwnn_store()
2927 phba->cfg_soft_wwnn = wwn_to_u64(wwnn); in lpfc_soft_wwnn_store()
2929 dev_printk(KERN_NOTICE, &phba->pcidev->dev, in lpfc_soft_wwnn_store()
2931 "setting of the soft_wwpn\n", phba->brd_no); in lpfc_soft_wwnn_store()
2938 * lpfc_oas_tgt_show - Return wwpn of target whose luns maybe enabled for
2952 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_show()
2955 wwn_to_u64(phba->cfg_oas_tgt_wwpn)); in lpfc_oas_tgt_show()
2959 * lpfc_oas_tgt_store - Store wwpn of target whose luns maybe enabled for
2967 * -EINVAL count is invalid, invalid wwpn byte invalid
2968 * -EPERM oas is not supported by hba
2976 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_store()
2981 if (!phba->cfg_fof) in lpfc_oas_tgt_store()
2982 return -EPERM; in lpfc_oas_tgt_store()
2985 if (buf[cnt-1] == '\n') in lpfc_oas_tgt_store()
2986 cnt--; in lpfc_oas_tgt_store()
2992 memcpy(phba->cfg_oas_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
2993 memcpy(phba->sli4_hba.oas_next_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
2995 phba->cfg_oas_flags |= OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
2997 phba->cfg_oas_flags &= ~OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
2998 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_tgt_store()
2999 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_tgt_store()
3006 * lpfc_oas_priority_show - Return wwpn of target whose luns maybe enabled for
3020 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_show()
3022 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority); in lpfc_oas_priority_show()
3026 * lpfc_oas_priority_store - Store wwpn of target whose luns maybe enabled for
3034 * -EINVAL count is invalid, invalid wwpn byte invalid
3035 * -EPERM oas is not supported by hba
3043 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_store()
3048 if (!phba->cfg_fof) in lpfc_oas_priority_store()
3049 return -EPERM; in lpfc_oas_priority_store()
3052 if (buf[cnt-1] == '\n') in lpfc_oas_priority_store()
3053 cnt--; in lpfc_oas_priority_store()
3057 return -EINVAL; in lpfc_oas_priority_store()
3060 phba->cfg_oas_priority = (uint8_t)val; in lpfc_oas_priority_store()
3062 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_priority_store()
3069 * lpfc_oas_vpt_show - Return wwpn of vport whose targets maybe enabled
3083 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_show()
3086 wwn_to_u64(phba->cfg_oas_vpt_wwpn)); in lpfc_oas_vpt_show()
3090 * lpfc_oas_vpt_store - Store wwpn of vport whose targets maybe enabled
3098 * -EINVAL count is invalid, invalid wwpn byte invalid
3099 * -EPERM oas is not supported by hba
3107 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_store()
3112 if (!phba->cfg_fof) in lpfc_oas_vpt_store()
3113 return -EPERM; in lpfc_oas_vpt_store()
3116 if (buf[cnt-1] == '\n') in lpfc_oas_vpt_store()
3117 cnt--; in lpfc_oas_vpt_store()
3123 memcpy(phba->cfg_oas_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3124 memcpy(phba->sli4_hba.oas_next_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3126 phba->cfg_oas_flags |= OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3128 phba->cfg_oas_flags &= ~OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3129 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_vpt_store()
3130 if (phba->cfg_oas_priority == 0) in lpfc_oas_vpt_store()
3131 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_vpt_store()
3132 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_vpt_store()
3139 * lpfc_oas_lun_state_show - Return the current state (enabled or disabled)
3154 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_show()
3156 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_state); in lpfc_oas_lun_state_show()
3160 * lpfc_oas_lun_state_store - Store the state (enabled or disabled)
3169 * -EINVAL count is invalid, invalid wwpn byte invalid
3170 * -EPERM oas is not supported by hba
3178 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_store()
3181 if (!phba->cfg_fof) in lpfc_oas_lun_state_store()
3182 return -EPERM; in lpfc_oas_lun_state_store()
3185 return -EINVAL; in lpfc_oas_lun_state_store()
3188 return -EINVAL; in lpfc_oas_lun_state_store()
3191 return -EINVAL; in lpfc_oas_lun_state_store()
3193 phba->cfg_oas_lun_state = val; in lpfc_oas_lun_state_store()
3200 * lpfc_oas_lun_status_show - Return the status of the Optimized Access
3215 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_status_show()
3217 if (!(phba->cfg_oas_flags & OAS_LUN_VALID)) in lpfc_oas_lun_status_show()
3218 return -EFAULT; in lpfc_oas_lun_status_show()
3220 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_status); in lpfc_oas_lun_status_show()
3227 * lpfc_oas_lun_state_set - enable or disable a lun for Optimized Access Storage
3236 * -EPERM OAS is not enabled or not supported by this port.
3247 if (!phba->cfg_fof) in lpfc_oas_lun_state_set()
3248 return -EPERM; in lpfc_oas_lun_state_set()
3254 rc = -ENOMEM; in lpfc_oas_lun_state_set()
3264 * lpfc_oas_lun_get_next - get the next lun that has been enabled for Optimized
3289 phba->sli4_hba.oas_next_vpt_wwpn, in lpfc_oas_lun_get_next()
3291 phba->sli4_hba.oas_next_tgt_wwpn, in lpfc_oas_lun_get_next()
3292 &phba->sli4_hba.oas_next_lun, in lpfc_oas_lun_get_next()
3302 * lpfc_oas_lun_state_change - enable/disable a lun for OAS operations
3314 * -ENOMEM: failed to enable an lun for OAS operations
3315 * -EPERM: OAS is not enabled
3331 * lpfc_oas_lun_show - Return oas enabled luns from a chosen target
3341 * -EFAULT: target or vport wwpn was not set properly.
3342 * -EPERM: oas is not enabled.
3349 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_show()
3354 if (!phba->cfg_fof) in lpfc_oas_lun_show()
3355 return -EPERM; in lpfc_oas_lun_show()
3357 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_show()
3358 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_VPORT)) in lpfc_oas_lun_show()
3359 return -EFAULT; in lpfc_oas_lun_show()
3361 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_show()
3362 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_TARGET)) in lpfc_oas_lun_show()
3363 return -EFAULT; in lpfc_oas_lun_show()
3365 oas_lun = lpfc_oas_lun_get_next(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_show()
3366 phba->cfg_oas_tgt_wwpn, in lpfc_oas_lun_show()
3367 &phba->cfg_oas_lun_status, in lpfc_oas_lun_show()
3368 &phba->cfg_oas_priority); in lpfc_oas_lun_show()
3370 phba->cfg_oas_flags |= OAS_LUN_VALID; in lpfc_oas_lun_show()
3372 len += scnprintf(buf + len, PAGE_SIZE-len, "0x%llx", oas_lun); in lpfc_oas_lun_show()
3378 * lpfc_oas_lun_store - Sets the OAS state for lun
3388 * -EFAULT: target or vport wwpn was not set properly.
3389 * -EPERM: oas is not enabled.
3397 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_store()
3402 if (!phba->cfg_fof) in lpfc_oas_lun_store()
3403 return -EPERM; in lpfc_oas_lun_store()
3405 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_store()
3406 return -EFAULT; in lpfc_oas_lun_store()
3408 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_store()
3409 return -EFAULT; in lpfc_oas_lun_store()
3412 return -EINVAL; in lpfc_oas_lun_store()
3415 return -EINVAL; in lpfc_oas_lun_store()
3417 pri = phba->cfg_oas_priority; in lpfc_oas_lun_store()
3419 pri = phba->cfg_XLanePriority; in lpfc_oas_lun_store()
3424 wwn_to_u64(phba->cfg_oas_vpt_wwpn), in lpfc_oas_lun_store()
3425 wwn_to_u64(phba->cfg_oas_tgt_wwpn), scsi_lun, in lpfc_oas_lun_store()
3426 pri, phba->cfg_oas_lun_state); in lpfc_oas_lun_store()
3428 rc = lpfc_oas_lun_state_change(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_store()
3429 phba->cfg_oas_tgt_wwpn, scsi_lun, in lpfc_oas_lun_store()
3430 phba->cfg_oas_lun_state, pri); in lpfc_oas_lun_store()
3449 " 0 - none,"
3450 " 1 - poll with interrupts enabled"
3451 " 3 - poll and disable FCP ring interrupts");
3463 " 0 - auto (SLI-3 if supported),"
3464 " 2 - select SLI-2 even on SLI-3 capable HBAs,"
3465 " 3 - select SLI-3");
3497 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pls_show()
3500 phba->sli4_hba.pc_sli4_params.pls); in lpfc_pls_show()
3509 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pt_show()
3512 (phba->hba_flag & HBA_PERSISTENT_TOPO) ? 1 : 0); in lpfc_pt_show()
3519 # 1 - (1024)
3520 # 2 - (2048)
3521 # 3 - (3072)
3522 # 4 - (4096)
3523 # 5 - (5120)
3529 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_iocb_hw_show()
3531 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max); in lpfc_iocb_hw_show()
3540 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txq_hw_show()
3544 pring ? pring->txq_max : 0); in lpfc_txq_hw_show()
3554 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txcmplq_hw_show()
3558 pring ? pring->txcmplq_max : 0); in lpfc_txcmplq_hw_show()
3576 * lpfc_nodev_tmo_show - Return the hba dev loss timeout value
3588 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nodev_tmo_show()
3590 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); in lpfc_nodev_tmo_show()
3594 * lpfc_nodev_tmo_init - Set the hba nodev timeout value
3606 * -EINVAL val out of range
3611 if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { in lpfc_nodev_tmo_init()
3612 vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; in lpfc_nodev_tmo_init()
3622 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_init()
3623 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_init()
3630 vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; in lpfc_nodev_tmo_init()
3631 return -EINVAL; in lpfc_nodev_tmo_init()
3635 * lpfc_update_rport_devloss_tmo - Update dev loss tmo value
3652 spin_lock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3653 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_update_rport_devloss_tmo()
3656 if (ndlp->rport) in lpfc_update_rport_devloss_tmo()
3657 ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; in lpfc_update_rport_devloss_tmo()
3659 spin_lock(&vport->phba->hbalock); in lpfc_update_rport_devloss_tmo()
3662 remoteport = rport->remoteport; in lpfc_update_rport_devloss_tmo()
3663 spin_unlock(&vport->phba->hbalock); in lpfc_update_rport_devloss_tmo()
3666 vport->cfg_devloss_tmo); in lpfc_update_rport_devloss_tmo()
3669 spin_unlock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3673 * lpfc_nodev_tmo_set - Set the vport nodev tmo and devloss tmo values
3685 * -EINVAL val out of range
3690 if (vport->dev_loss_tmo_changed || in lpfc_nodev_tmo_set()
3698 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_set()
3699 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_set()
3712 return -EINVAL; in lpfc_nodev_tmo_set()
3733 * lpfc_devloss_tmo_set - Sets vport nodev tmo, devloss tmo values, changed bit in lpfc_vport_param_init()
3744 * -EINVAL val out of range in lpfc_vport_param_init()
3750 vport->cfg_nodev_tmo = val; in lpfc_vport_param_init()
3751 vport->cfg_devloss_tmo = val; in lpfc_vport_param_init()
3752 vport->dev_loss_tmo_changed = 1; in lpfc_vport_param_init()
3762 return -EINVAL; in lpfc_vport_param_init()
3799 * Supported Values: 1 - register just FCP
3800 * 3 - register both FCP and NVME
3805 "Enable FC4 Protocol support - FCP / NVME");
3814 "Verbose logging bit-mask");
3850 * -EINVAL if val is invalid
3859 return -EINVAL; in lpfc_tgt_queue_depth_set()
3861 if (val == vport->cfg_tgt_queue_depth) in lpfc_tgt_queue_depth_set()
3864 spin_lock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3865 vport->cfg_tgt_queue_depth = val; in lpfc_tgt_queue_depth_set()
3868 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) in lpfc_tgt_queue_depth_set()
3869 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_tgt_queue_depth_set()
3871 spin_unlock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3919 * lpfc_restrict_login_init - Set the vport restrict login flag
3931 * -EINVAL val out of range
3941 vport->cfg_restrict_login = 1; in lpfc_restrict_login_init()
3942 return -EINVAL; in lpfc_restrict_login_init()
3944 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_restrict_login_init()
3945 vport->cfg_restrict_login = 0; in lpfc_restrict_login_init()
3948 vport->cfg_restrict_login = val; in lpfc_restrict_login_init()
3953 * lpfc_restrict_login_set - Set the vport restrict login flag
3966 * -EINVAL val out of range
3976 vport->cfg_restrict_login = 1; in lpfc_restrict_login_set()
3977 return -EINVAL; in lpfc_restrict_login_set()
3979 if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { in lpfc_restrict_login_set()
3983 vport->cfg_restrict_login = 0; in lpfc_restrict_login_set()
3986 vport->cfg_restrict_login = val; in lpfc_restrict_login_set()
3995 # Fibre channel "ALPA". In the FC-AL Profile there is an "informative
4001 # Turning on the scan-down variable (on = 1, off = 0) will
4014 # 0x0 = attempt loop mode then point-to-point
4016 # 0x02 = attempt point-to-point mode only
4018 # 0x06 = attempt point-to-point mode then loop
4019 # Set point-to-point mode if you want to run as an N_Port.
4027 * lpfc_topology_set - Set the adapters topology field
4039 * non-zero return value from lpfc_issue_lip()
4040 * -EINVAL val out of range
4047 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_topology_store()
4048 struct lpfc_hba *phba = vport->phba; in lpfc_topology_store()
4061 return -EINVAL; in lpfc_topology_store()
4063 return -EINVAL; in lpfc_topology_store()
4066 prev_val = phba->cfg_topology; in lpfc_topology_store()
4067 if (phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G && in lpfc_topology_store()
4072 return -EINVAL; in lpfc_topology_store()
4076 * - persistent topology enabled in lpfc_topology_store()
4077 * - G7/G6 with no private loop support in lpfc_topology_store()
4080 if ((phba->hba_flag & HBA_PERSISTENT_TOPO || in lpfc_topology_store()
4081 (!phba->sli4_hba.pc_sli4_params.pls && in lpfc_topology_store()
4082 (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC || in lpfc_topology_store()
4083 phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC))) && in lpfc_topology_store()
4087 return -EINVAL; in lpfc_topology_store()
4089 phba->cfg_topology = val; in lpfc_topology_store()
4096 if (prev_val != val && phba->sli_rev == LPFC_SLI_REV4) in lpfc_topology_store()
4097 phba->fc_topology_changed = 1; in lpfc_topology_store()
4098 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_topology_store()
4100 phba->cfg_topology = prev_val; in lpfc_topology_store()
4101 return -EINVAL; in lpfc_topology_store()
4108 phba->brd_no, val); in lpfc_topology_store()
4109 return -EINVAL; in lpfc_topology_store()
4131 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_static_vport_show()
4132 if (vport->vport_flag & STATIC_VPORT) in lpfc_static_vport_show()
4146 * lpfc_stat_data_ctrl_store - write call back for lpfc_stat_data_ctrl sysfs file
4169 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_stat_data_ctrl_store()
4170 struct lpfc_hba *phba = vport->phba; in lpfc_stat_data_ctrl_store()
4181 if (strlen(buf) > (LPFC_MAX_DATA_CTRL_LEN - 1)) in lpfc_stat_data_ctrl_store()
4182 return -EINVAL; in lpfc_stat_data_ctrl_store()
4186 /* Ignore this token - this is command token */ in lpfc_stat_data_ctrl_store()
4189 return -EINVAL; in lpfc_stat_data_ctrl_store()
4193 return -EINVAL; in lpfc_stat_data_ctrl_store()
4200 return -EINVAL; in lpfc_stat_data_ctrl_store()
4204 return -EINVAL; in lpfc_stat_data_ctrl_store()
4209 return -EINVAL; in lpfc_stat_data_ctrl_store()
4212 return -EINVAL; in lpfc_stat_data_ctrl_store()
4217 return -ENOMEM; in lpfc_stat_data_ctrl_store()
4219 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4221 spin_lock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4223 vports[i]->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4224 if (vports[i]->stat_data_enabled) in lpfc_stat_data_ctrl_store()
4226 spin_unlock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4230 phba->bucket_type = bucket_type; in lpfc_stat_data_ctrl_store()
4231 phba->bucket_base = base; in lpfc_stat_data_ctrl_store()
4232 phba->bucket_step = step; in lpfc_stat_data_ctrl_store()
4234 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4238 spin_lock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4239 vports[i]->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4240 spin_unlock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4249 return -ENOMEM; in lpfc_stat_data_ctrl_store()
4251 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4253 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4254 vports[i]->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4256 vport->stat_data_enabled = 0; in lpfc_stat_data_ctrl_store()
4257 vports[i]->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4258 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4261 phba->bucket_type = LPFC_NO_BUCKET; in lpfc_stat_data_ctrl_store()
4262 phba->bucket_base = 0; in lpfc_stat_data_ctrl_store()
4263 phba->bucket_step = 0; in lpfc_stat_data_ctrl_store()
4269 if (phba->bucket_type == LPFC_NO_BUCKET) in lpfc_stat_data_ctrl_store()
4270 return -EINVAL; in lpfc_stat_data_ctrl_store()
4271 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4272 if (vport->stat_data_enabled) { in lpfc_stat_data_ctrl_store()
4273 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4277 vport->stat_data_enabled = 1; in lpfc_stat_data_ctrl_store()
4278 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4283 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4284 if (vport->stat_data_enabled == 0) { in lpfc_stat_data_ctrl_store()
4285 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4289 vport->stat_data_enabled = 0; in lpfc_stat_data_ctrl_store()
4290 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4295 if ((phba->bucket_type == LPFC_NO_BUCKET) in lpfc_stat_data_ctrl_store()
4296 || !vport->stat_data_enabled) in lpfc_stat_data_ctrl_store()
4298 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4299 vport->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4301 vport->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4302 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4305 return -EINVAL; in lpfc_stat_data_ctrl_store()
4310 * lpfc_stat_data_ctrl_show - Read function for lpfc_stat_data_ctrl sysfs file
4323 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_stat_data_ctrl_show()
4324 struct lpfc_hba *phba = vport->phba; in lpfc_stat_data_ctrl_show()
4330 switch (phba->bucket_type) { in lpfc_stat_data_ctrl_show()
4345 vport->stat_data_enabled, vport->stat_data_blocked, in lpfc_stat_data_ctrl_show()
4346 bucket_type, phba->bucket_base, phba->bucket_step); in lpfc_stat_data_ctrl_show()
4348 if (phba->bucket_type != LPFC_NO_BUCKET) { in lpfc_stat_data_ctrl_show()
4350 if (phba->bucket_type == LPFC_LINEAR_BUCKET) in lpfc_stat_data_ctrl_show()
4351 bucket_value = phba->bucket_base + in lpfc_stat_data_ctrl_show()
4352 phba->bucket_step * i; in lpfc_stat_data_ctrl_show()
4354 bucket_value = phba->bucket_base + in lpfc_stat_data_ctrl_show()
4355 (1 << i) * phba->bucket_step; in lpfc_stat_data_ctrl_show()
4386 * sysfs_drvr_stat_data_read - Read function for lpfc_drvr_stat_data attribute
4406 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_drvr_stat_data_read()
4407 struct lpfc_hba *phba = vport->phba; in sysfs_drvr_stat_data_read()
4414 if (!vport->stat_data_enabled || vport->stat_data_blocked in sysfs_drvr_stat_data_read()
4415 || (phba->bucket_type == LPFC_NO_BUCKET)) in sysfs_drvr_stat_data_read()
4418 spin_lock_irq(shost->host_lock); in sysfs_drvr_stat_data_read()
4419 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in sysfs_drvr_stat_data_read()
4420 if (!NLP_CHK_NODE_ACT(ndlp) || !ndlp->lat_data) in sysfs_drvr_stat_data_read()
4424 nport_index--; in sysfs_drvr_stat_data_read()
4432 if (!ndlp->lat_data) in sysfs_drvr_stat_data_read()
4437 ndlp->nlp_portname.u.wwn[0], in sysfs_drvr_stat_data_read()
4438 ndlp->nlp_portname.u.wwn[1], in sysfs_drvr_stat_data_read()
4439 ndlp->nlp_portname.u.wwn[2], in sysfs_drvr_stat_data_read()
4440 ndlp->nlp_portname.u.wwn[3], in sysfs_drvr_stat_data_read()
4441 ndlp->nlp_portname.u.wwn[4], in sysfs_drvr_stat_data_read()
4442 ndlp->nlp_portname.u.wwn[5], in sysfs_drvr_stat_data_read()
4443 ndlp->nlp_portname.u.wwn[6], in sysfs_drvr_stat_data_read()
4444 ndlp->nlp_portname.u.wwn[7]); in sysfs_drvr_stat_data_read()
4450 ndlp->lat_data[i].cmd_count); in sysfs_drvr_stat_data_read()
4456 spin_unlock_irq(shost->host_lock); in sysfs_drvr_stat_data_read()
4476 * lpfc_link_speed_set - Set the adapters link speed
4489 * non-zero return value from lpfc_issue_lip()
4490 * -EINVAL val out of range
4497 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_speed_store()
4498 struct lpfc_hba *phba = vport->phba; in lpfc_link_speed_store()
4505 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_link_speed_store()
4507 phba->hba_flag & HBA_FORCED_LINK_SPEED) in lpfc_link_speed_store()
4508 return -EPERM; in lpfc_link_speed_store()
4516 return -EINVAL; in lpfc_link_speed_store()
4518 return -EINVAL; in lpfc_link_speed_store()
4522 phba->cfg_link_speed, val, nolip ? "(nolip)" : "(lip)"); in lpfc_link_speed_store()
4524 if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || in lpfc_link_speed_store()
4525 ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || in lpfc_link_speed_store()
4526 ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || in lpfc_link_speed_store()
4527 ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || in lpfc_link_speed_store()
4528 ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) || in lpfc_link_speed_store()
4529 ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb)) || in lpfc_link_speed_store()
4530 ((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb)) || in lpfc_link_speed_store()
4531 ((val == LPFC_USER_LINK_SPEED_64G) && !(phba->lmt & LMT_64Gb))) { in lpfc_link_speed_store()
4536 return -EINVAL; in lpfc_link_speed_store()
4539 phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_speed_store()
4544 return -EINVAL; in lpfc_link_speed_store()
4556 prev_val = phba->cfg_link_speed; in lpfc_link_speed_store()
4557 phba->cfg_link_speed = val; in lpfc_link_speed_store()
4561 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_link_speed_store()
4563 phba->cfg_link_speed = prev_val; in lpfc_link_speed_store()
4564 return -EINVAL; in lpfc_link_speed_store()
4575 return -EINVAL; in lpfc_link_speed_store()
4585 * lpfc_link_speed_init - Set the adapters link speed in lpfc_param_show()
4598 * -EINVAL val out of range in lpfc_param_show()
4603 if (val >= LPFC_USER_LINK_SPEED_16G && phba->cfg_topology == 4) { in lpfc_param_show()
4608 phba->cfg_topology = 0; in lpfc_param_show()
4620 phba->cfg_link_speed = val; in lpfc_param_show()
4627 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_param_show()
4628 return -EINVAL; in lpfc_param_show()
4645 * lpfc_aer_support_store - Set the adapter for aer support in lpfc_param_show()
4669 * -EINVAL if val out of range or intended mode is not supported. in lpfc_param_show()
4676 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_param_show()
4677 struct lpfc_hba *phba = vport->phba; in lpfc_param_show()
4678 int val = 0, rc = -EINVAL; in lpfc_param_show()
4681 return -EINVAL; in lpfc_param_show()
4683 return -EINVAL; in lpfc_param_show()
4687 if (phba->hba_flag & HBA_AER_ENABLED) { in lpfc_param_show()
4688 rc = pci_disable_pcie_error_reporting(phba->pcidev); in lpfc_param_show()
4690 spin_lock_irq(&phba->hbalock); in lpfc_param_show()
4691 phba->hba_flag &= ~HBA_AER_ENABLED; in lpfc_param_show()
4692 spin_unlock_irq(&phba->hbalock); in lpfc_param_show()
4693 phba->cfg_aer_support = 0; in lpfc_param_show()
4696 rc = -EPERM; in lpfc_param_show()
4698 phba->cfg_aer_support = 0; in lpfc_param_show()
4703 if (!(phba->hba_flag & HBA_AER_ENABLED)) { in lpfc_param_show()
4704 rc = pci_enable_pcie_error_reporting(phba->pcidev); in lpfc_param_show()
4706 spin_lock_irq(&phba->hbalock); in lpfc_param_show()
4707 phba->hba_flag |= HBA_AER_ENABLED; in lpfc_param_show()
4708 spin_unlock_irq(&phba->hbalock); in lpfc_param_show()
4709 phba->cfg_aer_support = 1; in lpfc_param_show()
4712 rc = -EPERM; in lpfc_param_show()
4714 phba->cfg_aer_support = 1; in lpfc_param_show()
4719 rc = -EINVAL; in lpfc_param_show()
4728 * lpfc_aer_cleanup_state - Clean up aer state to the aer enabled device
4743 * -EINVAL if the buf does not contain the 1 or the device is not currently
4751 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_aer_cleanup_state()
4752 struct lpfc_hba *phba = vport->phba; in lpfc_aer_cleanup_state()
4753 int val, rc = -1; in lpfc_aer_cleanup_state()
4756 return -EINVAL; in lpfc_aer_cleanup_state()
4758 return -EINVAL; in lpfc_aer_cleanup_state()
4760 return -EINVAL; in lpfc_aer_cleanup_state()
4762 if (phba->hba_flag & HBA_AER_ENABLED) in lpfc_aer_cleanup_state()
4763 rc = pci_aer_clear_nonfatal_status(phba->pcidev); in lpfc_aer_cleanup_state()
4768 return -EPERM; in lpfc_aer_cleanup_state()
4775 * lpfc_sriov_nr_virtfn_store - Enable the adapter for sr-iov virtual functions
4784 * try to enable or disable SR-IOV virtual functions according to the
4794 * cfg_sriov_nr_virtfn; otherwise, -EINVAL shall be returned and driver
4797 * If none-zero virtual functions have already been enabled to the
4799 * -EINVAL will be returned and the driver does nothing;
4801 * If the nr_vfn provided is zero and none-zero virtual functions have
4811 * -EINVAL if val out of range or intended mode is not supported.
4818 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sriov_nr_virtfn_store()
4819 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_nr_virtfn_store()
4820 struct pci_dev *pdev = phba->pcidev; in lpfc_sriov_nr_virtfn_store()
4821 int val = 0, rc = -EINVAL; in lpfc_sriov_nr_virtfn_store()
4825 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4827 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4829 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4833 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4835 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4841 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4845 phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4846 return -EEXIST; in lpfc_sriov_nr_virtfn_store()
4850 phba->cfg_sriov_nr_virtfn = val; in lpfc_sriov_nr_virtfn_store()
4855 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4858 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4860 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4861 rc = -EPERM; in lpfc_sriov_nr_virtfn_store()
4869 "Enable PCIe device SR-IOV virtual fn");
4875 * lpfc_request_firmware_store - Request for Linux generic firmware upgrade
4887 * -EINVAL if val out of range or intended mode is not supported.
4895 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_request_firmware_upgrade_store()
4896 struct lpfc_hba *phba = vport->phba; in lpfc_request_firmware_upgrade_store()
4901 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4903 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4905 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4909 rc = -EPERM; in lpfc_request_firmware_upgrade_store()
4921 * lpfc_request_firmware_upgrade_init - Enable initial linux generic fw upgrade in lpfc_param_show()
4930 * -EINVAL val out of range in lpfc_param_show()
4936 phba->cfg_request_firmware_upgrade = val; in lpfc_param_show()
4939 return -EINVAL; in lpfc_param_show()
4959 * 0 - on success
4960 * -EIO - if command is not sent
4967 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_force_rscn_store()
4972 return -EIO; in lpfc_force_rscn_store()
4989 * lpfc_force_rscn_init - Force an RSCN to be sent to all remote NPorts in lpfc_param_show()
5008 * @buf: string with the number of fast-path FCP interrupts per second.
5013 * maximum number of fast-path FCP interrupts per second.
5018 * -EINVAL if val out of range or intended mode is not supported.
5025 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_imax_store()
5026 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_imax_store()
5032 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_fcp_imax_store()
5033 return -EINVAL; in lpfc_fcp_imax_store()
5037 return -EINVAL; in lpfc_fcp_imax_store()
5039 return -EINVAL; in lpfc_fcp_imax_store()
5047 return -EINVAL; in lpfc_fcp_imax_store()
5049 phba->cfg_auto_imax = (val) ? 0 : 1; in lpfc_fcp_imax_store()
5050 if (phba->cfg_fcp_imax && !val) { in lpfc_fcp_imax_store()
5051 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_fcp_imax_store()
5055 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_fcp_imax_store()
5056 eqi->icnt = 0; in lpfc_fcp_imax_store()
5060 phba->cfg_fcp_imax = (uint32_t)val; in lpfc_fcp_imax_store()
5062 if (phba->cfg_fcp_imax) in lpfc_fcp_imax_store()
5063 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_fcp_imax_store()
5067 for (i = 0; i < phba->cfg_irq_chann; i += LPFC_MAX_EQ_DELAY_EQID_CNT) in lpfc_fcp_imax_store()
5075 # lpfc_fcp_imax: The maximum number of fast-path FCP interrupts per second
5087 * lpfc_fcp_imax_init - Set the initial sr-iov virtual function enable in lpfc_param_show()
5093 * maximum number of fast-path FCP interrupts per second. in lpfc_param_show()
5097 * -EINVAL val out of range in lpfc_param_show()
5102 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_param_show()
5103 phba->cfg_fcp_imax = 0; in lpfc_param_show()
5109 phba->cfg_fcp_imax = val; in lpfc_param_show()
5116 phba->cfg_fcp_imax = LPFC_DEF_IMAX; in lpfc_param_show()
5136 * -ERANGE: if val is not in the valid range
5137 * -EINVAL: if bad value format or intended mode is not supported.
5144 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_cq_max_proc_limit_store()
5145 struct lpfc_hba *phba = vport->phba; in lpfc_cq_max_proc_limit_store()
5151 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_store()
5152 return -EINVAL; in lpfc_cq_max_proc_limit_store()
5156 return -EINVAL; in lpfc_cq_max_proc_limit_store()
5158 return -EINVAL; in lpfc_cq_max_proc_limit_store()
5161 return -ERANGE; in lpfc_cq_max_proc_limit_store()
5163 phba->cfg_cq_max_proc_limit = (uint32_t)val; in lpfc_cq_max_proc_limit_store()
5166 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_cq_max_proc_limit_store()
5168 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_cq_max_proc_limit_store()
5172 list_for_each_entry(cq, &eq->child_list, list) in lpfc_cq_max_proc_limit_store()
5173 cq->max_proc_limit = min(phba->cfg_cq_max_proc_limit, in lpfc_cq_max_proc_limit_store()
5174 cq->entry_count); in lpfc_cq_max_proc_limit_store()
5194 * than re-enabling interrupts.
5202 * lpfc_cq_max_proc_limit_init - Set the initial cq max_proc_limit
5218 phba->cfg_cq_max_proc_limit = LPFC_CQ_DEF_MAX_PROC_LIMIT; in lpfc_cq_max_proc_limit_init()
5220 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_init()
5224 phba->cfg_cq_max_proc_limit = val; in lpfc_cq_max_proc_limit_init()
5231 phba->cfg_cq_max_proc_limit); in lpfc_cq_max_proc_limit_init()
5239 * lpfc_state_show - Display current driver CPU affinity
5251 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_cpu_map_show()
5252 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_cpu_map_show()
5256 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_fcp_cpu_map_show()
5257 (phba->intr_type != MSIX)) in lpfc_fcp_cpu_map_show()
5260 switch (phba->cfg_fcp_cpu_map) { in lpfc_fcp_cpu_map_show()
5262 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
5264 phba->cfg_fcp_cpu_map); in lpfc_fcp_cpu_map_show()
5267 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
5268 "fcp_cpu_map: HBA centric mapping (%d): " in lpfc_fcp_cpu_map_show()
5270 phba->cfg_fcp_cpu_map, num_online_cpus(), in lpfc_fcp_cpu_map_show()
5272 phba->sli4_hba.num_possible_cpu); in lpfc_fcp_cpu_map_show()
5276 while (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
5277 phba->sli4_hba.num_possible_cpu) { in lpfc_fcp_cpu_map_show()
5278 cpup = &phba->sli4_hba.cpu_map[phba->sli4_hba.curr_disp_cpu]; in lpfc_fcp_cpu_map_show()
5280 if (!cpu_present(phba->sli4_hba.curr_disp_cpu)) in lpfc_fcp_cpu_map_show()
5281 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5282 "CPU %02d not present\n", in lpfc_fcp_cpu_map_show()
5283 phba->sli4_hba.curr_disp_cpu); in lpfc_fcp_cpu_map_show()
5284 else if (cpup->eq == LPFC_VECTOR_MAP_EMPTY) { in lpfc_fcp_cpu_map_show()
5285 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
5287 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5288 "CPU %02d hdwq None " in lpfc_fcp_cpu_map_show()
5290 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5291 cpup->phys_id, cpup->core_id, in lpfc_fcp_cpu_map_show()
5292 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5293 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
5296 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5297 "CPU %02d EQ None hdwq %04d " in lpfc_fcp_cpu_map_show()
5299 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5300 cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
5301 cpup->core_id, in lpfc_fcp_cpu_map_show()
5302 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5303 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
5305 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
5307 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5308 "CPU %02d hdwq None " in lpfc_fcp_cpu_map_show()
5310 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5311 cpup->phys_id, in lpfc_fcp_cpu_map_show()
5312 cpup->core_id, in lpfc_fcp_cpu_map_show()
5313 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5314 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
5315 lpfc_get_irq(cpup->eq)); in lpfc_fcp_cpu_map_show()
5318 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5319 "CPU %02d EQ %04d hdwq %04d " in lpfc_fcp_cpu_map_show()
5321 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5322 cpup->eq, cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
5323 cpup->core_id, in lpfc_fcp_cpu_map_show()
5324 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5325 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
5326 lpfc_get_irq(cpup->eq)); in lpfc_fcp_cpu_map_show()
5329 phba->sli4_hba.curr_disp_cpu++; in lpfc_fcp_cpu_map_show()
5332 if (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
5333 phba->sli4_hba.num_possible_cpu && in lpfc_fcp_cpu_map_show()
5334 (len >= (PAGE_SIZE - 64))) { in lpfc_fcp_cpu_map_show()
5336 PAGE_SIZE - len, "more...\n"); in lpfc_fcp_cpu_map_show()
5341 if (phba->sli4_hba.curr_disp_cpu == phba->sli4_hba.num_possible_cpu) in lpfc_fcp_cpu_map_show()
5342 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_fcp_cpu_map_show()
5348 * lpfc_fcp_cpu_map_store - Change CPU affinity of driver vectors
5355 * -EINVAL - Not implemented yet.
5361 return -EINVAL; in lpfc_fcp_cpu_map_store()
5369 # 0 - Do not affinitze IRQ vectors
5370 # 1 - Affintize HBA vectors with respect to each HBA
5380 * lpfc_fcp_cpu_map_init - Set the initial sr-iov virtual function enable
5385 * If val is in a valid range [0-2], then affinitze the adapter's
5390 * -EINVAL val out of range
5395 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_fcp_cpu_map_init()
5396 phba->cfg_fcp_cpu_map = 0; in lpfc_fcp_cpu_map_init()
5401 phba->cfg_fcp_cpu_map = val; in lpfc_fcp_cpu_map_init()
5408 phba->cfg_fcp_cpu_map = LPFC_HBA_CPU_MAP; in lpfc_fcp_cpu_map_init()
5443 * Parameter supported on physical port only - no NPIV support.
5464 # the parameter is set to a non-zero value, the I/O queue depth is controlled
5478 if (val == vport->cfg_max_scsicmpl_time) in lpfc_max_scsicmpl_time_set()
5481 return -EINVAL; in lpfc_max_scsicmpl_time_set()
5482 vport->cfg_max_scsicmpl_time = val; in lpfc_max_scsicmpl_time_set()
5484 spin_lock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5485 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_max_scsicmpl_time_set()
5488 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) in lpfc_max_scsicmpl_time_set()
5490 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_max_scsicmpl_time_set()
5492 spin_unlock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5516 * current CPU.
5521 * The driver dynamically sets this to 1 (BY_CPU) if it's able to set up cpu
5523 * CPU. Otherwise, the default 0 (Round Robin) scheduling of FCP/NVME I/Os
5530 "issuing commands [0] - Hardware Queue, [1] - Current CPU");
5542 "[0] - GID_FT, [1] - GID_PT");
5548 # For [1], bus reset issues target reset to non-FCP2 devices
5551 "FCP2 devices [0] - issue tgt reset, [1] - no tgt reset");
5604 # Traditional FDMI support means the driver will assume FDMI-2 support;
5605 # however, if that fails, it will fallback to FDMI-1.
5629 # there are FC targets, such as JBODs, that only recognize 8-bits of
5662 # 2 = MSI-X enabled (default)
5666 "MSI-X (2), if possible");
5725 * lpfc_cpumask_irq_mode_init - initalizes cpumask of phba based on
5732 unsigned int cpu, first_cpu, numa_node = NUMA_NO_NODE; in lpfc_cpumask_irq_mode_init() local
5734 struct cpumask *aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_cpumask_irq_mode_init()
5738 if (phba->irq_chann_mode == NUMA_MODE) { in lpfc_cpumask_irq_mode_init()
5740 numa_node = dev_to_node(&phba->pcidev->dev); in lpfc_cpumask_irq_mode_init()
5742 phba->irq_chann_mode = NORMAL_MODE; in lpfc_cpumask_irq_mode_init()
5747 for_each_possible_cpu(cpu) { in lpfc_cpumask_irq_mode_init()
5748 switch (phba->irq_chann_mode) { in lpfc_cpumask_irq_mode_init()
5750 if (cpu_to_node(cpu) == numa_node) in lpfc_cpumask_irq_mode_init()
5751 cpumask_set_cpu(cpu, aff_mask); in lpfc_cpumask_irq_mode_init()
5754 sibling_mask = topology_sibling_cpumask(cpu); in lpfc_cpumask_irq_mode_init()
5773 phba->irq_chann_mode = NUMA_MODE; in lpfc_assign_default_irq_chann()
5777 phba->irq_chann_mode = NHT_MODE; in lpfc_assign_default_irq_chann()
5780 phba->irq_chann_mode = NORMAL_MODE; in lpfc_assign_default_irq_chann()
5785 phba->irq_chann_mode = NORMAL_MODE; in lpfc_assign_default_irq_chann()
5792 * of EQ / MSI-X vectors the driver will create. This should never be
5807 /* lpfc_irq_chann_init - Set the hba irq_chann initial value
5818 * -EINVAL if value was out of range
5825 if (phba->cfg_use_msi != 2) { in lpfc_irq_chann_init()
5828 phba->cfg_use_msi); in lpfc_irq_chann_init()
5829 phba->irq_chann_mode = NORMAL_MODE; in lpfc_irq_chann_init()
5830 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5838 if (phba->irq_chann_mode != NORMAL_MODE) { in lpfc_irq_chann_init()
5839 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_chann_init()
5845 phba->irq_chann_mode); in lpfc_irq_chann_init()
5846 phba->irq_chann_mode = NORMAL_MODE; in lpfc_irq_chann_init()
5847 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5849 phba->cfg_irq_chann = cpumask_weight(aff_mask); in lpfc_irq_chann_init()
5854 if (phba->irq_chann_mode == NHT_MODE) in lpfc_irq_chann_init()
5855 phba->cfg_hdw_queue = phba->cfg_irq_chann; in lpfc_irq_chann_init()
5859 "(mode: %d)\n", phba->cfg_irq_chann, in lpfc_irq_chann_init()
5860 phba->irq_chann_mode); in lpfc_irq_chann_init()
5871 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5872 return -EINVAL; in lpfc_irq_chann_init()
5874 phba->cfg_irq_chann = val; in lpfc_irq_chann_init()
5881 * lpfc_irq_chann_show - Display value of irq_chann
5893 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_irq_chann_show()
5894 struct lpfc_hba *phba = vport->phba; in lpfc_irq_chann_show()
5896 return scnprintf(buf, PAGE_SIZE, "%u\n", phba->cfg_irq_chann); in lpfc_irq_chann_show()
5928 # 0x0 - 0x7f = CS_CTL field in FC header (high 7 bits)
5934 # lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF)
5943 # - Bit mask of host protection capabilities used to register with the
5944 # SCSI mid-layer
5945 # - Only meaningful if BG is turned on (lpfc_enable_bg=1).
5946 # - Allows you to ultimately specify which profiles to use
5947 # - Default will result in registering capabilities for all profiles.
5948 # - SHOST_DIF_TYPE1_PROTECTION 1
5950 # - SHOST_DIX_TYPE0_PROTECTION 8
5952 # - SHOST_DIX_TYPE1_PROTECTION 16
5964 "T10-DIF host protection capabilities mask");
5968 # - Bit mask of protection guard types to register with the SCSI mid-layer
5969 # - Guard types are currently either 1) T10-DIF CRC 2) IP checksum
5970 # - Allows you to ultimately specify which profiles to use
5971 # - Default will result in registering capabilities for all guard types
5976 "T10-DIF host protection guard type");
5984 * When this parameter is set to non-zero value, initial Nport discovery is
5996 * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
6000 * Because of the additional overhead involved in setting up T10-DIF,
6009 * lpfc_sg_seg_cnt_show - Display the scatter/gather list sizes
6022 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sg_seg_cnt_show()
6023 struct lpfc_hba *phba = vport->phba; in lpfc_sg_seg_cnt_show()
6027 phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); in lpfc_sg_seg_cnt_show()
6029 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_sg_seg_cnt_show()
6031 phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sg_seg_cnt_show()
6032 phba->cfg_nvme_seg_cnt); in lpfc_sg_seg_cnt_show()
6039 * lpfc_sg_seg_cnt_init - Set the hba sg_seg_cnt initial value
6050 * -EINVAL if value was out of range
6056 phba->cfg_sg_seg_cnt = val; in lpfc_sg_seg_cnt_init()
6063 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT; in lpfc_sg_seg_cnt_init()
6064 return -EINVAL; in lpfc_sg_seg_cnt_init()
6078 * [1-4] = Multiple of 1/4th Mb of host memory for FW logging
6091 return -EINVAL; in lpfc_ras_fwlog_buffsize_set()
6093 if (phba->cfg_ras_fwlog_buffsize == val) in lpfc_ras_fwlog_buffsize_set()
6096 if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn)) in lpfc_ras_fwlog_buffsize_set()
6097 return -EINVAL; in lpfc_ras_fwlog_buffsize_set()
6099 spin_lock_irq(&phba->hbalock); in lpfc_ras_fwlog_buffsize_set()
6100 state = phba->ras_fwlog.state; in lpfc_ras_fwlog_buffsize_set()
6101 spin_unlock_irq(&phba->hbalock); in lpfc_ras_fwlog_buffsize_set()
6106 return -EBUSY; in lpfc_ras_fwlog_buffsize_set()
6113 phba->cfg_ras_fwlog_buffsize = val; in lpfc_ras_fwlog_buffsize_set()
6120 if (phba->ras_fwlog.ras_enabled) in lpfc_ras_fwlog_buffsize_set()
6121 ret = lpfc_sli4_ras_fwlog_init(phba, phba->cfg_ras_fwlog_level, in lpfc_ras_fwlog_buffsize_set()
6309 * sysfs_ctlreg_write - Write method for writing to ctlreg
6322 * -ERANGE off and count combo out of range
6323 * -EINVAL off, count or buff address invalid
6324 * -EPERM adapter is offline
6335 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_write()
6336 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_write()
6338 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_write()
6339 return -EPERM; in sysfs_ctlreg_write()
6342 return -ERANGE; in sysfs_ctlreg_write()
6348 return -EINVAL; in sysfs_ctlreg_write()
6352 return -EINVAL; in sysfs_ctlreg_write()
6354 if (!(vport->fc_flag & FC_OFFLINE_MODE)) in sysfs_ctlreg_write()
6355 return -EPERM; in sysfs_ctlreg_write()
6357 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6358 for (buf_off = 0; buf_off < count - LPFC_REG_WRITE_KEY_SIZE; in sysfs_ctlreg_write()
6361 phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_write()
6363 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6369 * sysfs_ctlreg_read - Read method for reading from ctlreg
6382 * -ERANGE off and count combo out of range
6383 * -EINVAL off, count or buff address invalid
6395 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_read()
6396 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_read()
6398 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_read()
6399 return -EPERM; in sysfs_ctlreg_read()
6402 return -ERANGE; in sysfs_ctlreg_read()
6405 count = FF_REG_AREA_SIZE - off; in sysfs_ctlreg_read()
6410 return -EINVAL; in sysfs_ctlreg_read()
6412 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6416 *tmp_ptr = readl(phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_read()
6419 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6435 * sysfs_mbox_write - Write method for writing information via mbox
6448 * -EPERM operation not permitted
6455 return -EPERM; in sysfs_mbox_write()
6459 * sysfs_mbox_read - Read method for reading information via mbox
6472 * -EPERM operation not permitted
6479 return -EPERM; in sysfs_mbox_read()
6493 * lpfc_alloc_sysfs_attr - Creates the ctlreg and mbox entries
6506 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6510 if (error || vport->port_type == LPFC_NPIV_PORT) in lpfc_alloc_sysfs_attr()
6513 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6518 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6525 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_alloc_sysfs_attr()
6527 sysfs_remove_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6534 * lpfc_free_sysfs_attr - Removes the ctlreg and mbox entries
6541 sysfs_remove_bin_file(&shost->shost_dev.kobj, in lpfc_free_sysfs_attr()
6544 if (vport->port_type == LPFC_NPIV_PORT) in lpfc_free_sysfs_attr()
6546 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr); in lpfc_free_sysfs_attr()
6547 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_free_sysfs_attr()
6555 * lpfc_get_host_symbolic_name - Copy symbolic name into the scsi host
6561 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_get_host_symbolic_name()
6568 * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
6574 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_id()
6576 /* note: fc_myDID already in cpu endianness */ in lpfc_get_host_port_id()
6577 fc_host_port_id(shost) = vport->fc_myDID; in lpfc_get_host_port_id()
6581 * lpfc_get_host_port_type - Set the value of the scsi host port type
6587 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_type()
6588 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_type()
6590 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_type()
6592 if (vport->port_type == LPFC_NPIV_PORT) { in lpfc_get_host_port_type()
6595 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_host_port_type()
6596 if (vport->fc_flag & FC_PUBLIC_LOOP) in lpfc_get_host_port_type()
6601 if (vport->fc_flag & FC_FABRIC) in lpfc_get_host_port_type()
6609 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_type()
6613 * lpfc_get_host_port_state - Set the value of the scsi host port state
6619 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_state()
6620 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_state()
6622 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_state()
6624 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_host_port_state()
6627 switch (phba->link_state) { in lpfc_get_host_port_state()
6636 if (vport->port_state < LPFC_VPORT_READY) in lpfc_get_host_port_state()
6652 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_state()
6656 * lpfc_get_host_speed - Set the value of the scsi host speed
6662 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_speed()
6663 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_speed()
6665 spin_lock_irq(shost->host_lock); in lpfc_get_host_speed()
6667 if ((lpfc_is_link_up(phba)) && (!(phba->hba_flag & HBA_FCOE_MODE))) { in lpfc_get_host_speed()
6668 switch(phba->fc_linkspeed) { in lpfc_get_host_speed()
6700 } else if (lpfc_is_link_up(phba) && (phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_get_host_speed()
6701 switch (phba->fc_linkspeed) { in lpfc_get_host_speed()
6727 spin_unlock_irq(shost->host_lock); in lpfc_get_host_speed()
6731 * lpfc_get_host_fabric_name - Set the value of the scsi host fabric name
6737 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_fabric_name()
6738 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_fabric_name()
6741 spin_lock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
6743 if ((vport->port_state > LPFC_FLOGI) && in lpfc_get_host_fabric_name()
6744 ((vport->fc_flag & FC_FABRIC) || in lpfc_get_host_fabric_name()
6745 ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) && in lpfc_get_host_fabric_name()
6746 (vport->fc_flag & FC_PUBLIC_LOOP)))) in lpfc_get_host_fabric_name()
6747 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); in lpfc_get_host_fabric_name()
6752 spin_unlock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
6758 * lpfc_get_stats - Return statistical information about the adapter
6772 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_stats()
6773 struct lpfc_hba *phba = vport->phba; in lpfc_get_stats()
6774 struct lpfc_sli *psli = &phba->sli; in lpfc_get_stats()
6775 struct fc_host_statistics *hs = &phba->link_stats; in lpfc_get_stats()
6776 struct lpfc_lnk_stat * lso = &psli->lnk_stat_offsets; in lpfc_get_stats()
6785 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_stats()
6786 !phba->mbox_mem_pool || in lpfc_get_stats()
6787 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_stats()
6790 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_stats()
6793 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_stats()
6798 pmb = &pmboxq->u.mb; in lpfc_get_stats()
6799 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_get_stats()
6800 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6801 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6802 pmboxq->vport = vport; in lpfc_get_stats()
6804 if (vport->fc_flag & FC_OFFLINE_MODE) { in lpfc_get_stats()
6807 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6811 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6814 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6821 hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt; in lpfc_get_stats()
6826 hs->tx_words = (uint64_t) in lpfc_get_stats()
6827 ((uint64_t)pmb->un.varRdStatus.xmitByteCnt in lpfc_get_stats()
6829 hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt; in lpfc_get_stats()
6830 hs->rx_words = (uint64_t) in lpfc_get_stats()
6831 ((uint64_t)pmb->un.varRdStatus.rcvByteCnt in lpfc_get_stats()
6835 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_get_stats()
6836 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6837 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6838 pmboxq->vport = vport; in lpfc_get_stats()
6840 if (vport->fc_flag & FC_OFFLINE_MODE) { in lpfc_get_stats()
6843 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6847 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6850 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6855 hs->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_get_stats()
6856 hs->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_get_stats()
6857 hs->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_get_stats()
6858 hs->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_get_stats()
6859 hs->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_get_stats()
6860 hs->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6861 hs->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6863 hs->link_failure_count -= lso->link_failure_count; in lpfc_get_stats()
6864 hs->loss_of_sync_count -= lso->loss_of_sync_count; in lpfc_get_stats()
6865 hs->loss_of_signal_count -= lso->loss_of_signal_count; in lpfc_get_stats()
6866 hs->prim_seq_protocol_err_count -= lso->prim_seq_protocol_err_count; in lpfc_get_stats()
6867 hs->invalid_tx_word_count -= lso->invalid_tx_word_count; in lpfc_get_stats()
6868 hs->invalid_crc_count -= lso->invalid_crc_count; in lpfc_get_stats()
6869 hs->error_frames -= lso->error_frames; in lpfc_get_stats()
6871 if (phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_stats()
6872 hs->lip_count = -1; in lpfc_get_stats()
6873 hs->nos_count = (phba->link_events >> 1); in lpfc_get_stats()
6874 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6875 } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_stats()
6876 hs->lip_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6877 hs->lip_count -= lso->link_events; in lpfc_get_stats()
6878 hs->nos_count = -1; in lpfc_get_stats()
6880 hs->lip_count = -1; in lpfc_get_stats()
6881 hs->nos_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6882 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6885 hs->dumped_frames = -1; in lpfc_get_stats()
6887 hs->seconds_since_last_reset = ktime_get_seconds() - psli->stats_start; in lpfc_get_stats()
6889 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6895 * lpfc_reset_stats - Copy the adapter link stats information
6901 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_reset_stats()
6902 struct lpfc_hba *phba = vport->phba; in lpfc_reset_stats()
6903 struct lpfc_sli *psli = &phba->sli; in lpfc_reset_stats()
6904 struct lpfc_lnk_stat *lso = &psli->lnk_stat_offsets; in lpfc_reset_stats()
6909 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_reset_stats()
6912 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_reset_stats()
6917 pmb = &pmboxq->u.mb; in lpfc_reset_stats()
6918 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_reset_stats()
6919 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6920 pmb->un.varWords[0] = 0x1; /* reset request */ in lpfc_reset_stats()
6921 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6922 pmboxq->vport = vport; in lpfc_reset_stats()
6924 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6925 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) { in lpfc_reset_stats()
6928 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6932 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6935 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6941 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_reset_stats()
6942 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6943 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6944 pmboxq->vport = vport; in lpfc_reset_stats()
6946 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6947 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) { in lpfc_reset_stats()
6950 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6954 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6957 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6962 lso->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_reset_stats()
6963 lso->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_reset_stats()
6964 lso->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_reset_stats()
6965 lso->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_reset_stats()
6966 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_reset_stats()
6967 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6968 lso->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6969 if (phba->hba_flag & HBA_FCOE_MODE) in lpfc_reset_stats()
6970 lso->link_events = (phba->link_events >> 1); in lpfc_reset_stats()
6972 lso->link_events = (phba->fc_eventTag >> 1); in lpfc_reset_stats()
6974 psli->stats_start = ktime_get_seconds(); in lpfc_reset_stats()
6976 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6987 * lpfc_get_node_by_target - Return the nodelist for a target
6997 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in lpfc_get_node_by_target()
6998 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_node_by_target()
7001 spin_lock_irq(shost->host_lock); in lpfc_get_node_by_target()
7003 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_get_node_by_target()
7005 ndlp->nlp_state == NLP_STE_MAPPED_NODE && in lpfc_get_node_by_target()
7006 starget->id == ndlp->nlp_sid) { in lpfc_get_node_by_target()
7007 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
7011 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
7016 * lpfc_get_starget_port_id - Set the target port id to the ndlp DID or -1
7024 fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1; in lpfc_get_starget_port_id()
7028 * lpfc_get_starget_node_name - Set the target node name
7039 ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0; in lpfc_get_starget_node_name()
7043 * lpfc_get_starget_port_name - Set the target port name
7054 ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0; in lpfc_get_starget_port_name()
7058 * lpfc_set_rport_loss_tmo - Set the rport dev loss tmo
7069 struct lpfc_rport_data *rdata = rport->dd_data; in lpfc_set_rport_loss_tmo()
7070 struct lpfc_nodelist *ndlp = rdata->pnode; in lpfc_set_rport_loss_tmo()
7076 rport->dev_loss_tmo = timeout; in lpfc_set_rport_loss_tmo()
7078 rport->dev_loss_tmo = 1; in lpfc_set_rport_loss_tmo()
7081 dev_info(&rport->dev, "Cannot find remote node to " in lpfc_set_rport_loss_tmo()
7083 rport->port_id); in lpfc_set_rport_loss_tmo()
7090 if (nrport && nrport->remoteport) in lpfc_set_rport_loss_tmo()
7091 nvme_fc_set_remoteport_devloss(nrport->remoteport, in lpfc_set_rport_loss_tmo()
7092 rport->dev_loss_tmo); in lpfc_set_rport_loss_tmo()
7097 * lpfc_rport_show_function - Return rport target information
7115 struct lpfc_rport_data *rdata = rport->hostdata; \
7117 (rdata->target) ? cast rdata->target->field : 0); \
7125 * lpfc_set_vport_symbolic_name - Set the vport's symbolic name
7130 * has been changed. This function re-registers the symbolic name with the
7136 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; in lpfc_set_vport_symbolic_name()
7138 if (vport->port_state == LPFC_VPORT_READY) in lpfc_set_vport_symbolic_name()
7143 * lpfc_hba_log_verbose_init - Set hba's log verbose level
7154 phba->cfg_log_verbose = verbose; in lpfc_hba_log_verbose_init()
7290 * lpfc_get_hba_function_mode - Used to determine the HBA function in FCoE
7298 switch (phba->pcidev->device) { in lpfc_get_hba_function_mode()
7307 phba->hba_flag |= HBA_FCOE_MODE; in lpfc_get_hba_function_mode()
7311 phba->hba_flag &= ~HBA_FCOE_MODE; in lpfc_get_hba_function_mode()
7316 * lpfc_get_cfgparam - Used during probe_one to init the adapter structure
7354 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_get_cfgparam()
7355 phba->cfg_EnableXLane = 0; in lpfc_get_cfgparam()
7358 memset(phba->cfg_oas_tgt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7359 memset(phba->cfg_oas_vpt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7360 phba->cfg_oas_lun_state = 0; in lpfc_get_cfgparam()
7361 phba->cfg_oas_lun_status = 0; in lpfc_get_cfgparam()
7362 phba->cfg_oas_flags = 0; in lpfc_get_cfgparam()
7363 phba->cfg_oas_priority = 0; in lpfc_get_cfgparam()
7367 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_cfgparam()
7368 phba->cfg_poll = 0; in lpfc_get_cfgparam()
7370 phba->cfg_poll = lpfc_poll; in lpfc_get_cfgparam()
7376 if (phba->cfg_enable_bg && phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_cfgparam()
7380 phba->cfg_enable_bg = 0; in lpfc_get_cfgparam()
7381 } else if (phba->cfg_enable_bg) { in lpfc_get_cfgparam()
7382 phba->sli3_options |= LPFC_SLI3_BG_ENABLED; in lpfc_get_cfgparam()
7400 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_get_cfgparam()
7402 phba->nvmet_support = 0; in lpfc_get_cfgparam()
7403 phba->cfg_nvmet_mrq = 0; in lpfc_get_cfgparam()
7404 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7405 phba->cfg_enable_bbcr = 0; in lpfc_get_cfgparam()
7406 phba->cfg_xri_rebalancing = 0; in lpfc_get_cfgparam()
7409 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_cfgparam()
7410 phba->cfg_enable_fc4_type |= LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7413 phba->cfg_auto_imax = (phba->cfg_fcp_imax) ? 0 : 1; in lpfc_get_cfgparam()
7415 phba->cfg_enable_pbde = 0; in lpfc_get_cfgparam()
7418 if (phba->cfg_hdw_queue == 0) in lpfc_get_cfgparam()
7419 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7420 if (phba->cfg_irq_chann == 0) in lpfc_get_cfgparam()
7421 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7422 if (phba->cfg_irq_chann > phba->cfg_hdw_queue) in lpfc_get_cfgparam()
7423 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_get_cfgparam()
7425 phba->cfg_soft_wwnn = 0L; in lpfc_get_cfgparam()
7426 phba->cfg_soft_wwpn = 0L; in lpfc_get_cfgparam()
7444 * lpfc_nvme_mod_param_dep - Adjust module parameter value based on
7453 if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu) { in lpfc_nvme_mod_param_dep()
7454 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7457 if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu) { in lpfc_nvme_mod_param_dep()
7458 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7461 if (phba->cfg_irq_chann > phba->cfg_hdw_queue) { in lpfc_nvme_mod_param_dep()
7462 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7467 "2006 Reducing Queues - CPU limitation: " in lpfc_nvme_mod_param_dep()
7469 phba->cfg_irq_chann, in lpfc_nvme_mod_param_dep()
7470 phba->cfg_hdw_queue); in lpfc_nvme_mod_param_dep()
7472 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_nvme_mod_param_dep()
7473 phba->nvmet_support) { in lpfc_nvme_mod_param_dep()
7474 phba->cfg_enable_fc4_type &= ~LPFC_ENABLE_FCP; in lpfc_nvme_mod_param_dep()
7479 phba->cfg_nvme_enable_fb, in lpfc_nvme_mod_param_dep()
7480 phba->cfg_nvmet_fb_size, in lpfc_nvme_mod_param_dep()
7483 if (phba->cfg_nvme_enable_fb == 0) in lpfc_nvme_mod_param_dep()
7484 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7486 if (phba->cfg_nvmet_fb_size > LPFC_NVMET_FB_SZ_MAX) in lpfc_nvme_mod_param_dep()
7487 phba->cfg_nvmet_fb_size = LPFC_NVMET_FB_SZ_MAX; in lpfc_nvme_mod_param_dep()
7490 if (!phba->cfg_nvmet_mrq) in lpfc_nvme_mod_param_dep()
7491 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7494 if (phba->cfg_nvmet_mrq > phba->cfg_hdw_queue) { in lpfc_nvme_mod_param_dep()
7495 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7498 phba->cfg_nvmet_mrq); in lpfc_nvme_mod_param_dep()
7500 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_nvme_mod_param_dep()
7501 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_nvme_mod_param_dep()
7505 phba->nvmet_support = 0; in lpfc_nvme_mod_param_dep()
7506 phba->cfg_nvmet_mrq = 0; in lpfc_nvme_mod_param_dep()
7507 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7512 * lpfc_get_vport_cfgparam - Used during port create, init the vport structure