Lines Matching +full:cpu +full:- +full:centric
4 * Copyright (C) 2017-2018 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 *
40 #include <linux/nvme-fc-driver.h>
78 * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules
86 * Hex 0-9 becomes ascii '0' to '9'.
87 * Hex a-f becomes ascii '=' to 'B' capital B.
99 hdw[7 - i] = 0x30 + j; in lpfc_jedec_to_ascii()
101 hdw[7 - i] = 0x61 + j - 10; in lpfc_jedec_to_ascii()
109 * lpfc_drvr_version_show - Return the Emulex driver string with version number
124 * lpfc_enable_fip_show - Return the fip mode of the HBA
136 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_enable_fip_show()
137 struct lpfc_hba *phba = vport->phba; in lpfc_enable_fip_show()
139 if (phba->hba_flag & HBA_FIP_SUPPORT) in lpfc_enable_fip_show()
151 struct lpfc_hba *phba = vport->phba; in lpfc_nvme_info_show()
166 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) { in lpfc_nvme_info_show()
170 if (phba->nvmet_support) { in lpfc_nvme_info_show()
171 if (!phba->targetport) { in lpfc_nvme_info_show()
174 wwn_to_u64(vport->fc_portname.u.wwn)); in lpfc_nvme_info_show()
178 if (phba->targetport->port_id) in lpfc_nvme_info_show()
191 phba->brd_no, in lpfc_nvme_info_show()
192 wwn_to_u64(vport->fc_portname.u.wwn), in lpfc_nvme_info_show()
193 wwn_to_u64(vport->fc_nodename.u.wwn), in lpfc_nvme_info_show()
194 phba->targetport->port_id); in lpfc_nvme_info_show()
202 tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private; in lpfc_nvme_info_show()
205 atomic_read(&tgtp->rcv_ls_req_in), in lpfc_nvme_info_show()
206 atomic_read(&tgtp->rcv_ls_req_drop), in lpfc_nvme_info_show()
207 atomic_read(&tgtp->xmt_ls_abort)); in lpfc_nvme_info_show()
211 if (atomic_read(&tgtp->rcv_ls_req_in) != in lpfc_nvme_info_show()
212 atomic_read(&tgtp->rcv_ls_req_out)) { in lpfc_nvme_info_show()
215 atomic_read(&tgtp->rcv_ls_req_in), in lpfc_nvme_info_show()
216 atomic_read(&tgtp->rcv_ls_req_out)); in lpfc_nvme_info_show()
223 atomic_read(&tgtp->xmt_ls_rsp), in lpfc_nvme_info_show()
224 atomic_read(&tgtp->xmt_ls_drop), in lpfc_nvme_info_show()
225 atomic_read(&tgtp->xmt_ls_rsp_cmpl)); in lpfc_nvme_info_show()
231 atomic_read(&tgtp->xmt_ls_rsp_aborted), in lpfc_nvme_info_show()
232 atomic_read(&tgtp->xmt_ls_rsp_xb_set), in lpfc_nvme_info_show()
233 atomic_read(&tgtp->xmt_ls_rsp_error)); in lpfc_nvme_info_show()
240 atomic_read(&tgtp->rcv_fcp_cmd_in), in lpfc_nvme_info_show()
241 atomic_read(&tgtp->rcv_fcp_cmd_defer), in lpfc_nvme_info_show()
242 atomic_read(&tgtp->xmt_fcp_release), in lpfc_nvme_info_show()
243 atomic_read(&tgtp->rcv_fcp_cmd_drop)); in lpfc_nvme_info_show()
247 if (atomic_read(&tgtp->rcv_fcp_cmd_in) != in lpfc_nvme_info_show()
248 atomic_read(&tgtp->rcv_fcp_cmd_out)) { 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_out)); in lpfc_nvme_info_show()
260 atomic_read(&tgtp->xmt_fcp_read), in lpfc_nvme_info_show()
261 atomic_read(&tgtp->xmt_fcp_read_rsp), in lpfc_nvme_info_show()
262 atomic_read(&tgtp->xmt_fcp_write), in lpfc_nvme_info_show()
263 atomic_read(&tgtp->xmt_fcp_rsp), in lpfc_nvme_info_show()
264 atomic_read(&tgtp->xmt_fcp_drop)); in lpfc_nvme_info_show()
270 atomic_read(&tgtp->xmt_fcp_rsp_cmpl), in lpfc_nvme_info_show()
271 atomic_read(&tgtp->xmt_fcp_rsp_error), in lpfc_nvme_info_show()
272 atomic_read(&tgtp->xmt_fcp_rsp_drop)); in lpfc_nvme_info_show()
278 atomic_read(&tgtp->xmt_fcp_rsp_aborted), in lpfc_nvme_info_show()
279 atomic_read(&tgtp->xmt_fcp_rsp_xb_set), in lpfc_nvme_info_show()
280 atomic_read(&tgtp->xmt_fcp_xri_abort_cqe)); in lpfc_nvme_info_show()
286 atomic_read(&tgtp->xmt_fcp_abort), in lpfc_nvme_info_show()
287 atomic_read(&tgtp->xmt_fcp_abort_cmpl)); in lpfc_nvme_info_show()
293 atomic_read(&tgtp->xmt_abort_sol), in lpfc_nvme_info_show()
294 atomic_read(&tgtp->xmt_abort_unsol), in lpfc_nvme_info_show()
295 atomic_read(&tgtp->xmt_abort_rsp), in lpfc_nvme_info_show()
296 atomic_read(&tgtp->xmt_abort_rsp_error)); in lpfc_nvme_info_show()
302 atomic_read(&tgtp->defer_ctx), in lpfc_nvme_info_show()
303 atomic_read(&tgtp->defer_fod), in lpfc_nvme_info_show()
304 atomic_read(&tgtp->defer_wqfull)); in lpfc_nvme_info_show()
309 tot = atomic_read(&tgtp->rcv_fcp_cmd_drop); in lpfc_nvme_info_show()
310 tot += atomic_read(&tgtp->xmt_fcp_release); in lpfc_nvme_info_show()
311 tot = atomic_read(&tgtp->rcv_fcp_cmd_in) - tot; in lpfc_nvme_info_show()
316 phba->sli4_hba.nvmet_xri_cnt, in lpfc_nvme_info_show()
317 phba->sli4_hba.nvmet_io_wait_cnt, in lpfc_nvme_info_show()
318 phba->sli4_hba.nvmet_io_wait_total, in lpfc_nvme_info_show()
324 localport = vport->localport; in lpfc_nvme_info_show()
328 wwn_to_u64(vport->fc_portname.u.wwn)); in lpfc_nvme_info_show()
331 lport = (struct lpfc_nvme_lport *)localport->private; in lpfc_nvme_info_show()
337 phba->brd_no, in lpfc_nvme_info_show()
338 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_nvme_info_show()
339 phba->sli4_hba.nvme_xri_max, in lpfc_nvme_info_show()
340 phba->sli4_hba.scsi_xri_max, in lpfc_nvme_info_show()
346 if (localport->port_id) in lpfc_nvme_info_show()
354 phba->brd_no, in lpfc_nvme_info_show()
355 wwn_to_u64(vport->fc_portname.u.wwn), in lpfc_nvme_info_show()
356 wwn_to_u64(vport->fc_nodename.u.wwn), in lpfc_nvme_info_show()
357 localport->port_id, statep); in lpfc_nvme_info_show()
361 spin_lock_irq(shost->host_lock); in lpfc_nvme_info_show()
363 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_nvme_info_show()
365 spin_lock(&vport->phba->hbalock); in lpfc_nvme_info_show()
368 nrport = rport->remoteport; in lpfc_nvme_info_show()
369 spin_unlock(&vport->phba->hbalock); in lpfc_nvme_info_show()
374 switch (nrport->port_state) { in lpfc_nvme_info_show()
389 if (phba->brd_no >= 10) { in lpfc_nvme_info_show()
395 nrport->port_name); in lpfc_nvme_info_show()
400 nrport->node_name); in lpfc_nvme_info_show()
405 nrport->port_id); in lpfc_nvme_info_show()
410 if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR) { in lpfc_nvme_info_show()
414 if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET) { in lpfc_nvme_info_show()
418 if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY) { in lpfc_nvme_info_show()
422 if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR | in lpfc_nvme_info_show()
426 nrport->port_role); in lpfc_nvme_info_show()
435 spin_unlock_irq(shost->host_lock); in lpfc_nvme_info_show()
445 atomic_read(&lport->fc4NvmeLsRequests), in lpfc_nvme_info_show()
446 atomic_read(&lport->fc4NvmeLsCmpls), in lpfc_nvme_info_show()
447 atomic_read(&lport->xmt_ls_abort)); in lpfc_nvme_info_show()
453 atomic_read(&lport->xmt_ls_err), in lpfc_nvme_info_show()
454 atomic_read(&lport->cmpl_ls_xb), in lpfc_nvme_info_show()
455 atomic_read(&lport->cmpl_ls_err)); in lpfc_nvme_info_show()
461 for (i = 0; i < phba->cfg_nvme_io_channel; i++) { in lpfc_nvme_info_show()
462 cstat = &lport->cstat[i]; in lpfc_nvme_info_show()
463 tot = atomic_read(&cstat->fc4NvmeIoCmpls); in lpfc_nvme_info_show()
465 data1 = atomic_read(&cstat->fc4NvmeInputRequests); in lpfc_nvme_info_show()
466 data2 = atomic_read(&cstat->fc4NvmeOutputRequests); in lpfc_nvme_info_show()
467 data3 = atomic_read(&cstat->fc4NvmeControlRequests); in lpfc_nvme_info_show()
473 totin, totout, totout - totin); in lpfc_nvme_info_show()
480 atomic_read(&lport->xmt_fcp_abort), in lpfc_nvme_info_show()
481 atomic_read(&lport->xmt_fcp_noxri), in lpfc_nvme_info_show()
482 atomic_read(&lport->xmt_fcp_bad_ndlp), in lpfc_nvme_info_show()
483 atomic_read(&lport->xmt_fcp_qdepth), in lpfc_nvme_info_show()
484 atomic_read(&lport->xmt_fcp_err), in lpfc_nvme_info_show()
485 atomic_read(&lport->xmt_fcp_wqerr)); in lpfc_nvme_info_show()
491 atomic_read(&lport->cmpl_fcp_xb), in lpfc_nvme_info_show()
492 atomic_read(&lport->cmpl_fcp_err)); in lpfc_nvme_info_show()
499 spin_unlock_irq(shost->host_lock); in lpfc_nvme_info_show()
504 if (unlikely(len >= (PAGE_SIZE - 1))) { in lpfc_nvme_info_show()
509 strlcpy(buf + PAGE_SIZE - 1 - in lpfc_nvme_info_show()
510 strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1), in lpfc_nvme_info_show()
512 strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1) in lpfc_nvme_info_show()
524 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_info_show()
525 struct lpfc_hba *phba = vport->phba; in lpfc_bg_info_show()
527 if (phba->cfg_enable_bg) { in lpfc_bg_info_show()
528 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_bg_info_show()
544 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_guard_err_show()
545 struct lpfc_hba *phba = vport->phba; in lpfc_bg_guard_err_show()
548 (unsigned long long)phba->bg_guard_err_cnt); in lpfc_bg_guard_err_show()
556 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_apptag_err_show()
557 struct lpfc_hba *phba = vport->phba; in lpfc_bg_apptag_err_show()
560 (unsigned long long)phba->bg_apptag_err_cnt); in lpfc_bg_apptag_err_show()
568 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_reftag_err_show()
569 struct lpfc_hba *phba = vport->phba; in lpfc_bg_reftag_err_show()
572 (unsigned long long)phba->bg_reftag_err_cnt); in lpfc_bg_reftag_err_show()
576 * lpfc_info_show - Return some pci info about the host in ascii
593 * lpfc_serialnum_show - Return the hba serial number in ascii
605 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_serialnum_show()
606 struct lpfc_hba *phba = vport->phba; in lpfc_serialnum_show()
608 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->SerialNumber); in lpfc_serialnum_show()
612 * lpfc_temp_sensor_show - Return the temperature sensor level
628 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_temp_sensor_show()
629 struct lpfc_hba *phba = vport->phba; in lpfc_temp_sensor_show()
630 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->temp_sensor_support); in lpfc_temp_sensor_show()
634 * lpfc_modeldesc_show - Return the model description of the hba
646 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_modeldesc_show()
647 struct lpfc_hba *phba = vport->phba; in lpfc_modeldesc_show()
649 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelDesc); in lpfc_modeldesc_show()
653 * lpfc_modelname_show - Return the model name of the hba
665 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_modelname_show()
666 struct lpfc_hba *phba = vport->phba; in lpfc_modelname_show()
668 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelName); in lpfc_modelname_show()
672 * lpfc_programtype_show - Return the program type of the hba
684 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_programtype_show()
685 struct lpfc_hba *phba = vport->phba; in lpfc_programtype_show()
687 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ProgramType); in lpfc_programtype_show()
691 * lpfc_mlomgmt_show - Return the Menlo Maintenance sli flag
702 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_mlomgmt_show()
703 struct lpfc_hba *phba = vport->phba; in lpfc_mlomgmt_show()
706 (phba->sli.sli_flag & LPFC_MENLO_MAINT)); in lpfc_mlomgmt_show()
710 * lpfc_vportnum_show - Return the port number in ascii of the hba
722 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_vportnum_show()
723 struct lpfc_hba *phba = vport->phba; in lpfc_vportnum_show()
725 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->Port); in lpfc_vportnum_show()
729 * lpfc_fwrev_show - Return the firmware rev running in the hba
741 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_fwrev_show()
742 struct lpfc_hba *phba = vport->phba; in lpfc_fwrev_show()
749 if_type = phba->sli4_hba.pc_sli4_params.if_type; in lpfc_fwrev_show()
750 sli_family = phba->sli4_hba.pc_sli4_params.sli_family; in lpfc_fwrev_show()
752 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_fwrev_show()
753 len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d\n", in lpfc_fwrev_show()
754 fwrev, phba->sli_rev); in lpfc_fwrev_show()
756 len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d:%d:%x\n", in lpfc_fwrev_show()
757 fwrev, phba->sli_rev, if_type, sli_family); in lpfc_fwrev_show()
763 * lpfc_hdw_show - Return the jedec information about the hba
775 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_hdw_show()
776 struct lpfc_hba *phba = vport->phba; in lpfc_hdw_show()
777 lpfc_vpd_t *vp = &phba->vpd; in lpfc_hdw_show()
779 lpfc_jedec_to_ascii(vp->rev.biuRev, hdw); in lpfc_hdw_show()
784 * lpfc_option_rom_version_show - Return the adapter ROM FCode version
796 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_option_rom_version_show()
797 struct lpfc_hba *phba = vport->phba; in lpfc_option_rom_version_show()
800 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_option_rom_version_show()
802 phba->OptionROMVersion); in lpfc_option_rom_version_show()
809 * lpfc_state_show - Return the link state of the port
824 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_state_show()
825 struct lpfc_hba *phba = vport->phba; in lpfc_link_state_show()
828 switch (phba->link_state) { in lpfc_link_state_show()
835 if (phba->hba_flag & LINK_DISABLED) in lpfc_link_state_show()
836 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
837 "Link Down - User disabled\n"); in lpfc_link_state_show()
839 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
845 len += scnprintf(buf + len, PAGE_SIZE-len, "Link Up - "); in lpfc_link_state_show()
847 switch (vport->port_state) { in lpfc_link_state_show()
849 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
859 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
863 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
868 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
873 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
877 if (phba->sli.sli_flag & LPFC_MENLO_MAINT) in lpfc_link_state_show()
878 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
880 else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_state_show()
881 if (vport->fc_flag & FC_PUBLIC_LOOP) in lpfc_link_state_show()
882 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
885 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
888 if (vport->fc_flag & FC_FABRIC) in lpfc_link_state_show()
889 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
892 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
893 " Point-2-Point\n"); in lpfc_link_state_show()
901 * lpfc_sli4_protocol_show - Return the fip mode of the HBA
913 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sli4_protocol_show()
914 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_protocol_show()
916 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_sli4_protocol_show()
919 if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL) { in lpfc_sli4_protocol_show()
920 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_GE) in lpfc_sli4_protocol_show()
922 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC) in lpfc_sli4_protocol_show()
929 * lpfc_oas_supported_show - Return whether or not Optimized Access Storage
942 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_oas_supported_show()
943 struct lpfc_hba *phba = vport->phba; in lpfc_oas_supported_show()
946 phba->sli4_hba.pc_sli4_params.oas_supported); in lpfc_oas_supported_show()
950 * lpfc_link_state_store - Transition the link_state on an HBA port
957 * -EINVAL if the buffer is not "up" or "down"
958 * return from link state change function if non-zero
966 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_state_store()
967 struct lpfc_hba *phba = vport->phba; in lpfc_link_state_store()
969 int status = -EINVAL; in lpfc_link_state_store()
971 if ((strncmp(buf, "up", sizeof("up") - 1) == 0) && in lpfc_link_state_store()
972 (phba->link_state == LPFC_LINK_DOWN)) in lpfc_link_state_store()
973 status = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_link_state_store()
974 else if ((strncmp(buf, "down", sizeof("down") - 1) == 0) && in lpfc_link_state_store()
975 (phba->link_state >= LPFC_LINK_UP)) in lpfc_link_state_store()
976 status = phba->lpfc_hba_down_link(phba, MBX_NOWAIT); in lpfc_link_state_store()
985 * lpfc_num_discovered_ports_show - Return sum of mapped and unmapped vports
1001 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_num_discovered_ports_show()
1004 vport->fc_map_cnt + vport->fc_unmap_cnt); in lpfc_num_discovered_ports_show()
1008 * lpfc_issue_lip - Misnomer, name carried over from long ago
1012 * Bring the link down gracefully then re-init the link. The firmware will
1013 * re-init the fiber channel interface as required. Does not issue a LIP.
1016 * -EPERM port offline or management commands are being blocked
1017 * -ENOMEM cannot allocate memory for the mailbox command
1018 * -EIO error sending the mailbox command
1024 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_issue_lip()
1025 struct lpfc_hba *phba = vport->phba; in lpfc_issue_lip()
1033 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_issue_lip()
1034 (phba->hba_flag & LINK_DISABLED) || in lpfc_issue_lip()
1035 (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO)) in lpfc_issue_lip()
1036 return -EPERM; in lpfc_issue_lip()
1038 pmboxq = mempool_alloc(phba->mbox_mem_pool,GFP_KERNEL); in lpfc_issue_lip()
1041 return -ENOMEM; in lpfc_issue_lip()
1044 pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK; in lpfc_issue_lip()
1045 pmboxq->u.mb.mbxOwner = OWN_HOST; in lpfc_issue_lip()
1050 (pmboxq->u.mb.mbxStatus == 0 || in lpfc_issue_lip()
1051 pmboxq->u.mb.mbxStatus == MBXERR_LINK_DOWN)) { in lpfc_issue_lip()
1053 lpfc_init_link(phba, pmboxq, phba->cfg_topology, in lpfc_issue_lip()
1054 phba->cfg_link_speed); in lpfc_issue_lip()
1056 phba->fc_ratov * 2); in lpfc_issue_lip()
1058 (pmboxq->u.mb.mbxStatus == MBXERR_SEC_NO_PERMISSION)) in lpfc_issue_lip()
1066 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_issue_lip()
1069 return -EIO; in lpfc_issue_lip()
1097 * lpfc_do_offline - Issues a mailbox command to bring the link down
1105 * lpfc_workq_post_event() returns a non-zero return code if call fails.
1108 * -EIO error posting the event
1126 return -ENOMEM; in lpfc_do_offline()
1131 return -EIO; in lpfc_do_offline()
1133 psli = &phba->sli; in lpfc_do_offline()
1138 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_do_offline()
1139 for (i = 0; i < psli->num_rings; i++) { in lpfc_do_offline()
1140 pring = &psli->sli3_ring[i]; in lpfc_do_offline()
1141 if (!lpfc_emptyq_wait(phba, &pring->txcmplq, in lpfc_do_offline()
1142 &phba->hbalock)) in lpfc_do_offline()
1146 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_do_offline()
1147 pring = qp->pring; in lpfc_do_offline()
1150 if (!lpfc_emptyq_wait(phba, &pring->txcmplq, in lpfc_do_offline()
1151 &pring->ring_lock)) in lpfc_do_offline()
1159 return -ENOMEM; in lpfc_do_offline()
1164 return -EIO; in lpfc_do_offline()
1170 * lpfc_selective_reset - Offline then onlines the port
1183 * -EIO reset not configured or error posting the event
1193 if (!phba->cfg_enable_hba_reset) in lpfc_selective_reset()
1194 return -EACCES; in lpfc_selective_reset()
1196 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE)) { in lpfc_selective_reset()
1207 return -ENOMEM; in lpfc_selective_reset()
1212 return -EIO; in lpfc_selective_reset()
1218 * lpfc_issue_reset - Selectively resets an adapter
1234 * -EINVAL if the buffer does not contain the string "selective"
1235 * length of buf if lpfc-selective_reset() if the call succeeds
1243 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_issue_reset()
1244 struct lpfc_hba *phba = vport->phba; in lpfc_issue_reset()
1245 int status = -EINVAL; in lpfc_issue_reset()
1247 if (!phba->cfg_enable_hba_reset) in lpfc_issue_reset()
1248 return -EACCES; in lpfc_issue_reset()
1250 if (strncmp(buf, "selective", sizeof("selective") - 1) == 0) in lpfc_issue_reset()
1251 status = phba->lpfc_selective_reset(phba); in lpfc_issue_reset()
1260 * lpfc_sli4_pdev_status_reg_wait - Wait for pdev status register for readyness
1264 * SLI4 interface type-2 device to wait on the sliport status register for
1268 * zero for success, -EPERM when port does not have privilege to perform the
1269 * reset, -EIO when port timeout from recovering from the reset.
1282 lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1288 return -EPERM; in lpfc_sli4_pdev_status_reg_wait()
1293 lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1307 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1311 * lpfc_sli4_pdev_reg_request - Request physical dev to perform a register acc
1315 * Request SLI4 interface type-2 device to perform a physical register set
1325 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pdev_reg_request()
1332 if (!phba->cfg_enable_hba_reset) in lpfc_sli4_pdev_reg_request()
1333 return -EACCES; in lpfc_sli4_pdev_reg_request()
1335 if ((phba->sli_rev < LPFC_SLI_REV4) || in lpfc_sli4_pdev_reg_request()
1336 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_pdev_reg_request()
1338 return -EPERM; in lpfc_sli4_pdev_reg_request()
1341 before_fc_flag = phba->pport->fc_flag; in lpfc_sli4_pdev_reg_request()
1342 sriov_nr_virtfn = phba->cfg_sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1344 /* Disable SR-IOV virtual functions if enabled */ in lpfc_sli4_pdev_reg_request()
1345 if (phba->cfg_sriov_nr_virtfn) { in lpfc_sli4_pdev_reg_request()
1347 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_pdev_reg_request()
1351 phba->hba_flag |= HBA_FW_DUMP_OP; in lpfc_sli4_pdev_reg_request()
1356 phba->hba_flag &= ~HBA_FW_DUMP_OP; in lpfc_sli4_pdev_reg_request()
1363 reg_val = readl(phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1373 writel(reg_val, phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1376 readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); in lpfc_sli4_pdev_reg_request()
1381 if (rc == -EPERM) { in lpfc_sli4_pdev_reg_request()
1386 } else if (rc == -EIO) { in lpfc_sli4_pdev_reg_request()
1412 phba->cfg_sriov_nr_virtfn = sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1418 rc = -ENOMEM; in lpfc_sli4_pdev_reg_request()
1420 rc = -EIO; in lpfc_sli4_pdev_reg_request()
1426 * lpfc_nport_evt_cnt_show - Return the number of nport events
1438 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nport_evt_cnt_show()
1439 struct lpfc_hba *phba = vport->phba; in lpfc_nport_evt_cnt_show()
1441 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); in lpfc_nport_evt_cnt_show()
1445 * lpfc_board_mode_show - Return the state of the board
1457 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_show()
1458 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_show()
1461 if (phba->link_state == LPFC_HBA_ERROR) in lpfc_board_mode_show()
1463 else if (phba->link_state == LPFC_WARM_START) in lpfc_board_mode_show()
1465 else if (phba->link_state == LPFC_INIT_START) in lpfc_board_mode_show()
1474 * lpfc_board_mode_store - Puts the hba in online, offline, warm or error state
1481 * -EACCES if enable hba reset not enabled
1482 * -EINVAL if the buffer does not contain a valid string (see above)
1483 * -EIO if lpfc_workq_post_event() or lpfc_do_offline() fails
1491 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_store()
1492 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_store()
1498 if (!phba->cfg_enable_hba_reset) { in lpfc_board_mode_store()
1499 status = -EACCES; in lpfc_board_mode_store()
1508 if(strncmp(buf, "online", sizeof("online") - 1) == 0) { in lpfc_board_mode_store()
1512 status = -ENOMEM; in lpfc_board_mode_store()
1517 status = -EIO; in lpfc_board_mode_store()
1518 } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) in lpfc_board_mode_store()
1520 else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) in lpfc_board_mode_store()
1521 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
1522 status = -EINVAL; in lpfc_board_mode_store()
1525 else if (strncmp(buf, "error", sizeof("error") - 1) == 0) in lpfc_board_mode_store()
1526 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
1527 status = -EINVAL; in lpfc_board_mode_store()
1530 else if (strncmp(buf, "dump", sizeof("dump") - 1) == 0) in lpfc_board_mode_store()
1532 else if (strncmp(buf, "fw_reset", sizeof("fw_reset") - 1) == 0) in lpfc_board_mode_store()
1534 else if (strncmp(buf, "dv_reset", sizeof("dv_reset") - 1) == 0) in lpfc_board_mode_store()
1537 status = -EINVAL; in lpfc_board_mode_store()
1549 buf, status, phba->pport->fc_flag); in lpfc_board_mode_store()
1555 * lpfc_get_hba_info - Return various bits of informaton about the adapter
1588 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_hba_info()
1589 !phba->mbox_mem_pool || in lpfc_get_hba_info()
1590 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_hba_info()
1593 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_hba_info()
1596 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_hba_info()
1601 pmb = &pmboxq->u.mb; in lpfc_get_hba_info()
1602 pmb->mbxCommand = MBX_READ_CONFIG; in lpfc_get_hba_info()
1603 pmb->mbxOwner = OWN_HOST; in lpfc_get_hba_info()
1604 pmboxq->context1 = NULL; in lpfc_get_hba_info()
1606 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_hba_info()
1609 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_hba_info()
1613 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
1617 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_get_hba_info()
1618 rd_config = &pmboxq->u.mqe.un.rd_config; in lpfc_get_hba_info()
1622 *arpi = bf_get(lpfc_mbx_rd_conf_rpi_count, rd_config) - in lpfc_get_hba_info()
1623 phba->sli4_hba.max_cfg_param.rpi_used; in lpfc_get_hba_info()
1627 *axri = bf_get(lpfc_mbx_rd_conf_xri_count, rd_config) - in lpfc_get_hba_info()
1628 phba->sli4_hba.max_cfg_param.xri_used; in lpfc_get_hba_info()
1630 /* Account for differences with SLI-3. Get vpi count from in lpfc_get_hba_info()
1634 (bf_get(lpfc_mbx_rd_conf_vpi_count, rd_config) - 1) : 0; in lpfc_get_hba_info()
1642 *avpi = max_vpi - phba->sli4_hba.max_cfg_param.vpi_used; in lpfc_get_hba_info()
1645 *mrpi = pmb->un.varRdConfig.max_rpi; in lpfc_get_hba_info()
1647 *arpi = pmb->un.varRdConfig.avail_rpi; in lpfc_get_hba_info()
1649 *mxri = pmb->un.varRdConfig.max_xri; in lpfc_get_hba_info()
1651 *axri = pmb->un.varRdConfig.avail_xri; in lpfc_get_hba_info()
1653 *mvpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
1656 if (phba->link_state == LPFC_HBA_READY) in lpfc_get_hba_info()
1657 *avpi = pmb->un.varRdConfig.avail_vpi; in lpfc_get_hba_info()
1659 *avpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
1663 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
1668 * lpfc_max_rpi_show - Return maximum rpi
1686 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_rpi_show()
1687 struct lpfc_hba *phba = vport->phba; in lpfc_max_rpi_show()
1696 * lpfc_used_rpi_show - Return maximum rpi minus available rpi
1714 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_rpi_show()
1715 struct lpfc_hba *phba = vport->phba; in lpfc_used_rpi_show()
1719 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_rpi_show()
1724 * lpfc_max_xri_show - Return maximum xri
1742 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_xri_show()
1743 struct lpfc_hba *phba = vport->phba; in lpfc_max_xri_show()
1752 * lpfc_used_xri_show - Return maximum xpi minus the available xpi
1770 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_xri_show()
1771 struct lpfc_hba *phba = vport->phba; in lpfc_used_xri_show()
1775 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_xri_show()
1780 * lpfc_max_vpi_show - Return maximum vpi
1798 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_vpi_show()
1799 struct lpfc_hba *phba = vport->phba; in lpfc_max_vpi_show()
1808 * lpfc_used_vpi_show - Return maximum vpi minus the available vpi
1826 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_vpi_show()
1827 struct lpfc_hba *phba = vport->phba; in lpfc_used_vpi_show()
1831 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_vpi_show()
1836 * lpfc_npiv_info_show - Return text about NPIV support for the adapter
1853 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_npiv_info_show()
1854 struct lpfc_hba *phba = vport->phba; in lpfc_npiv_info_show()
1856 if (!(phba->max_vpi)) in lpfc_npiv_info_show()
1858 if (vport->port_type == LPFC_PHYSICAL_PORT) in lpfc_npiv_info_show()
1860 return scnprintf(buf, PAGE_SIZE, "NPIV Virtual (VPI %d)\n", vport->vpi); in lpfc_npiv_info_show()
1864 * lpfc_poll_show - Return text about poll support for the adapter
1879 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_show()
1880 struct lpfc_hba *phba = vport->phba; in lpfc_poll_show()
1882 return scnprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); in lpfc_poll_show()
1886 * lpfc_poll_store - Set the value of cfg_poll for the adapter
1896 * -EINVAL if the buffer connot be converted or is out of range
1904 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_store()
1905 struct lpfc_hba *phba = vport->phba; in lpfc_poll_store()
1911 return -EINVAL; in lpfc_poll_store()
1914 return -EINVAL; in lpfc_poll_store()
1917 return -EINVAL; in lpfc_poll_store()
1919 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_poll_store()
1924 phba->cfg_poll, val); in lpfc_poll_store()
1926 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
1928 old_val = phba->cfg_poll; in lpfc_poll_store()
1933 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
1934 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
1935 return -EINVAL; in lpfc_poll_store()
1938 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
1939 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
1944 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
1945 return -EINVAL; in lpfc_poll_store()
1951 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
1952 del_timer(&phba->fcp_poll_timer); in lpfc_poll_store()
1953 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
1954 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
1955 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
1956 return -EINVAL; in lpfc_poll_store()
1959 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
1960 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
1963 phba->cfg_poll = val; in lpfc_poll_store()
1965 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
1971 * lpfc_fips_level_show - Return the current FIPS level for the HBA
1983 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_fips_level_show()
1984 struct lpfc_hba *phba = vport->phba; in lpfc_fips_level_show()
1986 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->fips_level); in lpfc_fips_level_show()
1990 * lpfc_fips_rev_show - Return the FIPS Spec revision for the HBA
2002 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_fips_rev_show()
2003 struct lpfc_hba *phba = vport->phba; in lpfc_fips_rev_show()
2005 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->fips_spec_rev); in lpfc_fips_rev_show()
2009 * lpfc_dss_show - Return the current state of dss and the configured state
2021 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_dss_show()
2022 struct lpfc_hba *phba = vport->phba; in lpfc_dss_show()
2024 return scnprintf(buf, PAGE_SIZE, "%s - %sOperational\n", in lpfc_dss_show()
2025 (phba->cfg_enable_dss) ? "Enabled" : "Disabled", in lpfc_dss_show()
2026 (phba->sli3_options & LPFC_SLI3_DSS_ENABLED) ? in lpfc_dss_show()
2031 * lpfc_sriov_hw_max_virtfn_show - Return maximum number of virtual functions
2048 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sriov_hw_max_virtfn_show()
2049 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_hw_max_virtfn_show()
2073 * -EINVAL if val is invalid
2078 if (lpfc_rangecheck(val, 0, 1) && phba->sli_rev == LPFC_SLI_REV4) { in lpfc_enable_bbcr_set()
2081 LPFC_DRIVER_NAME, phba->cfg_enable_bbcr, val); in lpfc_enable_bbcr_set()
2082 phba->cfg_enable_bbcr = val; in lpfc_enable_bbcr_set()
2088 return -EINVAL; in lpfc_enable_bbcr_set()
2092 * lpfc_param_show - Return a cfg attribute value in decimal
2111 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2112 struct lpfc_hba *phba = vport->phba;\
2114 phba->cfg_##attr);\
2118 * lpfc_param_hex_show - Return a cfg attribute value in hex
2137 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2138 struct lpfc_hba *phba = vport->phba;\
2140 val = phba->cfg_##attr;\
2142 phba->cfg_##attr);\
2146 * lpfc_param_init - Initializes a cfg attribute
2162 * -EINVAL if default used
2169 phba->cfg_##attr = val;\
2175 phba->cfg_##attr = default;\
2176 return -EINVAL;\
2180 * lpfc_param_set - Set a cfg attribute value
2197 * -EINVAL if val is invalid
2206 phba->cfg_##attr, val); \
2207 phba->cfg_##attr = val;\
2213 return -EINVAL;\
2217 * lpfc_param_store - Set a vport attribute value
2234 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2243 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2244 struct lpfc_hba *phba = vport->phba;\
2247 return -EINVAL;\
2249 return -EINVAL;\
2253 return -EINVAL;\
2257 * lpfc_vport_param_show - Return decimal formatted cfg attribute value
2276 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2277 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
2281 * lpfc_vport_param_hex_show - Return hex formatted attribute value
2301 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2302 return scnprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
2306 * lpfc_vport_param_init - Initialize a vport cfg attribute
2321 * -EINVAL if default used
2328 vport->cfg_##attr = val;\
2334 vport->cfg_##attr = default;\
2335 return -EINVAL;\
2339 * lpfc_vport_param_set - Set a vport cfg attribute
2353 * -EINVAL if val is invalid
2363 vport->cfg_##attr, vport->cfg_##attr, \
2365 vport->cfg_##attr = val;\
2371 return -EINVAL;\
2375 * lpfc_vport_param_store - Set a vport attribute
2388 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2397 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2400 return -EINVAL;\
2402 return -EINVAL;\
2406 return -EINVAL;\
2455 * lpfc_wwn_set - Convert string to the 8 byte WWN value.
2461 * -EINVAL if the buffer does not contain a valid wwn
2470 if (buf[cnt-1] == '\n') in lpfc_wwn_set()
2471 cnt--; in lpfc_wwn_set()
2475 return -EINVAL; in lpfc_wwn_set()
2482 j = ((j << 4) | ((*buf++ - 'a') + 10)); in lpfc_wwn_set()
2484 j = ((j << 4) | ((*buf++ - 'A') + 10)); in lpfc_wwn_set()
2486 j = ((j << 4) | (*buf++ - '0')); in lpfc_wwn_set()
2488 return -EINVAL; in lpfc_wwn_set()
2497 * lpfc_soft_wwn_enable_store - Allows setting of the wwn if the key is valid
2504 * -EINVAL if the buffer does not contain lpfc_soft_wwn_key
2512 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwn_enable_store()
2513 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwn_enable_store()
2515 uint8_t vvvl = vport->fc_sparam.cmn.valid_vendor_ver_level; in lpfc_soft_wwn_enable_store()
2516 u32 *fawwpn_key = (uint32_t *)&vport->fc_sparam.un.vendorVersion[0]; in lpfc_soft_wwn_enable_store()
2523 * desired, the key must be written again to re-enable the in lpfc_soft_wwn_enable_store()
2526 * The "key" is not secret - it is a hardcoded string shown in lpfc_soft_wwn_enable_store()
2534 return -EINVAL; in lpfc_soft_wwn_enable_store()
2538 if (buf[cnt-1] == '\n') in lpfc_soft_wwn_enable_store()
2539 cnt--; in lpfc_soft_wwn_enable_store()
2543 return -EINVAL; in lpfc_soft_wwn_enable_store()
2545 phba->soft_wwn_enable = 1; in lpfc_soft_wwn_enable_store()
2547 dev_printk(KERN_WARNING, &phba->pcidev->dev, in lpfc_soft_wwn_enable_store()
2549 phba->brd_no); in lpfc_soft_wwn_enable_store()
2550 dev_printk(KERN_WARNING, &phba->pcidev->dev, in lpfc_soft_wwn_enable_store()
2558 * lpfc_soft_wwpn_show - Return the cfg soft ww port name of the adapter
2570 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwpn_show()
2571 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwpn_show()
2574 (unsigned long long)phba->cfg_soft_wwpn); in lpfc_soft_wwpn_show()
2578 * lpfc_soft_wwpn_store - Set the ww port name of the adapter
2585 * -EACCES hba reset not enabled, adapter over temp
2586 * -EINVAL soft wwn not enabled, count is invalid, invalid wwpn byte invalid
2587 * -EIO error taking adapter offline or online
2595 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwpn_store()
2596 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwpn_store()
2603 if (!phba->cfg_enable_hba_reset) in lpfc_soft_wwpn_store()
2604 return -EACCES; in lpfc_soft_wwpn_store()
2605 spin_lock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2606 if (phba->over_temp_state == HBA_OVER_TEMP) { in lpfc_soft_wwpn_store()
2607 spin_unlock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2608 return -EACCES; in lpfc_soft_wwpn_store()
2610 spin_unlock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2612 if (buf[cnt-1] == '\n') in lpfc_soft_wwpn_store()
2613 cnt--; in lpfc_soft_wwpn_store()
2615 if (!phba->soft_wwn_enable) in lpfc_soft_wwpn_store()
2616 return -EINVAL; in lpfc_soft_wwpn_store()
2619 phba->soft_wwn_enable = 0; in lpfc_soft_wwpn_store()
2624 phba->soft_wwn_enable = 1; in lpfc_soft_wwpn_store()
2628 phba->cfg_soft_wwpn = wwn_to_u64(wwpn); in lpfc_soft_wwpn_store()
2629 fc_host_port_name(shost) = phba->cfg_soft_wwpn; in lpfc_soft_wwpn_store()
2630 if (phba->cfg_soft_wwnn) in lpfc_soft_wwpn_store()
2631 fc_host_node_name(shost) = phba->cfg_soft_wwnn; in lpfc_soft_wwpn_store()
2633 dev_printk(KERN_NOTICE, &phba->pcidev->dev, in lpfc_soft_wwpn_store()
2634 "lpfc%d: Reinitializing to use soft_wwpn\n", phba->brd_no); in lpfc_soft_wwpn_store()
2640 "reinit adapter - %d\n", stat1); in lpfc_soft_wwpn_store()
2645 return -ENOMEM; in lpfc_soft_wwpn_store()
2651 "reinit adapter - %d\n", stat2); in lpfc_soft_wwpn_store()
2652 return (stat1 || stat2) ? -EIO : count; in lpfc_soft_wwpn_store()
2657 * lpfc_soft_wwnn_show - Return the cfg soft ww node name for the adapter
2669 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_soft_wwnn_show()
2671 (unsigned long long)phba->cfg_soft_wwnn); in lpfc_soft_wwnn_show()
2675 * lpfc_soft_wwnn_store - sets the ww node name of the adapter
2681 * -EINVAL soft wwn not enabled, count is invalid, invalid wwnn byte invalid
2689 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_soft_wwnn_store()
2695 if (buf[cnt-1] == '\n') in lpfc_soft_wwnn_store()
2696 cnt--; in lpfc_soft_wwnn_store()
2698 if (!phba->soft_wwn_enable) in lpfc_soft_wwnn_store()
2699 return -EINVAL; in lpfc_soft_wwnn_store()
2709 phba->cfg_soft_wwnn = wwn_to_u64(wwnn); in lpfc_soft_wwnn_store()
2711 dev_printk(KERN_NOTICE, &phba->pcidev->dev, in lpfc_soft_wwnn_store()
2713 "setting of the soft_wwpn\n", phba->brd_no); in lpfc_soft_wwnn_store()
2720 * lpfc_oas_tgt_show - Return wwpn of target whose luns maybe enabled for
2734 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_show()
2737 wwn_to_u64(phba->cfg_oas_tgt_wwpn)); in lpfc_oas_tgt_show()
2741 * lpfc_oas_tgt_store - Store wwpn of target whose luns maybe enabled for
2749 * -EINVAL count is invalid, invalid wwpn byte invalid
2750 * -EPERM oas is not supported by hba
2758 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_store()
2763 if (!phba->cfg_fof) in lpfc_oas_tgt_store()
2764 return -EPERM; in lpfc_oas_tgt_store()
2767 if (buf[cnt-1] == '\n') in lpfc_oas_tgt_store()
2768 cnt--; in lpfc_oas_tgt_store()
2774 memcpy(phba->cfg_oas_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
2775 memcpy(phba->sli4_hba.oas_next_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
2777 phba->cfg_oas_flags |= OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
2779 phba->cfg_oas_flags &= ~OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
2780 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_tgt_store()
2781 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_tgt_store()
2788 * lpfc_oas_priority_show - Return wwpn of target whose luns maybe enabled for
2802 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_show()
2804 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority); in lpfc_oas_priority_show()
2808 * lpfc_oas_priority_store - Store wwpn of target whose luns maybe enabled for
2816 * -EINVAL count is invalid, invalid wwpn byte invalid
2817 * -EPERM oas is not supported by hba
2825 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_store()
2830 if (!phba->cfg_fof) in lpfc_oas_priority_store()
2831 return -EPERM; in lpfc_oas_priority_store()
2834 if (buf[cnt-1] == '\n') in lpfc_oas_priority_store()
2835 cnt--; in lpfc_oas_priority_store()
2839 return -EINVAL; in lpfc_oas_priority_store()
2842 phba->cfg_oas_priority = (uint8_t)val; in lpfc_oas_priority_store()
2844 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_priority_store()
2851 * lpfc_oas_vpt_show - Return wwpn of vport whose targets maybe enabled
2865 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_show()
2868 wwn_to_u64(phba->cfg_oas_vpt_wwpn)); in lpfc_oas_vpt_show()
2872 * lpfc_oas_vpt_store - Store wwpn of vport whose targets maybe enabled
2880 * -EINVAL count is invalid, invalid wwpn byte invalid
2881 * -EPERM oas is not supported by hba
2889 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_store()
2894 if (!phba->cfg_fof) in lpfc_oas_vpt_store()
2895 return -EPERM; in lpfc_oas_vpt_store()
2898 if (buf[cnt-1] == '\n') in lpfc_oas_vpt_store()
2899 cnt--; in lpfc_oas_vpt_store()
2905 memcpy(phba->cfg_oas_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
2906 memcpy(phba->sli4_hba.oas_next_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
2908 phba->cfg_oas_flags |= OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
2910 phba->cfg_oas_flags &= ~OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
2911 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_vpt_store()
2912 if (phba->cfg_oas_priority == 0) in lpfc_oas_vpt_store()
2913 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_vpt_store()
2914 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_vpt_store()
2921 * lpfc_oas_lun_state_show - Return the current state (enabled or disabled)
2936 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_show()
2938 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_state); in lpfc_oas_lun_state_show()
2942 * lpfc_oas_lun_state_store - Store the state (enabled or disabled)
2951 * -EINVAL count is invalid, invalid wwpn byte invalid
2952 * -EPERM oas is not supported by hba
2960 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_store()
2963 if (!phba->cfg_fof) in lpfc_oas_lun_state_store()
2964 return -EPERM; in lpfc_oas_lun_state_store()
2967 return -EINVAL; in lpfc_oas_lun_state_store()
2970 return -EINVAL; in lpfc_oas_lun_state_store()
2973 return -EINVAL; in lpfc_oas_lun_state_store()
2975 phba->cfg_oas_lun_state = val; in lpfc_oas_lun_state_store()
2982 * lpfc_oas_lun_status_show - Return the status of the Optimized Access
2997 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_status_show()
2999 if (!(phba->cfg_oas_flags & OAS_LUN_VALID)) in lpfc_oas_lun_status_show()
3000 return -EFAULT; in lpfc_oas_lun_status_show()
3002 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_status); in lpfc_oas_lun_status_show()
3009 * lpfc_oas_lun_state_set - enable or disable a lun for Optimized Access Storage
3018 * -EPERM OAS is not enabled or not supported by this port.
3029 if (!phba->cfg_fof) in lpfc_oas_lun_state_set()
3030 return -EPERM; in lpfc_oas_lun_state_set()
3036 rc = -ENOMEM; in lpfc_oas_lun_state_set()
3046 * lpfc_oas_lun_get_next - get the next lun that has been enabled for Optimized
3071 phba->sli4_hba.oas_next_vpt_wwpn, in lpfc_oas_lun_get_next()
3073 phba->sli4_hba.oas_next_tgt_wwpn, in lpfc_oas_lun_get_next()
3074 &phba->sli4_hba.oas_next_lun, in lpfc_oas_lun_get_next()
3084 * lpfc_oas_lun_state_change - enable/disable a lun for OAS operations
3096 * -ENOMEM: failed to enable an lun for OAS operations
3097 * -EPERM: OAS is not enabled
3113 * lpfc_oas_lun_show - Return oas enabled luns from a chosen target
3123 * -EFAULT: target or vport wwpn was not set properly.
3124 * -EPERM: oas is not enabled.
3131 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_show()
3136 if (!phba->cfg_fof) in lpfc_oas_lun_show()
3137 return -EPERM; in lpfc_oas_lun_show()
3139 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_show()
3140 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_VPORT)) in lpfc_oas_lun_show()
3141 return -EFAULT; in lpfc_oas_lun_show()
3143 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_show()
3144 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_TARGET)) in lpfc_oas_lun_show()
3145 return -EFAULT; in lpfc_oas_lun_show()
3147 oas_lun = lpfc_oas_lun_get_next(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_show()
3148 phba->cfg_oas_tgt_wwpn, in lpfc_oas_lun_show()
3149 &phba->cfg_oas_lun_status, in lpfc_oas_lun_show()
3150 &phba->cfg_oas_priority); in lpfc_oas_lun_show()
3152 phba->cfg_oas_flags |= OAS_LUN_VALID; in lpfc_oas_lun_show()
3154 len += scnprintf(buf + len, PAGE_SIZE-len, "0x%llx", oas_lun); in lpfc_oas_lun_show()
3160 * lpfc_oas_lun_store - Sets the OAS state for lun
3170 * -EFAULT: target or vport wwpn was not set properly.
3171 * -EPERM: oas is not enabled.
3179 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_store()
3184 if (!phba->cfg_fof) in lpfc_oas_lun_store()
3185 return -EPERM; in lpfc_oas_lun_store()
3187 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_store()
3188 return -EFAULT; in lpfc_oas_lun_store()
3190 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_store()
3191 return -EFAULT; in lpfc_oas_lun_store()
3194 return -EINVAL; in lpfc_oas_lun_store()
3197 return -EINVAL; in lpfc_oas_lun_store()
3199 pri = phba->cfg_oas_priority; in lpfc_oas_lun_store()
3201 pri = phba->cfg_XLanePriority; in lpfc_oas_lun_store()
3206 wwn_to_u64(phba->cfg_oas_vpt_wwpn), in lpfc_oas_lun_store()
3207 wwn_to_u64(phba->cfg_oas_tgt_wwpn), scsi_lun, in lpfc_oas_lun_store()
3208 pri, phba->cfg_oas_lun_state); in lpfc_oas_lun_store()
3210 rc = lpfc_oas_lun_state_change(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_store()
3211 phba->cfg_oas_tgt_wwpn, scsi_lun, in lpfc_oas_lun_store()
3212 phba->cfg_oas_lun_state, pri); in lpfc_oas_lun_store()
3231 " 0 - none,"
3232 " 1 - poll with interrupts enabled"
3233 " 3 - poll and disable FCP ring interrupts");
3245 " 0 - auto (SLI-3 if supported),"
3246 " 2 - select SLI-2 even on SLI-3 capable HBAs,"
3247 " 3 - select SLI-3");
3276 # 1 - (1024)
3277 # 2 - (2048)
3278 # 3 - (3072)
3279 # 4 - (4096)
3280 # 5 - (5120)
3286 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_iocb_hw_show()
3288 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max); in lpfc_iocb_hw_show()
3297 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txq_hw_show()
3301 pring ? pring->txq_max : 0); in lpfc_txq_hw_show()
3311 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txcmplq_hw_show()
3315 pring ? pring->txcmplq_max : 0); in lpfc_txcmplq_hw_show()
3336 * lpfc_nodev_tmo_show - Return the hba dev loss timeout value
3348 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nodev_tmo_show()
3350 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); in lpfc_nodev_tmo_show()
3354 * lpfc_nodev_tmo_init - Set the hba nodev timeout value
3366 * -EINVAL val out of range
3371 if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { in lpfc_nodev_tmo_init()
3372 vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; in lpfc_nodev_tmo_init()
3382 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_init()
3383 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_init()
3390 vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; in lpfc_nodev_tmo_init()
3391 return -EINVAL; in lpfc_nodev_tmo_init()
3395 * lpfc_update_rport_devloss_tmo - Update dev loss tmo value
3412 spin_lock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3413 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_update_rport_devloss_tmo()
3416 if (ndlp->rport) in lpfc_update_rport_devloss_tmo()
3417 ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; in lpfc_update_rport_devloss_tmo()
3419 spin_lock(&vport->phba->hbalock); in lpfc_update_rport_devloss_tmo()
3422 remoteport = rport->remoteport; in lpfc_update_rport_devloss_tmo()
3423 spin_unlock(&vport->phba->hbalock); in lpfc_update_rport_devloss_tmo()
3425 nvme_fc_set_remoteport_devloss(rport->remoteport, in lpfc_update_rport_devloss_tmo()
3426 vport->cfg_devloss_tmo); in lpfc_update_rport_devloss_tmo()
3429 spin_unlock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3433 * lpfc_nodev_tmo_set - Set the vport nodev tmo and devloss tmo values
3445 * -EINVAL val out of range
3450 if (vport->dev_loss_tmo_changed || in lpfc_nodev_tmo_set()
3458 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_set()
3459 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_set()
3472 return -EINVAL; in lpfc_nodev_tmo_set()
3493 * lpfc_devloss_tmo_set - Sets vport nodev tmo, devloss tmo values, changed bit in lpfc_vport_param_init()
3504 * -EINVAL val out of range in lpfc_vport_param_init()
3510 vport->cfg_nodev_tmo = val; in lpfc_vport_param_init()
3511 vport->cfg_devloss_tmo = val; in lpfc_vport_param_init()
3512 vport->dev_loss_tmo_changed = 1; in lpfc_vport_param_init()
3522 return -EINVAL; in lpfc_vport_param_init()
3559 * Supported Values: 1 - register just FCP
3560 * 3 - register both FCP and NVME
3565 "Enable FC4 Protocol support - FCP / NVME");
3570 * lpfc_enable_fc4_type is 3 - register both FCP and NVME and
3590 "Verbose logging bit-mask");
3629 * -EINVAL if val is invalid
3638 return -EINVAL; in lpfc_tgt_queue_depth_set()
3640 if (val == vport->cfg_tgt_queue_depth) in lpfc_tgt_queue_depth_set()
3643 spin_lock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3644 vport->cfg_tgt_queue_depth = val; in lpfc_tgt_queue_depth_set()
3647 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) in lpfc_tgt_queue_depth_set()
3648 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_tgt_queue_depth_set()
3650 spin_unlock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3698 * lpfc_restrict_login_init - Set the vport restrict login flag
3710 * -EINVAL val out of range
3720 vport->cfg_restrict_login = 1; in lpfc_restrict_login_init()
3721 return -EINVAL; in lpfc_restrict_login_init()
3723 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_restrict_login_init()
3724 vport->cfg_restrict_login = 0; in lpfc_restrict_login_init()
3727 vport->cfg_restrict_login = val; in lpfc_restrict_login_init()
3732 * lpfc_restrict_login_set - Set the vport restrict login flag
3745 * -EINVAL val out of range
3755 vport->cfg_restrict_login = 1; in lpfc_restrict_login_set()
3756 return -EINVAL; in lpfc_restrict_login_set()
3758 if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { in lpfc_restrict_login_set()
3762 vport->cfg_restrict_login = 0; in lpfc_restrict_login_set()
3765 vport->cfg_restrict_login = val; in lpfc_restrict_login_set()
3774 # Fibre channel "ALPA". In the FC-AL Profile there is an "informative
3780 # Turning on the scan-down variable (on = 1, off = 0) will
3793 # 0x0 = attempt loop mode then point-to-point
3795 # 0x02 = attempt point-to-point mode only
3797 # 0x06 = attempt point-to-point mode then loop
3798 # Set point-to-point mode if you want to run as an N_Port.
3806 * lpfc_topology_set - Set the adapters topology field
3818 * non-zero return value from lpfc_issue_lip()
3819 * -EINVAL val out of range
3826 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_topology_store()
3827 struct lpfc_hba *phba = vport->phba; in lpfc_topology_store()
3840 return -EINVAL; in lpfc_topology_store()
3842 return -EINVAL; in lpfc_topology_store()
3845 prev_val = phba->cfg_topology; in lpfc_topology_store()
3846 if (phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G && in lpfc_topology_store()
3851 return -EINVAL; in lpfc_topology_store()
3853 if ((phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC || in lpfc_topology_store()
3854 phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC) && in lpfc_topology_store()
3858 return -EINVAL; in lpfc_topology_store()
3860 phba->cfg_topology = val; in lpfc_topology_store()
3867 if (prev_val != val && phba->sli_rev == LPFC_SLI_REV4) in lpfc_topology_store()
3868 phba->fc_topology_changed = 1; in lpfc_topology_store()
3869 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_topology_store()
3871 phba->cfg_topology = prev_val; in lpfc_topology_store()
3872 return -EINVAL; in lpfc_topology_store()
3879 phba->brd_no, val); in lpfc_topology_store()
3880 return -EINVAL; in lpfc_topology_store()
3902 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_static_vport_show()
3903 if (vport->vport_flag & STATIC_VPORT) in lpfc_static_vport_show()
3917 * lpfc_stat_data_ctrl_store - write call back for lpfc_stat_data_ctrl sysfs file
3940 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_stat_data_ctrl_store()
3941 struct lpfc_hba *phba = vport->phba; in lpfc_stat_data_ctrl_store()
3952 if (strlen(buf) > (LPFC_MAX_DATA_CTRL_LEN - 1)) in lpfc_stat_data_ctrl_store()
3953 return -EINVAL; in lpfc_stat_data_ctrl_store()
3957 /* Ignore this token - this is command token */ in lpfc_stat_data_ctrl_store()
3960 return -EINVAL; in lpfc_stat_data_ctrl_store()
3964 return -EINVAL; in lpfc_stat_data_ctrl_store()
3971 return -EINVAL; in lpfc_stat_data_ctrl_store()
3975 return -EINVAL; in lpfc_stat_data_ctrl_store()
3980 return -EINVAL; in lpfc_stat_data_ctrl_store()
3983 return -EINVAL; in lpfc_stat_data_ctrl_store()
3988 return -ENOMEM; in lpfc_stat_data_ctrl_store()
3990 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
3992 spin_lock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
3994 vports[i]->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
3995 if (vports[i]->stat_data_enabled) in lpfc_stat_data_ctrl_store()
3997 spin_unlock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4001 phba->bucket_type = bucket_type; in lpfc_stat_data_ctrl_store()
4002 phba->bucket_base = base; in lpfc_stat_data_ctrl_store()
4003 phba->bucket_step = step; in lpfc_stat_data_ctrl_store()
4005 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4009 spin_lock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4010 vports[i]->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4011 spin_unlock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4020 return -ENOMEM; in lpfc_stat_data_ctrl_store()
4022 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4024 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4025 vports[i]->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4027 vport->stat_data_enabled = 0; in lpfc_stat_data_ctrl_store()
4028 vports[i]->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4029 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4032 phba->bucket_type = LPFC_NO_BUCKET; in lpfc_stat_data_ctrl_store()
4033 phba->bucket_base = 0; in lpfc_stat_data_ctrl_store()
4034 phba->bucket_step = 0; in lpfc_stat_data_ctrl_store()
4040 if (phba->bucket_type == LPFC_NO_BUCKET) in lpfc_stat_data_ctrl_store()
4041 return -EINVAL; in lpfc_stat_data_ctrl_store()
4042 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4043 if (vport->stat_data_enabled) { in lpfc_stat_data_ctrl_store()
4044 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4048 vport->stat_data_enabled = 1; in lpfc_stat_data_ctrl_store()
4049 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4054 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4055 if (vport->stat_data_enabled == 0) { in lpfc_stat_data_ctrl_store()
4056 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4060 vport->stat_data_enabled = 0; in lpfc_stat_data_ctrl_store()
4061 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4066 if ((phba->bucket_type == LPFC_NO_BUCKET) in lpfc_stat_data_ctrl_store()
4067 || !vport->stat_data_enabled) in lpfc_stat_data_ctrl_store()
4069 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4070 vport->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4072 vport->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4073 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4076 return -EINVAL; in lpfc_stat_data_ctrl_store()
4081 * lpfc_stat_data_ctrl_show - Read function for lpfc_stat_data_ctrl sysfs file
4094 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_stat_data_ctrl_show()
4095 struct lpfc_hba *phba = vport->phba; in lpfc_stat_data_ctrl_show()
4101 switch (phba->bucket_type) { in lpfc_stat_data_ctrl_show()
4116 vport->stat_data_enabled, vport->stat_data_blocked, in lpfc_stat_data_ctrl_show()
4117 bucket_type, phba->bucket_base, phba->bucket_step); in lpfc_stat_data_ctrl_show()
4119 if (phba->bucket_type != LPFC_NO_BUCKET) { in lpfc_stat_data_ctrl_show()
4121 if (phba->bucket_type == LPFC_LINEAR_BUCKET) in lpfc_stat_data_ctrl_show()
4122 bucket_value = phba->bucket_base + in lpfc_stat_data_ctrl_show()
4123 phba->bucket_step * i; in lpfc_stat_data_ctrl_show()
4125 bucket_value = phba->bucket_base + in lpfc_stat_data_ctrl_show()
4126 (1 << i) * phba->bucket_step; in lpfc_stat_data_ctrl_show()
4157 * sysfs_drvr_stat_data_read - Read function for lpfc_drvr_stat_data attribute
4177 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_drvr_stat_data_read()
4178 struct lpfc_hba *phba = vport->phba; in sysfs_drvr_stat_data_read()
4185 if (!vport->stat_data_enabled || vport->stat_data_blocked in sysfs_drvr_stat_data_read()
4186 || (phba->bucket_type == LPFC_NO_BUCKET)) in sysfs_drvr_stat_data_read()
4189 spin_lock_irq(shost->host_lock); in sysfs_drvr_stat_data_read()
4190 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in sysfs_drvr_stat_data_read()
4191 if (!NLP_CHK_NODE_ACT(ndlp) || !ndlp->lat_data) in sysfs_drvr_stat_data_read()
4195 nport_index--; in sysfs_drvr_stat_data_read()
4203 if (!ndlp->lat_data) in sysfs_drvr_stat_data_read()
4208 ndlp->nlp_portname.u.wwn[0], in sysfs_drvr_stat_data_read()
4209 ndlp->nlp_portname.u.wwn[1], in sysfs_drvr_stat_data_read()
4210 ndlp->nlp_portname.u.wwn[2], in sysfs_drvr_stat_data_read()
4211 ndlp->nlp_portname.u.wwn[3], in sysfs_drvr_stat_data_read()
4212 ndlp->nlp_portname.u.wwn[4], in sysfs_drvr_stat_data_read()
4213 ndlp->nlp_portname.u.wwn[5], in sysfs_drvr_stat_data_read()
4214 ndlp->nlp_portname.u.wwn[6], in sysfs_drvr_stat_data_read()
4215 ndlp->nlp_portname.u.wwn[7]); in sysfs_drvr_stat_data_read()
4221 ndlp->lat_data[i].cmd_count); in sysfs_drvr_stat_data_read()
4227 spin_unlock_irq(shost->host_lock); in sysfs_drvr_stat_data_read()
4247 * lpfc_link_speed_set - Set the adapters link speed
4260 * non-zero return value from lpfc_issue_lip()
4261 * -EINVAL val out of range
4268 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_speed_store()
4269 struct lpfc_hba *phba = vport->phba; in lpfc_link_speed_store()
4276 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_link_speed_store()
4278 phba->hba_flag & HBA_FORCED_LINK_SPEED) in lpfc_link_speed_store()
4279 return -EPERM; in lpfc_link_speed_store()
4287 return -EINVAL; in lpfc_link_speed_store()
4289 return -EINVAL; in lpfc_link_speed_store()
4293 phba->cfg_link_speed, val, nolip ? "(nolip)" : "(lip)"); in lpfc_link_speed_store()
4295 if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || in lpfc_link_speed_store()
4296 ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || in lpfc_link_speed_store()
4297 ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || in lpfc_link_speed_store()
4298 ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || in lpfc_link_speed_store()
4299 ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) || in lpfc_link_speed_store()
4300 ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb)) || in lpfc_link_speed_store()
4301 ((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb)) || in lpfc_link_speed_store()
4302 ((val == LPFC_USER_LINK_SPEED_64G) && !(phba->lmt & LMT_64Gb))) { in lpfc_link_speed_store()
4307 return -EINVAL; in lpfc_link_speed_store()
4310 phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_speed_store()
4315 return -EINVAL; in lpfc_link_speed_store()
4327 prev_val = phba->cfg_link_speed; in lpfc_link_speed_store()
4328 phba->cfg_link_speed = val; in lpfc_link_speed_store()
4332 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_link_speed_store()
4334 phba->cfg_link_speed = prev_val; in lpfc_link_speed_store()
4335 return -EINVAL; in lpfc_link_speed_store()
4346 return -EINVAL; in lpfc_link_speed_store()
4356 * lpfc_link_speed_init - Set the adapters link speed in lpfc_param_show()
4369 * -EINVAL val out of range in lpfc_param_show()
4374 if (val >= LPFC_USER_LINK_SPEED_16G && phba->cfg_topology == 4) { in lpfc_param_show()
4379 phba->cfg_topology = 0; in lpfc_param_show()
4391 phba->cfg_link_speed = val; in lpfc_param_show()
4398 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_param_show()
4399 return -EINVAL; in lpfc_param_show()
4416 * lpfc_aer_support_store - Set the adapter for aer support in lpfc_param_show()
4440 * -EINVAL if val out of range or intended mode is not supported. in lpfc_param_show()
4447 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_param_show()
4448 struct lpfc_hba *phba = vport->phba; in lpfc_param_show()
4449 int val = 0, rc = -EINVAL; in lpfc_param_show()
4452 return -EINVAL; in lpfc_param_show()
4454 return -EINVAL; in lpfc_param_show()
4458 if (phba->hba_flag & HBA_AER_ENABLED) { in lpfc_param_show()
4459 rc = pci_disable_pcie_error_reporting(phba->pcidev); in lpfc_param_show()
4461 spin_lock_irq(&phba->hbalock); in lpfc_param_show()
4462 phba->hba_flag &= ~HBA_AER_ENABLED; in lpfc_param_show()
4463 spin_unlock_irq(&phba->hbalock); in lpfc_param_show()
4464 phba->cfg_aer_support = 0; in lpfc_param_show()
4467 rc = -EPERM; in lpfc_param_show()
4469 phba->cfg_aer_support = 0; in lpfc_param_show()
4474 if (!(phba->hba_flag & HBA_AER_ENABLED)) { in lpfc_param_show()
4475 rc = pci_enable_pcie_error_reporting(phba->pcidev); in lpfc_param_show()
4477 spin_lock_irq(&phba->hbalock); in lpfc_param_show()
4478 phba->hba_flag |= HBA_AER_ENABLED; in lpfc_param_show()
4479 spin_unlock_irq(&phba->hbalock); in lpfc_param_show()
4480 phba->cfg_aer_support = 1; in lpfc_param_show()
4483 rc = -EPERM; in lpfc_param_show()
4485 phba->cfg_aer_support = 1; in lpfc_param_show()
4490 rc = -EINVAL; in lpfc_param_show()
4499 * lpfc_aer_cleanup_state - Clean up aer state to the aer enabled device
4514 * -EINVAL if the buf does not contain the 1 or the device is not currently
4522 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_aer_cleanup_state()
4523 struct lpfc_hba *phba = vport->phba; in lpfc_aer_cleanup_state()
4524 int val, rc = -1; in lpfc_aer_cleanup_state()
4527 return -EINVAL; in lpfc_aer_cleanup_state()
4529 return -EINVAL; in lpfc_aer_cleanup_state()
4531 return -EINVAL; in lpfc_aer_cleanup_state()
4533 if (phba->hba_flag & HBA_AER_ENABLED) in lpfc_aer_cleanup_state()
4534 rc = pci_cleanup_aer_uncorrect_error_status(phba->pcidev); in lpfc_aer_cleanup_state()
4539 return -EPERM; in lpfc_aer_cleanup_state()
4546 * lpfc_sriov_nr_virtfn_store - Enable the adapter for sr-iov virtual functions
4555 * try to enable or disable SR-IOV virtual functions according to the
4565 * cfg_sriov_nr_virtfn; otherwise, -EINVAL shall be returned and driver
4568 * If none-zero virtual functions have already been enabled to the
4570 * -EINVAL will be returned and the driver does nothing;
4572 * If the nr_vfn provided is zero and none-zero virtual functions have
4582 * -EINVAL if val out of range or intended mode is not supported.
4589 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sriov_nr_virtfn_store()
4590 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_nr_virtfn_store()
4591 struct pci_dev *pdev = phba->pcidev; in lpfc_sriov_nr_virtfn_store()
4592 int val = 0, rc = -EINVAL; in lpfc_sriov_nr_virtfn_store()
4596 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4598 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4600 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4604 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4606 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4612 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4616 phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4617 return -EEXIST; in lpfc_sriov_nr_virtfn_store()
4621 phba->cfg_sriov_nr_virtfn = val; in lpfc_sriov_nr_virtfn_store()
4626 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4629 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4631 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4632 rc = -EPERM; in lpfc_sriov_nr_virtfn_store()
4640 "Enable PCIe device SR-IOV virtual fn");
4646 * lpfc_request_firmware_store - Request for Linux generic firmware upgrade
4658 * -EINVAL if val out of range or intended mode is not supported.
4666 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_request_firmware_upgrade_store()
4667 struct lpfc_hba *phba = vport->phba; in lpfc_request_firmware_upgrade_store()
4668 int val = 0, rc = -EINVAL; in lpfc_request_firmware_upgrade_store()
4672 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4674 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4676 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4680 rc = -EPERM; in lpfc_request_firmware_upgrade_store()
4692 * lpfc_request_firmware_upgrade_init - Enable initial linux generic fw upgrade in lpfc_param_show()
4701 * -EINVAL val out of range in lpfc_param_show()
4707 phba->cfg_request_firmware_upgrade = val; in lpfc_param_show()
4710 return -EINVAL; in lpfc_param_show()
4721 * @buf: string with the number of fast-path FCP interrupts per second.
4726 * maximum number of fast-path FCP interrupts per second.
4731 * -EINVAL if val out of range or intended mode is not supported.
4738 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_imax_store()
4739 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_imax_store()
4743 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_fcp_imax_store()
4744 return -EINVAL; in lpfc_fcp_imax_store()
4748 return -EINVAL; in lpfc_fcp_imax_store()
4750 return -EINVAL; in lpfc_fcp_imax_store()
4758 return -EINVAL; in lpfc_fcp_imax_store()
4760 phba->cfg_fcp_imax = (uint32_t)val; in lpfc_fcp_imax_store()
4761 phba->initial_imax = phba->cfg_fcp_imax; in lpfc_fcp_imax_store()
4763 for (i = 0; i < phba->io_channel_irqs; i += LPFC_MAX_EQ_DELAY_EQID_CNT) in lpfc_fcp_imax_store()
4771 # lpfc_fcp_imax: The maximum number of fast-path FCP interrupts per second
4783 * lpfc_fcp_imax_init - Set the initial sr-iov virtual function enable in lpfc_param_show()
4789 * maximum number of fast-path FCP interrupts per second. in lpfc_param_show()
4793 * -EINVAL val out of range in lpfc_param_show()
4798 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_param_show()
4799 phba->cfg_fcp_imax = 0; in lpfc_param_show()
4805 phba->cfg_fcp_imax = val; in lpfc_param_show()
4812 phba->cfg_fcp_imax = LPFC_DEF_IMAX; in lpfc_param_show()
4820 * lpfc_auto_imax: Controls Auto-interrupt coalescing values support.
4830 * lpfc_state_show - Display current driver CPU affinity
4842 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_cpu_map_show()
4843 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_cpu_map_show()
4847 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_fcp_cpu_map_show()
4848 (phba->intr_type != MSIX)) in lpfc_fcp_cpu_map_show()
4851 switch (phba->cfg_fcp_cpu_map) { in lpfc_fcp_cpu_map_show()
4853 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
4855 phba->cfg_fcp_cpu_map); in lpfc_fcp_cpu_map_show()
4858 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
4859 "fcp_cpu_map: HBA centric mapping (%d): " in lpfc_fcp_cpu_map_show()
4861 phba->cfg_fcp_cpu_map, in lpfc_fcp_cpu_map_show()
4862 phba->sli4_hba.num_online_cpu); in lpfc_fcp_cpu_map_show()
4865 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
4866 "fcp_cpu_map: Driver centric mapping (%d): " in lpfc_fcp_cpu_map_show()
4868 phba->cfg_fcp_cpu_map, in lpfc_fcp_cpu_map_show()
4869 phba->sli4_hba.num_online_cpu); in lpfc_fcp_cpu_map_show()
4873 while (phba->sli4_hba.curr_disp_cpu < phba->sli4_hba.num_present_cpu) { in lpfc_fcp_cpu_map_show()
4874 cpup = &phba->sli4_hba.cpu_map[phba->sli4_hba.curr_disp_cpu]; in lpfc_fcp_cpu_map_show()
4877 if (cpup->irq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
4878 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
4879 "CPU %02d io_chan %02d " in lpfc_fcp_cpu_map_show()
4881 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
4882 cpup->channel_id, cpup->phys_id, in lpfc_fcp_cpu_map_show()
4883 cpup->core_id); in lpfc_fcp_cpu_map_show()
4885 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
4886 "CPU %02d io_chan %02d " in lpfc_fcp_cpu_map_show()
4888 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
4889 cpup->channel_id, cpup->phys_id, in lpfc_fcp_cpu_map_show()
4890 cpup->core_id, cpup->irq); in lpfc_fcp_cpu_map_show()
4892 phba->sli4_hba.curr_disp_cpu++; in lpfc_fcp_cpu_map_show()
4895 if (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
4896 phba->sli4_hba.num_present_cpu && in lpfc_fcp_cpu_map_show()
4897 (len >= (PAGE_SIZE - 64))) { in lpfc_fcp_cpu_map_show()
4898 len += scnprintf(buf + len, PAGE_SIZE-len, "more...\n"); in lpfc_fcp_cpu_map_show()
4903 if (phba->sli4_hba.curr_disp_cpu == phba->sli4_hba.num_present_cpu) in lpfc_fcp_cpu_map_show()
4904 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_fcp_cpu_map_show()
4910 * lpfc_fcp_cpu_map_store - Change CPU affinity of driver vectors
4917 * -EINVAL - Not implemented yet.
4923 int status = -EINVAL; in lpfc_fcp_cpu_map_store()
4932 # 0 - Do not affinitze IRQ vectors
4933 # 1 - Affintize HBA vectors with respect to each HBA
4935 # 2 - Affintize HBA vectors with respect to the entire driver
4944 * lpfc_fcp_cpu_map_init - Set the initial sr-iov virtual function enable
4949 * If val is in a valid range [0-2], then affinitze the adapter's
4954 * -EINVAL val out of range
4959 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_fcp_cpu_map_init()
4960 phba->cfg_fcp_cpu_map = 0; in lpfc_fcp_cpu_map_init()
4965 phba->cfg_fcp_cpu_map = val; in lpfc_fcp_cpu_map_init()
4972 phba->cfg_fcp_cpu_map = LPFC_DRIVER_CPU_MAP; in lpfc_fcp_cpu_map_init()
5007 * Parameter supported on physical port only - no NPIV support.
5021 * port only - no NPIV support.
5031 # the parameter is set to a non-zero value, the I/O queue depth is controlled
5045 if (val == vport->cfg_max_scsicmpl_time) in lpfc_max_scsicmpl_time_set()
5048 return -EINVAL; in lpfc_max_scsicmpl_time_set()
5049 vport->cfg_max_scsicmpl_time = val; in lpfc_max_scsicmpl_time_set()
5051 spin_lock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5052 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_max_scsicmpl_time_set()
5055 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) in lpfc_max_scsicmpl_time_set()
5057 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_max_scsicmpl_time_set()
5059 spin_unlock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5076 * current CPU.
5081 * The driver dynamically sets this to 1 (BY_CPU) if it's able to set up cpu
5083 * CPU. Otherwise, the default 0 (Round Robin) scheduling of FCP/NVME I/Os
5090 "issuing commands [0] - Round Robin, [1] - Current CPU");
5096 # For [1], bus reset issues target reset to non-FCP2 devices
5099 "FCP2 devices [0] - issue tgt reset, [1] - no tgt reset");
5152 # Traditional FDMI support means the driver will assume FDMI-2 support;
5153 # however, if that fails, it will fallback to FDMI-1.
5177 # there are FC targets, such as JBODs, that only recognize 8-bits of
5210 # 2 = MSI-X enabled (default)
5214 "MSI-X (2), if possible");
5302 # 0x0 - 0x7f = CS_CTL field in FC header (high 7 bits)
5308 # lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF)
5327 # - Bit mask of host protection capabilities used to register with the
5328 # SCSI mid-layer
5329 # - Only meaningful if BG is turned on (lpfc_enable_bg=1).
5330 # - Allows you to ultimately specify which profiles to use
5331 # - Default will result in registering capabilities for all profiles.
5332 # - SHOST_DIF_TYPE1_PROTECTION 1
5334 # - SHOST_DIX_TYPE0_PROTECTION 8
5336 # - SHOST_DIX_TYPE1_PROTECTION 16
5348 "T10-DIF host protection capabilities mask");
5352 # - Bit mask of protection guard types to register with the SCSI mid-layer
5353 # - Guard types are currently either 1) T10-DIF CRC 2) IP checksum
5354 # - Allows you to ultimately specify which profiles to use
5355 # - Default will result in registering capabilities for all guard types
5360 "T10-DIF host protection guard type");
5368 * When this parameter is set to non-zero value, initial Nport discovery is
5380 * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
5384 * Because of the additional overhead involved in setting up T10-DIF,
5558 * sysfs_ctlreg_write - Write method for writing to ctlreg
5571 * -ERANGE off and count combo out of range
5572 * -EINVAL off, count or buff address invalid
5573 * -EPERM adapter is offline
5584 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_write()
5585 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_write()
5587 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_write()
5588 return -EPERM; in sysfs_ctlreg_write()
5591 return -ERANGE; in sysfs_ctlreg_write()
5597 return -EINVAL; in sysfs_ctlreg_write()
5601 return -EINVAL; in sysfs_ctlreg_write()
5603 if (!(vport->fc_flag & FC_OFFLINE_MODE)) in sysfs_ctlreg_write()
5604 return -EPERM; in sysfs_ctlreg_write()
5606 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_write()
5607 for (buf_off = 0; buf_off < count - LPFC_REG_WRITE_KEY_SIZE; in sysfs_ctlreg_write()
5610 phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_write()
5612 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_write()
5618 * sysfs_ctlreg_read - Read method for reading from ctlreg
5631 * -ERANGE off and count combo out of range
5632 * -EINVAL off, count or buff address invalid
5644 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_read()
5645 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_read()
5647 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_read()
5648 return -EPERM; in sysfs_ctlreg_read()
5651 return -ERANGE; in sysfs_ctlreg_read()
5654 count = FF_REG_AREA_SIZE - off; in sysfs_ctlreg_read()
5659 return -EINVAL; in sysfs_ctlreg_read()
5661 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_read()
5665 *tmp_ptr = readl(phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_read()
5668 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_read()
5684 * sysfs_mbox_write - Write method for writing information via mbox
5697 * -EPERM operation not permitted
5704 return -EPERM; in sysfs_mbox_write()
5708 * sysfs_mbox_read - Read method for reading information via mbox
5721 * -EPERM operation not permitted
5728 return -EPERM; in sysfs_mbox_read()
5742 * lpfc_alloc_sysfs_attr - Creates the ctlreg and mbox entries
5755 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
5759 if (error || vport->port_type == LPFC_NPIV_PORT) in lpfc_alloc_sysfs_attr()
5762 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
5767 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
5774 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_alloc_sysfs_attr()
5776 sysfs_remove_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
5783 * lpfc_free_sysfs_attr - Removes the ctlreg and mbox entries
5790 sysfs_remove_bin_file(&shost->shost_dev.kobj, in lpfc_free_sysfs_attr()
5793 if (vport->port_type == LPFC_NPIV_PORT) in lpfc_free_sysfs_attr()
5795 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr); in lpfc_free_sysfs_attr()
5796 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_free_sysfs_attr()
5804 * lpfc_get_host_symbolic_name - Copy symbolic name into the scsi host
5810 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_get_host_symbolic_name()
5817 * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
5823 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_id()
5825 /* note: fc_myDID already in cpu endianness */ in lpfc_get_host_port_id()
5826 fc_host_port_id(shost) = vport->fc_myDID; in lpfc_get_host_port_id()
5830 * lpfc_get_host_port_type - Set the value of the scsi host port type
5836 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_type()
5837 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_type()
5839 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_type()
5841 if (vport->port_type == LPFC_NPIV_PORT) { in lpfc_get_host_port_type()
5844 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_host_port_type()
5845 if (vport->fc_flag & FC_PUBLIC_LOOP) in lpfc_get_host_port_type()
5850 if (vport->fc_flag & FC_FABRIC) in lpfc_get_host_port_type()
5858 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_type()
5862 * lpfc_get_host_port_state - Set the value of the scsi host port state
5868 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_state()
5869 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_state()
5871 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_state()
5873 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_host_port_state()
5876 switch (phba->link_state) { in lpfc_get_host_port_state()
5885 if (vport->port_state < LPFC_VPORT_READY) in lpfc_get_host_port_state()
5901 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_state()
5905 * lpfc_get_host_speed - Set the value of the scsi host speed
5911 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_speed()
5912 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_speed()
5914 spin_lock_irq(shost->host_lock); in lpfc_get_host_speed()
5916 if ((lpfc_is_link_up(phba)) && (!(phba->hba_flag & HBA_FCOE_MODE))) { in lpfc_get_host_speed()
5917 switch(phba->fc_linkspeed) { in lpfc_get_host_speed()
5946 } else if (lpfc_is_link_up(phba) && (phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_get_host_speed()
5947 switch (phba->fc_linkspeed) { in lpfc_get_host_speed()
5967 spin_unlock_irq(shost->host_lock); in lpfc_get_host_speed()
5971 * lpfc_get_host_fabric_name - Set the value of the scsi host fabric name
5977 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_fabric_name()
5978 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_fabric_name()
5981 spin_lock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
5983 if ((vport->port_state > LPFC_FLOGI) && in lpfc_get_host_fabric_name()
5984 ((vport->fc_flag & FC_FABRIC) || in lpfc_get_host_fabric_name()
5985 ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) && in lpfc_get_host_fabric_name()
5986 (vport->fc_flag & FC_PUBLIC_LOOP)))) in lpfc_get_host_fabric_name()
5987 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); in lpfc_get_host_fabric_name()
5992 spin_unlock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
5998 * lpfc_get_stats - Return statistical information about the adapter
6012 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_stats()
6013 struct lpfc_hba *phba = vport->phba; in lpfc_get_stats()
6014 struct lpfc_sli *psli = &phba->sli; in lpfc_get_stats()
6015 struct fc_host_statistics *hs = &phba->link_stats; in lpfc_get_stats()
6016 struct lpfc_lnk_stat * lso = &psli->lnk_stat_offsets; in lpfc_get_stats()
6025 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_stats()
6026 !phba->mbox_mem_pool || in lpfc_get_stats()
6027 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_stats()
6030 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_stats()
6033 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_stats()
6038 pmb = &pmboxq->u.mb; in lpfc_get_stats()
6039 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_get_stats()
6040 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6041 pmboxq->context1 = NULL; in lpfc_get_stats()
6042 pmboxq->vport = vport; in lpfc_get_stats()
6044 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_stats()
6047 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6051 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6057 hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt; in lpfc_get_stats()
6062 hs->tx_words = (uint64_t) in lpfc_get_stats()
6063 ((uint64_t)pmb->un.varRdStatus.xmitByteCnt in lpfc_get_stats()
6065 hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt; in lpfc_get_stats()
6066 hs->rx_words = (uint64_t) in lpfc_get_stats()
6067 ((uint64_t)pmb->un.varRdStatus.rcvByteCnt in lpfc_get_stats()
6071 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_get_stats()
6072 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6073 pmboxq->context1 = NULL; in lpfc_get_stats()
6074 pmboxq->vport = vport; in lpfc_get_stats()
6076 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_stats()
6079 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6083 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6087 hs->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_get_stats()
6088 hs->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_get_stats()
6089 hs->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_get_stats()
6090 hs->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_get_stats()
6091 hs->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_get_stats()
6092 hs->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6093 hs->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6095 hs->link_failure_count -= lso->link_failure_count; in lpfc_get_stats()
6096 hs->loss_of_sync_count -= lso->loss_of_sync_count; in lpfc_get_stats()
6097 hs->loss_of_signal_count -= lso->loss_of_signal_count; in lpfc_get_stats()
6098 hs->prim_seq_protocol_err_count -= lso->prim_seq_protocol_err_count; in lpfc_get_stats()
6099 hs->invalid_tx_word_count -= lso->invalid_tx_word_count; in lpfc_get_stats()
6100 hs->invalid_crc_count -= lso->invalid_crc_count; in lpfc_get_stats()
6101 hs->error_frames -= lso->error_frames; in lpfc_get_stats()
6103 if (phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_stats()
6104 hs->lip_count = -1; in lpfc_get_stats()
6105 hs->nos_count = (phba->link_events >> 1); in lpfc_get_stats()
6106 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6107 } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_stats()
6108 hs->lip_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6109 hs->lip_count -= lso->link_events; in lpfc_get_stats()
6110 hs->nos_count = -1; in lpfc_get_stats()
6112 hs->lip_count = -1; in lpfc_get_stats()
6113 hs->nos_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6114 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6117 hs->dumped_frames = -1; in lpfc_get_stats()
6119 hs->seconds_since_last_reset = ktime_get_seconds() - psli->stats_start; in lpfc_get_stats()
6121 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6127 * lpfc_reset_stats - Copy the adapter link stats information
6133 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_reset_stats()
6134 struct lpfc_hba *phba = vport->phba; in lpfc_reset_stats()
6135 struct lpfc_sli *psli = &phba->sli; in lpfc_reset_stats()
6136 struct lpfc_lnk_stat *lso = &psli->lnk_stat_offsets; in lpfc_reset_stats()
6141 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_reset_stats()
6144 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_reset_stats()
6149 pmb = &pmboxq->u.mb; in lpfc_reset_stats()
6150 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_reset_stats()
6151 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6152 pmb->un.varWords[0] = 0x1; /* reset request */ in lpfc_reset_stats()
6153 pmboxq->context1 = NULL; in lpfc_reset_stats()
6154 pmboxq->vport = vport; in lpfc_reset_stats()
6156 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6157 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) in lpfc_reset_stats()
6160 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6164 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6169 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_reset_stats()
6170 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6171 pmboxq->context1 = NULL; in lpfc_reset_stats()
6172 pmboxq->vport = vport; in lpfc_reset_stats()
6174 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6175 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) in lpfc_reset_stats()
6178 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6182 mempool_free( pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6186 lso->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_reset_stats()
6187 lso->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_reset_stats()
6188 lso->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_reset_stats()
6189 lso->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_reset_stats()
6190 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_reset_stats()
6191 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6192 lso->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6193 if (phba->hba_flag & HBA_FCOE_MODE) in lpfc_reset_stats()
6194 lso->link_events = (phba->link_events >> 1); in lpfc_reset_stats()
6196 lso->link_events = (phba->fc_eventTag >> 1); in lpfc_reset_stats()
6198 psli->stats_start = ktime_get_seconds(); in lpfc_reset_stats()
6200 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6211 * lpfc_get_node_by_target - Return the nodelist for a target
6221 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in lpfc_get_node_by_target()
6222 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_node_by_target()
6225 spin_lock_irq(shost->host_lock); in lpfc_get_node_by_target()
6227 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_get_node_by_target()
6229 ndlp->nlp_state == NLP_STE_MAPPED_NODE && in lpfc_get_node_by_target()
6230 starget->id == ndlp->nlp_sid) { in lpfc_get_node_by_target()
6231 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
6235 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
6240 * lpfc_get_starget_port_id - Set the target port id to the ndlp DID or -1
6248 fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1; in lpfc_get_starget_port_id()
6252 * lpfc_get_starget_node_name - Set the target node name
6263 ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0; in lpfc_get_starget_node_name()
6267 * lpfc_get_starget_port_name - Set the target port name
6278 ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0; in lpfc_get_starget_port_name()
6282 * lpfc_set_rport_loss_tmo - Set the rport dev loss tmo
6294 rport->dev_loss_tmo = timeout; in lpfc_set_rport_loss_tmo()
6296 rport->dev_loss_tmo = 1; in lpfc_set_rport_loss_tmo()
6300 * lpfc_rport_show_function - Return rport target information
6318 struct lpfc_rport_data *rdata = rport->hostdata; \
6320 (rdata->target) ? cast rdata->target->field : 0); \
6328 * lpfc_set_vport_symbolic_name - Set the vport's symbolic name
6333 * has been changed. This function re-registers the symbolic name with the
6339 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; in lpfc_set_vport_symbolic_name()
6341 if (vport->port_state == LPFC_VPORT_READY) in lpfc_set_vport_symbolic_name()
6346 * lpfc_hba_log_verbose_init - Set hba's log verbose level
6357 phba->cfg_log_verbose = verbose; in lpfc_hba_log_verbose_init()
6493 * lpfc_get_cfgparam - Used during probe_one to init the adapter structure
6526 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_get_cfgparam()
6527 phba->cfg_EnableXLane = 0; in lpfc_get_cfgparam()
6530 memset(phba->cfg_oas_tgt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
6531 memset(phba->cfg_oas_vpt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
6532 phba->cfg_oas_lun_state = 0; in lpfc_get_cfgparam()
6533 phba->cfg_oas_lun_status = 0; in lpfc_get_cfgparam()
6534 phba->cfg_oas_flags = 0; in lpfc_get_cfgparam()
6535 phba->cfg_oas_priority = 0; in lpfc_get_cfgparam()
6539 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_cfgparam()
6540 phba->cfg_poll = 0; in lpfc_get_cfgparam()
6542 phba->cfg_poll = lpfc_poll; in lpfc_get_cfgparam()
6544 if (phba->cfg_enable_bg) in lpfc_get_cfgparam()
6545 phba->sli3_options |= LPFC_SLI3_BG_ENABLED; in lpfc_get_cfgparam()
6561 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_get_cfgparam()
6563 phba->nvmet_support = 0; in lpfc_get_cfgparam()
6564 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
6565 phba->cfg_enable_bbcr = 0; in lpfc_get_cfgparam()
6568 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_cfgparam()
6569 phba->cfg_enable_fc4_type |= LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
6572 if (phba->cfg_auto_imax && !phba->cfg_fcp_imax) in lpfc_get_cfgparam()
6573 phba->cfg_auto_imax = 0; in lpfc_get_cfgparam()
6574 phba->initial_imax = phba->cfg_fcp_imax; in lpfc_get_cfgparam()
6576 phba->cfg_enable_pbde = 0; in lpfc_get_cfgparam()
6579 if (phba->cfg_fcp_io_channel == 0) in lpfc_get_cfgparam()
6580 phba->cfg_fcp_io_channel = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
6581 if (phba->cfg_nvme_io_channel == 0) in lpfc_get_cfgparam()
6582 phba->cfg_nvme_io_channel = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
6584 if (phba->cfg_enable_fc4_type == LPFC_ENABLE_NVME) in lpfc_get_cfgparam()
6585 phba->cfg_fcp_io_channel = 0; in lpfc_get_cfgparam()
6587 if (phba->cfg_enable_fc4_type == LPFC_ENABLE_FCP) in lpfc_get_cfgparam()
6588 phba->cfg_nvme_io_channel = 0; in lpfc_get_cfgparam()
6590 if (phba->cfg_fcp_io_channel > phba->cfg_nvme_io_channel) in lpfc_get_cfgparam()
6591 phba->io_channel_irqs = phba->cfg_fcp_io_channel; in lpfc_get_cfgparam()
6593 phba->io_channel_irqs = phba->cfg_nvme_io_channel; in lpfc_get_cfgparam()
6595 phba->cfg_soft_wwnn = 0L; in lpfc_get_cfgparam()
6596 phba->cfg_soft_wwpn = 0L; in lpfc_get_cfgparam()
6608 phba->cfg_enable_dss = 1; in lpfc_get_cfgparam()
6614 * lpfc_nvme_mod_param_dep - Adjust module parameter value based on
6621 if (phba->cfg_nvme_io_channel > phba->sli4_hba.num_present_cpu) in lpfc_nvme_mod_param_dep()
6622 phba->cfg_nvme_io_channel = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
6624 if (phba->cfg_fcp_io_channel > phba->sli4_hba.num_present_cpu) in lpfc_nvme_mod_param_dep()
6625 phba->cfg_fcp_io_channel = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
6627 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_nvme_mod_param_dep()
6628 phba->nvmet_support) { in lpfc_nvme_mod_param_dep()
6629 phba->cfg_enable_fc4_type &= ~LPFC_ENABLE_FCP; in lpfc_nvme_mod_param_dep()
6630 phba->cfg_fcp_io_channel = 0; in lpfc_nvme_mod_param_dep()
6635 phba->cfg_nvme_enable_fb, in lpfc_nvme_mod_param_dep()
6636 phba->cfg_nvmet_fb_size, in lpfc_nvme_mod_param_dep()
6639 if (phba->cfg_nvme_enable_fb == 0) in lpfc_nvme_mod_param_dep()
6640 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
6642 if (phba->cfg_nvmet_fb_size > LPFC_NVMET_FB_SZ_MAX) in lpfc_nvme_mod_param_dep()
6643 phba->cfg_nvmet_fb_size = LPFC_NVMET_FB_SZ_MAX; in lpfc_nvme_mod_param_dep()
6646 if (!phba->cfg_nvmet_mrq) in lpfc_nvme_mod_param_dep()
6647 phba->cfg_nvmet_mrq = phba->cfg_nvme_io_channel; in lpfc_nvme_mod_param_dep()
6650 if (phba->cfg_nvmet_mrq > phba->cfg_nvme_io_channel) { in lpfc_nvme_mod_param_dep()
6651 phba->cfg_nvmet_mrq = phba->cfg_nvme_io_channel; in lpfc_nvme_mod_param_dep()
6654 phba->cfg_nvmet_mrq); in lpfc_nvme_mod_param_dep()
6656 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_nvme_mod_param_dep()
6657 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_nvme_mod_param_dep()
6661 phba->nvmet_support = 0; in lpfc_nvme_mod_param_dep()
6662 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_OFF; in lpfc_nvme_mod_param_dep()
6663 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
6666 if (phba->cfg_fcp_io_channel > phba->cfg_nvme_io_channel) in lpfc_nvme_mod_param_dep()
6667 phba->io_channel_irqs = phba->cfg_fcp_io_channel; in lpfc_nvme_mod_param_dep()
6669 phba->io_channel_irqs = phba->cfg_nvme_io_channel; in lpfc_nvme_mod_param_dep()
6673 * lpfc_get_vport_cfgparam - Used during port create, init the vport structure