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

4  * Copyright (C) 2017-2022 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 *
72 " trunk - link was \"low\" speed",
74 " existing trunk - link was \"middle\" speed",
76 " trunk - link was \"high\" speed",
77 "Attached to non-trunking port - F_Port",
78 "Attached to non-trunking port - N_Port",
80 "non-FLOGI frame received",
87 * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules
95 * Hex 0-9 becomes ascii '0' to '9'.
96 * Hex a-f becomes ascii '=' to 'B' capital B.
108 hdw[7 - i] = 0x30 + j; in lpfc_jedec_to_ascii()
110 hdw[7 - i] = 0x61 + j - 10; in lpfc_jedec_to_ascii()
122 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_cmf_info_show()
123 struct lpfc_hba *phba = vport->phba; in lpfc_cmf_info_show()
127 int cpu; in lpfc_cmf_info_show() local
131 if (phba->cgn_i) in lpfc_cmf_info_show()
132 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cmf_info_show()
137 phba->sli4_hba.pc_sli4_params.mi_ver, in lpfc_cmf_info_show()
138 cp ? cp->cgn_info_version : 0, in lpfc_cmf_info_show()
139 phba->sli4_hba.pc_sli4_params.cmf, phba->cmf_timer_cnt); in lpfc_cmf_info_show()
144 if (!phba->sli4_hba.pc_sli4_params.cmf) in lpfc_cmf_info_show()
147 switch (phba->cgn_init_reg_signal) { in lpfc_cmf_info_show()
164 switch (phba->cgn_init_reg_fpin) { in lpfc_cmf_info_show()
185 switch (phba->cgn_reg_signal) { in lpfc_cmf_info_show()
202 switch (phba->cgn_reg_fpin) { in lpfc_cmf_info_show()
205 "FPIN:WARN ACQEcnt:%d\n", phba->cgn_acqe_cnt); in lpfc_cmf_info_show()
209 "FPIN:ALARM ACQEcnt:%d\n", phba->cgn_acqe_cnt); in lpfc_cmf_info_show()
213 "FPIN:WARN|ALARM ACQEcnt:%d\n", phba->cgn_acqe_cnt); in lpfc_cmf_info_show()
217 "FPIN:NONE ACQEcnt:%d\n", phba->cgn_acqe_cnt); in lpfc_cmf_info_show()
223 if (phba->cmf_active_mode != phba->cgn_p.cgn_param_mode) { in lpfc_cmf_info_show()
224 switch (phba->cmf_active_mode) { in lpfc_cmf_info_show()
241 switch (phba->cgn_p.cgn_param_mode) { in lpfc_cmf_info_show()
259 for_each_present_cpu(cpu) { in lpfc_cmf_info_show()
260 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_info_show()
261 total += atomic64_read(&cgs->total_bytes); in lpfc_cmf_info_show()
262 rcv += atomic64_read(&cgs->rcv_bytes); in lpfc_cmf_info_show()
267 atomic_read(&phba->cmf_busy), in lpfc_cmf_info_show()
268 phba->cmf_active_info, rcv, total); in lpfc_cmf_info_show()
276 (unsigned long)phba->cmf_link_byte_count, in lpfc_cmf_info_show()
277 (unsigned long)phba->cmf_max_bytes_per_interval); in lpfc_cmf_info_show()
283 if (unlikely(len >= (PAGE_SIZE - 1))) { in lpfc_cmf_info_show()
288 strscpy(buf + PAGE_SIZE - 1 - sizeof(LPFC_INFO_MORE_STR), in lpfc_cmf_info_show()
295 * lpfc_drvr_version_show - Return the Emulex driver string with version number
310 * lpfc_enable_fip_show - Return the fip mode of the HBA
322 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_enable_fip_show()
323 struct lpfc_hba *phba = vport->phba; in lpfc_enable_fip_show()
325 if (phba->hba_flag & HBA_FIP_SUPPORT) in lpfc_enable_fip_show()
337 struct lpfc_hba *phba = vport->phba; in lpfc_nvme_info_show()
352 if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) { in lpfc_nvme_info_show()
356 if (phba->nvmet_support) { in lpfc_nvme_info_show()
357 if (!phba->targetport) { in lpfc_nvme_info_show()
360 wwn_to_u64(vport->fc_portname.u.wwn)); in lpfc_nvme_info_show()
364 if (phba->targetport->port_id) in lpfc_nvme_info_show()
377 phba->brd_no, in lpfc_nvme_info_show()
378 wwn_to_u64(vport->fc_portname.u.wwn), in lpfc_nvme_info_show()
379 wwn_to_u64(vport->fc_nodename.u.wwn), in lpfc_nvme_info_show()
380 phba->targetport->port_id); in lpfc_nvme_info_show()
388 tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private; in lpfc_nvme_info_show()
391 atomic_read(&tgtp->rcv_ls_req_in), in lpfc_nvme_info_show()
392 atomic_read(&tgtp->rcv_ls_req_drop), in lpfc_nvme_info_show()
393 atomic_read(&tgtp->xmt_ls_abort)); in lpfc_nvme_info_show()
397 if (atomic_read(&tgtp->rcv_ls_req_in) != in lpfc_nvme_info_show()
398 atomic_read(&tgtp->rcv_ls_req_out)) { in lpfc_nvme_info_show()
401 atomic_read(&tgtp->rcv_ls_req_in), in lpfc_nvme_info_show()
402 atomic_read(&tgtp->rcv_ls_req_out)); in lpfc_nvme_info_show()
409 atomic_read(&tgtp->xmt_ls_rsp), in lpfc_nvme_info_show()
410 atomic_read(&tgtp->xmt_ls_drop), in lpfc_nvme_info_show()
411 atomic_read(&tgtp->xmt_ls_rsp_cmpl)); in lpfc_nvme_info_show()
417 atomic_read(&tgtp->xmt_ls_rsp_aborted), in lpfc_nvme_info_show()
418 atomic_read(&tgtp->xmt_ls_rsp_xb_set), in lpfc_nvme_info_show()
419 atomic_read(&tgtp->xmt_ls_rsp_error)); in lpfc_nvme_info_show()
426 atomic_read(&tgtp->rcv_fcp_cmd_in), in lpfc_nvme_info_show()
427 atomic_read(&tgtp->rcv_fcp_cmd_defer), in lpfc_nvme_info_show()
428 atomic_read(&tgtp->xmt_fcp_release), in lpfc_nvme_info_show()
429 atomic_read(&tgtp->rcv_fcp_cmd_drop)); in lpfc_nvme_info_show()
433 if (atomic_read(&tgtp->rcv_fcp_cmd_in) != in lpfc_nvme_info_show()
434 atomic_read(&tgtp->rcv_fcp_cmd_out)) { in lpfc_nvme_info_show()
437 atomic_read(&tgtp->rcv_fcp_cmd_in), in lpfc_nvme_info_show()
438 atomic_read(&tgtp->rcv_fcp_cmd_out)); in lpfc_nvme_info_show()
446 atomic_read(&tgtp->xmt_fcp_read), in lpfc_nvme_info_show()
447 atomic_read(&tgtp->xmt_fcp_read_rsp), in lpfc_nvme_info_show()
448 atomic_read(&tgtp->xmt_fcp_write), in lpfc_nvme_info_show()
449 atomic_read(&tgtp->xmt_fcp_rsp), in lpfc_nvme_info_show()
450 atomic_read(&tgtp->xmt_fcp_drop)); in lpfc_nvme_info_show()
456 atomic_read(&tgtp->xmt_fcp_rsp_cmpl), in lpfc_nvme_info_show()
457 atomic_read(&tgtp->xmt_fcp_rsp_error), in lpfc_nvme_info_show()
458 atomic_read(&tgtp->xmt_fcp_rsp_drop)); in lpfc_nvme_info_show()
464 atomic_read(&tgtp->xmt_fcp_rsp_aborted), in lpfc_nvme_info_show()
465 atomic_read(&tgtp->xmt_fcp_rsp_xb_set), in lpfc_nvme_info_show()
466 atomic_read(&tgtp->xmt_fcp_xri_abort_cqe)); in lpfc_nvme_info_show()
472 atomic_read(&tgtp->xmt_fcp_abort), in lpfc_nvme_info_show()
473 atomic_read(&tgtp->xmt_fcp_abort_cmpl)); in lpfc_nvme_info_show()
479 atomic_read(&tgtp->xmt_abort_sol), in lpfc_nvme_info_show()
480 atomic_read(&tgtp->xmt_abort_unsol), in lpfc_nvme_info_show()
481 atomic_read(&tgtp->xmt_abort_rsp), in lpfc_nvme_info_show()
482 atomic_read(&tgtp->xmt_abort_rsp_error)); in lpfc_nvme_info_show()
488 atomic_read(&tgtp->defer_ctx), in lpfc_nvme_info_show()
489 atomic_read(&tgtp->defer_fod), in lpfc_nvme_info_show()
490 atomic_read(&tgtp->defer_wqfull)); in lpfc_nvme_info_show()
495 tot = atomic_read(&tgtp->rcv_fcp_cmd_drop); in lpfc_nvme_info_show()
496 tot += atomic_read(&tgtp->xmt_fcp_release); in lpfc_nvme_info_show()
497 tot = atomic_read(&tgtp->rcv_fcp_cmd_in) - tot; in lpfc_nvme_info_show()
502 phba->sli4_hba.nvmet_xri_cnt, in lpfc_nvme_info_show()
503 phba->sli4_hba.nvmet_io_wait_cnt, in lpfc_nvme_info_show()
504 phba->sli4_hba.nvmet_io_wait_total, in lpfc_nvme_info_show()
510 localport = vport->localport; in lpfc_nvme_info_show()
514 wwn_to_u64(vport->fc_portname.u.wwn)); in lpfc_nvme_info_show()
517 lport = (struct lpfc_nvme_lport *)localport->private; in lpfc_nvme_info_show()
523 phba->brd_no, in lpfc_nvme_info_show()
524 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_nvme_info_show()
525 phba->sli4_hba.io_xri_max, in lpfc_nvme_info_show()
531 if (localport->port_id) in lpfc_nvme_info_show()
539 phba->brd_no, in lpfc_nvme_info_show()
540 wwn_to_u64(vport->fc_portname.u.wwn), in lpfc_nvme_info_show()
541 wwn_to_u64(vport->fc_nodename.u.wwn), in lpfc_nvme_info_show()
542 localport->port_id, statep); in lpfc_nvme_info_show()
546 spin_lock_irq(shost->host_lock); in lpfc_nvme_info_show()
548 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_nvme_info_show()
550 spin_lock(&ndlp->lock); in lpfc_nvme_info_show()
553 nrport = rport->remoteport; in lpfc_nvme_info_show()
554 spin_unlock(&ndlp->lock); in lpfc_nvme_info_show()
559 switch (nrport->port_state) { in lpfc_nvme_info_show()
574 if (phba->brd_no >= 10) { in lpfc_nvme_info_show()
580 nrport->port_name); in lpfc_nvme_info_show()
585 nrport->node_name); in lpfc_nvme_info_show()
590 nrport->port_id); in lpfc_nvme_info_show()
595 if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR) { in lpfc_nvme_info_show()
599 if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET) { in lpfc_nvme_info_show()
603 if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY) { in lpfc_nvme_info_show()
607 if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR | in lpfc_nvme_info_show()
611 nrport->port_role); in lpfc_nvme_info_show()
620 spin_unlock_irq(shost->host_lock); in lpfc_nvme_info_show()
630 atomic_read(&lport->fc4NvmeLsRequests), in lpfc_nvme_info_show()
631 atomic_read(&lport->fc4NvmeLsCmpls), in lpfc_nvme_info_show()
632 atomic_read(&lport->xmt_ls_abort)); in lpfc_nvme_info_show()
638 atomic_read(&lport->xmt_ls_err), in lpfc_nvme_info_show()
639 atomic_read(&lport->cmpl_ls_xb), in lpfc_nvme_info_show()
640 atomic_read(&lport->cmpl_ls_err)); in lpfc_nvme_info_show()
646 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_nvme_info_show()
647 cstat = &phba->sli4_hba.hdwq[i].nvme_cstat; in lpfc_nvme_info_show()
648 tot = cstat->io_cmpls; in lpfc_nvme_info_show()
650 data1 = cstat->input_requests; in lpfc_nvme_info_show()
651 data2 = cstat->output_requests; in lpfc_nvme_info_show()
652 data3 = cstat->control_requests; in lpfc_nvme_info_show()
658 totin, totout, totout - totin); in lpfc_nvme_info_show()
665 atomic_read(&lport->xmt_fcp_abort), in lpfc_nvme_info_show()
666 atomic_read(&lport->xmt_fcp_noxri), in lpfc_nvme_info_show()
667 atomic_read(&lport->xmt_fcp_bad_ndlp), in lpfc_nvme_info_show()
668 atomic_read(&lport->xmt_fcp_qdepth), in lpfc_nvme_info_show()
669 atomic_read(&lport->xmt_fcp_wqerr), in lpfc_nvme_info_show()
670 atomic_read(&lport->xmt_fcp_err)); in lpfc_nvme_info_show()
676 atomic_read(&lport->cmpl_fcp_xb), in lpfc_nvme_info_show()
677 atomic_read(&lport->cmpl_fcp_err)); in lpfc_nvme_info_show()
684 spin_unlock_irq(shost->host_lock); in lpfc_nvme_info_show()
689 if (unlikely(len >= (PAGE_SIZE - 1))) { in lpfc_nvme_info_show()
694 strscpy(buf + PAGE_SIZE - 1 - sizeof(LPFC_INFO_MORE_STR), in lpfc_nvme_info_show()
708 struct lpfc_hba *phba = vport->phba; in lpfc_scsi_stat_show()
716 if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_FCP) || in lpfc_scsi_stat_show()
717 (phba->sli_rev != LPFC_SLI_REV4)) in lpfc_scsi_stat_show()
724 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_scsi_stat_show()
725 cstat = &phba->sli4_hba.hdwq[i].scsi_cstat; in lpfc_scsi_stat_show()
726 tot = cstat->io_cmpls; in lpfc_scsi_stat_show()
728 data1 = cstat->input_requests; in lpfc_scsi_stat_show()
729 data2 = cstat->output_requests; in lpfc_scsi_stat_show()
730 data3 = cstat->control_requests; in lpfc_scsi_stat_show()
739 tot, ((data1 + data2 + data3) - tot)); in lpfc_scsi_stat_show()
744 "OutIO %016llx\n", totin, totout, totout - totin); in lpfc_scsi_stat_show()
758 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_info_show()
759 struct lpfc_hba *phba = vport->phba; in lpfc_bg_info_show()
761 if (phba->cfg_enable_bg) { in lpfc_bg_info_show()
762 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_bg_info_show()
778 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_guard_err_show()
779 struct lpfc_hba *phba = vport->phba; in lpfc_bg_guard_err_show()
782 (unsigned long long)phba->bg_guard_err_cnt); in lpfc_bg_guard_err_show()
790 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_apptag_err_show()
791 struct lpfc_hba *phba = vport->phba; in lpfc_bg_apptag_err_show()
794 (unsigned long long)phba->bg_apptag_err_cnt); in lpfc_bg_apptag_err_show()
802 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_reftag_err_show()
803 struct lpfc_hba *phba = vport->phba; in lpfc_bg_reftag_err_show()
806 (unsigned long long)phba->bg_reftag_err_cnt); in lpfc_bg_reftag_err_show()
810 * lpfc_info_show - Return some pci info about the host in ascii
827 * lpfc_serialnum_show - Return the hba serial number in ascii
839 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_serialnum_show()
840 struct lpfc_hba *phba = vport->phba; in lpfc_serialnum_show()
842 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->SerialNumber); in lpfc_serialnum_show()
846 * lpfc_temp_sensor_show - Return the temperature sensor level
862 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_temp_sensor_show()
863 struct lpfc_hba *phba = vport->phba; in lpfc_temp_sensor_show()
864 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->temp_sensor_support); in lpfc_temp_sensor_show()
868 * lpfc_modeldesc_show - Return the model description of the hba
880 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_modeldesc_show()
881 struct lpfc_hba *phba = vport->phba; in lpfc_modeldesc_show()
883 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelDesc); in lpfc_modeldesc_show()
887 * lpfc_modelname_show - Return the model name of the hba
899 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_modelname_show()
900 struct lpfc_hba *phba = vport->phba; in lpfc_modelname_show()
902 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelName); in lpfc_modelname_show()
906 * lpfc_programtype_show - Return the program type of the hba
918 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_programtype_show()
919 struct lpfc_hba *phba = vport->phba; in lpfc_programtype_show()
921 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ProgramType); in lpfc_programtype_show()
925 * lpfc_vportnum_show - Return the port number in ascii of the hba
937 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_vportnum_show()
938 struct lpfc_hba *phba = vport->phba; in lpfc_vportnum_show()
940 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->Port); in lpfc_vportnum_show()
944 * lpfc_fwrev_show - Return the firmware rev running in the hba
956 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_fwrev_show()
957 struct lpfc_hba *phba = vport->phba; in lpfc_fwrev_show()
964 if_type = phba->sli4_hba.pc_sli4_params.if_type; in lpfc_fwrev_show()
965 sli_family = phba->sli4_hba.pc_sli4_params.sli_family; in lpfc_fwrev_show()
967 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_fwrev_show()
968 len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d\n", in lpfc_fwrev_show()
969 fwrev, phba->sli_rev); in lpfc_fwrev_show()
971 len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d:%d:%x\n", in lpfc_fwrev_show()
972 fwrev, phba->sli_rev, if_type, sli_family); in lpfc_fwrev_show()
978 * lpfc_hdw_show - Return the jedec information about the hba
990 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_hdw_show()
991 struct lpfc_hba *phba = vport->phba; in lpfc_hdw_show()
992 lpfc_vpd_t *vp = &phba->vpd; in lpfc_hdw_show()
994 lpfc_jedec_to_ascii(vp->rev.biuRev, hdw); in lpfc_hdw_show()
996 vp->rev.smRev, vp->rev.smFwRev); in lpfc_hdw_show()
1000 * lpfc_option_rom_version_show - Return the adapter ROM FCode version
1012 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_option_rom_version_show()
1013 struct lpfc_hba *phba = vport->phba; in lpfc_option_rom_version_show()
1016 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_option_rom_version_show()
1018 phba->OptionROMVersion); in lpfc_option_rom_version_show()
1025 * lpfc_link_state_show - Return the link state of the port
1040 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_state_show()
1041 struct lpfc_hba *phba = vport->phba; in lpfc_link_state_show()
1044 switch (phba->link_state) { in lpfc_link_state_show()
1051 if (phba->hba_flag & LINK_DISABLED) in lpfc_link_state_show()
1052 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
1053 "Link Down - User disabled\n"); in lpfc_link_state_show()
1055 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
1061 len += scnprintf(buf + len, PAGE_SIZE-len, "Link Up - "); in lpfc_link_state_show()
1063 switch (vport->port_state) { in lpfc_link_state_show()
1065 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
1075 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1079 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1084 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1089 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1093 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_state_show()
1094 if (vport->fc_flag & FC_PUBLIC_LOOP) in lpfc_link_state_show()
1095 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
1098 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
1101 if (vport->fc_flag & FC_FABRIC) { in lpfc_link_state_show()
1102 if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_link_state_show()
1103 vport->port_type == LPFC_PHYSICAL_PORT && in lpfc_link_state_show()
1104 phba->sli4_hba.fawwpn_flag & in lpfc_link_state_show()
1107 PAGE_SIZE - len, in lpfc_link_state_show()
1108 " Fabric FA-PWWN\n"); in lpfc_link_state_show()
1111 PAGE_SIZE - len, in lpfc_link_state_show()
1114 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
1115 " Point-2-Point\n"); in lpfc_link_state_show()
1120 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_link_state_show()
1122 &phba->sli4_hba.sli_intf) == in lpfc_link_state_show()
1124 struct lpfc_trunk_link link = phba->trunk_link; in lpfc_link_state_show()
1126 if (bf_get(lpfc_conf_trunk_port0, &phba->sli4_hba)) in lpfc_link_state_show()
1127 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1133 if (bf_get(lpfc_conf_trunk_port1, &phba->sli4_hba)) in lpfc_link_state_show()
1134 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1140 if (bf_get(lpfc_conf_trunk_port2, &phba->sli4_hba)) in lpfc_link_state_show()
1141 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1147 if (bf_get(lpfc_conf_trunk_port3, &phba->sli4_hba)) in lpfc_link_state_show()
1148 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1160 * lpfc_sli4_protocol_show - Return the fip mode of the HBA
1172 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sli4_protocol_show()
1173 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_protocol_show()
1175 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_sli4_protocol_show()
1178 if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL) { in lpfc_sli4_protocol_show()
1179 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_GE) in lpfc_sli4_protocol_show()
1181 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC) in lpfc_sli4_protocol_show()
1188 * lpfc_oas_supported_show - Return whether or not Optimized Access Storage
1201 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_oas_supported_show()
1202 struct lpfc_hba *phba = vport->phba; in lpfc_oas_supported_show()
1205 phba->sli4_hba.pc_sli4_params.oas_supported); in lpfc_oas_supported_show()
1209 * lpfc_link_state_store - Transition the link_state on an HBA port
1216 * -EINVAL if the buffer is not "up" or "down"
1217 * return from link state change function if non-zero
1225 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_state_store()
1226 struct lpfc_hba *phba = vport->phba; in lpfc_link_state_store()
1228 int status = -EINVAL; in lpfc_link_state_store()
1230 if ((strncmp(buf, "up", sizeof("up") - 1) == 0) && in lpfc_link_state_store()
1231 (phba->link_state == LPFC_LINK_DOWN)) in lpfc_link_state_store()
1232 status = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_link_state_store()
1233 else if ((strncmp(buf, "down", sizeof("down") - 1) == 0) && in lpfc_link_state_store()
1234 (phba->link_state >= LPFC_LINK_UP)) in lpfc_link_state_store()
1235 status = phba->lpfc_hba_down_link(phba, MBX_NOWAIT); in lpfc_link_state_store()
1244 * lpfc_num_discovered_ports_show - Return sum of mapped and unmapped vports
1260 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_num_discovered_ports_show()
1263 vport->fc_map_cnt + vport->fc_unmap_cnt); in lpfc_num_discovered_ports_show()
1267 * lpfc_issue_lip - Misnomer, name carried over from long ago
1271 * Bring the link down gracefully then re-init the link. The firmware will
1272 * re-init the fiber channel interface as required. Does not issue a LIP.
1275 * -EPERM port offline or management commands are being blocked
1276 * -ENOMEM cannot allocate memory for the mailbox command
1277 * -EIO error sending the mailbox command
1283 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_issue_lip()
1284 struct lpfc_hba *phba = vport->phba; in lpfc_issue_lip()
1292 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_issue_lip()
1293 (phba->hba_flag & LINK_DISABLED) || in lpfc_issue_lip()
1294 (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO)) in lpfc_issue_lip()
1295 return -EPERM; in lpfc_issue_lip()
1297 pmboxq = mempool_alloc(phba->mbox_mem_pool,GFP_KERNEL); in lpfc_issue_lip()
1300 return -ENOMEM; in lpfc_issue_lip()
1303 pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK; in lpfc_issue_lip()
1304 pmboxq->u.mb.mbxOwner = OWN_HOST; in lpfc_issue_lip()
1306 if ((vport->fc_flag & FC_PT2PT) && (vport->fc_flag & FC_PT2PT_NO_NVME)) in lpfc_issue_lip()
1307 vport->fc_flag &= ~FC_PT2PT_NO_NVME; in lpfc_issue_lip()
1312 (pmboxq->u.mb.mbxStatus == 0 || in lpfc_issue_lip()
1313 pmboxq->u.mb.mbxStatus == MBXERR_LINK_DOWN)) { in lpfc_issue_lip()
1315 lpfc_init_link(phba, pmboxq, phba->cfg_topology, in lpfc_issue_lip()
1316 phba->cfg_link_speed); in lpfc_issue_lip()
1318 phba->fc_ratov * 2); in lpfc_issue_lip()
1320 (pmboxq->u.mb.mbxStatus == MBXERR_SEC_NO_PERMISSION)) in lpfc_issue_lip()
1328 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_issue_lip()
1331 return -EIO; in lpfc_issue_lip()
1358 * lpfc_do_offline - Issues a mailbox command to bring the link down
1366 * lpfc_workq_post_event() returns a non-zero return code if call fails.
1369 * -EIO error posting the event
1387 return -ENOMEM; in lpfc_do_offline()
1392 return -EIO; in lpfc_do_offline()
1394 psli = &phba->sli; in lpfc_do_offline()
1401 spin_lock_irq(&phba->hbalock); in lpfc_do_offline()
1402 if (!(psli->sli_flag & LPFC_QUEUE_FREE_INIT)) { in lpfc_do_offline()
1403 psli->sli_flag |= LPFC_QUEUE_FREE_WAIT; in lpfc_do_offline()
1405 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1408 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1413 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_do_offline()
1414 for (i = 0; i < psli->num_rings; i++) { in lpfc_do_offline()
1415 pring = &psli->sli3_ring[i]; in lpfc_do_offline()
1416 if (!lpfc_emptyq_wait(phba, &pring->txcmplq, in lpfc_do_offline()
1417 &phba->hbalock)) in lpfc_do_offline()
1421 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_do_offline()
1422 pring = qp->pring; in lpfc_do_offline()
1425 if (!lpfc_emptyq_wait(phba, &pring->txcmplq, in lpfc_do_offline()
1426 &pring->ring_lock)) in lpfc_do_offline()
1431 spin_lock_irq(&phba->hbalock); in lpfc_do_offline()
1432 psli->sli_flag &= ~LPFC_QUEUE_FREE_WAIT; in lpfc_do_offline()
1433 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1439 return -ENOMEM; in lpfc_do_offline()
1444 return -EIO; in lpfc_do_offline()
1450 * lpfc_reset_pci_bus - resets PCI bridge controller's secondary bus of an HBA
1454 * Issues a PCI secondary bus reset for the phba->pcidev.
1463 * -ENOTSUPP, cfg_enable_hba_reset must be of value 2
1464 * -ENODEV, NULL ptr to pcidev
1465 * -EBADSLT, detected invalid device
1466 * -EBUSY, port is not in offline state
1472 struct pci_dev *pdev = phba->pcidev; in lpfc_reset_pci_bus()
1478 if (phba->cfg_enable_hba_reset != 2) in lpfc_reset_pci_bus()
1479 return -ENOTSUPP; in lpfc_reset_pci_bus()
1483 return -ENODEV; in lpfc_reset_pci_bus()
1491 list_for_each_entry(ptr, &pdev->bus->devices, bus_list) { in lpfc_reset_pci_bus()
1496 ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_reset_pci_bus()
1497 if (!(phba_other->pport->fc_flag & FC_OFFLINE_MODE)) { in lpfc_reset_pci_bus()
1502 phba_other->wwpn[0], in lpfc_reset_pci_bus()
1503 phba_other->wwpn[1], in lpfc_reset_pci_bus()
1504 phba_other->wwpn[2], in lpfc_reset_pci_bus()
1505 phba_other->wwpn[3], in lpfc_reset_pci_bus()
1506 phba_other->wwpn[4], in lpfc_reset_pci_bus()
1507 phba_other->wwpn[5], in lpfc_reset_pci_bus()
1508 phba_other->wwpn[6], in lpfc_reset_pci_bus()
1509 phba_other->wwpn[7]); in lpfc_reset_pci_bus()
1510 return -EBUSY; in lpfc_reset_pci_bus()
1526 * lpfc_selective_reset - Offline then onlines the port
1539 * -EIO reset not configured or error posting the event
1549 if (!phba->cfg_enable_hba_reset) in lpfc_selective_reset()
1550 return -EACCES; in lpfc_selective_reset()
1552 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE)) { in lpfc_selective_reset()
1563 return -ENOMEM; in lpfc_selective_reset()
1568 return -EIO; in lpfc_selective_reset()
1574 * lpfc_issue_reset - Selectively resets an adapter
1590 * -EINVAL if the buffer does not contain the string "selective"
1591 * length of buf if lpfc-selective_reset() if the call succeeds
1599 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_issue_reset()
1600 struct lpfc_hba *phba = vport->phba; in lpfc_issue_reset()
1601 int status = -EINVAL; in lpfc_issue_reset()
1603 if (!phba->cfg_enable_hba_reset) in lpfc_issue_reset()
1604 return -EACCES; in lpfc_issue_reset()
1606 if (strncmp(buf, "selective", sizeof("selective") - 1) == 0) in lpfc_issue_reset()
1607 status = phba->lpfc_selective_reset(phba); in lpfc_issue_reset()
1616 * lpfc_sli4_pdev_status_reg_wait - Wait for pdev status register for readyness
1620 * SLI4 interface type-2 device to wait on the sliport status register for
1624 * zero for success, -EPERM when port does not have privilege to perform the
1625 * reset, -EIO when port timeout from recovering from the reset.
1638 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1640 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1645 return -EPERM; in lpfc_sli4_pdev_status_reg_wait()
1650 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1665 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1669 * lpfc_sli4_pdev_reg_request - Request physical dev to perform a register acc
1674 * Request SLI4 interface type-2 device to perform a physical register set
1684 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pdev_reg_request()
1691 if (!phba->cfg_enable_hba_reset) in lpfc_sli4_pdev_reg_request()
1692 return -EACCES; in lpfc_sli4_pdev_reg_request()
1694 if ((phba->sli_rev < LPFC_SLI_REV4) || in lpfc_sli4_pdev_reg_request()
1695 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_pdev_reg_request()
1697 return -EPERM; in lpfc_sli4_pdev_reg_request()
1700 before_fc_flag = phba->pport->fc_flag; in lpfc_sli4_pdev_reg_request()
1701 sriov_nr_virtfn = phba->cfg_sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1705 phba->fw_dump_cmpl = &online_compl; in lpfc_sli4_pdev_reg_request()
1707 /* Disable SR-IOV virtual functions if enabled */ in lpfc_sli4_pdev_reg_request()
1708 if (phba->cfg_sriov_nr_virtfn) { in lpfc_sli4_pdev_reg_request()
1710 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_pdev_reg_request()
1722 reg_val = readl(phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1732 writel(reg_val, phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1735 readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); in lpfc_sli4_pdev_reg_request()
1740 if (rc == -EPERM) { in lpfc_sli4_pdev_reg_request()
1745 } else if (rc == -EIO) { in lpfc_sli4_pdev_reg_request()
1750 if (phba->fw_dump_cmpl) in lpfc_sli4_pdev_reg_request()
1751 phba->fw_dump_cmpl = NULL; in lpfc_sli4_pdev_reg_request()
1757 if (phba->fw_dump_cmpl) in lpfc_sli4_pdev_reg_request()
1758 phba->fw_dump_cmpl = NULL; in lpfc_sli4_pdev_reg_request()
1767 wait_for_completion(phba->fw_dump_cmpl); in lpfc_sli4_pdev_reg_request()
1783 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_pdev_reg_request()
1789 phba->cfg_sriov_nr_virtfn = sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1795 rc = -ENOMEM; in lpfc_sli4_pdev_reg_request()
1797 rc = -EIO; in lpfc_sli4_pdev_reg_request()
1803 * lpfc_nport_evt_cnt_show - Return the number of nport events
1815 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nport_evt_cnt_show()
1816 struct lpfc_hba *phba = vport->phba; in lpfc_nport_evt_cnt_show()
1818 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); in lpfc_nport_evt_cnt_show()
1839 return -EINVAL; /* Invalid command */ in lpfc_set_trunking()
1853 return -EINVAL; in lpfc_set_trunking()
1859 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_set_trunking()
1861 return -ENOMEM; in lpfc_set_trunking()
1868 &mbox->u.mqe.un.set_trunk_mode, in lpfc_set_trunking()
1875 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_set_trunking()
1881 * lpfc_board_mode_show - Return the state of the board
1893 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_show()
1894 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_show()
1897 if (phba->link_state == LPFC_HBA_ERROR) in lpfc_board_mode_show()
1899 else if (phba->link_state == LPFC_WARM_START) in lpfc_board_mode_show()
1901 else if (phba->link_state == LPFC_INIT_START) in lpfc_board_mode_show()
1910 * lpfc_board_mode_store - Puts the hba in online, offline, warm or error state
1917 * -EACCES if enable hba reset not enabled
1918 * -EINVAL if the buffer does not contain a valid string (see above)
1919 * -EIO if lpfc_workq_post_event() or lpfc_do_offline() fails
1927 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_store()
1928 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_store()
1934 if (!phba->cfg_enable_hba_reset) { in lpfc_board_mode_store()
1935 status = -EACCES; in lpfc_board_mode_store()
1944 if(strncmp(buf, "online", sizeof("online") - 1) == 0) { in lpfc_board_mode_store()
1948 status = -ENOMEM; in lpfc_board_mode_store()
1953 status = -EIO; in lpfc_board_mode_store()
1954 } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) in lpfc_board_mode_store()
1956 else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) in lpfc_board_mode_store()
1957 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
1958 status = -EINVAL; in lpfc_board_mode_store()
1961 else if (strncmp(buf, "error", sizeof("error") - 1) == 0) in lpfc_board_mode_store()
1962 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
1963 status = -EINVAL; in lpfc_board_mode_store()
1966 else if (strncmp(buf, "dump", sizeof("dump") - 1) == 0) in lpfc_board_mode_store()
1968 else if (strncmp(buf, "fw_reset", sizeof("fw_reset") - 1) == 0) in lpfc_board_mode_store()
1970 else if (strncmp(buf, "dv_reset", sizeof("dv_reset") - 1) == 0) in lpfc_board_mode_store()
1972 else if (strncmp(buf, "pci_bus_reset", sizeof("pci_bus_reset") - 1) in lpfc_board_mode_store()
1975 else if (strncmp(buf, "heartbeat", sizeof("heartbeat") - 1) == 0) in lpfc_board_mode_store()
1977 else if (strncmp(buf, "trunk", sizeof("trunk") - 1) == 0) in lpfc_board_mode_store()
1980 status = -EINVAL; in lpfc_board_mode_store()
1992 buf, status, phba->pport->fc_flag); in lpfc_board_mode_store()
1998 * lpfc_get_hba_info - Return various bits of informaton about the adapter
2031 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_hba_info()
2032 !phba->mbox_mem_pool || in lpfc_get_hba_info()
2033 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_hba_info()
2036 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_hba_info()
2039 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_hba_info()
2044 pmb = &pmboxq->u.mb; in lpfc_get_hba_info()
2045 pmb->mbxCommand = MBX_READ_CONFIG; in lpfc_get_hba_info()
2046 pmb->mbxOwner = OWN_HOST; in lpfc_get_hba_info()
2047 pmboxq->ctx_buf = NULL; in lpfc_get_hba_info()
2049 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_hba_info()
2052 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_hba_info()
2056 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
2060 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_get_hba_info()
2061 rd_config = &pmboxq->u.mqe.un.rd_config; in lpfc_get_hba_info()
2065 *arpi = bf_get(lpfc_mbx_rd_conf_rpi_count, rd_config) - in lpfc_get_hba_info()
2066 phba->sli4_hba.max_cfg_param.rpi_used; in lpfc_get_hba_info()
2070 *axri = bf_get(lpfc_mbx_rd_conf_xri_count, rd_config) - in lpfc_get_hba_info()
2071 phba->sli4_hba.max_cfg_param.xri_used; in lpfc_get_hba_info()
2073 /* Account for differences with SLI-3. Get vpi count from in lpfc_get_hba_info()
2077 (bf_get(lpfc_mbx_rd_conf_vpi_count, rd_config) - 1) : 0; in lpfc_get_hba_info()
2085 *avpi = max_vpi - phba->sli4_hba.max_cfg_param.vpi_used; in lpfc_get_hba_info()
2088 *mrpi = pmb->un.varRdConfig.max_rpi; in lpfc_get_hba_info()
2090 *arpi = pmb->un.varRdConfig.avail_rpi; in lpfc_get_hba_info()
2092 *mxri = pmb->un.varRdConfig.max_xri; in lpfc_get_hba_info()
2094 *axri = pmb->un.varRdConfig.avail_xri; in lpfc_get_hba_info()
2096 *mvpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
2099 if (phba->link_state == LPFC_HBA_READY) in lpfc_get_hba_info()
2100 *avpi = pmb->un.varRdConfig.avail_vpi; in lpfc_get_hba_info()
2102 *avpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
2106 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
2111 * lpfc_max_rpi_show - Return maximum rpi
2129 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_rpi_show()
2130 struct lpfc_hba *phba = vport->phba; in lpfc_max_rpi_show()
2139 * lpfc_used_rpi_show - Return maximum rpi minus available rpi
2157 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_rpi_show()
2158 struct lpfc_hba *phba = vport->phba; in lpfc_used_rpi_show()
2162 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_rpi_show()
2167 * lpfc_max_xri_show - Return maximum xri
2185 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_xri_show()
2186 struct lpfc_hba *phba = vport->phba; in lpfc_max_xri_show()
2195 * lpfc_used_xri_show - Return maximum xpi minus the available xpi
2213 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_xri_show()
2214 struct lpfc_hba *phba = vport->phba; in lpfc_used_xri_show()
2218 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_xri_show()
2223 * lpfc_max_vpi_show - Return maximum vpi
2241 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_vpi_show()
2242 struct lpfc_hba *phba = vport->phba; in lpfc_max_vpi_show()
2251 * lpfc_used_vpi_show - Return maximum vpi minus the available vpi
2269 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_vpi_show()
2270 struct lpfc_hba *phba = vport->phba; in lpfc_used_vpi_show()
2274 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_vpi_show()
2279 * lpfc_npiv_info_show - Return text about NPIV support for the adapter
2296 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_npiv_info_show()
2297 struct lpfc_hba *phba = vport->phba; in lpfc_npiv_info_show()
2299 if (!(phba->max_vpi)) in lpfc_npiv_info_show()
2301 if (vport->port_type == LPFC_PHYSICAL_PORT) in lpfc_npiv_info_show()
2303 return scnprintf(buf, PAGE_SIZE, "NPIV Virtual (VPI %d)\n", vport->vpi); in lpfc_npiv_info_show()
2307 * lpfc_poll_show - Return text about poll support for the adapter
2322 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_show()
2323 struct lpfc_hba *phba = vport->phba; in lpfc_poll_show()
2325 return scnprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); in lpfc_poll_show()
2329 * lpfc_poll_store - Set the value of cfg_poll for the adapter
2339 * -EINVAL if the buffer connot be converted or is out of range
2347 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_store()
2348 struct lpfc_hba *phba = vport->phba; in lpfc_poll_store()
2354 return -EINVAL; in lpfc_poll_store()
2357 return -EINVAL; in lpfc_poll_store()
2360 return -EINVAL; in lpfc_poll_store()
2362 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_poll_store()
2367 phba->cfg_poll, val); in lpfc_poll_store()
2369 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2371 old_val = phba->cfg_poll; in lpfc_poll_store()
2376 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2377 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2378 return -EINVAL; in lpfc_poll_store()
2381 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2382 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2387 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2388 return -EINVAL; in lpfc_poll_store()
2394 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2395 del_timer(&phba->fcp_poll_timer); in lpfc_poll_store()
2396 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2397 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2398 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2399 return -EINVAL; in lpfc_poll_store()
2402 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2403 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2406 phba->cfg_poll = val; in lpfc_poll_store()
2408 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2414 * lpfc_sriov_hw_max_virtfn_show - Return maximum number of virtual functions
2431 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sriov_hw_max_virtfn_show()
2432 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_hw_max_virtfn_show()
2451 * -EINVAL if val is invalid
2456 if (lpfc_rangecheck(val, 0, 1) && phba->sli_rev == LPFC_SLI_REV4) { in lpfc_enable_bbcr_set()
2459 "%d\n", phba->cfg_enable_bbcr, val); in lpfc_enable_bbcr_set()
2460 phba->cfg_enable_bbcr = val; in lpfc_enable_bbcr_set()
2466 return -EINVAL; in lpfc_enable_bbcr_set()
2470 * lpfc_param_show - Return a cfg attribute value in decimal
2489 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2490 struct lpfc_hba *phba = vport->phba;\
2492 phba->cfg_##attr);\
2496 * lpfc_param_hex_show - Return a cfg attribute value in hex
2515 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2516 struct lpfc_hba *phba = vport->phba;\
2518 val = phba->cfg_##attr;\
2520 phba->cfg_##attr);\
2524 * lpfc_param_init - Initializes a cfg attribute
2540 * -EINVAL if default used
2547 phba->cfg_##attr = val;\
2553 phba->cfg_##attr = default;\
2554 return -EINVAL;\
2558 * lpfc_param_set - Set a cfg attribute value
2575 * -EINVAL if val is invalid
2584 phba->cfg_##attr, val); \
2585 phba->cfg_##attr = val;\
2591 return -EINVAL;\
2595 * lpfc_param_store - Set a vport attribute value
2612 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2621 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2622 struct lpfc_hba *phba = vport->phba;\
2625 return -EINVAL;\
2627 return -EINVAL;\
2631 return -EINVAL;\
2635 * lpfc_vport_param_show - Return decimal formatted cfg attribute value
2654 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2655 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
2659 * lpfc_vport_param_hex_show - Return hex formatted attribute value
2679 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2680 return scnprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
2684 * lpfc_vport_param_init - Initialize a vport cfg attribute
2699 * -EINVAL if default used
2706 vport->cfg_##attr = val;\
2712 vport->cfg_##attr = default;\
2713 return -EINVAL;\
2717 * lpfc_vport_param_set - Set a vport cfg attribute
2731 * -EINVAL if val is invalid
2741 vport->cfg_##attr, vport->cfg_##attr, \
2743 vport->cfg_##attr = val;\
2749 return -EINVAL;\
2753 * lpfc_vport_param_store - Set a vport attribute
2766 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2775 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2778 return -EINVAL;\
2780 return -EINVAL;\
2784 return -EINVAL;\
2830 * lpfc_wwn_set - Convert string to the 8 byte WWN value.
2836 * -EINVAL if the buffer does not contain a valid wwn
2845 if (buf[cnt-1] == '\n') in lpfc_wwn_set()
2846 cnt--; in lpfc_wwn_set()
2850 return -EINVAL; in lpfc_wwn_set()
2857 j = ((j << 4) | ((*buf++ - 'a') + 10)); in lpfc_wwn_set()
2859 j = ((j << 4) | ((*buf++ - 'A') + 10)); in lpfc_wwn_set()
2861 j = ((j << 4) | (*buf++ - '0')); in lpfc_wwn_set()
2863 return -EINVAL; in lpfc_wwn_set()
2874 * lpfc_oas_tgt_show - Return wwpn of target whose luns maybe enabled for
2888 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_show()
2891 wwn_to_u64(phba->cfg_oas_tgt_wwpn)); in lpfc_oas_tgt_show()
2895 * lpfc_oas_tgt_store - Store wwpn of target whose luns maybe enabled for
2903 * -EINVAL count is invalid, invalid wwpn byte invalid
2904 * -EPERM oas is not supported by hba
2912 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_store()
2917 if (!phba->cfg_fof) in lpfc_oas_tgt_store()
2918 return -EPERM; in lpfc_oas_tgt_store()
2921 if (buf[cnt-1] == '\n') in lpfc_oas_tgt_store()
2922 cnt--; in lpfc_oas_tgt_store()
2928 memcpy(phba->cfg_oas_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
2929 memcpy(phba->sli4_hba.oas_next_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
2931 phba->cfg_oas_flags |= OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
2933 phba->cfg_oas_flags &= ~OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
2934 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_tgt_store()
2935 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_tgt_store()
2942 * lpfc_oas_priority_show - Return wwpn of target whose luns maybe enabled for
2956 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_show()
2958 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority); in lpfc_oas_priority_show()
2962 * lpfc_oas_priority_store - Store wwpn of target whose luns maybe enabled for
2970 * -EINVAL count is invalid, invalid wwpn byte invalid
2971 * -EPERM oas is not supported by hba
2979 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_store()
2984 if (!phba->cfg_fof) in lpfc_oas_priority_store()
2985 return -EPERM; in lpfc_oas_priority_store()
2988 if (buf[cnt-1] == '\n') in lpfc_oas_priority_store()
2989 cnt--; in lpfc_oas_priority_store()
2993 return -EINVAL; in lpfc_oas_priority_store()
2996 phba->cfg_oas_priority = (uint8_t)val; in lpfc_oas_priority_store()
2998 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_priority_store()
3005 * lpfc_oas_vpt_show - Return wwpn of vport whose targets maybe enabled
3019 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_show()
3022 wwn_to_u64(phba->cfg_oas_vpt_wwpn)); in lpfc_oas_vpt_show()
3026 * lpfc_oas_vpt_store - Store wwpn of vport whose targets maybe enabled
3034 * -EINVAL count is invalid, invalid wwpn byte invalid
3035 * -EPERM oas is not supported by hba
3043 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_store()
3048 if (!phba->cfg_fof) in lpfc_oas_vpt_store()
3049 return -EPERM; in lpfc_oas_vpt_store()
3052 if (buf[cnt-1] == '\n') in lpfc_oas_vpt_store()
3053 cnt--; in lpfc_oas_vpt_store()
3059 memcpy(phba->cfg_oas_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3060 memcpy(phba->sli4_hba.oas_next_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3062 phba->cfg_oas_flags |= OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3064 phba->cfg_oas_flags &= ~OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3065 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_vpt_store()
3066 if (phba->cfg_oas_priority == 0) in lpfc_oas_vpt_store()
3067 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_vpt_store()
3068 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_vpt_store()
3075 * lpfc_oas_lun_state_show - Return the current state (enabled or disabled)
3090 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_show()
3092 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_state); in lpfc_oas_lun_state_show()
3096 * lpfc_oas_lun_state_store - Store the state (enabled or disabled)
3105 * -EINVAL count is invalid, invalid wwpn byte invalid
3106 * -EPERM oas is not supported by hba
3114 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_store()
3117 if (!phba->cfg_fof) in lpfc_oas_lun_state_store()
3118 return -EPERM; in lpfc_oas_lun_state_store()
3121 return -EINVAL; in lpfc_oas_lun_state_store()
3124 return -EINVAL; in lpfc_oas_lun_state_store()
3127 return -EINVAL; in lpfc_oas_lun_state_store()
3129 phba->cfg_oas_lun_state = val; in lpfc_oas_lun_state_store()
3136 * lpfc_oas_lun_status_show - Return the status of the Optimized Access
3151 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_status_show()
3153 if (!(phba->cfg_oas_flags & OAS_LUN_VALID)) in lpfc_oas_lun_status_show()
3154 return -EFAULT; in lpfc_oas_lun_status_show()
3156 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_status); in lpfc_oas_lun_status_show()
3163 * lpfc_oas_lun_state_set - enable or disable a lun for Optimized Access Storage
3174 * -EPERM OAS is not enabled or not supported by this port.
3185 if (!phba->cfg_fof) in lpfc_oas_lun_state_set()
3186 return -EPERM; in lpfc_oas_lun_state_set()
3192 rc = -ENOMEM; in lpfc_oas_lun_state_set()
3202 * lpfc_oas_lun_get_next - get the next lun that has been enabled for Optimized
3228 phba->sli4_hba.oas_next_vpt_wwpn, in lpfc_oas_lun_get_next()
3230 phba->sli4_hba.oas_next_tgt_wwpn, in lpfc_oas_lun_get_next()
3231 &phba->sli4_hba.oas_next_lun, in lpfc_oas_lun_get_next()
3241 * lpfc_oas_lun_state_change - enable/disable a lun for OAS operations
3254 * -ENOMEM: failed to enable an lun for OAS operations
3255 * -EPERM: OAS is not enabled
3271 * lpfc_oas_lun_show - Return oas enabled luns from a chosen target
3281 * -EFAULT: target or vport wwpn was not set properly.
3282 * -EPERM: oas is not enabled.
3289 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_show()
3294 if (!phba->cfg_fof) in lpfc_oas_lun_show()
3295 return -EPERM; in lpfc_oas_lun_show()
3297 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_show()
3298 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_VPORT)) in lpfc_oas_lun_show()
3299 return -EFAULT; in lpfc_oas_lun_show()
3301 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_show()
3302 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_TARGET)) in lpfc_oas_lun_show()
3303 return -EFAULT; in lpfc_oas_lun_show()
3305 oas_lun = lpfc_oas_lun_get_next(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_show()
3306 phba->cfg_oas_tgt_wwpn, in lpfc_oas_lun_show()
3307 &phba->cfg_oas_lun_status, in lpfc_oas_lun_show()
3308 &phba->cfg_oas_priority); in lpfc_oas_lun_show()
3310 phba->cfg_oas_flags |= OAS_LUN_VALID; in lpfc_oas_lun_show()
3312 len += scnprintf(buf + len, PAGE_SIZE-len, "0x%llx", oas_lun); in lpfc_oas_lun_show()
3318 * lpfc_oas_lun_store - Sets the OAS state for lun
3329 * -EFAULT: target or vport wwpn was not set properly.
3330 * -EPERM: oas is not enabled.
3338 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_store()
3343 if (!phba->cfg_fof) in lpfc_oas_lun_store()
3344 return -EPERM; in lpfc_oas_lun_store()
3346 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_store()
3347 return -EFAULT; in lpfc_oas_lun_store()
3349 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_store()
3350 return -EFAULT; in lpfc_oas_lun_store()
3353 return -EINVAL; in lpfc_oas_lun_store()
3356 return -EINVAL; in lpfc_oas_lun_store()
3358 pri = phba->cfg_oas_priority; in lpfc_oas_lun_store()
3360 pri = phba->cfg_XLanePriority; in lpfc_oas_lun_store()
3365 wwn_to_u64(phba->cfg_oas_vpt_wwpn), in lpfc_oas_lun_store()
3366 wwn_to_u64(phba->cfg_oas_tgt_wwpn), scsi_lun, in lpfc_oas_lun_store()
3367 pri, phba->cfg_oas_lun_state); in lpfc_oas_lun_store()
3369 rc = lpfc_oas_lun_state_change(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_store()
3370 phba->cfg_oas_tgt_wwpn, scsi_lun, in lpfc_oas_lun_store()
3371 phba->cfg_oas_lun_state, pri); in lpfc_oas_lun_store()
3390 " 0 - none,"
3391 " 1 - poll with interrupts enabled"
3392 " 3 - poll and disable FCP ring interrupts");
3403 "SLI mode selector: 3 - select SLI-3");
3444 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pls_show()
3447 phba->sli4_hba.pc_sli4_params.pls); in lpfc_pls_show()
3456 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pt_show()
3459 (phba->hba_flag & HBA_PERSISTENT_TOPO) ? 1 : 0); in lpfc_pt_show()
3466 # 1 - (1024)
3467 # 2 - (2048)
3468 # 3 - (3072)
3469 # 4 - (4096)
3470 # 5 - (5120)
3476 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_iocb_hw_show()
3478 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max); in lpfc_iocb_hw_show()
3487 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txq_hw_show()
3491 pring ? pring->txq_max : 0); in lpfc_txq_hw_show()
3501 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txcmplq_hw_show()
3505 pring ? pring->txcmplq_max : 0); in lpfc_txcmplq_hw_show()
3523 * lpfc_nodev_tmo_show - Return the hba dev loss timeout value
3535 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nodev_tmo_show()
3537 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); in lpfc_nodev_tmo_show()
3541 * lpfc_nodev_tmo_init - Set the hba nodev timeout value
3553 * -EINVAL val out of range
3558 if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { in lpfc_nodev_tmo_init()
3559 vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; in lpfc_nodev_tmo_init()
3569 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_init()
3570 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_init()
3577 vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; in lpfc_nodev_tmo_init()
3578 return -EINVAL; in lpfc_nodev_tmo_init()
3582 * lpfc_update_rport_devloss_tmo - Update dev loss tmo value
3599 spin_lock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3600 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_update_rport_devloss_tmo()
3601 if (ndlp->rport) in lpfc_update_rport_devloss_tmo()
3602 ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; in lpfc_update_rport_devloss_tmo()
3604 spin_lock(&ndlp->lock); in lpfc_update_rport_devloss_tmo()
3607 remoteport = rport->remoteport; in lpfc_update_rport_devloss_tmo()
3608 spin_unlock(&ndlp->lock); in lpfc_update_rport_devloss_tmo()
3611 vport->cfg_devloss_tmo); in lpfc_update_rport_devloss_tmo()
3614 spin_unlock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3618 * lpfc_nodev_tmo_set - Set the vport nodev tmo and devloss tmo values
3630 * -EINVAL val out of range
3635 if (vport->dev_loss_tmo_changed || in lpfc_nodev_tmo_set()
3643 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_set()
3644 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_set()
3657 return -EINVAL; in lpfc_nodev_tmo_set()
3678 * lpfc_devloss_tmo_set - Sets vport nodev tmo, devloss tmo values, changed bit in lpfc_vport_param_init()
3689 * -EINVAL val out of range in lpfc_vport_param_init()
3695 vport->cfg_nodev_tmo = val; in lpfc_vport_param_init()
3696 vport->cfg_devloss_tmo = val; in lpfc_vport_param_init()
3697 vport->dev_loss_tmo_changed = 1; in lpfc_vport_param_init()
3707 return -EINVAL; in lpfc_vport_param_init()
3744 * Supported Values: 1 - register just FCP
3745 * 3 - register both FCP and NVME
3750 "Enable FC4 Protocol support - FCP / NVME");
3759 "Verbose logging bit-mask");
3795 * -EINVAL if val is invalid
3804 return -EINVAL; in lpfc_tgt_queue_depth_set()
3806 if (val == vport->cfg_tgt_queue_depth) in lpfc_tgt_queue_depth_set()
3809 spin_lock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3810 vport->cfg_tgt_queue_depth = val; in lpfc_tgt_queue_depth_set()
3813 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) in lpfc_tgt_queue_depth_set()
3814 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_tgt_queue_depth_set()
3816 spin_unlock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3864 * lpfc_restrict_login_init - Set the vport restrict login flag
3876 * -EINVAL val out of range
3886 vport->cfg_restrict_login = 1; in lpfc_restrict_login_init()
3887 return -EINVAL; in lpfc_restrict_login_init()
3889 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_restrict_login_init()
3890 vport->cfg_restrict_login = 0; in lpfc_restrict_login_init()
3893 vport->cfg_restrict_login = val; in lpfc_restrict_login_init()
3898 * lpfc_restrict_login_set - Set the vport restrict login flag
3911 * -EINVAL val out of range
3921 vport->cfg_restrict_login = 1; in lpfc_restrict_login_set()
3922 return -EINVAL; in lpfc_restrict_login_set()
3924 if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { in lpfc_restrict_login_set()
3928 vport->cfg_restrict_login = 0; in lpfc_restrict_login_set()
3931 vport->cfg_restrict_login = val; in lpfc_restrict_login_set()
3940 # Fibre channel "ALPA". In the FC-AL Profile there is an "informative
3946 # Turning on the scan-down variable (on = 1, off = 0) will
3959 # 0x0 = attempt loop mode then point-to-point
3961 # 0x02 = attempt point-to-point mode only
3963 # 0x06 = attempt point-to-point mode then loop
3964 # Set point-to-point mode if you want to run as an N_Port.
3972 * lpfc_topology_store - Set the adapters topology field
3986 * non-zero return value from lpfc_issue_lip()
3987 * -EINVAL val out of range
3994 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_topology_store()
3995 struct lpfc_hba *phba = vport->phba; in lpfc_topology_store()
4009 return -EINVAL; in lpfc_topology_store()
4011 return -EINVAL; in lpfc_topology_store()
4014 prev_val = phba->cfg_topology; in lpfc_topology_store()
4015 if (phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G && in lpfc_topology_store()
4020 return -EINVAL; in lpfc_topology_store()
4024 * - persistent topology enabled in lpfc_topology_store()
4025 * - ASIC_GEN_NUM >= 0xC, with no private loop support in lpfc_topology_store()
4028 &phba->sli4_hba.sli_intf); in lpfc_topology_store()
4030 &phba->sli4_hba.sli_intf); in lpfc_topology_store()
4031 if ((phba->hba_flag & HBA_PERSISTENT_TOPO || in lpfc_topology_store()
4032 (!phba->sli4_hba.pc_sli4_params.pls && in lpfc_topology_store()
4038 return -EINVAL; in lpfc_topology_store()
4040 phba->cfg_topology = val; in lpfc_topology_store()
4047 if (prev_val != val && phba->sli_rev == LPFC_SLI_REV4) in lpfc_topology_store()
4048 phba->fc_topology_changed = 1; in lpfc_topology_store()
4049 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_topology_store()
4051 phba->cfg_topology = prev_val; in lpfc_topology_store()
4052 return -EINVAL; in lpfc_topology_store()
4059 phba->brd_no, val); in lpfc_topology_store()
4060 return -EINVAL; in lpfc_topology_store()
4082 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_static_vport_show()
4083 if (vport->vport_flag & STATIC_VPORT) in lpfc_static_vport_show()
4102 * lpfc_link_speed_store - Set the adapters link speed
4117 * non-zero return value from lpfc_issue_lip()
4118 * -EINVAL val out of range
4125 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_speed_store()
4126 struct lpfc_hba *phba = vport->phba; in lpfc_link_speed_store()
4133 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_link_speed_store()
4135 phba->hba_flag & HBA_FORCED_LINK_SPEED) in lpfc_link_speed_store()
4136 return -EPERM; in lpfc_link_speed_store()
4144 return -EINVAL; in lpfc_link_speed_store()
4146 return -EINVAL; in lpfc_link_speed_store()
4150 phba->cfg_link_speed, val, nolip ? "(nolip)" : "(lip)"); in lpfc_link_speed_store()
4152 if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || in lpfc_link_speed_store()
4153 ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || in lpfc_link_speed_store()
4154 ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || in lpfc_link_speed_store()
4155 ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || in lpfc_link_speed_store()
4156 ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) || in lpfc_link_speed_store()
4157 ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb)) || in lpfc_link_speed_store()
4158 ((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb)) || in lpfc_link_speed_store()
4159 ((val == LPFC_USER_LINK_SPEED_64G) && !(phba->lmt & LMT_64Gb))) { in lpfc_link_speed_store()
4164 return -EINVAL; in lpfc_link_speed_store()
4167 phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_speed_store()
4172 return -EINVAL; in lpfc_link_speed_store()
4184 prev_val = phba->cfg_link_speed; in lpfc_link_speed_store()
4185 phba->cfg_link_speed = val; in lpfc_link_speed_store()
4189 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_link_speed_store()
4191 phba->cfg_link_speed = prev_val; in lpfc_link_speed_store()
4192 return -EINVAL; in lpfc_link_speed_store()
4203 return -EINVAL; in lpfc_link_speed_store()
4213 * lpfc_link_speed_init - Set the adapters link speed in lpfc_param_show()
4226 * -EINVAL val out of range in lpfc_param_show()
4231 if (val >= LPFC_USER_LINK_SPEED_16G && phba->cfg_topology == 4) { in lpfc_param_show()
4236 phba->cfg_topology = 0; in lpfc_param_show()
4248 phba->cfg_link_speed = val; in lpfc_param_show()
4255 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_param_show()
4256 return -EINVAL; in lpfc_param_show()
4273 * lpfc_aer_support_store - Set the adapter for aer support in lpfc_param_show()
4297 * -EINVAL if val out of range or intended mode is not supported. in lpfc_param_show()
4304 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_param_show()
4305 struct lpfc_hba *phba = vport->phba; in lpfc_param_show()
4306 int val = 0, rc = -EINVAL; in lpfc_param_show()
4309 return -EINVAL; in lpfc_param_show()
4311 return -EINVAL; in lpfc_param_show()
4315 if (phba->hba_flag & HBA_AER_ENABLED) { in lpfc_param_show()
4316 rc = pci_disable_pcie_error_reporting(phba->pcidev); in lpfc_param_show()
4318 spin_lock_irq(&phba->hbalock); in lpfc_param_show()
4319 phba->hba_flag &= ~HBA_AER_ENABLED; in lpfc_param_show()
4320 spin_unlock_irq(&phba->hbalock); in lpfc_param_show()
4321 phba->cfg_aer_support = 0; in lpfc_param_show()
4324 rc = -EPERM; in lpfc_param_show()
4326 phba->cfg_aer_support = 0; in lpfc_param_show()
4331 if (!(phba->hba_flag & HBA_AER_ENABLED)) { in lpfc_param_show()
4332 rc = pci_enable_pcie_error_reporting(phba->pcidev); in lpfc_param_show()
4334 spin_lock_irq(&phba->hbalock); in lpfc_param_show()
4335 phba->hba_flag |= HBA_AER_ENABLED; in lpfc_param_show()
4336 spin_unlock_irq(&phba->hbalock); in lpfc_param_show()
4337 phba->cfg_aer_support = 1; in lpfc_param_show()
4340 rc = -EPERM; in lpfc_param_show()
4342 phba->cfg_aer_support = 1; in lpfc_param_show()
4347 rc = -EINVAL; in lpfc_param_show()
4356 * lpfc_aer_cleanup_state - Clean up aer state to the aer enabled device
4371 * -EINVAL if the buf does not contain the 1 or the device is not currently
4379 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_aer_cleanup_state()
4380 struct lpfc_hba *phba = vport->phba; in lpfc_aer_cleanup_state()
4381 int val, rc = -1; in lpfc_aer_cleanup_state()
4384 return -EINVAL; in lpfc_aer_cleanup_state()
4386 return -EINVAL; in lpfc_aer_cleanup_state()
4388 return -EINVAL; in lpfc_aer_cleanup_state()
4390 if (phba->hba_flag & HBA_AER_ENABLED) in lpfc_aer_cleanup_state()
4391 rc = pci_aer_clear_nonfatal_status(phba->pcidev); in lpfc_aer_cleanup_state()
4396 return -EPERM; in lpfc_aer_cleanup_state()
4403 * lpfc_sriov_nr_virtfn_store - Enable the adapter for sr-iov virtual functions
4412 * try to enable or disable SR-IOV virtual functions according to the
4422 * cfg_sriov_nr_virtfn; otherwise, -EINVAL shall be returned and driver
4425 * If none-zero virtual functions have already been enabled to the
4427 * -EINVAL will be returned and the driver does nothing;
4429 * If the nr_vfn provided is zero and none-zero virtual functions have
4439 * -EINVAL if val out of range or intended mode is not supported.
4446 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sriov_nr_virtfn_store()
4447 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_nr_virtfn_store()
4448 struct pci_dev *pdev = phba->pcidev; in lpfc_sriov_nr_virtfn_store()
4449 int val = 0, rc = -EINVAL; in lpfc_sriov_nr_virtfn_store()
4453 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4455 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4457 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4461 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4463 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4469 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4473 phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4474 return -EEXIST; in lpfc_sriov_nr_virtfn_store()
4478 phba->cfg_sriov_nr_virtfn = val; in lpfc_sriov_nr_virtfn_store()
4483 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4486 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4488 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4489 rc = -EPERM; in lpfc_sriov_nr_virtfn_store()
4497 "Enable PCIe device SR-IOV virtual fn");
4503 * lpfc_request_firmware_upgrade_store - Request for Linux generic firmware upgrade
4515 * -EINVAL if val out of range or intended mode is not supported.
4523 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_request_firmware_upgrade_store()
4524 struct lpfc_hba *phba = vport->phba; in lpfc_request_firmware_upgrade_store()
4529 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4531 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4533 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4537 rc = -EPERM; in lpfc_request_firmware_upgrade_store()
4549 * lpfc_request_firmware_upgrade_init - Enable initial linux generic fw upgrade in lpfc_param_show()
4558 * -EINVAL val out of range in lpfc_param_show()
4564 phba->cfg_request_firmware_upgrade = val; in lpfc_param_show()
4567 return -EINVAL; in lpfc_param_show()
4587 * 0 - on success
4588 * -EIO - if command is not sent
4595 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_force_rscn_store()
4600 return -EIO; in lpfc_force_rscn_store()
4617 * lpfc_force_rscn_init - Force an RSCN to be sent to all remote NPorts in lpfc_param_show()
4636 * @buf: string with the number of fast-path FCP interrupts per second.
4641 * maximum number of fast-path FCP interrupts per second.
4646 * -EINVAL if val out of range or intended mode is not supported.
4653 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_imax_store()
4654 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_imax_store()
4660 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_fcp_imax_store()
4661 return -EINVAL; in lpfc_fcp_imax_store()
4665 return -EINVAL; in lpfc_fcp_imax_store()
4667 return -EINVAL; in lpfc_fcp_imax_store()
4675 return -EINVAL; in lpfc_fcp_imax_store()
4677 phba->cfg_auto_imax = (val) ? 0 : 1; in lpfc_fcp_imax_store()
4678 if (phba->cfg_fcp_imax && !val) { in lpfc_fcp_imax_store()
4679 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_fcp_imax_store()
4683 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_fcp_imax_store()
4684 eqi->icnt = 0; in lpfc_fcp_imax_store()
4688 phba->cfg_fcp_imax = (uint32_t)val; in lpfc_fcp_imax_store()
4690 if (phba->cfg_fcp_imax) in lpfc_fcp_imax_store()
4691 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_fcp_imax_store()
4695 for (i = 0; i < phba->cfg_irq_chann; i += LPFC_MAX_EQ_DELAY_EQID_CNT) in lpfc_fcp_imax_store()
4703 # lpfc_fcp_imax: The maximum number of fast-path FCP interrupts per second
4715 * lpfc_fcp_imax_init - Set the initial sr-iov virtual function enable in lpfc_param_show()
4721 * maximum number of fast-path FCP interrupts per second. in lpfc_param_show()
4725 * -EINVAL val out of range in lpfc_param_show()
4730 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_param_show()
4731 phba->cfg_fcp_imax = 0; in lpfc_param_show()
4737 phba->cfg_fcp_imax = val; in lpfc_param_show()
4744 phba->cfg_fcp_imax = LPFC_DEF_IMAX; in lpfc_param_show()
4764 * -ERANGE: if val is not in the valid range
4765 * -EINVAL: if bad value format or intended mode is not supported.
4772 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_cq_max_proc_limit_store()
4773 struct lpfc_hba *phba = vport->phba; in lpfc_cq_max_proc_limit_store()
4779 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_store()
4780 return -EINVAL; in lpfc_cq_max_proc_limit_store()
4784 return -EINVAL; in lpfc_cq_max_proc_limit_store()
4786 return -EINVAL; in lpfc_cq_max_proc_limit_store()
4789 return -ERANGE; in lpfc_cq_max_proc_limit_store()
4791 phba->cfg_cq_max_proc_limit = (uint32_t)val; in lpfc_cq_max_proc_limit_store()
4794 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_cq_max_proc_limit_store()
4796 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_cq_max_proc_limit_store()
4800 list_for_each_entry(cq, &eq->child_list, list) in lpfc_cq_max_proc_limit_store()
4801 cq->max_proc_limit = min(phba->cfg_cq_max_proc_limit, in lpfc_cq_max_proc_limit_store()
4802 cq->entry_count); in lpfc_cq_max_proc_limit_store()
4822 * than re-enabling interrupts.
4830 * lpfc_cq_max_proc_limit_init - Set the initial cq max_proc_limit
4846 phba->cfg_cq_max_proc_limit = LPFC_CQ_DEF_MAX_PROC_LIMIT; in lpfc_cq_max_proc_limit_init()
4848 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_init()
4852 phba->cfg_cq_max_proc_limit = val; in lpfc_cq_max_proc_limit_init()
4859 phba->cfg_cq_max_proc_limit); in lpfc_cq_max_proc_limit_init()
4867 * lpfc_fcp_cpu_map_show - Display current driver CPU affinity
4879 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_cpu_map_show()
4880 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_cpu_map_show()
4884 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_fcp_cpu_map_show()
4885 (phba->intr_type != MSIX)) in lpfc_fcp_cpu_map_show()
4888 switch (phba->cfg_fcp_cpu_map) { in lpfc_fcp_cpu_map_show()
4890 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
4892 phba->cfg_fcp_cpu_map); in lpfc_fcp_cpu_map_show()
4895 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
4896 "fcp_cpu_map: HBA centric mapping (%d): " in lpfc_fcp_cpu_map_show()
4898 phba->cfg_fcp_cpu_map, num_online_cpus(), in lpfc_fcp_cpu_map_show()
4900 phba->sli4_hba.num_possible_cpu); in lpfc_fcp_cpu_map_show()
4904 while (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
4905 phba->sli4_hba.num_possible_cpu) { in lpfc_fcp_cpu_map_show()
4906 cpup = &phba->sli4_hba.cpu_map[phba->sli4_hba.curr_disp_cpu]; in lpfc_fcp_cpu_map_show()
4908 if (!cpu_present(phba->sli4_hba.curr_disp_cpu)) in lpfc_fcp_cpu_map_show()
4909 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
4910 "CPU %02d not present\n", in lpfc_fcp_cpu_map_show()
4911 phba->sli4_hba.curr_disp_cpu); in lpfc_fcp_cpu_map_show()
4912 else if (cpup->eq == LPFC_VECTOR_MAP_EMPTY) { in lpfc_fcp_cpu_map_show()
4913 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
4915 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
4916 "CPU %02d hdwq None " in lpfc_fcp_cpu_map_show()
4918 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
4919 cpup->phys_id, cpup->core_id, in lpfc_fcp_cpu_map_show()
4920 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
4921 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
4924 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
4925 "CPU %02d EQ None hdwq %04d " in lpfc_fcp_cpu_map_show()
4927 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
4928 cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
4929 cpup->core_id, in lpfc_fcp_cpu_map_show()
4930 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
4931 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
4933 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
4935 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
4936 "CPU %02d hdwq None " in lpfc_fcp_cpu_map_show()
4938 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
4939 cpup->phys_id, in lpfc_fcp_cpu_map_show()
4940 cpup->core_id, in lpfc_fcp_cpu_map_show()
4941 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
4942 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
4943 lpfc_get_irq(cpup->eq)); in lpfc_fcp_cpu_map_show()
4946 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
4947 "CPU %02d EQ %04d hdwq %04d " in lpfc_fcp_cpu_map_show()
4949 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
4950 cpup->eq, cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
4951 cpup->core_id, in lpfc_fcp_cpu_map_show()
4952 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
4953 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
4954 lpfc_get_irq(cpup->eq)); in lpfc_fcp_cpu_map_show()
4957 phba->sli4_hba.curr_disp_cpu++; in lpfc_fcp_cpu_map_show()
4960 if (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
4961 phba->sli4_hba.num_possible_cpu && in lpfc_fcp_cpu_map_show()
4962 (len >= (PAGE_SIZE - 64))) { in lpfc_fcp_cpu_map_show()
4964 PAGE_SIZE - len, "more...\n"); in lpfc_fcp_cpu_map_show()
4969 if (phba->sli4_hba.curr_disp_cpu == phba->sli4_hba.num_possible_cpu) in lpfc_fcp_cpu_map_show()
4970 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_fcp_cpu_map_show()
4976 * lpfc_fcp_cpu_map_store - Change CPU affinity of driver vectors
4983 * -EINVAL - Not implemented yet.
4989 return -EINVAL; in lpfc_fcp_cpu_map_store()
4997 # 0 - Do not affinitze IRQ vectors
4998 # 1 - Affintize HBA vectors with respect to each HBA
5008 * lpfc_fcp_cpu_map_init - Set the initial sr-iov virtual function enable
5013 * If val is in a valid range [0-2], then affinitze the adapter's
5018 * -EINVAL val out of range
5023 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_fcp_cpu_map_init()
5024 phba->cfg_fcp_cpu_map = 0; in lpfc_fcp_cpu_map_init()
5029 phba->cfg_fcp_cpu_map = val; in lpfc_fcp_cpu_map_init()
5036 phba->cfg_fcp_cpu_map = LPFC_HBA_CPU_MAP; in lpfc_fcp_cpu_map_init()
5071 * Parameter supported on physical port only - no NPIV support.
5092 # the parameter is set to a non-zero value, the I/O queue depth is controlled
5106 if (val == vport->cfg_max_scsicmpl_time) in lpfc_max_scsicmpl_time_set()
5109 return -EINVAL; in lpfc_max_scsicmpl_time_set()
5110 vport->cfg_max_scsicmpl_time = val; in lpfc_max_scsicmpl_time_set()
5112 spin_lock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5113 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_max_scsicmpl_time_set()
5114 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) in lpfc_max_scsicmpl_time_set()
5116 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_max_scsicmpl_time_set()
5118 spin_unlock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5142 * current CPU.
5147 * The driver dynamically sets this to 1 (BY_CPU) if it's able to set up cpu
5149 * CPU. Otherwise, the default 0 (Round Robin) scheduling of FCP/NVME I/Os
5156 "issuing commands [0] - Hardware Queue, [1] - Current CPU");
5168 "[0] - GID_FT, [1] - GID_PT");
5174 # For [1], bus reset issues target reset to non-FCP2 devices
5177 "FCP2 devices [0] - issue tgt reset, [1] - no tgt reset");
5230 # Traditional FDMI support means the driver will assume FDMI-2 support;
5231 # however, if that fails, it will fallback to FDMI-1.
5255 # there are FC targets, such as JBODs, that only recognize 8-bits of
5288 # 2 = MSI-X enabled (default)
5292 "MSI-X (2), if possible");
5351 * lpfc_cpumask_irq_mode_init - initalizes cpumask of phba based on
5358 unsigned int cpu, first_cpu, numa_node = NUMA_NO_NODE; in lpfc_cpumask_irq_mode_init() local
5360 struct cpumask *aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_cpumask_irq_mode_init()
5364 if (phba->irq_chann_mode == NUMA_MODE) { in lpfc_cpumask_irq_mode_init()
5366 numa_node = dev_to_node(&phba->pcidev->dev); in lpfc_cpumask_irq_mode_init()
5368 phba->irq_chann_mode = NORMAL_MODE; in lpfc_cpumask_irq_mode_init()
5373 for_each_possible_cpu(cpu) { in lpfc_cpumask_irq_mode_init()
5374 switch (phba->irq_chann_mode) { in lpfc_cpumask_irq_mode_init()
5376 if (cpu_to_node(cpu) == numa_node) in lpfc_cpumask_irq_mode_init()
5377 cpumask_set_cpu(cpu, aff_mask); in lpfc_cpumask_irq_mode_init()
5380 sibling_mask = topology_sibling_cpumask(cpu); in lpfc_cpumask_irq_mode_init()
5399 phba->irq_chann_mode = NUMA_MODE; in lpfc_assign_default_irq_chann()
5403 phba->irq_chann_mode = NHT_MODE; in lpfc_assign_default_irq_chann()
5406 phba->irq_chann_mode = NORMAL_MODE; in lpfc_assign_default_irq_chann()
5411 phba->irq_chann_mode = NORMAL_MODE; in lpfc_assign_default_irq_chann()
5418 * of EQ / MSI-X vectors the driver will create. This should never be
5433 /* lpfc_irq_chann_init - Set the hba irq_chann initial value
5444 * -EINVAL if value was out of range
5451 if (phba->cfg_use_msi != 2) { in lpfc_irq_chann_init()
5454 phba->cfg_use_msi); in lpfc_irq_chann_init()
5455 phba->irq_chann_mode = NORMAL_MODE; in lpfc_irq_chann_init()
5456 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5462 phba->cfg_hdw_queue == LPFC_HBA_HDWQ_DEF && in lpfc_irq_chann_init()
5463 phba->sli_rev == LPFC_SLI_REV4) in lpfc_irq_chann_init()
5466 if (phba->irq_chann_mode != NORMAL_MODE) { in lpfc_irq_chann_init()
5467 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_chann_init()
5473 phba->irq_chann_mode); in lpfc_irq_chann_init()
5474 phba->irq_chann_mode = NORMAL_MODE; in lpfc_irq_chann_init()
5475 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5477 phba->cfg_irq_chann = cpumask_weight(aff_mask); in lpfc_irq_chann_init()
5482 if (phba->irq_chann_mode == NHT_MODE) in lpfc_irq_chann_init()
5483 phba->cfg_hdw_queue = phba->cfg_irq_chann; in lpfc_irq_chann_init()
5487 "(mode: %d)\n", phba->cfg_irq_chann, in lpfc_irq_chann_init()
5488 phba->irq_chann_mode); in lpfc_irq_chann_init()
5499 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5500 return -EINVAL; in lpfc_irq_chann_init()
5502 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_irq_chann_init()
5503 phba->cfg_irq_chann = val; in lpfc_irq_chann_init()
5505 phba->cfg_irq_chann = 2; in lpfc_irq_chann_init()
5506 phba->cfg_hdw_queue = 1; in lpfc_irq_chann_init()
5514 * lpfc_irq_chann_show - Display value of irq_chann
5526 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_irq_chann_show()
5527 struct lpfc_hba *phba = vport->phba; in lpfc_irq_chann_show()
5529 return scnprintf(buf, PAGE_SIZE, "%u\n", phba->cfg_irq_chann); in lpfc_irq_chann_show()
5561 # 0x0 - 0x7f = CS_CTL field in FC header (high 7 bits)
5567 # lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF)
5576 # - Bit mask of host protection capabilities used to register with the
5577 # SCSI mid-layer
5578 # - Only meaningful if BG is turned on (lpfc_enable_bg=1).
5579 # - Allows you to ultimately specify which profiles to use
5580 # - Default will result in registering capabilities for all profiles.
5581 # - SHOST_DIF_TYPE1_PROTECTION 1
5583 # - SHOST_DIX_TYPE0_PROTECTION 8
5585 # - SHOST_DIX_TYPE1_PROTECTION 16
5597 "T10-DIF host protection capabilities mask");
5601 # - Bit mask of protection guard types to register with the SCSI mid-layer
5602 # - Guard types are currently either 1) T10-DIF CRC 2) IP checksum
5603 # - Allows you to ultimately specify which profiles to use
5604 # - Default will result in registering capabilities for all guard types
5609 "T10-DIF host protection guard type");
5617 * When this parameter is set to non-zero value, initial Nport discovery is
5629 * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
5633 * Because of the additional overhead involved in setting up T10-DIF,
5642 * lpfc_sg_seg_cnt_show - Display the scatter/gather list sizes
5655 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sg_seg_cnt_show()
5656 struct lpfc_hba *phba = vport->phba; in lpfc_sg_seg_cnt_show()
5660 phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); in lpfc_sg_seg_cnt_show()
5662 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_sg_seg_cnt_show()
5664 phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sg_seg_cnt_show()
5665 phba->cfg_nvme_seg_cnt); in lpfc_sg_seg_cnt_show()
5672 * lpfc_sg_seg_cnt_init - Set the hba sg_seg_cnt initial value
5683 * -EINVAL if value was out of range
5689 phba->cfg_sg_seg_cnt = val; in lpfc_sg_seg_cnt_init()
5696 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT; in lpfc_sg_seg_cnt_init()
5697 return -EINVAL; in lpfc_sg_seg_cnt_init()
5711 * [1-4] = Multiple of 1/4th Mb of host memory for FW logging
5724 return -EINVAL; in lpfc_ras_fwlog_buffsize_set()
5726 if (phba->cfg_ras_fwlog_buffsize == val) in lpfc_ras_fwlog_buffsize_set()
5729 if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn)) in lpfc_ras_fwlog_buffsize_set()
5730 return -EINVAL; in lpfc_ras_fwlog_buffsize_set()
5732 spin_lock_irq(&phba->hbalock); in lpfc_ras_fwlog_buffsize_set()
5733 state = phba->ras_fwlog.state; in lpfc_ras_fwlog_buffsize_set()
5734 spin_unlock_irq(&phba->hbalock); in lpfc_ras_fwlog_buffsize_set()
5739 return -EBUSY; in lpfc_ras_fwlog_buffsize_set()
5746 phba->cfg_ras_fwlog_buffsize = val; in lpfc_ras_fwlog_buffsize_set()
5753 if (phba->ras_fwlog.ras_enabled) in lpfc_ras_fwlog_buffsize_set()
5754 ret = lpfc_sli4_ras_fwlog_init(phba, phba->cfg_ras_fwlog_level, in lpfc_ras_fwlog_buffsize_set()
5796 int lpfc_use_cgn_signal = 1; /* 0 - only use FPINs, 1 - Use signals if avail */
5819 * 4 - 255 = vmid support enabled for 4-255 VMs
6022 * sysfs_ctlreg_write - Write method for writing to ctlreg
6035 * -ERANGE off and count combo out of range
6036 * -EINVAL off, count or buff address invalid
6037 * -EPERM adapter is offline
6048 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_write()
6049 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_write()
6051 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_write()
6052 return -EPERM; in sysfs_ctlreg_write()
6055 return -ERANGE; in sysfs_ctlreg_write()
6061 return -EINVAL; in sysfs_ctlreg_write()
6065 return -EINVAL; in sysfs_ctlreg_write()
6067 if (!(vport->fc_flag & FC_OFFLINE_MODE)) in sysfs_ctlreg_write()
6068 return -EPERM; in sysfs_ctlreg_write()
6070 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6071 for (buf_off = 0; buf_off < count - LPFC_REG_WRITE_KEY_SIZE; in sysfs_ctlreg_write()
6074 phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_write()
6076 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6082 * sysfs_ctlreg_read - Read method for reading from ctlreg
6095 * -ERANGE off and count combo out of range
6096 * -EINVAL off, count or buff address invalid
6108 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_read()
6109 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_read()
6111 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_read()
6112 return -EPERM; in sysfs_ctlreg_read()
6115 return -ERANGE; in sysfs_ctlreg_read()
6118 count = FF_REG_AREA_SIZE - off; in sysfs_ctlreg_read()
6123 return -EINVAL; in sysfs_ctlreg_read()
6125 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6129 *tmp_ptr = readl(phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_read()
6132 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6148 * sysfs_mbox_write - Write method for writing information via mbox
6161 * -EPERM operation not permitted
6168 return -EPERM; in sysfs_mbox_write()
6172 * sysfs_mbox_read - Read method for reading information via mbox
6185 * -EPERM operation not permitted
6192 return -EPERM; in sysfs_mbox_read()
6206 * lpfc_alloc_sysfs_attr - Creates the ctlreg and mbox entries
6220 if (vport->port_type == LPFC_NPIV_PORT) in lpfc_alloc_sysfs_attr()
6223 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6228 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6235 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_alloc_sysfs_attr()
6241 * lpfc_free_sysfs_attr - Removes the ctlreg and mbox entries
6250 if (vport->port_type == LPFC_NPIV_PORT) in lpfc_free_sysfs_attr()
6252 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr); in lpfc_free_sysfs_attr()
6253 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_free_sysfs_attr()
6261 * lpfc_get_host_symbolic_name - Copy symbolic name into the scsi host
6267 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_get_host_symbolic_name()
6274 * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
6280 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_id()
6282 /* note: fc_myDID already in cpu endianness */ in lpfc_get_host_port_id()
6283 fc_host_port_id(shost) = vport->fc_myDID; in lpfc_get_host_port_id()
6287 * lpfc_get_host_port_type - Set the value of the scsi host port type
6293 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_type()
6294 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_type()
6296 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_type()
6298 if (vport->port_type == LPFC_NPIV_PORT) { in lpfc_get_host_port_type()
6301 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_host_port_type()
6302 if (vport->fc_flag & FC_PUBLIC_LOOP) in lpfc_get_host_port_type()
6307 if (vport->fc_flag & FC_FABRIC) in lpfc_get_host_port_type()
6315 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_type()
6319 * lpfc_get_host_port_state - Set the value of the scsi host port state
6325 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_state()
6326 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_state()
6328 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_state()
6330 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_host_port_state()
6333 switch (phba->link_state) { in lpfc_get_host_port_state()
6342 if (vport->port_state < LPFC_VPORT_READY) in lpfc_get_host_port_state()
6358 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_state()
6362 * lpfc_get_host_speed - Set the value of the scsi host speed
6368 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_speed()
6369 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_speed()
6371 spin_lock_irq(shost->host_lock); in lpfc_get_host_speed()
6373 if ((lpfc_is_link_up(phba)) && (!(phba->hba_flag & HBA_FCOE_MODE))) { in lpfc_get_host_speed()
6374 switch(phba->fc_linkspeed) { in lpfc_get_host_speed()
6409 } else if (lpfc_is_link_up(phba) && (phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_get_host_speed()
6410 switch (phba->fc_linkspeed) { in lpfc_get_host_speed()
6436 spin_unlock_irq(shost->host_lock); in lpfc_get_host_speed()
6440 * lpfc_get_host_fabric_name - Set the value of the scsi host fabric name
6446 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_fabric_name()
6447 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_fabric_name()
6450 spin_lock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
6452 if ((vport->port_state > LPFC_FLOGI) && in lpfc_get_host_fabric_name()
6453 ((vport->fc_flag & FC_FABRIC) || in lpfc_get_host_fabric_name()
6454 ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) && in lpfc_get_host_fabric_name()
6455 (vport->fc_flag & FC_PUBLIC_LOOP)))) in lpfc_get_host_fabric_name()
6456 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); in lpfc_get_host_fabric_name()
6461 spin_unlock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
6467 * lpfc_get_stats - Return statistical information about the adapter
6481 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_stats()
6482 struct lpfc_hba *phba = vport->phba; in lpfc_get_stats()
6483 struct lpfc_sli *psli = &phba->sli; in lpfc_get_stats()
6484 struct fc_host_statistics *hs = &phba->link_stats; in lpfc_get_stats()
6485 struct lpfc_lnk_stat * lso = &psli->lnk_stat_offsets; in lpfc_get_stats()
6494 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_stats()
6495 !phba->mbox_mem_pool || in lpfc_get_stats()
6496 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_stats()
6499 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_stats()
6502 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_stats()
6507 pmb = &pmboxq->u.mb; in lpfc_get_stats()
6508 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_get_stats()
6509 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6510 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6511 pmboxq->vport = vport; in lpfc_get_stats()
6513 if (vport->fc_flag & FC_OFFLINE_MODE) { in lpfc_get_stats()
6516 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6520 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6523 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6530 hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt; in lpfc_get_stats()
6531 hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt; in lpfc_get_stats()
6540 if (pmb->un.varRdStatus.xkb & RD_ST_XKB) { in lpfc_get_stats()
6541 hs->tx_words = (u64) in lpfc_get_stats()
6542 ((((u64)(pmb->un.varRdStatus.xmit_xkb & in lpfc_get_stats()
6544 (u64)pmb->un.varRdStatus.xmitByteCnt) * in lpfc_get_stats()
6546 hs->rx_words = (u64) in lpfc_get_stats()
6547 ((((u64)(pmb->un.varRdStatus.rcv_xkb & in lpfc_get_stats()
6549 (u64)pmb->un.varRdStatus.rcvByteCnt) * in lpfc_get_stats()
6552 hs->tx_words = (uint64_t) in lpfc_get_stats()
6553 ((uint64_t)pmb->un.varRdStatus.xmitByteCnt in lpfc_get_stats()
6555 hs->rx_words = (uint64_t) in lpfc_get_stats()
6556 ((uint64_t)pmb->un.varRdStatus.rcvByteCnt in lpfc_get_stats()
6561 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_get_stats()
6562 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6563 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6564 pmboxq->vport = vport; in lpfc_get_stats()
6566 if (vport->fc_flag & FC_OFFLINE_MODE) { in lpfc_get_stats()
6569 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6573 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6576 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6581 hs->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_get_stats()
6582 hs->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_get_stats()
6583 hs->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_get_stats()
6584 hs->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_get_stats()
6585 hs->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_get_stats()
6586 hs->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6587 hs->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6589 hs->cn_sig_warn = atomic64_read(&phba->cgn_acqe_stat.warn); in lpfc_get_stats()
6590 hs->cn_sig_alarm = atomic64_read(&phba->cgn_acqe_stat.alarm); in lpfc_get_stats()
6592 hs->link_failure_count -= lso->link_failure_count; in lpfc_get_stats()
6593 hs->loss_of_sync_count -= lso->loss_of_sync_count; in lpfc_get_stats()
6594 hs->loss_of_signal_count -= lso->loss_of_signal_count; in lpfc_get_stats()
6595 hs->prim_seq_protocol_err_count -= lso->prim_seq_protocol_err_count; in lpfc_get_stats()
6596 hs->invalid_tx_word_count -= lso->invalid_tx_word_count; in lpfc_get_stats()
6597 hs->invalid_crc_count -= lso->invalid_crc_count; in lpfc_get_stats()
6598 hs->error_frames -= lso->error_frames; in lpfc_get_stats()
6600 if (phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_stats()
6601 hs->lip_count = -1; in lpfc_get_stats()
6602 hs->nos_count = (phba->link_events >> 1); in lpfc_get_stats()
6603 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6604 } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_stats()
6605 hs->lip_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6606 hs->lip_count -= lso->link_events; in lpfc_get_stats()
6607 hs->nos_count = -1; in lpfc_get_stats()
6609 hs->lip_count = -1; in lpfc_get_stats()
6610 hs->nos_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6611 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6614 hs->dumped_frames = -1; in lpfc_get_stats()
6616 hs->seconds_since_last_reset = ktime_get_seconds() - psli->stats_start; in lpfc_get_stats()
6618 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6624 * lpfc_reset_stats - Copy the adapter link stats information
6630 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_reset_stats()
6631 struct lpfc_hba *phba = vport->phba; in lpfc_reset_stats()
6632 struct lpfc_sli *psli = &phba->sli; in lpfc_reset_stats()
6633 struct lpfc_lnk_stat *lso = &psli->lnk_stat_offsets; in lpfc_reset_stats()
6638 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_reset_stats()
6641 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_reset_stats()
6646 pmb = &pmboxq->u.mb; in lpfc_reset_stats()
6647 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_reset_stats()
6648 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6649 pmb->un.varWords[0] = 0x1; /* reset request */ in lpfc_reset_stats()
6650 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6651 pmboxq->vport = vport; in lpfc_reset_stats()
6653 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6654 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) { in lpfc_reset_stats()
6657 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6661 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6664 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6670 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_reset_stats()
6671 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6672 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6673 pmboxq->vport = vport; in lpfc_reset_stats()
6675 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6676 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) { in lpfc_reset_stats()
6679 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6683 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6686 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6691 lso->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_reset_stats()
6692 lso->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_reset_stats()
6693 lso->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_reset_stats()
6694 lso->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_reset_stats()
6695 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_reset_stats()
6696 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6697 lso->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6698 if (phba->hba_flag & HBA_FCOE_MODE) in lpfc_reset_stats()
6699 lso->link_events = (phba->link_events >> 1); in lpfc_reset_stats()
6701 lso->link_events = (phba->fc_eventTag >> 1); in lpfc_reset_stats()
6703 atomic64_set(&phba->cgn_acqe_stat.warn, 0); in lpfc_reset_stats()
6704 atomic64_set(&phba->cgn_acqe_stat.alarm, 0); in lpfc_reset_stats()
6706 memset(&shost_to_fc_host(shost)->fpin_stats, 0, in lpfc_reset_stats()
6707 sizeof(shost_to_fc_host(shost)->fpin_stats)); in lpfc_reset_stats()
6709 psli->stats_start = ktime_get_seconds(); in lpfc_reset_stats()
6711 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6722 * lpfc_get_node_by_target - Return the nodelist for a target
6732 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in lpfc_get_node_by_target()
6733 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_node_by_target()
6736 spin_lock_irq(shost->host_lock); in lpfc_get_node_by_target()
6738 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_get_node_by_target()
6739 if (ndlp->nlp_state == NLP_STE_MAPPED_NODE && in lpfc_get_node_by_target()
6740 starget->id == ndlp->nlp_sid) { in lpfc_get_node_by_target()
6741 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
6745 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
6750 * lpfc_get_starget_port_id - Set the target port id to the ndlp DID or -1
6758 fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1; in lpfc_get_starget_port_id()
6762 * lpfc_get_starget_node_name - Set the target node name
6773 ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0; in lpfc_get_starget_node_name()
6777 * lpfc_get_starget_port_name - Set the target port name
6788 ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0; in lpfc_get_starget_port_name()
6792 * lpfc_set_rport_loss_tmo - Set the rport dev loss tmo
6803 struct lpfc_rport_data *rdata = rport->dd_data; in lpfc_set_rport_loss_tmo()
6804 struct lpfc_nodelist *ndlp = rdata->pnode; in lpfc_set_rport_loss_tmo()
6810 rport->dev_loss_tmo = timeout; in lpfc_set_rport_loss_tmo()
6812 rport->dev_loss_tmo = 1; in lpfc_set_rport_loss_tmo()
6815 dev_info(&rport->dev, "Cannot find remote node to " in lpfc_set_rport_loss_tmo()
6817 rport->port_id); in lpfc_set_rport_loss_tmo()
6824 if (nrport && nrport->remoteport) in lpfc_set_rport_loss_tmo()
6825 nvme_fc_set_remoteport_devloss(nrport->remoteport, in lpfc_set_rport_loss_tmo()
6826 rport->dev_loss_tmo); in lpfc_set_rport_loss_tmo()
6831 * lpfc_rport_show_function - Return rport target information
6849 struct lpfc_rport_data *rdata = rport->hostdata; \
6851 (rdata->target) ? cast rdata->target->field : 0); \
6859 * lpfc_set_vport_symbolic_name - Set the vport's symbolic name
6864 * has been changed. This function re-registers the symbolic name with the
6870 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; in lpfc_set_vport_symbolic_name()
6872 if (vport->port_state == LPFC_VPORT_READY) in lpfc_set_vport_symbolic_name()
6877 * lpfc_hba_log_verbose_init - Set hba's log verbose level
6889 phba->cfg_log_verbose = verbose; in lpfc_hba_log_verbose_init()
7025 * lpfc_get_hba_function_mode - Used to determine the HBA function in FCoE
7033 switch (phba->pcidev->device) { in lpfc_get_hba_function_mode()
7041 phba->hba_flag |= HBA_FCOE_MODE; in lpfc_get_hba_function_mode()
7045 phba->hba_flag &= ~HBA_FCOE_MODE; in lpfc_get_hba_function_mode()
7050 * lpfc_get_cfgparam - Used during probe_one to init the adapter structure
7094 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_get_cfgparam()
7095 phba->cfg_EnableXLane = 0; in lpfc_get_cfgparam()
7098 memset(phba->cfg_oas_tgt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7099 memset(phba->cfg_oas_vpt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7100 phba->cfg_oas_lun_state = 0; in lpfc_get_cfgparam()
7101 phba->cfg_oas_lun_status = 0; in lpfc_get_cfgparam()
7102 phba->cfg_oas_flags = 0; in lpfc_get_cfgparam()
7103 phba->cfg_oas_priority = 0; in lpfc_get_cfgparam()
7107 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_cfgparam()
7108 phba->cfg_poll = 0; in lpfc_get_cfgparam()
7110 phba->cfg_poll = lpfc_poll; in lpfc_get_cfgparam()
7116 if (phba->cfg_enable_bg && phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_cfgparam()
7120 phba->cfg_enable_bg = 0; in lpfc_get_cfgparam()
7121 } else if (phba->cfg_enable_bg) { in lpfc_get_cfgparam()
7122 phba->sli3_options |= LPFC_SLI3_BG_ENABLED; in lpfc_get_cfgparam()
7141 phba->cgn_p.cgn_param_mode = LPFC_CFG_OFF; in lpfc_get_cfgparam()
7142 phba->cmf_active_mode = LPFC_CFG_OFF; in lpfc_get_cfgparam()
7147 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_get_cfgparam()
7149 phba->nvmet_support = 0; in lpfc_get_cfgparam()
7150 phba->cfg_nvmet_mrq = 0; in lpfc_get_cfgparam()
7151 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7152 phba->cfg_enable_bbcr = 0; in lpfc_get_cfgparam()
7153 phba->cfg_xri_rebalancing = 0; in lpfc_get_cfgparam()
7156 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_cfgparam()
7157 phba->cfg_enable_fc4_type |= LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7160 phba->cfg_auto_imax = (phba->cfg_fcp_imax) ? 0 : 1; in lpfc_get_cfgparam()
7162 phba->cfg_enable_pbde = 0; in lpfc_get_cfgparam()
7165 if (phba->cfg_hdw_queue == 0) in lpfc_get_cfgparam()
7166 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7167 if (phba->cfg_irq_chann == 0) in lpfc_get_cfgparam()
7168 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7169 if (phba->cfg_irq_chann > phba->cfg_hdw_queue && in lpfc_get_cfgparam()
7170 phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_cfgparam()
7171 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_get_cfgparam()
7190 * lpfc_nvme_mod_param_dep - Adjust module parameter value based on
7199 if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu) { in lpfc_nvme_mod_param_dep()
7200 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7203 if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu) { in lpfc_nvme_mod_param_dep()
7204 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7207 if (phba->cfg_irq_chann > phba->cfg_hdw_queue) { in lpfc_nvme_mod_param_dep()
7208 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7213 "2006 Reducing Queues - CPU limitation: " in lpfc_nvme_mod_param_dep()
7215 phba->cfg_irq_chann, in lpfc_nvme_mod_param_dep()
7216 phba->cfg_hdw_queue); in lpfc_nvme_mod_param_dep()
7218 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_nvme_mod_param_dep()
7219 phba->nvmet_support) { in lpfc_nvme_mod_param_dep()
7220 phba->cfg_enable_fc4_type &= ~LPFC_ENABLE_FCP; in lpfc_nvme_mod_param_dep()
7225 phba->cfg_nvme_enable_fb, in lpfc_nvme_mod_param_dep()
7226 phba->cfg_nvmet_fb_size, in lpfc_nvme_mod_param_dep()
7229 if (phba->cfg_nvme_enable_fb == 0) in lpfc_nvme_mod_param_dep()
7230 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7232 if (phba->cfg_nvmet_fb_size > LPFC_NVMET_FB_SZ_MAX) in lpfc_nvme_mod_param_dep()
7233 phba->cfg_nvmet_fb_size = LPFC_NVMET_FB_SZ_MAX; in lpfc_nvme_mod_param_dep()
7236 if (!phba->cfg_nvmet_mrq) in lpfc_nvme_mod_param_dep()
7237 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7240 if (phba->cfg_nvmet_mrq > phba->cfg_hdw_queue) { in lpfc_nvme_mod_param_dep()
7241 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7244 phba->cfg_nvmet_mrq); in lpfc_nvme_mod_param_dep()
7246 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_nvme_mod_param_dep()
7247 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_nvme_mod_param_dep()
7251 phba->nvmet_support = 0; in lpfc_nvme_mod_param_dep()
7252 phba->cfg_nvmet_mrq = 0; in lpfc_nvme_mod_param_dep()
7253 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7258 * lpfc_get_vport_cfgparam - Used during port create, init the vport structure