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

4  * Copyright (C) 2017-2019 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>
77 " trunk - link was \"low\" speed",
79 " existing trunk - link was \"middle\" speed",
81 " trunk - link was \"high\" speed",
82 "Attached to non-trunking port - F_Port",
83 "Attached to non-trunking port - N_Port",
85 "non-FLOGI frame received",
92 * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules
100 * Hex 0-9 becomes ascii '0' to '9'.
101 * Hex a-f becomes ascii '=' to 'B' capital B.
113 hdw[7 - i] = 0x30 + j; in lpfc_jedec_to_ascii()
115 hdw[7 - i] = 0x61 + j - 10; in lpfc_jedec_to_ascii()
123 * lpfc_drvr_version_show - Return the Emulex driver string with version number
138 * lpfc_enable_fip_show - Return the fip mode of the HBA
150 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_enable_fip_show()
151 struct lpfc_hba *phba = vport->phba; in lpfc_enable_fip_show()
153 if (phba->hba_flag & HBA_FIP_SUPPORT) in lpfc_enable_fip_show()
165 struct lpfc_hba *phba = vport->phba; in lpfc_nvme_info_show()
181 if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) { in lpfc_nvme_info_show()
185 if (phba->nvmet_support) { in lpfc_nvme_info_show()
186 if (!phba->targetport) { in lpfc_nvme_info_show()
189 wwn_to_u64(vport->fc_portname.u.wwn)); in lpfc_nvme_info_show()
193 if (phba->targetport->port_id) in lpfc_nvme_info_show()
206 phba->brd_no, in lpfc_nvme_info_show()
207 wwn_to_u64(vport->fc_portname.u.wwn), in lpfc_nvme_info_show()
208 wwn_to_u64(vport->fc_nodename.u.wwn), in lpfc_nvme_info_show()
209 phba->targetport->port_id); in lpfc_nvme_info_show()
217 tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private; in lpfc_nvme_info_show()
220 atomic_read(&tgtp->rcv_ls_req_in), in lpfc_nvme_info_show()
221 atomic_read(&tgtp->rcv_ls_req_drop), in lpfc_nvme_info_show()
222 atomic_read(&tgtp->xmt_ls_abort)); in lpfc_nvme_info_show()
226 if (atomic_read(&tgtp->rcv_ls_req_in) != in lpfc_nvme_info_show()
227 atomic_read(&tgtp->rcv_ls_req_out)) { in lpfc_nvme_info_show()
230 atomic_read(&tgtp->rcv_ls_req_in), in lpfc_nvme_info_show()
231 atomic_read(&tgtp->rcv_ls_req_out)); in lpfc_nvme_info_show()
238 atomic_read(&tgtp->xmt_ls_rsp), in lpfc_nvme_info_show()
239 atomic_read(&tgtp->xmt_ls_drop), in lpfc_nvme_info_show()
240 atomic_read(&tgtp->xmt_ls_rsp_cmpl)); in lpfc_nvme_info_show()
246 atomic_read(&tgtp->xmt_ls_rsp_aborted), in lpfc_nvme_info_show()
247 atomic_read(&tgtp->xmt_ls_rsp_xb_set), in lpfc_nvme_info_show()
248 atomic_read(&tgtp->xmt_ls_rsp_error)); in lpfc_nvme_info_show()
255 atomic_read(&tgtp->rcv_fcp_cmd_in), in lpfc_nvme_info_show()
256 atomic_read(&tgtp->rcv_fcp_cmd_defer), in lpfc_nvme_info_show()
257 atomic_read(&tgtp->xmt_fcp_release), in lpfc_nvme_info_show()
258 atomic_read(&tgtp->rcv_fcp_cmd_drop)); in lpfc_nvme_info_show()
262 if (atomic_read(&tgtp->rcv_fcp_cmd_in) != in lpfc_nvme_info_show()
263 atomic_read(&tgtp->rcv_fcp_cmd_out)) { in lpfc_nvme_info_show()
266 atomic_read(&tgtp->rcv_fcp_cmd_in), in lpfc_nvme_info_show()
267 atomic_read(&tgtp->rcv_fcp_cmd_out)); in lpfc_nvme_info_show()
275 atomic_read(&tgtp->xmt_fcp_read), in lpfc_nvme_info_show()
276 atomic_read(&tgtp->xmt_fcp_read_rsp), in lpfc_nvme_info_show()
277 atomic_read(&tgtp->xmt_fcp_write), in lpfc_nvme_info_show()
278 atomic_read(&tgtp->xmt_fcp_rsp), in lpfc_nvme_info_show()
279 atomic_read(&tgtp->xmt_fcp_drop)); in lpfc_nvme_info_show()
285 atomic_read(&tgtp->xmt_fcp_rsp_cmpl), in lpfc_nvme_info_show()
286 atomic_read(&tgtp->xmt_fcp_rsp_error), in lpfc_nvme_info_show()
287 atomic_read(&tgtp->xmt_fcp_rsp_drop)); in lpfc_nvme_info_show()
293 atomic_read(&tgtp->xmt_fcp_rsp_aborted), in lpfc_nvme_info_show()
294 atomic_read(&tgtp->xmt_fcp_rsp_xb_set), in lpfc_nvme_info_show()
295 atomic_read(&tgtp->xmt_fcp_xri_abort_cqe)); in lpfc_nvme_info_show()
301 atomic_read(&tgtp->xmt_fcp_abort), in lpfc_nvme_info_show()
302 atomic_read(&tgtp->xmt_fcp_abort_cmpl)); in lpfc_nvme_info_show()
308 atomic_read(&tgtp->xmt_abort_sol), in lpfc_nvme_info_show()
309 atomic_read(&tgtp->xmt_abort_unsol), in lpfc_nvme_info_show()
310 atomic_read(&tgtp->xmt_abort_rsp), in lpfc_nvme_info_show()
311 atomic_read(&tgtp->xmt_abort_rsp_error)); in lpfc_nvme_info_show()
317 atomic_read(&tgtp->defer_ctx), in lpfc_nvme_info_show()
318 atomic_read(&tgtp->defer_fod), in lpfc_nvme_info_show()
319 atomic_read(&tgtp->defer_wqfull)); in lpfc_nvme_info_show()
324 tot = atomic_read(&tgtp->rcv_fcp_cmd_drop); in lpfc_nvme_info_show()
325 tot += atomic_read(&tgtp->xmt_fcp_release); in lpfc_nvme_info_show()
326 tot = atomic_read(&tgtp->rcv_fcp_cmd_in) - tot; in lpfc_nvme_info_show()
331 phba->sli4_hba.nvmet_xri_cnt, in lpfc_nvme_info_show()
332 phba->sli4_hba.nvmet_io_wait_cnt, in lpfc_nvme_info_show()
333 phba->sli4_hba.nvmet_io_wait_total, in lpfc_nvme_info_show()
339 localport = vport->localport; in lpfc_nvme_info_show()
343 wwn_to_u64(vport->fc_portname.u.wwn)); in lpfc_nvme_info_show()
346 lport = (struct lpfc_nvme_lport *)localport->private; in lpfc_nvme_info_show()
353 phba->brd_no, in lpfc_nvme_info_show()
354 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_nvme_info_show()
355 phba->sli4_hba.io_xri_max, in lpfc_nvme_info_show()
361 if (localport->port_id) in lpfc_nvme_info_show()
369 phba->brd_no, in lpfc_nvme_info_show()
370 wwn_to_u64(vport->fc_portname.u.wwn), in lpfc_nvme_info_show()
371 wwn_to_u64(vport->fc_nodename.u.wwn), in lpfc_nvme_info_show()
372 localport->port_id, statep); in lpfc_nvme_info_show()
376 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_nvme_info_show()
378 spin_lock_irqsave(&vport->phba->hbalock, iflags); in lpfc_nvme_info_show()
381 nrport = rport->remoteport; in lpfc_nvme_info_show()
382 spin_unlock_irqrestore(&vport->phba->hbalock, iflags); in lpfc_nvme_info_show()
387 switch (nrport->port_state) { in lpfc_nvme_info_show()
402 if (phba->brd_no >= 10) { in lpfc_nvme_info_show()
408 nrport->port_name); in lpfc_nvme_info_show()
413 nrport->node_name); in lpfc_nvme_info_show()
418 nrport->port_id); in lpfc_nvme_info_show()
423 if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR) { in lpfc_nvme_info_show()
427 if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET) { in lpfc_nvme_info_show()
431 if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY) { in lpfc_nvme_info_show()
435 if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR | in lpfc_nvme_info_show()
439 nrport->port_role); in lpfc_nvme_info_show()
458 atomic_read(&lport->fc4NvmeLsRequests), in lpfc_nvme_info_show()
459 atomic_read(&lport->fc4NvmeLsCmpls), in lpfc_nvme_info_show()
460 atomic_read(&lport->xmt_ls_abort)); in lpfc_nvme_info_show()
466 atomic_read(&lport->xmt_ls_err), in lpfc_nvme_info_show()
467 atomic_read(&lport->cmpl_ls_xb), in lpfc_nvme_info_show()
468 atomic_read(&lport->cmpl_ls_err)); in lpfc_nvme_info_show()
474 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_nvme_info_show()
475 cstat = &phba->sli4_hba.hdwq[i].nvme_cstat; in lpfc_nvme_info_show()
476 tot = cstat->io_cmpls; in lpfc_nvme_info_show()
478 data1 = cstat->input_requests; in lpfc_nvme_info_show()
479 data2 = cstat->output_requests; in lpfc_nvme_info_show()
480 data3 = cstat->control_requests; in lpfc_nvme_info_show()
486 totin, totout, totout - totin); in lpfc_nvme_info_show()
493 atomic_read(&lport->xmt_fcp_abort), in lpfc_nvme_info_show()
494 atomic_read(&lport->xmt_fcp_noxri), in lpfc_nvme_info_show()
495 atomic_read(&lport->xmt_fcp_bad_ndlp), in lpfc_nvme_info_show()
496 atomic_read(&lport->xmt_fcp_qdepth), in lpfc_nvme_info_show()
497 atomic_read(&lport->xmt_fcp_err), in lpfc_nvme_info_show()
498 atomic_read(&lport->xmt_fcp_wqerr)); in lpfc_nvme_info_show()
504 atomic_read(&lport->cmpl_fcp_xb), in lpfc_nvme_info_show()
505 atomic_read(&lport->cmpl_fcp_err)); in lpfc_nvme_info_show()
517 if (unlikely(len >= (PAGE_SIZE - 1))) { in lpfc_nvme_info_show()
522 strlcpy(buf + PAGE_SIZE - 1 - in lpfc_nvme_info_show()
523 strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1), in lpfc_nvme_info_show()
525 strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1) in lpfc_nvme_info_show()
538 struct lpfc_hba *phba = vport->phba; in lpfc_scsi_stat_show()
546 if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_FCP) || in lpfc_scsi_stat_show()
547 (phba->sli_rev != LPFC_SLI_REV4)) in lpfc_scsi_stat_show()
554 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_scsi_stat_show()
555 cstat = &phba->sli4_hba.hdwq[i].scsi_cstat; in lpfc_scsi_stat_show()
556 tot = cstat->io_cmpls; in lpfc_scsi_stat_show()
558 data1 = cstat->input_requests; in lpfc_scsi_stat_show()
559 data2 = cstat->output_requests; in lpfc_scsi_stat_show()
560 data3 = cstat->control_requests; in lpfc_scsi_stat_show()
569 tot, ((data1 + data2 + data3) - tot)); in lpfc_scsi_stat_show()
574 "OutIO %016llx\n", totin, totout, totout - totin); in lpfc_scsi_stat_show()
588 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_info_show()
589 struct lpfc_hba *phba = vport->phba; in lpfc_bg_info_show()
591 if (phba->cfg_enable_bg) { in lpfc_bg_info_show()
592 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_bg_info_show()
608 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_guard_err_show()
609 struct lpfc_hba *phba = vport->phba; in lpfc_bg_guard_err_show()
612 (unsigned long long)phba->bg_guard_err_cnt); in lpfc_bg_guard_err_show()
620 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_apptag_err_show()
621 struct lpfc_hba *phba = vport->phba; in lpfc_bg_apptag_err_show()
624 (unsigned long long)phba->bg_apptag_err_cnt); in lpfc_bg_apptag_err_show()
632 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_reftag_err_show()
633 struct lpfc_hba *phba = vport->phba; in lpfc_bg_reftag_err_show()
636 (unsigned long long)phba->bg_reftag_err_cnt); in lpfc_bg_reftag_err_show()
640 * lpfc_info_show - Return some pci info about the host in ascii
657 * lpfc_serialnum_show - Return the hba serial number in ascii
669 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_serialnum_show()
670 struct lpfc_hba *phba = vport->phba; in lpfc_serialnum_show()
672 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->SerialNumber); in lpfc_serialnum_show()
676 * lpfc_temp_sensor_show - Return the temperature sensor level
692 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_temp_sensor_show()
693 struct lpfc_hba *phba = vport->phba; in lpfc_temp_sensor_show()
694 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->temp_sensor_support); in lpfc_temp_sensor_show()
698 * lpfc_modeldesc_show - Return the model description of the hba
710 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_modeldesc_show()
711 struct lpfc_hba *phba = vport->phba; in lpfc_modeldesc_show()
713 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelDesc); in lpfc_modeldesc_show()
717 * lpfc_modelname_show - Return the model name of the hba
729 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_modelname_show()
730 struct lpfc_hba *phba = vport->phba; in lpfc_modelname_show()
732 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelName); in lpfc_modelname_show()
736 * lpfc_programtype_show - Return the program type of the hba
748 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_programtype_show()
749 struct lpfc_hba *phba = vport->phba; in lpfc_programtype_show()
751 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ProgramType); in lpfc_programtype_show()
755 * lpfc_mlomgmt_show - Return the Menlo Maintenance sli flag
766 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_mlomgmt_show()
767 struct lpfc_hba *phba = vport->phba; in lpfc_mlomgmt_show()
770 (phba->sli.sli_flag & LPFC_MENLO_MAINT)); in lpfc_mlomgmt_show()
774 * lpfc_vportnum_show - Return the port number in ascii of the hba
786 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_vportnum_show()
787 struct lpfc_hba *phba = vport->phba; in lpfc_vportnum_show()
789 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->Port); in lpfc_vportnum_show()
793 * lpfc_fwrev_show - Return the firmware rev running in the hba
805 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_fwrev_show()
806 struct lpfc_hba *phba = vport->phba; in lpfc_fwrev_show()
813 if_type = phba->sli4_hba.pc_sli4_params.if_type; in lpfc_fwrev_show()
814 sli_family = phba->sli4_hba.pc_sli4_params.sli_family; in lpfc_fwrev_show()
816 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_fwrev_show()
817 len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d\n", in lpfc_fwrev_show()
818 fwrev, phba->sli_rev); in lpfc_fwrev_show()
820 len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d:%d:%x\n", in lpfc_fwrev_show()
821 fwrev, phba->sli_rev, if_type, sli_family); in lpfc_fwrev_show()
827 * lpfc_hdw_show - Return the jedec information about the hba
839 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_hdw_show()
840 struct lpfc_hba *phba = vport->phba; in lpfc_hdw_show()
841 lpfc_vpd_t *vp = &phba->vpd; in lpfc_hdw_show()
843 lpfc_jedec_to_ascii(vp->rev.biuRev, hdw); in lpfc_hdw_show()
845 vp->rev.smRev, vp->rev.smFwRev); in lpfc_hdw_show()
849 * lpfc_option_rom_version_show - Return the adapter ROM FCode version
861 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_option_rom_version_show()
862 struct lpfc_hba *phba = vport->phba; in lpfc_option_rom_version_show()
865 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_option_rom_version_show()
867 phba->OptionROMVersion); in lpfc_option_rom_version_show()
874 * lpfc_state_show - Return the link state of the port
889 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_state_show()
890 struct lpfc_hba *phba = vport->phba; in lpfc_link_state_show()
893 switch (phba->link_state) { in lpfc_link_state_show()
900 if (phba->hba_flag & LINK_DISABLED) in lpfc_link_state_show()
901 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
902 "Link Down - User disabled\n"); in lpfc_link_state_show()
904 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
910 len += scnprintf(buf + len, PAGE_SIZE-len, "Link Up - "); in lpfc_link_state_show()
912 switch (vport->port_state) { in lpfc_link_state_show()
914 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
924 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
928 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
933 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
938 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
942 if (phba->sli.sli_flag & LPFC_MENLO_MAINT) in lpfc_link_state_show()
943 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
945 else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_state_show()
946 if (vport->fc_flag & FC_PUBLIC_LOOP) in lpfc_link_state_show()
947 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
950 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
953 if (vport->fc_flag & FC_FABRIC) in lpfc_link_state_show()
954 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
957 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
958 " Point-2-Point\n"); in lpfc_link_state_show()
962 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_link_state_show()
964 &phba->sli4_hba.sli_intf) == in lpfc_link_state_show()
966 struct lpfc_trunk_link link = phba->trunk_link; in lpfc_link_state_show()
968 if (bf_get(lpfc_conf_trunk_port0, &phba->sli4_hba)) in lpfc_link_state_show()
969 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
975 if (bf_get(lpfc_conf_trunk_port1, &phba->sli4_hba)) in lpfc_link_state_show()
976 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
982 if (bf_get(lpfc_conf_trunk_port2, &phba->sli4_hba)) in lpfc_link_state_show()
983 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
989 if (bf_get(lpfc_conf_trunk_port3, &phba->sli4_hba)) in lpfc_link_state_show()
990 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1002 * lpfc_sli4_protocol_show - Return the fip mode of the HBA
1014 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sli4_protocol_show()
1015 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_protocol_show()
1017 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_sli4_protocol_show()
1020 if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL) { in lpfc_sli4_protocol_show()
1021 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_GE) in lpfc_sli4_protocol_show()
1023 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC) in lpfc_sli4_protocol_show()
1030 * lpfc_oas_supported_show - Return whether or not Optimized Access Storage
1043 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_oas_supported_show()
1044 struct lpfc_hba *phba = vport->phba; in lpfc_oas_supported_show()
1047 phba->sli4_hba.pc_sli4_params.oas_supported); in lpfc_oas_supported_show()
1051 * lpfc_link_state_store - Transition the link_state on an HBA port
1058 * -EINVAL if the buffer is not "up" or "down"
1059 * return from link state change function if non-zero
1067 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_state_store()
1068 struct lpfc_hba *phba = vport->phba; in lpfc_link_state_store()
1070 int status = -EINVAL; in lpfc_link_state_store()
1072 if ((strncmp(buf, "up", sizeof("up") - 1) == 0) && in lpfc_link_state_store()
1073 (phba->link_state == LPFC_LINK_DOWN)) in lpfc_link_state_store()
1074 status = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_link_state_store()
1075 else if ((strncmp(buf, "down", sizeof("down") - 1) == 0) && in lpfc_link_state_store()
1076 (phba->link_state >= LPFC_LINK_UP)) in lpfc_link_state_store()
1077 status = phba->lpfc_hba_down_link(phba, MBX_NOWAIT); in lpfc_link_state_store()
1086 * lpfc_num_discovered_ports_show - Return sum of mapped and unmapped vports
1102 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_num_discovered_ports_show()
1105 vport->fc_map_cnt + vport->fc_unmap_cnt); in lpfc_num_discovered_ports_show()
1109 * lpfc_issue_lip - Misnomer, name carried over from long ago
1113 * Bring the link down gracefully then re-init the link. The firmware will
1114 * re-init the fiber channel interface as required. Does not issue a LIP.
1117 * -EPERM port offline or management commands are being blocked
1118 * -ENOMEM cannot allocate memory for the mailbox command
1119 * -EIO error sending the mailbox command
1125 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_issue_lip()
1126 struct lpfc_hba *phba = vport->phba; in lpfc_issue_lip()
1134 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_issue_lip()
1135 (phba->hba_flag & LINK_DISABLED) || in lpfc_issue_lip()
1136 (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO)) in lpfc_issue_lip()
1137 return -EPERM; in lpfc_issue_lip()
1139 pmboxq = mempool_alloc(phba->mbox_mem_pool,GFP_KERNEL); in lpfc_issue_lip()
1142 return -ENOMEM; in lpfc_issue_lip()
1145 pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK; in lpfc_issue_lip()
1146 pmboxq->u.mb.mbxOwner = OWN_HOST; in lpfc_issue_lip()
1151 (pmboxq->u.mb.mbxStatus == 0 || in lpfc_issue_lip()
1152 pmboxq->u.mb.mbxStatus == MBXERR_LINK_DOWN)) { in lpfc_issue_lip()
1154 lpfc_init_link(phba, pmboxq, phba->cfg_topology, in lpfc_issue_lip()
1155 phba->cfg_link_speed); in lpfc_issue_lip()
1157 phba->fc_ratov * 2); in lpfc_issue_lip()
1159 (pmboxq->u.mb.mbxStatus == MBXERR_SEC_NO_PERMISSION)) in lpfc_issue_lip()
1167 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_issue_lip()
1170 return -EIO; in lpfc_issue_lip()
1198 * lpfc_do_offline - Issues a mailbox command to bring the link down
1206 * lpfc_workq_post_event() returns a non-zero return code if call fails.
1209 * -EIO error posting the event
1227 return -ENOMEM; in lpfc_do_offline()
1232 return -EIO; in lpfc_do_offline()
1234 psli = &phba->sli; in lpfc_do_offline()
1241 spin_lock_irq(&phba->hbalock); in lpfc_do_offline()
1242 if (!(psli->sli_flag & LPFC_QUEUE_FREE_INIT)) { in lpfc_do_offline()
1243 psli->sli_flag |= LPFC_QUEUE_FREE_WAIT; in lpfc_do_offline()
1245 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1248 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1253 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_do_offline()
1254 for (i = 0; i < psli->num_rings; i++) { in lpfc_do_offline()
1255 pring = &psli->sli3_ring[i]; in lpfc_do_offline()
1256 if (!lpfc_emptyq_wait(phba, &pring->txcmplq, in lpfc_do_offline()
1257 &phba->hbalock)) in lpfc_do_offline()
1261 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_do_offline()
1262 pring = qp->pring; in lpfc_do_offline()
1265 if (!lpfc_emptyq_wait(phba, &pring->txcmplq, in lpfc_do_offline()
1266 &pring->ring_lock)) in lpfc_do_offline()
1271 spin_lock_irq(&phba->hbalock); in lpfc_do_offline()
1272 psli->sli_flag &= ~LPFC_QUEUE_FREE_WAIT; in lpfc_do_offline()
1273 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1279 return -ENOMEM; in lpfc_do_offline()
1284 return -EIO; in lpfc_do_offline()
1290 * lpfc_reset_pci_bus - resets PCI bridge controller's secondary bus of an HBA
1294 * Issues a PCI secondary bus reset for the phba->pcidev.
1303 * -ENOTSUPP, cfg_enable_hba_reset must be of value 2
1304 * -ENODEV, NULL ptr to pcidev
1305 * -EBADSLT, detected invalid device
1306 * -EBUSY, port is not in offline state
1312 struct pci_dev *pdev = phba->pcidev; in lpfc_reset_pci_bus()
1318 if (phba->cfg_enable_hba_reset != 2) in lpfc_reset_pci_bus()
1319 return -ENOTSUPP; in lpfc_reset_pci_bus()
1323 return -ENODEV; in lpfc_reset_pci_bus()
1331 list_for_each_entry(ptr, &pdev->bus->devices, bus_list) { in lpfc_reset_pci_bus()
1336 ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_reset_pci_bus()
1337 if (!(phba_other->pport->fc_flag & FC_OFFLINE_MODE)) { in lpfc_reset_pci_bus()
1342 phba_other->wwpn[0], in lpfc_reset_pci_bus()
1343 phba_other->wwpn[1], in lpfc_reset_pci_bus()
1344 phba_other->wwpn[2], in lpfc_reset_pci_bus()
1345 phba_other->wwpn[3], in lpfc_reset_pci_bus()
1346 phba_other->wwpn[4], in lpfc_reset_pci_bus()
1347 phba_other->wwpn[5], in lpfc_reset_pci_bus()
1348 phba_other->wwpn[6], in lpfc_reset_pci_bus()
1349 phba_other->wwpn[7]); in lpfc_reset_pci_bus()
1350 return -EBUSY; in lpfc_reset_pci_bus()
1366 * lpfc_selective_reset - Offline then onlines the port
1379 * -EIO reset not configured or error posting the event
1389 if (!phba->cfg_enable_hba_reset) in lpfc_selective_reset()
1390 return -EACCES; in lpfc_selective_reset()
1392 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE)) { in lpfc_selective_reset()
1403 return -ENOMEM; in lpfc_selective_reset()
1408 return -EIO; in lpfc_selective_reset()
1414 * lpfc_issue_reset - Selectively resets an adapter
1430 * -EINVAL if the buffer does not contain the string "selective"
1431 * length of buf if lpfc-selective_reset() if the call succeeds
1439 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_issue_reset()
1440 struct lpfc_hba *phba = vport->phba; in lpfc_issue_reset()
1441 int status = -EINVAL; in lpfc_issue_reset()
1443 if (!phba->cfg_enable_hba_reset) in lpfc_issue_reset()
1444 return -EACCES; in lpfc_issue_reset()
1446 if (strncmp(buf, "selective", sizeof("selective") - 1) == 0) in lpfc_issue_reset()
1447 status = phba->lpfc_selective_reset(phba); in lpfc_issue_reset()
1456 * lpfc_sli4_pdev_status_reg_wait - Wait for pdev status register for readyness
1460 * SLI4 interface type-2 device to wait on the sliport status register for
1464 * zero for success, -EPERM when port does not have privilege to perform the
1465 * reset, -EIO when port timeout from recovering from the reset.
1478 lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1484 return -EPERM; in lpfc_sli4_pdev_status_reg_wait()
1489 lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1503 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1507 * lpfc_sli4_pdev_reg_request - Request physical dev to perform a register acc
1511 * Request SLI4 interface type-2 device to perform a physical register set
1521 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pdev_reg_request()
1528 if (!phba->cfg_enable_hba_reset) in lpfc_sli4_pdev_reg_request()
1529 return -EACCES; in lpfc_sli4_pdev_reg_request()
1531 if ((phba->sli_rev < LPFC_SLI_REV4) || in lpfc_sli4_pdev_reg_request()
1532 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_pdev_reg_request()
1534 return -EPERM; in lpfc_sli4_pdev_reg_request()
1537 before_fc_flag = phba->pport->fc_flag; in lpfc_sli4_pdev_reg_request()
1538 sriov_nr_virtfn = phba->cfg_sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1540 /* Disable SR-IOV virtual functions if enabled */ in lpfc_sli4_pdev_reg_request()
1541 if (phba->cfg_sriov_nr_virtfn) { in lpfc_sli4_pdev_reg_request()
1543 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_pdev_reg_request()
1547 phba->hba_flag |= HBA_FW_DUMP_OP; in lpfc_sli4_pdev_reg_request()
1552 phba->hba_flag &= ~HBA_FW_DUMP_OP; in lpfc_sli4_pdev_reg_request()
1559 reg_val = readl(phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1569 writel(reg_val, phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1572 readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); in lpfc_sli4_pdev_reg_request()
1577 if (rc == -EPERM) { in lpfc_sli4_pdev_reg_request()
1582 } else if (rc == -EIO) { in lpfc_sli4_pdev_reg_request()
1608 phba->cfg_sriov_nr_virtfn = sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1614 rc = -ENOMEM; in lpfc_sli4_pdev_reg_request()
1616 rc = -EIO; in lpfc_sli4_pdev_reg_request()
1622 * lpfc_nport_evt_cnt_show - Return the number of nport events
1634 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nport_evt_cnt_show()
1635 struct lpfc_hba *phba = vport->phba; in lpfc_nport_evt_cnt_show()
1637 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); in lpfc_nport_evt_cnt_show()
1658 return -EINVAL; /* Invalid command */ in lpfc_set_trunking()
1672 return -EINVAL; in lpfc_set_trunking()
1678 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_set_trunking()
1680 return -ENOMEM; in lpfc_set_trunking()
1687 &mbox->u.mqe.un.set_trunk_mode, in lpfc_set_trunking()
1695 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_set_trunking()
1701 * lpfc_board_mode_show - Return the state of the board
1713 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_show()
1714 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_show()
1717 if (phba->link_state == LPFC_HBA_ERROR) in lpfc_board_mode_show()
1719 else if (phba->link_state == LPFC_WARM_START) in lpfc_board_mode_show()
1721 else if (phba->link_state == LPFC_INIT_START) in lpfc_board_mode_show()
1730 * lpfc_board_mode_store - Puts the hba in online, offline, warm or error state
1737 * -EACCES if enable hba reset not enabled
1738 * -EINVAL if the buffer does not contain a valid string (see above)
1739 * -EIO if lpfc_workq_post_event() or lpfc_do_offline() fails
1747 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_store()
1748 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_store()
1754 if (!phba->cfg_enable_hba_reset) { in lpfc_board_mode_store()
1755 status = -EACCES; in lpfc_board_mode_store()
1764 if(strncmp(buf, "online", sizeof("online") - 1) == 0) { in lpfc_board_mode_store()
1768 status = -ENOMEM; in lpfc_board_mode_store()
1773 status = -EIO; in lpfc_board_mode_store()
1774 } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) in lpfc_board_mode_store()
1776 else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) in lpfc_board_mode_store()
1777 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
1778 status = -EINVAL; in lpfc_board_mode_store()
1781 else if (strncmp(buf, "error", sizeof("error") - 1) == 0) in lpfc_board_mode_store()
1782 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
1783 status = -EINVAL; in lpfc_board_mode_store()
1786 else if (strncmp(buf, "dump", sizeof("dump") - 1) == 0) in lpfc_board_mode_store()
1788 else if (strncmp(buf, "fw_reset", sizeof("fw_reset") - 1) == 0) in lpfc_board_mode_store()
1790 else if (strncmp(buf, "dv_reset", sizeof("dv_reset") - 1) == 0) in lpfc_board_mode_store()
1792 else if (strncmp(buf, "pci_bus_reset", sizeof("pci_bus_reset") - 1) in lpfc_board_mode_store()
1795 else if (strncmp(buf, "trunk", sizeof("trunk") - 1) == 0) in lpfc_board_mode_store()
1798 status = -EINVAL; in lpfc_board_mode_store()
1810 buf, status, phba->pport->fc_flag); in lpfc_board_mode_store()
1816 * lpfc_get_hba_info - Return various bits of informaton about the adapter
1849 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_hba_info()
1850 !phba->mbox_mem_pool || in lpfc_get_hba_info()
1851 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_hba_info()
1854 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_hba_info()
1857 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_hba_info()
1862 pmb = &pmboxq->u.mb; in lpfc_get_hba_info()
1863 pmb->mbxCommand = MBX_READ_CONFIG; in lpfc_get_hba_info()
1864 pmb->mbxOwner = OWN_HOST; in lpfc_get_hba_info()
1865 pmboxq->ctx_buf = NULL; in lpfc_get_hba_info()
1867 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_hba_info()
1870 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_hba_info()
1874 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
1878 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_get_hba_info()
1879 rd_config = &pmboxq->u.mqe.un.rd_config; in lpfc_get_hba_info()
1883 *arpi = bf_get(lpfc_mbx_rd_conf_rpi_count, rd_config) - in lpfc_get_hba_info()
1884 phba->sli4_hba.max_cfg_param.rpi_used; in lpfc_get_hba_info()
1888 *axri = bf_get(lpfc_mbx_rd_conf_xri_count, rd_config) - in lpfc_get_hba_info()
1889 phba->sli4_hba.max_cfg_param.xri_used; in lpfc_get_hba_info()
1891 /* Account for differences with SLI-3. Get vpi count from in lpfc_get_hba_info()
1895 (bf_get(lpfc_mbx_rd_conf_vpi_count, rd_config) - 1) : 0; in lpfc_get_hba_info()
1903 *avpi = max_vpi - phba->sli4_hba.max_cfg_param.vpi_used; in lpfc_get_hba_info()
1906 *mrpi = pmb->un.varRdConfig.max_rpi; in lpfc_get_hba_info()
1908 *arpi = pmb->un.varRdConfig.avail_rpi; in lpfc_get_hba_info()
1910 *mxri = pmb->un.varRdConfig.max_xri; in lpfc_get_hba_info()
1912 *axri = pmb->un.varRdConfig.avail_xri; in lpfc_get_hba_info()
1914 *mvpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
1917 if (phba->link_state == LPFC_HBA_READY) in lpfc_get_hba_info()
1918 *avpi = pmb->un.varRdConfig.avail_vpi; in lpfc_get_hba_info()
1920 *avpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
1924 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
1929 * lpfc_max_rpi_show - Return maximum rpi
1947 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_rpi_show()
1948 struct lpfc_hba *phba = vport->phba; in lpfc_max_rpi_show()
1957 * lpfc_used_rpi_show - Return maximum rpi minus available rpi
1975 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_rpi_show()
1976 struct lpfc_hba *phba = vport->phba; in lpfc_used_rpi_show()
1980 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_rpi_show()
1985 * lpfc_max_xri_show - Return maximum xri
2003 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_xri_show()
2004 struct lpfc_hba *phba = vport->phba; in lpfc_max_xri_show()
2013 * lpfc_used_xri_show - Return maximum xpi minus the available xpi
2031 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_xri_show()
2032 struct lpfc_hba *phba = vport->phba; in lpfc_used_xri_show()
2036 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_xri_show()
2041 * lpfc_max_vpi_show - Return maximum vpi
2059 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_vpi_show()
2060 struct lpfc_hba *phba = vport->phba; in lpfc_max_vpi_show()
2069 * lpfc_used_vpi_show - Return maximum vpi minus the available vpi
2087 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_vpi_show()
2088 struct lpfc_hba *phba = vport->phba; in lpfc_used_vpi_show()
2092 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_vpi_show()
2097 * lpfc_npiv_info_show - Return text about NPIV support for the adapter
2114 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_npiv_info_show()
2115 struct lpfc_hba *phba = vport->phba; in lpfc_npiv_info_show()
2117 if (!(phba->max_vpi)) in lpfc_npiv_info_show()
2119 if (vport->port_type == LPFC_PHYSICAL_PORT) in lpfc_npiv_info_show()
2121 return scnprintf(buf, PAGE_SIZE, "NPIV Virtual (VPI %d)\n", vport->vpi); in lpfc_npiv_info_show()
2125 * lpfc_poll_show - Return text about poll support for the adapter
2140 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_show()
2141 struct lpfc_hba *phba = vport->phba; in lpfc_poll_show()
2143 return scnprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); in lpfc_poll_show()
2147 * lpfc_poll_store - Set the value of cfg_poll for the adapter
2157 * -EINVAL if the buffer connot be converted or is out of range
2165 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_store()
2166 struct lpfc_hba *phba = vport->phba; in lpfc_poll_store()
2172 return -EINVAL; in lpfc_poll_store()
2175 return -EINVAL; in lpfc_poll_store()
2178 return -EINVAL; in lpfc_poll_store()
2180 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_poll_store()
2185 phba->cfg_poll, val); in lpfc_poll_store()
2187 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2189 old_val = phba->cfg_poll; in lpfc_poll_store()
2194 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2195 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2196 return -EINVAL; in lpfc_poll_store()
2199 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2200 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2205 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2206 return -EINVAL; in lpfc_poll_store()
2212 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2213 del_timer(&phba->fcp_poll_timer); in lpfc_poll_store()
2214 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2215 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2216 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2217 return -EINVAL; in lpfc_poll_store()
2220 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2221 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2224 phba->cfg_poll = val; in lpfc_poll_store()
2226 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2232 * lpfc_fips_level_show - Return the current FIPS level for the HBA
2244 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_fips_level_show()
2245 struct lpfc_hba *phba = vport->phba; in lpfc_fips_level_show()
2247 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->fips_level); in lpfc_fips_level_show()
2251 * lpfc_fips_rev_show - Return the FIPS Spec revision for the HBA
2263 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_fips_rev_show()
2264 struct lpfc_hba *phba = vport->phba; in lpfc_fips_rev_show()
2266 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->fips_spec_rev); in lpfc_fips_rev_show()
2270 * lpfc_dss_show - Return the current state of dss and the configured state
2282 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_dss_show()
2283 struct lpfc_hba *phba = vport->phba; in lpfc_dss_show()
2285 return scnprintf(buf, PAGE_SIZE, "%s - %sOperational\n", in lpfc_dss_show()
2286 (phba->cfg_enable_dss) ? "Enabled" : "Disabled", in lpfc_dss_show()
2287 (phba->sli3_options & LPFC_SLI3_DSS_ENABLED) ? in lpfc_dss_show()
2292 * lpfc_sriov_hw_max_virtfn_show - Return maximum number of virtual functions
2309 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sriov_hw_max_virtfn_show()
2310 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_hw_max_virtfn_show()
2334 * -EINVAL if val is invalid
2339 if (lpfc_rangecheck(val, 0, 1) && phba->sli_rev == LPFC_SLI_REV4) { in lpfc_enable_bbcr_set()
2342 LPFC_DRIVER_NAME, phba->cfg_enable_bbcr, val); in lpfc_enable_bbcr_set()
2343 phba->cfg_enable_bbcr = val; in lpfc_enable_bbcr_set()
2349 return -EINVAL; in lpfc_enable_bbcr_set()
2353 * lpfc_param_show - Return a cfg attribute value in decimal
2372 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2373 struct lpfc_hba *phba = vport->phba;\
2375 phba->cfg_##attr);\
2379 * lpfc_param_hex_show - Return a cfg attribute value in hex
2398 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2399 struct lpfc_hba *phba = vport->phba;\
2401 val = phba->cfg_##attr;\
2403 phba->cfg_##attr);\
2407 * lpfc_param_init - Initializes a cfg attribute
2423 * -EINVAL if default used
2430 phba->cfg_##attr = val;\
2436 phba->cfg_##attr = default;\
2437 return -EINVAL;\
2441 * lpfc_param_set - Set a cfg attribute value
2458 * -EINVAL if val is invalid
2467 phba->cfg_##attr, val); \
2468 phba->cfg_##attr = val;\
2474 return -EINVAL;\
2478 * lpfc_param_store - Set a vport attribute value
2495 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2504 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2505 struct lpfc_hba *phba = vport->phba;\
2508 return -EINVAL;\
2510 return -EINVAL;\
2514 return -EINVAL;\
2518 * lpfc_vport_param_show - Return decimal formatted cfg attribute value
2537 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2538 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
2542 * lpfc_vport_param_hex_show - Return hex formatted attribute value
2562 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2563 return scnprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
2567 * lpfc_vport_param_init - Initialize a vport cfg attribute
2582 * -EINVAL if default used
2589 vport->cfg_##attr = val;\
2595 vport->cfg_##attr = default;\
2596 return -EINVAL;\
2600 * lpfc_vport_param_set - Set a vport cfg attribute
2614 * -EINVAL if val is invalid
2624 vport->cfg_##attr, vport->cfg_##attr, \
2626 vport->cfg_##attr = val;\
2632 return -EINVAL;\
2636 * lpfc_vport_param_store - Set a vport attribute
2649 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2658 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2661 return -EINVAL;\
2663 return -EINVAL;\
2667 return -EINVAL;\
2717 * lpfc_wwn_set - Convert string to the 8 byte WWN value.
2723 * -EINVAL if the buffer does not contain a valid wwn
2732 if (buf[cnt-1] == '\n') in lpfc_wwn_set()
2733 cnt--; in lpfc_wwn_set()
2737 return -EINVAL; in lpfc_wwn_set()
2744 j = ((j << 4) | ((*buf++ - 'a') + 10)); in lpfc_wwn_set()
2746 j = ((j << 4) | ((*buf++ - 'A') + 10)); in lpfc_wwn_set()
2748 j = ((j << 4) | (*buf++ - '0')); in lpfc_wwn_set()
2750 return -EINVAL; in lpfc_wwn_set()
2759 * lpfc_soft_wwn_enable_store - Allows setting of the wwn if the key is valid
2766 * -EINVAL if the buffer does not contain lpfc_soft_wwn_key
2774 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwn_enable_store()
2775 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwn_enable_store()
2777 uint8_t vvvl = vport->fc_sparam.cmn.valid_vendor_ver_level; in lpfc_soft_wwn_enable_store()
2778 u32 *fawwpn_key = (uint32_t *)&vport->fc_sparam.un.vendorVersion[0]; in lpfc_soft_wwn_enable_store()
2785 * desired, the key must be written again to re-enable the in lpfc_soft_wwn_enable_store()
2788 * The "key" is not secret - it is a hardcoded string shown in lpfc_soft_wwn_enable_store()
2796 return -EINVAL; in lpfc_soft_wwn_enable_store()
2800 if (buf[cnt-1] == '\n') in lpfc_soft_wwn_enable_store()
2801 cnt--; in lpfc_soft_wwn_enable_store()
2805 return -EINVAL; in lpfc_soft_wwn_enable_store()
2807 phba->soft_wwn_enable = 1; in lpfc_soft_wwn_enable_store()
2809 dev_printk(KERN_WARNING, &phba->pcidev->dev, in lpfc_soft_wwn_enable_store()
2811 phba->brd_no); in lpfc_soft_wwn_enable_store()
2812 dev_printk(KERN_WARNING, &phba->pcidev->dev, in lpfc_soft_wwn_enable_store()
2820 * lpfc_soft_wwpn_show - Return the cfg soft ww port name of the adapter
2832 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwpn_show()
2833 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwpn_show()
2836 (unsigned long long)phba->cfg_soft_wwpn); in lpfc_soft_wwpn_show()
2840 * lpfc_soft_wwpn_store - Set the ww port name of the adapter
2847 * -EACCES hba reset not enabled, adapter over temp
2848 * -EINVAL soft wwn not enabled, count is invalid, invalid wwpn byte invalid
2849 * -EIO error taking adapter offline or online
2857 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwpn_store()
2858 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwpn_store()
2865 if (!phba->cfg_enable_hba_reset) in lpfc_soft_wwpn_store()
2866 return -EACCES; in lpfc_soft_wwpn_store()
2867 spin_lock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2868 if (phba->over_temp_state == HBA_OVER_TEMP) { in lpfc_soft_wwpn_store()
2869 spin_unlock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2870 return -EACCES; in lpfc_soft_wwpn_store()
2872 spin_unlock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2874 if (buf[cnt-1] == '\n') in lpfc_soft_wwpn_store()
2875 cnt--; in lpfc_soft_wwpn_store()
2877 if (!phba->soft_wwn_enable) in lpfc_soft_wwpn_store()
2878 return -EINVAL; in lpfc_soft_wwpn_store()
2881 phba->soft_wwn_enable = 0; in lpfc_soft_wwpn_store()
2886 phba->soft_wwn_enable = 1; in lpfc_soft_wwpn_store()
2890 phba->cfg_soft_wwpn = wwn_to_u64(wwpn); in lpfc_soft_wwpn_store()
2891 fc_host_port_name(shost) = phba->cfg_soft_wwpn; in lpfc_soft_wwpn_store()
2892 if (phba->cfg_soft_wwnn) in lpfc_soft_wwpn_store()
2893 fc_host_node_name(shost) = phba->cfg_soft_wwnn; in lpfc_soft_wwpn_store()
2895 dev_printk(KERN_NOTICE, &phba->pcidev->dev, in lpfc_soft_wwpn_store()
2896 "lpfc%d: Reinitializing to use soft_wwpn\n", phba->brd_no); in lpfc_soft_wwpn_store()
2902 "reinit adapter - %d\n", stat1); in lpfc_soft_wwpn_store()
2907 return -ENOMEM; in lpfc_soft_wwpn_store()
2913 "reinit adapter - %d\n", stat2); in lpfc_soft_wwpn_store()
2914 return (stat1 || stat2) ? -EIO : count; in lpfc_soft_wwpn_store()
2919 * lpfc_soft_wwnn_show - Return the cfg soft ww node name for the adapter
2931 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_soft_wwnn_show()
2933 (unsigned long long)phba->cfg_soft_wwnn); in lpfc_soft_wwnn_show()
2937 * lpfc_soft_wwnn_store - sets the ww node name of the adapter
2943 * -EINVAL soft wwn not enabled, count is invalid, invalid wwnn byte invalid
2951 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_soft_wwnn_store()
2957 if (buf[cnt-1] == '\n') in lpfc_soft_wwnn_store()
2958 cnt--; in lpfc_soft_wwnn_store()
2960 if (!phba->soft_wwn_enable) in lpfc_soft_wwnn_store()
2961 return -EINVAL; in lpfc_soft_wwnn_store()
2971 phba->cfg_soft_wwnn = wwn_to_u64(wwnn); in lpfc_soft_wwnn_store()
2973 dev_printk(KERN_NOTICE, &phba->pcidev->dev, in lpfc_soft_wwnn_store()
2975 "setting of the soft_wwpn\n", phba->brd_no); in lpfc_soft_wwnn_store()
2982 * lpfc_oas_tgt_show - Return wwpn of target whose luns maybe enabled for
2996 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_show()
2999 wwn_to_u64(phba->cfg_oas_tgt_wwpn)); in lpfc_oas_tgt_show()
3003 * lpfc_oas_tgt_store - Store wwpn of target whose luns maybe enabled for
3011 * -EINVAL count is invalid, invalid wwpn byte invalid
3012 * -EPERM oas is not supported by hba
3020 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_store()
3025 if (!phba->cfg_fof) in lpfc_oas_tgt_store()
3026 return -EPERM; in lpfc_oas_tgt_store()
3029 if (buf[cnt-1] == '\n') in lpfc_oas_tgt_store()
3030 cnt--; in lpfc_oas_tgt_store()
3036 memcpy(phba->cfg_oas_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
3037 memcpy(phba->sli4_hba.oas_next_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
3039 phba->cfg_oas_flags |= OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
3041 phba->cfg_oas_flags &= ~OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
3042 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_tgt_store()
3043 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_tgt_store()
3050 * lpfc_oas_priority_show - Return wwpn of target whose luns maybe enabled for
3064 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_show()
3066 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority); in lpfc_oas_priority_show()
3070 * lpfc_oas_priority_store - Store wwpn of target whose luns maybe enabled for
3078 * -EINVAL count is invalid, invalid wwpn byte invalid
3079 * -EPERM oas is not supported by hba
3087 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_store()
3092 if (!phba->cfg_fof) in lpfc_oas_priority_store()
3093 return -EPERM; in lpfc_oas_priority_store()
3096 if (buf[cnt-1] == '\n') in lpfc_oas_priority_store()
3097 cnt--; in lpfc_oas_priority_store()
3101 return -EINVAL; in lpfc_oas_priority_store()
3104 phba->cfg_oas_priority = (uint8_t)val; in lpfc_oas_priority_store()
3106 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_priority_store()
3113 * lpfc_oas_vpt_show - Return wwpn of vport whose targets maybe enabled
3127 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_show()
3130 wwn_to_u64(phba->cfg_oas_vpt_wwpn)); in lpfc_oas_vpt_show()
3134 * lpfc_oas_vpt_store - Store wwpn of vport whose targets maybe enabled
3142 * -EINVAL count is invalid, invalid wwpn byte invalid
3143 * -EPERM oas is not supported by hba
3151 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_store()
3156 if (!phba->cfg_fof) in lpfc_oas_vpt_store()
3157 return -EPERM; in lpfc_oas_vpt_store()
3160 if (buf[cnt-1] == '\n') in lpfc_oas_vpt_store()
3161 cnt--; in lpfc_oas_vpt_store()
3167 memcpy(phba->cfg_oas_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3168 memcpy(phba->sli4_hba.oas_next_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3170 phba->cfg_oas_flags |= OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3172 phba->cfg_oas_flags &= ~OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3173 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_vpt_store()
3174 if (phba->cfg_oas_priority == 0) in lpfc_oas_vpt_store()
3175 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_vpt_store()
3176 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_vpt_store()
3183 * lpfc_oas_lun_state_show - Return the current state (enabled or disabled)
3198 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_show()
3200 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_state); in lpfc_oas_lun_state_show()
3204 * lpfc_oas_lun_state_store - Store the state (enabled or disabled)
3213 * -EINVAL count is invalid, invalid wwpn byte invalid
3214 * -EPERM oas is not supported by hba
3222 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_store()
3225 if (!phba->cfg_fof) in lpfc_oas_lun_state_store()
3226 return -EPERM; in lpfc_oas_lun_state_store()
3229 return -EINVAL; in lpfc_oas_lun_state_store()
3232 return -EINVAL; in lpfc_oas_lun_state_store()
3235 return -EINVAL; in lpfc_oas_lun_state_store()
3237 phba->cfg_oas_lun_state = val; in lpfc_oas_lun_state_store()
3244 * lpfc_oas_lun_status_show - Return the status of the Optimized Access
3259 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_status_show()
3261 if (!(phba->cfg_oas_flags & OAS_LUN_VALID)) in lpfc_oas_lun_status_show()
3262 return -EFAULT; in lpfc_oas_lun_status_show()
3264 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_status); in lpfc_oas_lun_status_show()
3271 * lpfc_oas_lun_state_set - enable or disable a lun for Optimized Access Storage
3280 * -EPERM OAS is not enabled or not supported by this port.
3291 if (!phba->cfg_fof) in lpfc_oas_lun_state_set()
3292 return -EPERM; in lpfc_oas_lun_state_set()
3298 rc = -ENOMEM; in lpfc_oas_lun_state_set()
3308 * lpfc_oas_lun_get_next - get the next lun that has been enabled for Optimized
3333 phba->sli4_hba.oas_next_vpt_wwpn, in lpfc_oas_lun_get_next()
3335 phba->sli4_hba.oas_next_tgt_wwpn, in lpfc_oas_lun_get_next()
3336 &phba->sli4_hba.oas_next_lun, in lpfc_oas_lun_get_next()
3346 * lpfc_oas_lun_state_change - enable/disable a lun for OAS operations
3358 * -ENOMEM: failed to enable an lun for OAS operations
3359 * -EPERM: OAS is not enabled
3375 * lpfc_oas_lun_show - Return oas enabled luns from a chosen target
3385 * -EFAULT: target or vport wwpn was not set properly.
3386 * -EPERM: oas is not enabled.
3393 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_show()
3398 if (!phba->cfg_fof) in lpfc_oas_lun_show()
3399 return -EPERM; in lpfc_oas_lun_show()
3401 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_show()
3402 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_VPORT)) in lpfc_oas_lun_show()
3403 return -EFAULT; in lpfc_oas_lun_show()
3405 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_show()
3406 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_TARGET)) in lpfc_oas_lun_show()
3407 return -EFAULT; in lpfc_oas_lun_show()
3409 oas_lun = lpfc_oas_lun_get_next(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_show()
3410 phba->cfg_oas_tgt_wwpn, in lpfc_oas_lun_show()
3411 &phba->cfg_oas_lun_status, in lpfc_oas_lun_show()
3412 &phba->cfg_oas_priority); in lpfc_oas_lun_show()
3414 phba->cfg_oas_flags |= OAS_LUN_VALID; in lpfc_oas_lun_show()
3416 len += scnprintf(buf + len, PAGE_SIZE-len, "0x%llx", oas_lun); in lpfc_oas_lun_show()
3422 * lpfc_oas_lun_store - Sets the OAS state for lun
3432 * -EFAULT: target or vport wwpn was not set properly.
3433 * -EPERM: oas is not enabled.
3441 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_store()
3446 if (!phba->cfg_fof) in lpfc_oas_lun_store()
3447 return -EPERM; in lpfc_oas_lun_store()
3449 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_store()
3450 return -EFAULT; in lpfc_oas_lun_store()
3452 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_store()
3453 return -EFAULT; in lpfc_oas_lun_store()
3456 return -EINVAL; in lpfc_oas_lun_store()
3459 return -EINVAL; in lpfc_oas_lun_store()
3461 pri = phba->cfg_oas_priority; in lpfc_oas_lun_store()
3463 pri = phba->cfg_XLanePriority; in lpfc_oas_lun_store()
3468 wwn_to_u64(phba->cfg_oas_vpt_wwpn), in lpfc_oas_lun_store()
3469 wwn_to_u64(phba->cfg_oas_tgt_wwpn), scsi_lun, in lpfc_oas_lun_store()
3470 pri, phba->cfg_oas_lun_state); in lpfc_oas_lun_store()
3472 rc = lpfc_oas_lun_state_change(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_store()
3473 phba->cfg_oas_tgt_wwpn, scsi_lun, in lpfc_oas_lun_store()
3474 phba->cfg_oas_lun_state, pri); in lpfc_oas_lun_store()
3493 " 0 - none,"
3494 " 1 - poll with interrupts enabled"
3495 " 3 - poll and disable FCP ring interrupts");
3507 " 0 - auto (SLI-3 if supported),"
3508 " 2 - select SLI-2 even on SLI-3 capable HBAs,"
3509 " 3 - select SLI-3");
3538 # 1 - (1024)
3539 # 2 - (2048)
3540 # 3 - (3072)
3541 # 4 - (4096)
3542 # 5 - (5120)
3548 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_iocb_hw_show()
3550 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max); in lpfc_iocb_hw_show()
3559 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txq_hw_show()
3563 pring ? pring->txq_max : 0); in lpfc_txq_hw_show()
3573 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txcmplq_hw_show()
3577 pring ? pring->txcmplq_max : 0); in lpfc_txcmplq_hw_show()
3598 * lpfc_nodev_tmo_show - Return the hba dev loss timeout value
3610 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nodev_tmo_show()
3612 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); in lpfc_nodev_tmo_show()
3616 * lpfc_nodev_tmo_init - Set the hba nodev timeout value
3628 * -EINVAL val out of range
3633 if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { in lpfc_nodev_tmo_init()
3634 vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; in lpfc_nodev_tmo_init()
3644 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_init()
3645 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_init()
3652 vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; in lpfc_nodev_tmo_init()
3653 return -EINVAL; in lpfc_nodev_tmo_init()
3657 * lpfc_update_rport_devloss_tmo - Update dev loss tmo value
3674 spin_lock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3675 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_update_rport_devloss_tmo()
3678 if (ndlp->rport) in lpfc_update_rport_devloss_tmo()
3679 ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; in lpfc_update_rport_devloss_tmo()
3681 spin_lock(&vport->phba->hbalock); in lpfc_update_rport_devloss_tmo()
3684 remoteport = rport->remoteport; in lpfc_update_rport_devloss_tmo()
3685 spin_unlock(&vport->phba->hbalock); in lpfc_update_rport_devloss_tmo()
3688 vport->cfg_devloss_tmo); in lpfc_update_rport_devloss_tmo()
3691 spin_unlock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3695 * lpfc_nodev_tmo_set - Set the vport nodev tmo and devloss tmo values
3707 * -EINVAL val out of range
3712 if (vport->dev_loss_tmo_changed || in lpfc_nodev_tmo_set()
3720 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_set()
3721 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_set()
3734 return -EINVAL; in lpfc_nodev_tmo_set()
3755 * lpfc_devloss_tmo_set - Sets vport nodev tmo, devloss tmo values, changed bit in lpfc_vport_param_init()
3766 * -EINVAL val out of range in lpfc_vport_param_init()
3772 vport->cfg_nodev_tmo = val; in lpfc_vport_param_init()
3773 vport->cfg_devloss_tmo = val; in lpfc_vport_param_init()
3774 vport->dev_loss_tmo_changed = 1; in lpfc_vport_param_init()
3784 return -EINVAL; in lpfc_vport_param_init()
3821 * Supported Values: 1 - register just FCP
3822 * 3 - register both FCP and NVME
3827 "Enable FC4 Protocol support - FCP / NVME");
3836 "Verbose logging bit-mask");
3875 * -EINVAL if val is invalid
3884 return -EINVAL; in lpfc_tgt_queue_depth_set()
3886 if (val == vport->cfg_tgt_queue_depth) in lpfc_tgt_queue_depth_set()
3889 spin_lock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3890 vport->cfg_tgt_queue_depth = val; in lpfc_tgt_queue_depth_set()
3893 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) in lpfc_tgt_queue_depth_set()
3894 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_tgt_queue_depth_set()
3896 spin_unlock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3944 * lpfc_restrict_login_init - Set the vport restrict login flag
3956 * -EINVAL val out of range
3966 vport->cfg_restrict_login = 1; in lpfc_restrict_login_init()
3967 return -EINVAL; in lpfc_restrict_login_init()
3969 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_restrict_login_init()
3970 vport->cfg_restrict_login = 0; in lpfc_restrict_login_init()
3973 vport->cfg_restrict_login = val; in lpfc_restrict_login_init()
3978 * lpfc_restrict_login_set - Set the vport restrict login flag
3991 * -EINVAL val out of range
4001 vport->cfg_restrict_login = 1; in lpfc_restrict_login_set()
4002 return -EINVAL; in lpfc_restrict_login_set()
4004 if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { in lpfc_restrict_login_set()
4008 vport->cfg_restrict_login = 0; in lpfc_restrict_login_set()
4011 vport->cfg_restrict_login = val; in lpfc_restrict_login_set()
4020 # Fibre channel "ALPA". In the FC-AL Profile there is an "informative
4026 # Turning on the scan-down variable (on = 1, off = 0) will
4039 # 0x0 = attempt loop mode then point-to-point
4041 # 0x02 = attempt point-to-point mode only
4043 # 0x06 = attempt point-to-point mode then loop
4044 # Set point-to-point mode if you want to run as an N_Port.
4052 * lpfc_topology_set - Set the adapters topology field
4064 * non-zero return value from lpfc_issue_lip()
4065 * -EINVAL val out of range
4072 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_topology_store()
4073 struct lpfc_hba *phba = vport->phba; in lpfc_topology_store()
4086 return -EINVAL; in lpfc_topology_store()
4088 return -EINVAL; in lpfc_topology_store()
4091 prev_val = phba->cfg_topology; in lpfc_topology_store()
4092 if (phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G && in lpfc_topology_store()
4097 return -EINVAL; in lpfc_topology_store()
4099 if ((phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC || in lpfc_topology_store()
4100 phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC) && in lpfc_topology_store()
4104 return -EINVAL; in lpfc_topology_store()
4106 phba->cfg_topology = val; in lpfc_topology_store()
4113 if (prev_val != val && phba->sli_rev == LPFC_SLI_REV4) in lpfc_topology_store()
4114 phba->fc_topology_changed = 1; in lpfc_topology_store()
4115 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_topology_store()
4117 phba->cfg_topology = prev_val; in lpfc_topology_store()
4118 return -EINVAL; in lpfc_topology_store()
4125 phba->brd_no, val); in lpfc_topology_store()
4126 return -EINVAL; in lpfc_topology_store()
4148 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_static_vport_show()
4149 if (vport->vport_flag & STATIC_VPORT) in lpfc_static_vport_show()
4163 * lpfc_stat_data_ctrl_store - write call back for lpfc_stat_data_ctrl sysfs file
4186 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_stat_data_ctrl_store()
4187 struct lpfc_hba *phba = vport->phba; in lpfc_stat_data_ctrl_store()
4198 if (strlen(buf) > (LPFC_MAX_DATA_CTRL_LEN - 1)) in lpfc_stat_data_ctrl_store()
4199 return -EINVAL; in lpfc_stat_data_ctrl_store()
4203 /* Ignore this token - this is command token */ in lpfc_stat_data_ctrl_store()
4206 return -EINVAL; in lpfc_stat_data_ctrl_store()
4210 return -EINVAL; in lpfc_stat_data_ctrl_store()
4217 return -EINVAL; in lpfc_stat_data_ctrl_store()
4221 return -EINVAL; in lpfc_stat_data_ctrl_store()
4226 return -EINVAL; in lpfc_stat_data_ctrl_store()
4229 return -EINVAL; in lpfc_stat_data_ctrl_store()
4234 return -ENOMEM; in lpfc_stat_data_ctrl_store()
4236 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4238 spin_lock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4240 vports[i]->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4241 if (vports[i]->stat_data_enabled) in lpfc_stat_data_ctrl_store()
4243 spin_unlock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4247 phba->bucket_type = bucket_type; in lpfc_stat_data_ctrl_store()
4248 phba->bucket_base = base; in lpfc_stat_data_ctrl_store()
4249 phba->bucket_step = step; in lpfc_stat_data_ctrl_store()
4251 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4255 spin_lock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4256 vports[i]->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4257 spin_unlock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4266 return -ENOMEM; in lpfc_stat_data_ctrl_store()
4268 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4270 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4271 vports[i]->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4273 vport->stat_data_enabled = 0; in lpfc_stat_data_ctrl_store()
4274 vports[i]->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4275 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4278 phba->bucket_type = LPFC_NO_BUCKET; in lpfc_stat_data_ctrl_store()
4279 phba->bucket_base = 0; in lpfc_stat_data_ctrl_store()
4280 phba->bucket_step = 0; in lpfc_stat_data_ctrl_store()
4286 if (phba->bucket_type == LPFC_NO_BUCKET) in lpfc_stat_data_ctrl_store()
4287 return -EINVAL; in lpfc_stat_data_ctrl_store()
4288 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4289 if (vport->stat_data_enabled) { in lpfc_stat_data_ctrl_store()
4290 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4294 vport->stat_data_enabled = 1; in lpfc_stat_data_ctrl_store()
4295 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4300 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4301 if (vport->stat_data_enabled == 0) { in lpfc_stat_data_ctrl_store()
4302 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4306 vport->stat_data_enabled = 0; in lpfc_stat_data_ctrl_store()
4307 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4312 if ((phba->bucket_type == LPFC_NO_BUCKET) in lpfc_stat_data_ctrl_store()
4313 || !vport->stat_data_enabled) in lpfc_stat_data_ctrl_store()
4315 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4316 vport->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4318 vport->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4319 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4322 return -EINVAL; in lpfc_stat_data_ctrl_store()
4327 * lpfc_stat_data_ctrl_show - Read function for lpfc_stat_data_ctrl sysfs file
4340 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_stat_data_ctrl_show()
4341 struct lpfc_hba *phba = vport->phba; in lpfc_stat_data_ctrl_show()
4347 switch (phba->bucket_type) { in lpfc_stat_data_ctrl_show()
4362 vport->stat_data_enabled, vport->stat_data_blocked, in lpfc_stat_data_ctrl_show()
4363 bucket_type, phba->bucket_base, phba->bucket_step); in lpfc_stat_data_ctrl_show()
4365 if (phba->bucket_type != LPFC_NO_BUCKET) { in lpfc_stat_data_ctrl_show()
4367 if (phba->bucket_type == LPFC_LINEAR_BUCKET) in lpfc_stat_data_ctrl_show()
4368 bucket_value = phba->bucket_base + in lpfc_stat_data_ctrl_show()
4369 phba->bucket_step * i; in lpfc_stat_data_ctrl_show()
4371 bucket_value = phba->bucket_base + in lpfc_stat_data_ctrl_show()
4372 (1 << i) * phba->bucket_step; in lpfc_stat_data_ctrl_show()
4403 * sysfs_drvr_stat_data_read - Read function for lpfc_drvr_stat_data attribute
4423 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_drvr_stat_data_read()
4424 struct lpfc_hba *phba = vport->phba; in sysfs_drvr_stat_data_read()
4431 if (!vport->stat_data_enabled || vport->stat_data_blocked in sysfs_drvr_stat_data_read()
4432 || (phba->bucket_type == LPFC_NO_BUCKET)) in sysfs_drvr_stat_data_read()
4435 spin_lock_irq(shost->host_lock); in sysfs_drvr_stat_data_read()
4436 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in sysfs_drvr_stat_data_read()
4437 if (!NLP_CHK_NODE_ACT(ndlp) || !ndlp->lat_data) in sysfs_drvr_stat_data_read()
4441 nport_index--; in sysfs_drvr_stat_data_read()
4449 if (!ndlp->lat_data) in sysfs_drvr_stat_data_read()
4454 ndlp->nlp_portname.u.wwn[0], in sysfs_drvr_stat_data_read()
4455 ndlp->nlp_portname.u.wwn[1], in sysfs_drvr_stat_data_read()
4456 ndlp->nlp_portname.u.wwn[2], in sysfs_drvr_stat_data_read()
4457 ndlp->nlp_portname.u.wwn[3], in sysfs_drvr_stat_data_read()
4458 ndlp->nlp_portname.u.wwn[4], in sysfs_drvr_stat_data_read()
4459 ndlp->nlp_portname.u.wwn[5], in sysfs_drvr_stat_data_read()
4460 ndlp->nlp_portname.u.wwn[6], in sysfs_drvr_stat_data_read()
4461 ndlp->nlp_portname.u.wwn[7]); in sysfs_drvr_stat_data_read()
4467 ndlp->lat_data[i].cmd_count); in sysfs_drvr_stat_data_read()
4473 spin_unlock_irq(shost->host_lock); in sysfs_drvr_stat_data_read()
4493 * lpfc_link_speed_set - Set the adapters link speed
4506 * non-zero return value from lpfc_issue_lip()
4507 * -EINVAL val out of range
4514 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_speed_store()
4515 struct lpfc_hba *phba = vport->phba; in lpfc_link_speed_store()
4522 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_link_speed_store()
4524 phba->hba_flag & HBA_FORCED_LINK_SPEED) in lpfc_link_speed_store()
4525 return -EPERM; in lpfc_link_speed_store()
4533 return -EINVAL; in lpfc_link_speed_store()
4535 return -EINVAL; in lpfc_link_speed_store()
4539 phba->cfg_link_speed, val, nolip ? "(nolip)" : "(lip)"); in lpfc_link_speed_store()
4541 if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || in lpfc_link_speed_store()
4542 ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || in lpfc_link_speed_store()
4543 ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || in lpfc_link_speed_store()
4544 ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || in lpfc_link_speed_store()
4545 ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) || in lpfc_link_speed_store()
4546 ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb)) || in lpfc_link_speed_store()
4547 ((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb)) || in lpfc_link_speed_store()
4548 ((val == LPFC_USER_LINK_SPEED_64G) && !(phba->lmt & LMT_64Gb))) { in lpfc_link_speed_store()
4553 return -EINVAL; in lpfc_link_speed_store()
4556 phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_speed_store()
4561 return -EINVAL; in lpfc_link_speed_store()
4573 prev_val = phba->cfg_link_speed; in lpfc_link_speed_store()
4574 phba->cfg_link_speed = val; in lpfc_link_speed_store()
4578 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_link_speed_store()
4580 phba->cfg_link_speed = prev_val; in lpfc_link_speed_store()
4581 return -EINVAL; in lpfc_link_speed_store()
4592 return -EINVAL; in lpfc_link_speed_store()
4602 * lpfc_link_speed_init - Set the adapters link speed in lpfc_param_show()
4615 * -EINVAL val out of range in lpfc_param_show()
4620 if (val >= LPFC_USER_LINK_SPEED_16G && phba->cfg_topology == 4) { in lpfc_param_show()
4625 phba->cfg_topology = 0; in lpfc_param_show()
4637 phba->cfg_link_speed = val; in lpfc_param_show()
4644 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_param_show()
4645 return -EINVAL; in lpfc_param_show()
4662 * lpfc_aer_support_store - Set the adapter for aer support in lpfc_param_show()
4686 * -EINVAL if val out of range or intended mode is not supported. in lpfc_param_show()
4693 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_param_show()
4694 struct lpfc_hba *phba = vport->phba; in lpfc_param_show()
4695 int val = 0, rc = -EINVAL; in lpfc_param_show()
4698 return -EINVAL; in lpfc_param_show()
4700 return -EINVAL; in lpfc_param_show()
4704 if (phba->hba_flag & HBA_AER_ENABLED) { in lpfc_param_show()
4705 rc = pci_disable_pcie_error_reporting(phba->pcidev); in lpfc_param_show()
4707 spin_lock_irq(&phba->hbalock); in lpfc_param_show()
4708 phba->hba_flag &= ~HBA_AER_ENABLED; in lpfc_param_show()
4709 spin_unlock_irq(&phba->hbalock); in lpfc_param_show()
4710 phba->cfg_aer_support = 0; in lpfc_param_show()
4713 rc = -EPERM; in lpfc_param_show()
4715 phba->cfg_aer_support = 0; in lpfc_param_show()
4720 if (!(phba->hba_flag & HBA_AER_ENABLED)) { in lpfc_param_show()
4721 rc = pci_enable_pcie_error_reporting(phba->pcidev); in lpfc_param_show()
4723 spin_lock_irq(&phba->hbalock); in lpfc_param_show()
4724 phba->hba_flag |= HBA_AER_ENABLED; in lpfc_param_show()
4725 spin_unlock_irq(&phba->hbalock); in lpfc_param_show()
4726 phba->cfg_aer_support = 1; in lpfc_param_show()
4729 rc = -EPERM; in lpfc_param_show()
4731 phba->cfg_aer_support = 1; in lpfc_param_show()
4736 rc = -EINVAL; in lpfc_param_show()
4745 * lpfc_aer_cleanup_state - Clean up aer state to the aer enabled device
4760 * -EINVAL if the buf does not contain the 1 or the device is not currently
4768 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_aer_cleanup_state()
4769 struct lpfc_hba *phba = vport->phba; in lpfc_aer_cleanup_state()
4770 int val, rc = -1; in lpfc_aer_cleanup_state()
4773 return -EINVAL; in lpfc_aer_cleanup_state()
4775 return -EINVAL; in lpfc_aer_cleanup_state()
4777 return -EINVAL; in lpfc_aer_cleanup_state()
4779 if (phba->hba_flag & HBA_AER_ENABLED) in lpfc_aer_cleanup_state()
4780 rc = pci_cleanup_aer_uncorrect_error_status(phba->pcidev); in lpfc_aer_cleanup_state()
4785 return -EPERM; in lpfc_aer_cleanup_state()
4792 * lpfc_sriov_nr_virtfn_store - Enable the adapter for sr-iov virtual functions
4801 * try to enable or disable SR-IOV virtual functions according to the
4811 * cfg_sriov_nr_virtfn; otherwise, -EINVAL shall be returned and driver
4814 * If none-zero virtual functions have already been enabled to the
4816 * -EINVAL will be returned and the driver does nothing;
4818 * If the nr_vfn provided is zero and none-zero virtual functions have
4828 * -EINVAL if val out of range or intended mode is not supported.
4835 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sriov_nr_virtfn_store()
4836 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_nr_virtfn_store()
4837 struct pci_dev *pdev = phba->pcidev; in lpfc_sriov_nr_virtfn_store()
4838 int val = 0, rc = -EINVAL; in lpfc_sriov_nr_virtfn_store()
4842 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4844 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4846 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4850 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4852 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4858 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4862 phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4863 return -EEXIST; in lpfc_sriov_nr_virtfn_store()
4867 phba->cfg_sriov_nr_virtfn = val; in lpfc_sriov_nr_virtfn_store()
4872 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4875 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4877 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4878 rc = -EPERM; in lpfc_sriov_nr_virtfn_store()
4886 "Enable PCIe device SR-IOV virtual fn");
4892 * lpfc_request_firmware_store - Request for Linux generic firmware upgrade
4904 * -EINVAL if val out of range or intended mode is not supported.
4912 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_request_firmware_upgrade_store()
4913 struct lpfc_hba *phba = vport->phba; in lpfc_request_firmware_upgrade_store()
4914 int val = 0, rc = -EINVAL; in lpfc_request_firmware_upgrade_store()
4918 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4920 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4922 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4926 rc = -EPERM; in lpfc_request_firmware_upgrade_store()
4938 * lpfc_request_firmware_upgrade_init - Enable initial linux generic fw upgrade in lpfc_param_show()
4947 * -EINVAL val out of range in lpfc_param_show()
4953 phba->cfg_request_firmware_upgrade = val; in lpfc_param_show()
4956 return -EINVAL; in lpfc_param_show()
4976 * 0 - on success
4977 * -EIO - if command is not sent
4984 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_force_rscn_store()
4989 return -EIO; in lpfc_force_rscn_store()
5006 * lpfc_force_rscn_init - Force an RSCN to be sent to all remote NPorts in lpfc_param_show()
5025 * @buf: string with the number of fast-path FCP interrupts per second.
5030 * maximum number of fast-path FCP interrupts per second.
5035 * -EINVAL if val out of range or intended mode is not supported.
5042 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_imax_store()
5043 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_imax_store()
5049 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_fcp_imax_store()
5050 return -EINVAL; in lpfc_fcp_imax_store()
5054 return -EINVAL; in lpfc_fcp_imax_store()
5056 return -EINVAL; in lpfc_fcp_imax_store()
5064 return -EINVAL; in lpfc_fcp_imax_store()
5066 phba->cfg_auto_imax = (val) ? 0 : 1; in lpfc_fcp_imax_store()
5067 if (phba->cfg_fcp_imax && !val) { in lpfc_fcp_imax_store()
5068 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_fcp_imax_store()
5072 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_fcp_imax_store()
5073 eqi->icnt = 0; in lpfc_fcp_imax_store()
5077 phba->cfg_fcp_imax = (uint32_t)val; in lpfc_fcp_imax_store()
5079 if (phba->cfg_fcp_imax) in lpfc_fcp_imax_store()
5080 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_fcp_imax_store()
5084 for (i = 0; i < phba->cfg_irq_chann; i += LPFC_MAX_EQ_DELAY_EQID_CNT) in lpfc_fcp_imax_store()
5092 # lpfc_fcp_imax: The maximum number of fast-path FCP interrupts per second
5104 * lpfc_fcp_imax_init - Set the initial sr-iov virtual function enable in lpfc_param_show()
5110 * maximum number of fast-path FCP interrupts per second. in lpfc_param_show()
5114 * -EINVAL val out of range in lpfc_param_show()
5119 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_param_show()
5120 phba->cfg_fcp_imax = 0; in lpfc_param_show()
5126 phba->cfg_fcp_imax = val; in lpfc_param_show()
5133 phba->cfg_fcp_imax = LPFC_DEF_IMAX; in lpfc_param_show()
5153 * -ERANGE: if val is not in the valid range
5154 * -EINVAL: if bad value format or intended mode is not supported.
5161 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_cq_max_proc_limit_store()
5162 struct lpfc_hba *phba = vport->phba; in lpfc_cq_max_proc_limit_store()
5168 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_store()
5169 return -EINVAL; in lpfc_cq_max_proc_limit_store()
5173 return -EINVAL; in lpfc_cq_max_proc_limit_store()
5175 return -EINVAL; in lpfc_cq_max_proc_limit_store()
5178 return -ERANGE; in lpfc_cq_max_proc_limit_store()
5180 phba->cfg_cq_max_proc_limit = (uint32_t)val; in lpfc_cq_max_proc_limit_store()
5183 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_cq_max_proc_limit_store()
5185 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_cq_max_proc_limit_store()
5189 list_for_each_entry(cq, &eq->child_list, list) in lpfc_cq_max_proc_limit_store()
5190 cq->max_proc_limit = min(phba->cfg_cq_max_proc_limit, in lpfc_cq_max_proc_limit_store()
5191 cq->entry_count); in lpfc_cq_max_proc_limit_store()
5211 * than re-enabling interrupts.
5219 * lpfc_cq_max_proc_limit_init - Set the initial cq max_proc_limit
5235 phba->cfg_cq_max_proc_limit = LPFC_CQ_DEF_MAX_PROC_LIMIT; in lpfc_cq_max_proc_limit_init()
5237 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_init()
5241 phba->cfg_cq_max_proc_limit = val; in lpfc_cq_max_proc_limit_init()
5248 phba->cfg_cq_max_proc_limit); in lpfc_cq_max_proc_limit_init()
5256 * lpfc_state_show - Display current driver CPU affinity
5268 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_cpu_map_show()
5269 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_cpu_map_show()
5273 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_fcp_cpu_map_show()
5274 (phba->intr_type != MSIX)) in lpfc_fcp_cpu_map_show()
5277 switch (phba->cfg_fcp_cpu_map) { in lpfc_fcp_cpu_map_show()
5279 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
5281 phba->cfg_fcp_cpu_map); in lpfc_fcp_cpu_map_show()
5284 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
5285 "fcp_cpu_map: HBA centric mapping (%d): " in lpfc_fcp_cpu_map_show()
5287 phba->cfg_fcp_cpu_map, num_online_cpus(), in lpfc_fcp_cpu_map_show()
5289 phba->sli4_hba.num_possible_cpu); in lpfc_fcp_cpu_map_show()
5293 while (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
5294 phba->sli4_hba.num_possible_cpu) { in lpfc_fcp_cpu_map_show()
5295 cpup = &phba->sli4_hba.cpu_map[phba->sli4_hba.curr_disp_cpu]; in lpfc_fcp_cpu_map_show()
5297 if (!cpu_present(phba->sli4_hba.curr_disp_cpu)) in lpfc_fcp_cpu_map_show()
5298 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5299 "CPU %02d not present\n", in lpfc_fcp_cpu_map_show()
5300 phba->sli4_hba.curr_disp_cpu); in lpfc_fcp_cpu_map_show()
5301 else if (cpup->irq == LPFC_VECTOR_MAP_EMPTY) { in lpfc_fcp_cpu_map_show()
5302 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
5304 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5305 "CPU %02d hdwq None " in lpfc_fcp_cpu_map_show()
5307 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5308 cpup->phys_id, cpup->core_id, in lpfc_fcp_cpu_map_show()
5309 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5310 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
5313 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5314 "CPU %02d EQ %04d hdwq %04d " in lpfc_fcp_cpu_map_show()
5316 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5317 cpup->eq, cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
5318 cpup->core_id, in lpfc_fcp_cpu_map_show()
5319 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5320 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
5322 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
5324 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5325 "CPU %02d hdwq None " in lpfc_fcp_cpu_map_show()
5327 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5328 cpup->phys_id, in lpfc_fcp_cpu_map_show()
5329 cpup->core_id, in lpfc_fcp_cpu_map_show()
5330 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5331 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
5332 cpup->irq); in lpfc_fcp_cpu_map_show()
5335 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5336 "CPU %02d EQ %04d hdwq %04d " in lpfc_fcp_cpu_map_show()
5338 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5339 cpup->eq, cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
5340 cpup->core_id, in lpfc_fcp_cpu_map_show()
5341 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5342 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
5343 cpup->irq); in lpfc_fcp_cpu_map_show()
5346 phba->sli4_hba.curr_disp_cpu++; in lpfc_fcp_cpu_map_show()
5349 if (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
5350 phba->sli4_hba.num_possible_cpu && in lpfc_fcp_cpu_map_show()
5351 (len >= (PAGE_SIZE - 64))) { in lpfc_fcp_cpu_map_show()
5353 PAGE_SIZE - len, "more...\n"); in lpfc_fcp_cpu_map_show()
5358 if (phba->sli4_hba.curr_disp_cpu == phba->sli4_hba.num_possible_cpu) in lpfc_fcp_cpu_map_show()
5359 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_fcp_cpu_map_show()
5365 * lpfc_fcp_cpu_map_store - Change CPU affinity of driver vectors
5372 * -EINVAL - Not implemented yet.
5378 int status = -EINVAL; in lpfc_fcp_cpu_map_store()
5387 # 0 - Do not affinitze IRQ vectors
5388 # 1 - Affintize HBA vectors with respect to each HBA
5398 * lpfc_fcp_cpu_map_init - Set the initial sr-iov virtual function enable
5403 * If val is in a valid range [0-2], then affinitze the adapter's
5408 * -EINVAL val out of range
5413 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_fcp_cpu_map_init()
5414 phba->cfg_fcp_cpu_map = 0; in lpfc_fcp_cpu_map_init()
5419 phba->cfg_fcp_cpu_map = val; in lpfc_fcp_cpu_map_init()
5426 phba->cfg_fcp_cpu_map = LPFC_HBA_CPU_MAP; in lpfc_fcp_cpu_map_init()
5461 * Parameter supported on physical port only - no NPIV support.
5482 # the parameter is set to a non-zero value, the I/O queue depth is controlled
5496 if (val == vport->cfg_max_scsicmpl_time) in lpfc_max_scsicmpl_time_set()
5499 return -EINVAL; in lpfc_max_scsicmpl_time_set()
5500 vport->cfg_max_scsicmpl_time = val; in lpfc_max_scsicmpl_time_set()
5502 spin_lock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5503 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_max_scsicmpl_time_set()
5506 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) in lpfc_max_scsicmpl_time_set()
5508 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_max_scsicmpl_time_set()
5510 spin_unlock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5534 * current CPU.
5539 * The driver dynamically sets this to 1 (BY_CPU) if it's able to set up cpu
5541 * CPU. Otherwise, the default 0 (Round Robin) scheduling of FCP/NVME I/Os
5548 "issuing commands [0] - Hardware Queue, [1] - Current CPU");
5560 "[0] - GID_FT, [1] - GID_PT");
5566 # For [1], bus reset issues target reset to non-FCP2 devices
5569 "FCP2 devices [0] - issue tgt reset, [1] - no tgt reset");
5622 # Traditional FDMI support means the driver will assume FDMI-2 support;
5623 # however, if that fails, it will fallback to FDMI-1.
5647 # there are FC targets, such as JBODs, that only recognize 8-bits of
5680 # 2 = MSI-X enabled (default)
5684 "MSI-X (2), if possible");
5744 * of EQ / MSI-X vectors the driver will create. This should never be
5784 # 0x0 - 0x7f = CS_CTL field in FC header (high 7 bits)
5790 # lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF)
5799 # - Bit mask of host protection capabilities used to register with the
5800 # SCSI mid-layer
5801 # - Only meaningful if BG is turned on (lpfc_enable_bg=1).
5802 # - Allows you to ultimately specify which profiles to use
5803 # - Default will result in registering capabilities for all profiles.
5804 # - SHOST_DIF_TYPE1_PROTECTION 1
5806 # - SHOST_DIX_TYPE0_PROTECTION 8
5808 # - SHOST_DIX_TYPE1_PROTECTION 16
5820 "T10-DIF host protection capabilities mask");
5824 # - Bit mask of protection guard types to register with the SCSI mid-layer
5825 # - Guard types are currently either 1) T10-DIF CRC 2) IP checksum
5826 # - Allows you to ultimately specify which profiles to use
5827 # - Default will result in registering capabilities for all guard types
5832 "T10-DIF host protection guard type");
5840 * When this parameter is set to non-zero value, initial Nport discovery is
5852 * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
5856 * Because of the additional overhead involved in setting up T10-DIF,
5865 * lpfc_sg_seg_cnt_show - Display the scatter/gather list sizes
5878 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sg_seg_cnt_show()
5879 struct lpfc_hba *phba = vport->phba; in lpfc_sg_seg_cnt_show()
5883 phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); in lpfc_sg_seg_cnt_show()
5886 phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sg_seg_cnt_show()
5887 phba->cfg_nvme_seg_cnt); in lpfc_sg_seg_cnt_show()
5894 * lpfc_sg_seg_cnt_init - Set the hba sg_seg_cnt initial value
5905 * -EINVAL if value was out of range
5911 phba->cfg_sg_seg_cnt = val; in lpfc_sg_seg_cnt_init()
5918 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT; in lpfc_sg_seg_cnt_init()
5919 return -EINVAL; in lpfc_sg_seg_cnt_init()
5933 * [1-4] = Multiple of 1/4th Mb of host memory for FW logging
6122 * sysfs_ctlreg_write - Write method for writing to ctlreg
6135 * -ERANGE off and count combo out of range
6136 * -EINVAL off, count or buff address invalid
6137 * -EPERM adapter is offline
6148 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_write()
6149 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_write()
6151 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_write()
6152 return -EPERM; in sysfs_ctlreg_write()
6155 return -ERANGE; in sysfs_ctlreg_write()
6161 return -EINVAL; in sysfs_ctlreg_write()
6165 return -EINVAL; in sysfs_ctlreg_write()
6167 if (!(vport->fc_flag & FC_OFFLINE_MODE)) in sysfs_ctlreg_write()
6168 return -EPERM; in sysfs_ctlreg_write()
6170 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6171 for (buf_off = 0; buf_off < count - LPFC_REG_WRITE_KEY_SIZE; in sysfs_ctlreg_write()
6174 phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_write()
6176 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6182 * sysfs_ctlreg_read - Read method for reading from ctlreg
6195 * -ERANGE off and count combo out of range
6196 * -EINVAL off, count or buff address invalid
6208 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_read()
6209 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_read()
6211 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_read()
6212 return -EPERM; in sysfs_ctlreg_read()
6215 return -ERANGE; in sysfs_ctlreg_read()
6218 count = FF_REG_AREA_SIZE - off; in sysfs_ctlreg_read()
6223 return -EINVAL; in sysfs_ctlreg_read()
6225 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6229 *tmp_ptr = readl(phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_read()
6232 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6248 * sysfs_mbox_write - Write method for writing information via mbox
6261 * -EPERM operation not permitted
6268 return -EPERM; in sysfs_mbox_write()
6272 * sysfs_mbox_read - Read method for reading information via mbox
6285 * -EPERM operation not permitted
6292 return -EPERM; in sysfs_mbox_read()
6306 * lpfc_alloc_sysfs_attr - Creates the ctlreg and mbox entries
6319 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6323 if (error || vport->port_type == LPFC_NPIV_PORT) in lpfc_alloc_sysfs_attr()
6326 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6331 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6338 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_alloc_sysfs_attr()
6340 sysfs_remove_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6347 * lpfc_free_sysfs_attr - Removes the ctlreg and mbox entries
6354 sysfs_remove_bin_file(&shost->shost_dev.kobj, in lpfc_free_sysfs_attr()
6357 if (vport->port_type == LPFC_NPIV_PORT) in lpfc_free_sysfs_attr()
6359 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr); in lpfc_free_sysfs_attr()
6360 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_free_sysfs_attr()
6368 * lpfc_get_host_symbolic_name - Copy symbolic name into the scsi host
6374 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_get_host_symbolic_name()
6381 * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
6387 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_id()
6389 /* note: fc_myDID already in cpu endianness */ in lpfc_get_host_port_id()
6390 fc_host_port_id(shost) = vport->fc_myDID; in lpfc_get_host_port_id()
6394 * lpfc_get_host_port_type - Set the value of the scsi host port type
6400 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_type()
6401 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_type()
6403 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_type()
6405 if (vport->port_type == LPFC_NPIV_PORT) { in lpfc_get_host_port_type()
6408 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_host_port_type()
6409 if (vport->fc_flag & FC_PUBLIC_LOOP) in lpfc_get_host_port_type()
6414 if (vport->fc_flag & FC_FABRIC) in lpfc_get_host_port_type()
6422 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_type()
6426 * lpfc_get_host_port_state - Set the value of the scsi host port state
6432 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_state()
6433 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_state()
6435 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_state()
6437 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_host_port_state()
6440 switch (phba->link_state) { in lpfc_get_host_port_state()
6449 if (vport->port_state < LPFC_VPORT_READY) in lpfc_get_host_port_state()
6465 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_state()
6469 * lpfc_get_host_speed - Set the value of the scsi host speed
6475 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_speed()
6476 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_speed()
6478 spin_lock_irq(shost->host_lock); in lpfc_get_host_speed()
6480 if ((lpfc_is_link_up(phba)) && (!(phba->hba_flag & HBA_FCOE_MODE))) { in lpfc_get_host_speed()
6481 switch(phba->fc_linkspeed) { in lpfc_get_host_speed()
6513 } else if (lpfc_is_link_up(phba) && (phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_get_host_speed()
6514 switch (phba->fc_linkspeed) { in lpfc_get_host_speed()
6534 spin_unlock_irq(shost->host_lock); in lpfc_get_host_speed()
6538 * lpfc_get_host_fabric_name - Set the value of the scsi host fabric name
6544 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_fabric_name()
6545 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_fabric_name()
6548 spin_lock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
6550 if ((vport->port_state > LPFC_FLOGI) && in lpfc_get_host_fabric_name()
6551 ((vport->fc_flag & FC_FABRIC) || in lpfc_get_host_fabric_name()
6552 ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) && in lpfc_get_host_fabric_name()
6553 (vport->fc_flag & FC_PUBLIC_LOOP)))) in lpfc_get_host_fabric_name()
6554 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); in lpfc_get_host_fabric_name()
6559 spin_unlock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
6565 * lpfc_get_stats - Return statistical information about the adapter
6579 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_stats()
6580 struct lpfc_hba *phba = vport->phba; in lpfc_get_stats()
6581 struct lpfc_sli *psli = &phba->sli; in lpfc_get_stats()
6582 struct fc_host_statistics *hs = &phba->link_stats; in lpfc_get_stats()
6583 struct lpfc_lnk_stat * lso = &psli->lnk_stat_offsets; in lpfc_get_stats()
6592 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_stats()
6593 !phba->mbox_mem_pool || in lpfc_get_stats()
6594 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_stats()
6597 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_stats()
6600 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_stats()
6605 pmb = &pmboxq->u.mb; in lpfc_get_stats()
6606 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_get_stats()
6607 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6608 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6609 pmboxq->vport = vport; in lpfc_get_stats()
6611 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_stats()
6614 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6618 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6624 hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt; in lpfc_get_stats()
6629 hs->tx_words = (uint64_t) in lpfc_get_stats()
6630 ((uint64_t)pmb->un.varRdStatus.xmitByteCnt in lpfc_get_stats()
6632 hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt; in lpfc_get_stats()
6633 hs->rx_words = (uint64_t) in lpfc_get_stats()
6634 ((uint64_t)pmb->un.varRdStatus.rcvByteCnt in lpfc_get_stats()
6638 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_get_stats()
6639 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6640 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6641 pmboxq->vport = vport; in lpfc_get_stats()
6643 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_stats()
6646 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6650 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6654 hs->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_get_stats()
6655 hs->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_get_stats()
6656 hs->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_get_stats()
6657 hs->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_get_stats()
6658 hs->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_get_stats()
6659 hs->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6660 hs->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6662 hs->link_failure_count -= lso->link_failure_count; in lpfc_get_stats()
6663 hs->loss_of_sync_count -= lso->loss_of_sync_count; in lpfc_get_stats()
6664 hs->loss_of_signal_count -= lso->loss_of_signal_count; in lpfc_get_stats()
6665 hs->prim_seq_protocol_err_count -= lso->prim_seq_protocol_err_count; in lpfc_get_stats()
6666 hs->invalid_tx_word_count -= lso->invalid_tx_word_count; in lpfc_get_stats()
6667 hs->invalid_crc_count -= lso->invalid_crc_count; in lpfc_get_stats()
6668 hs->error_frames -= lso->error_frames; in lpfc_get_stats()
6670 if (phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_stats()
6671 hs->lip_count = -1; in lpfc_get_stats()
6672 hs->nos_count = (phba->link_events >> 1); in lpfc_get_stats()
6673 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6674 } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_stats()
6675 hs->lip_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6676 hs->lip_count -= lso->link_events; in lpfc_get_stats()
6677 hs->nos_count = -1; in lpfc_get_stats()
6679 hs->lip_count = -1; in lpfc_get_stats()
6680 hs->nos_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6681 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6684 hs->dumped_frames = -1; in lpfc_get_stats()
6686 hs->seconds_since_last_reset = ktime_get_seconds() - psli->stats_start; in lpfc_get_stats()
6688 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6694 * lpfc_reset_stats - Copy the adapter link stats information
6700 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_reset_stats()
6701 struct lpfc_hba *phba = vport->phba; in lpfc_reset_stats()
6702 struct lpfc_sli *psli = &phba->sli; in lpfc_reset_stats()
6703 struct lpfc_lnk_stat *lso = &psli->lnk_stat_offsets; in lpfc_reset_stats()
6708 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_reset_stats()
6711 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_reset_stats()
6716 pmb = &pmboxq->u.mb; in lpfc_reset_stats()
6717 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_reset_stats()
6718 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6719 pmb->un.varWords[0] = 0x1; /* reset request */ in lpfc_reset_stats()
6720 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6721 pmboxq->vport = vport; in lpfc_reset_stats()
6723 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6724 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) in lpfc_reset_stats()
6727 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6731 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6736 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_reset_stats()
6737 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6738 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6739 pmboxq->vport = vport; in lpfc_reset_stats()
6741 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6742 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) in lpfc_reset_stats()
6745 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6749 mempool_free( pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6753 lso->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_reset_stats()
6754 lso->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_reset_stats()
6755 lso->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_reset_stats()
6756 lso->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_reset_stats()
6757 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_reset_stats()
6758 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6759 lso->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6760 if (phba->hba_flag & HBA_FCOE_MODE) in lpfc_reset_stats()
6761 lso->link_events = (phba->link_events >> 1); in lpfc_reset_stats()
6763 lso->link_events = (phba->fc_eventTag >> 1); in lpfc_reset_stats()
6765 psli->stats_start = ktime_get_seconds(); in lpfc_reset_stats()
6767 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6778 * lpfc_get_node_by_target - Return the nodelist for a target
6788 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in lpfc_get_node_by_target()
6789 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_node_by_target()
6792 spin_lock_irq(shost->host_lock); in lpfc_get_node_by_target()
6794 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_get_node_by_target()
6796 ndlp->nlp_state == NLP_STE_MAPPED_NODE && in lpfc_get_node_by_target()
6797 starget->id == ndlp->nlp_sid) { in lpfc_get_node_by_target()
6798 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
6802 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
6807 * lpfc_get_starget_port_id - Set the target port id to the ndlp DID or -1
6815 fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1; in lpfc_get_starget_port_id()
6819 * lpfc_get_starget_node_name - Set the target node name
6830 ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0; in lpfc_get_starget_node_name()
6834 * lpfc_get_starget_port_name - Set the target port name
6845 ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0; in lpfc_get_starget_port_name()
6849 * lpfc_set_rport_loss_tmo - Set the rport dev loss tmo
6860 struct lpfc_rport_data *rdata = rport->dd_data; in lpfc_set_rport_loss_tmo()
6861 struct lpfc_nodelist *ndlp = rdata->pnode; in lpfc_set_rport_loss_tmo()
6867 rport->dev_loss_tmo = timeout; in lpfc_set_rport_loss_tmo()
6869 rport->dev_loss_tmo = 1; in lpfc_set_rport_loss_tmo()
6872 dev_info(&rport->dev, "Cannot find remote node to " in lpfc_set_rport_loss_tmo()
6874 rport->port_id); in lpfc_set_rport_loss_tmo()
6881 if (nrport && nrport->remoteport) in lpfc_set_rport_loss_tmo()
6882 nvme_fc_set_remoteport_devloss(nrport->remoteport, in lpfc_set_rport_loss_tmo()
6883 rport->dev_loss_tmo); in lpfc_set_rport_loss_tmo()
6888 * lpfc_rport_show_function - Return rport target information
6906 struct lpfc_rport_data *rdata = rport->hostdata; \
6908 (rdata->target) ? cast rdata->target->field : 0); \
6916 * lpfc_set_vport_symbolic_name - Set the vport's symbolic name
6921 * has been changed. This function re-registers the symbolic name with the
6927 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; in lpfc_set_vport_symbolic_name()
6929 if (vport->port_state == LPFC_VPORT_READY) in lpfc_set_vport_symbolic_name()
6934 * lpfc_hba_log_verbose_init - Set hba's log verbose level
6945 phba->cfg_log_verbose = verbose; in lpfc_hba_log_verbose_init()
7081 * lpfc_get_hba_function_mode - Used to determine the HBA function in FCoE
7089 if (phba->pcidev->device == PCI_DEVICE_ID_SKYHAWK) in lpfc_get_hba_function_mode()
7090 phba->hba_flag |= HBA_FCOE_MODE; in lpfc_get_hba_function_mode()
7092 phba->hba_flag &= ~HBA_FCOE_MODE; in lpfc_get_hba_function_mode()
7096 * lpfc_get_cfgparam - Used during probe_one to init the adapter structure
7133 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_get_cfgparam()
7134 phba->cfg_EnableXLane = 0; in lpfc_get_cfgparam()
7137 memset(phba->cfg_oas_tgt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7138 memset(phba->cfg_oas_vpt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7139 phba->cfg_oas_lun_state = 0; in lpfc_get_cfgparam()
7140 phba->cfg_oas_lun_status = 0; in lpfc_get_cfgparam()
7141 phba->cfg_oas_flags = 0; in lpfc_get_cfgparam()
7142 phba->cfg_oas_priority = 0; in lpfc_get_cfgparam()
7146 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_cfgparam()
7147 phba->cfg_poll = 0; in lpfc_get_cfgparam()
7149 phba->cfg_poll = lpfc_poll; in lpfc_get_cfgparam()
7155 if (phba->cfg_enable_bg && phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_cfgparam()
7159 phba->cfg_enable_bg = 0; in lpfc_get_cfgparam()
7160 } else if (phba->cfg_enable_bg) { in lpfc_get_cfgparam()
7161 phba->sli3_options |= LPFC_SLI3_BG_ENABLED; in lpfc_get_cfgparam()
7179 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_get_cfgparam()
7181 phba->nvmet_support = 0; in lpfc_get_cfgparam()
7182 phba->cfg_nvmet_mrq = 0; in lpfc_get_cfgparam()
7183 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7184 phba->cfg_enable_bbcr = 0; in lpfc_get_cfgparam()
7185 phba->cfg_xri_rebalancing = 0; in lpfc_get_cfgparam()
7188 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_cfgparam()
7189 phba->cfg_enable_fc4_type |= LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7192 phba->cfg_auto_imax = (phba->cfg_fcp_imax) ? 0 : 1; in lpfc_get_cfgparam()
7194 phba->cfg_enable_pbde = 0; in lpfc_get_cfgparam()
7197 if (phba->cfg_hdw_queue == 0) in lpfc_get_cfgparam()
7198 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7199 if (phba->cfg_irq_chann == 0) in lpfc_get_cfgparam()
7200 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7201 if (phba->cfg_irq_chann > phba->cfg_hdw_queue) in lpfc_get_cfgparam()
7202 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_get_cfgparam()
7204 phba->cfg_soft_wwnn = 0L; in lpfc_get_cfgparam()
7205 phba->cfg_soft_wwpn = 0L; in lpfc_get_cfgparam()
7216 phba->cfg_enable_dss = 1; in lpfc_get_cfgparam()
7226 * lpfc_nvme_mod_param_dep - Adjust module parameter value based on
7233 if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu) in lpfc_nvme_mod_param_dep()
7234 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7235 if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu) in lpfc_nvme_mod_param_dep()
7236 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7237 if (phba->cfg_irq_chann > phba->cfg_hdw_queue) in lpfc_nvme_mod_param_dep()
7238 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7240 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_nvme_mod_param_dep()
7241 phba->nvmet_support) { in lpfc_nvme_mod_param_dep()
7242 phba->cfg_enable_fc4_type &= ~LPFC_ENABLE_FCP; in lpfc_nvme_mod_param_dep()
7247 phba->cfg_nvme_enable_fb, in lpfc_nvme_mod_param_dep()
7248 phba->cfg_nvmet_fb_size, in lpfc_nvme_mod_param_dep()
7251 if (phba->cfg_nvme_enable_fb == 0) in lpfc_nvme_mod_param_dep()
7252 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7254 if (phba->cfg_nvmet_fb_size > LPFC_NVMET_FB_SZ_MAX) in lpfc_nvme_mod_param_dep()
7255 phba->cfg_nvmet_fb_size = LPFC_NVMET_FB_SZ_MAX; in lpfc_nvme_mod_param_dep()
7258 if (!phba->cfg_nvmet_mrq) in lpfc_nvme_mod_param_dep()
7259 phba->cfg_nvmet_mrq = phba->cfg_irq_chann; in lpfc_nvme_mod_param_dep()
7262 if (phba->cfg_nvmet_mrq > phba->cfg_irq_chann) { in lpfc_nvme_mod_param_dep()
7263 phba->cfg_nvmet_mrq = phba->cfg_irq_chann; in lpfc_nvme_mod_param_dep()
7266 phba->cfg_nvmet_mrq); in lpfc_nvme_mod_param_dep()
7268 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_nvme_mod_param_dep()
7269 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_nvme_mod_param_dep()
7273 phba->nvmet_support = 0; in lpfc_nvme_mod_param_dep()
7274 phba->cfg_nvmet_mrq = 0; in lpfc_nvme_mod_param_dep()
7275 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7280 * lpfc_get_vport_cfgparam - Used during port create, init the vport structure