Lines Matching +full:attr +full:- +full:cnt +full:- +full:name
4 * Copyright (C) 2017-2023 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()
118 lpfc_cmf_info_show(struct device *dev, struct device_attribute *attr, in lpfc_cmf_info_show() argument
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()
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()
136 "CMF %d cnt %d\n", in lpfc_cmf_info_show()
137 phba->sli4_hba.pc_sli4_params.mi_cap, 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()
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
297 * @attr: device attribute, not used.
303 lpfc_drvr_version_show(struct device *dev, struct device_attribute *attr, in lpfc_drvr_version_show() argument
310 * lpfc_enable_fip_show - Return the fip mode of the HBA
312 * @attr: device attribute, not used.
318 lpfc_enable_fip_show(struct device *dev, struct device_attribute *attr, in lpfc_enable_fip_show() argument
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()
332 lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, in lpfc_nvme_info_show() argument
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()
703 lpfc_scsi_stat_show(struct device *dev, struct device_attribute *attr, in lpfc_scsi_stat_show() argument
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()
754 lpfc_bg_info_show(struct device *dev, struct device_attribute *attr, in lpfc_bg_info_show() argument
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()
774 lpfc_bg_guard_err_show(struct device *dev, struct device_attribute *attr, in lpfc_bg_guard_err_show() argument
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()
786 lpfc_bg_apptag_err_show(struct device *dev, struct device_attribute *attr, in lpfc_bg_apptag_err_show() argument
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()
798 lpfc_bg_reftag_err_show(struct device *dev, struct device_attribute *attr, in lpfc_bg_reftag_err_show() argument
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
812 * @attr: device attribute, not used.
818 lpfc_info_show(struct device *dev, struct device_attribute *attr, in lpfc_info_show() argument
827 * lpfc_serialnum_show - Return the hba serial number in ascii
829 * @attr: device attribute, not used.
835 lpfc_serialnum_show(struct device *dev, struct device_attribute *attr, in lpfc_serialnum_show() argument
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
848 * @attr: device attribute, not used.
858 lpfc_temp_sensor_show(struct device *dev, struct device_attribute *attr, in lpfc_temp_sensor_show() argument
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
870 * @attr: device attribute, not used.
876 lpfc_modeldesc_show(struct device *dev, struct device_attribute *attr, in lpfc_modeldesc_show() argument
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
889 * @attr: device attribute, not used.
890 * @buf: on return contains the scsi vpd model name.
895 lpfc_modelname_show(struct device *dev, struct device_attribute *attr, in lpfc_modelname_show() argument
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
908 * @attr: device attribute, not used.
914 lpfc_programtype_show(struct device *dev, struct device_attribute *attr, in lpfc_programtype_show() argument
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
927 * @attr: device attribute, not used.
933 lpfc_vportnum_show(struct device *dev, struct device_attribute *attr, in lpfc_vportnum_show() argument
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
946 * @attr: device attribute, not used.
952 lpfc_fwrev_show(struct device *dev, struct device_attribute *attr, in lpfc_fwrev_show() argument
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
980 * @attr: device attribute, not used.
986 lpfc_hdw_show(struct device *dev, struct device_attribute *attr, char *buf) in lpfc_hdw_show() argument
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
1002 * @attr: device attribute, not used.
1008 lpfc_option_rom_version_show(struct device *dev, struct device_attribute *attr, in lpfc_option_rom_version_show() argument
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
1027 * @attr: device attribute, not used.
1036 lpfc_link_state_show(struct device *dev, struct device_attribute *attr, in lpfc_link_state_show() argument
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
1162 * @attr: device attribute, not used.
1168 lpfc_sli4_protocol_show(struct device *dev, struct device_attribute *attr, in lpfc_sli4_protocol_show() argument
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
1191 * @attr: device attribute, not used.
1197 lpfc_oas_supported_show(struct device *dev, struct device_attribute *attr, in lpfc_oas_supported_show() argument
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
1211 * @attr: device attribute, not used.
1216 * -EINVAL if the buffer is not "up" or "down"
1217 * return from link state change function if non-zero
1221 lpfc_link_state_store(struct device *dev, struct device_attribute *attr, in lpfc_link_state_store() argument
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
1246 * @attr: device attribute, not used.
1257 struct device_attribute *attr, char *buf) in lpfc_num_discovered_ports_show() argument
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()
1339 int cnt = 0; in lpfc_emptyq_wait() local
1345 if (cnt++ > 250) { /* 5 secs */ in lpfc_emptyq_wait()
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
1576 * @attr: device attribute, not used.
1590 * -EINVAL if the buffer does not contain the string "selective"
1591 * length of buf if lpfc-selective_reset() if the call succeeds
1595 lpfc_issue_reset(struct device *dev, struct device_attribute *attr, in lpfc_issue_reset() argument
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()
1651 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1656 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1671 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1675 * lpfc_sli4_pdev_reg_request - Request physical dev to perform a register acc
1680 * Request SLI4 interface type-2 device to perform a physical register set
1690 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pdev_reg_request()
1697 if (!phba->cfg_enable_hba_reset) in lpfc_sli4_pdev_reg_request()
1698 return -EACCES; in lpfc_sli4_pdev_reg_request()
1700 if ((phba->sli_rev < LPFC_SLI_REV4) || in lpfc_sli4_pdev_reg_request()
1701 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_pdev_reg_request()
1703 return -EPERM; in lpfc_sli4_pdev_reg_request()
1706 before_fc_flag = phba->pport->fc_flag; in lpfc_sli4_pdev_reg_request()
1707 sriov_nr_virtfn = phba->cfg_sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1711 phba->fw_dump_cmpl = &online_compl; in lpfc_sli4_pdev_reg_request()
1713 /* Disable SR-IOV virtual functions if enabled */ in lpfc_sli4_pdev_reg_request()
1714 if (phba->cfg_sriov_nr_virtfn) { in lpfc_sli4_pdev_reg_request()
1716 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_pdev_reg_request()
1728 reg_val = readl(phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1738 writel(reg_val, phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1741 readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); in lpfc_sli4_pdev_reg_request()
1746 if (rc == -EPERM) { in lpfc_sli4_pdev_reg_request()
1751 } else if (rc == -EIO) { in lpfc_sli4_pdev_reg_request()
1756 if (phba->fw_dump_cmpl) in lpfc_sli4_pdev_reg_request()
1757 phba->fw_dump_cmpl = NULL; in lpfc_sli4_pdev_reg_request()
1763 if (phba->fw_dump_cmpl) in lpfc_sli4_pdev_reg_request()
1764 phba->fw_dump_cmpl = NULL; in lpfc_sli4_pdev_reg_request()
1773 wait_for_completion(phba->fw_dump_cmpl); in lpfc_sli4_pdev_reg_request()
1789 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_pdev_reg_request()
1795 phba->cfg_sriov_nr_virtfn = sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1801 rc = -ENOMEM; in lpfc_sli4_pdev_reg_request()
1803 rc = -EIO; in lpfc_sli4_pdev_reg_request()
1809 * lpfc_nport_evt_cnt_show - Return the number of nport events
1811 * @attr: device attribute, not used.
1817 lpfc_nport_evt_cnt_show(struct device *dev, struct device_attribute *attr, in lpfc_nport_evt_cnt_show() argument
1821 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nport_evt_cnt_show()
1822 struct lpfc_hba *phba = vport->phba; in lpfc_nport_evt_cnt_show()
1824 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); in lpfc_nport_evt_cnt_show()
1845 return -EINVAL; /* Invalid command */ in lpfc_set_trunking()
1859 return -EINVAL; in lpfc_set_trunking()
1865 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_set_trunking()
1867 return -ENOMEM; in lpfc_set_trunking()
1874 &mbox->u.mqe.un.set_trunk_mode, in lpfc_set_trunking()
1881 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_set_trunking()
1887 lpfc_xcvr_data_show(struct device *dev, struct device_attribute *attr, in lpfc_xcvr_data_show() argument
1891 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_xcvr_data_show()
1892 struct lpfc_hba *phba = vport->phba; in lpfc_xcvr_data_show()
1910 len = scnprintf(buf, PAGE_SIZE - len, "SFP info NA:\n"); in lpfc_xcvr_data_show()
1914 strscpy(chbuf, &rdp_context->page_a0[SSF_VENDOR_NAME], 16); in lpfc_xcvr_data_show()
1916 len = scnprintf(buf, PAGE_SIZE - len, "VendorName:\t%s\n", chbuf); in lpfc_xcvr_data_show()
1917 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_xcvr_data_show()
1918 "VendorOUI:\t%02x-%02x-%02x\n", in lpfc_xcvr_data_show()
1919 (uint8_t)rdp_context->page_a0[SSF_VENDOR_OUI], in lpfc_xcvr_data_show()
1920 (uint8_t)rdp_context->page_a0[SSF_VENDOR_OUI + 1], in lpfc_xcvr_data_show()
1921 (uint8_t)rdp_context->page_a0[SSF_VENDOR_OUI + 2]); in lpfc_xcvr_data_show()
1922 strscpy(chbuf, &rdp_context->page_a0[SSF_VENDOR_PN], 16); in lpfc_xcvr_data_show()
1923 len += scnprintf(buf + len, PAGE_SIZE - len, "VendorPN:\t%s\n", chbuf); in lpfc_xcvr_data_show()
1924 strscpy(chbuf, &rdp_context->page_a0[SSF_VENDOR_SN], 16); in lpfc_xcvr_data_show()
1925 len += scnprintf(buf + len, PAGE_SIZE - len, "VendorSN:\t%s\n", chbuf); in lpfc_xcvr_data_show()
1926 strscpy(chbuf, &rdp_context->page_a0[SSF_VENDOR_REV], 4); in lpfc_xcvr_data_show()
1927 len += scnprintf(buf + len, PAGE_SIZE - len, "VendorRev:\t%s\n", chbuf); in lpfc_xcvr_data_show()
1928 strscpy(chbuf, &rdp_context->page_a0[SSF_DATE_CODE], 8); in lpfc_xcvr_data_show()
1929 len += scnprintf(buf + len, PAGE_SIZE - len, "DateCode:\t%s\n", chbuf); in lpfc_xcvr_data_show()
1930 len += scnprintf(buf + len, PAGE_SIZE - len, "Identifier:\t%xh\n", in lpfc_xcvr_data_show()
1931 (uint8_t)rdp_context->page_a0[SSF_IDENTIFIER]); in lpfc_xcvr_data_show()
1932 len += scnprintf(buf + len, PAGE_SIZE - len, "ExtIdentifier:\t%xh\n", in lpfc_xcvr_data_show()
1933 (uint8_t)rdp_context->page_a0[SSF_EXT_IDENTIFIER]); in lpfc_xcvr_data_show()
1934 len += scnprintf(buf + len, PAGE_SIZE - len, "Connector:\t%xh\n", in lpfc_xcvr_data_show()
1935 (uint8_t)rdp_context->page_a0[SSF_CONNECTOR]); in lpfc_xcvr_data_show()
1936 wavelength = (rdp_context->page_a0[SSF_WAVELENGTH_B1] << 8) | in lpfc_xcvr_data_show()
1937 rdp_context->page_a0[SSF_WAVELENGTH_B0]; in lpfc_xcvr_data_show()
1939 len += scnprintf(buf + len, PAGE_SIZE - len, "Wavelength:\t%d nm\n", in lpfc_xcvr_data_show()
1942 &rdp_context->page_a0[SSF_TRANSCEIVER_CODE_B7]; in lpfc_xcvr_data_show()
1944 len += scnprintf(buf + len, PAGE_SIZE - len, "Speeds: \t"); in lpfc_xcvr_data_show()
1946 len += scnprintf(buf + len, PAGE_SIZE - len, "Unknown\n"); in lpfc_xcvr_data_show()
1948 if (trasn_code_byte7->fc_sp_100MB) in lpfc_xcvr_data_show()
1949 len += scnprintf(buf + len, PAGE_SIZE - len, "1 "); in lpfc_xcvr_data_show()
1950 if (trasn_code_byte7->fc_sp_200mb) in lpfc_xcvr_data_show()
1951 len += scnprintf(buf + len, PAGE_SIZE - len, "2 "); in lpfc_xcvr_data_show()
1952 if (trasn_code_byte7->fc_sp_400MB) in lpfc_xcvr_data_show()
1953 len += scnprintf(buf + len, PAGE_SIZE - len, "4 "); in lpfc_xcvr_data_show()
1954 if (trasn_code_byte7->fc_sp_800MB) in lpfc_xcvr_data_show()
1955 len += scnprintf(buf + len, PAGE_SIZE - len, "8 "); in lpfc_xcvr_data_show()
1956 if (trasn_code_byte7->fc_sp_1600MB) in lpfc_xcvr_data_show()
1957 len += scnprintf(buf + len, PAGE_SIZE - len, "16 "); in lpfc_xcvr_data_show()
1958 if (trasn_code_byte7->fc_sp_3200MB) in lpfc_xcvr_data_show()
1959 len += scnprintf(buf + len, PAGE_SIZE - len, "32 "); in lpfc_xcvr_data_show()
1960 if (trasn_code_byte7->speed_chk_ecc) in lpfc_xcvr_data_show()
1961 len += scnprintf(buf + len, PAGE_SIZE - len, "64 "); in lpfc_xcvr_data_show()
1962 len += scnprintf(buf + len, PAGE_SIZE - len, "GB\n"); in lpfc_xcvr_data_show()
1964 temperature = (rdp_context->page_a2[SFF_TEMPERATURE_B1] << 8 | in lpfc_xcvr_data_show()
1965 rdp_context->page_a2[SFF_TEMPERATURE_B0]); in lpfc_xcvr_data_show()
1966 vcc = (rdp_context->page_a2[SFF_VCC_B1] << 8 | in lpfc_xcvr_data_show()
1967 rdp_context->page_a2[SFF_VCC_B0]); in lpfc_xcvr_data_show()
1968 tx_power = (rdp_context->page_a2[SFF_TXPOWER_B1] << 8 | in lpfc_xcvr_data_show()
1969 rdp_context->page_a2[SFF_TXPOWER_B0]); in lpfc_xcvr_data_show()
1970 tx_bias = (rdp_context->page_a2[SFF_TX_BIAS_CURRENT_B1] << 8 | in lpfc_xcvr_data_show()
1971 rdp_context->page_a2[SFF_TX_BIAS_CURRENT_B0]); in lpfc_xcvr_data_show()
1972 rx_power = (rdp_context->page_a2[SFF_RXPOWER_B1] << 8 | in lpfc_xcvr_data_show()
1973 rdp_context->page_a2[SFF_RXPOWER_B0]); in lpfc_xcvr_data_show()
1975 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_xcvr_data_show()
1977 len += scnprintf(buf + len, PAGE_SIZE - len, "Vcc:\t\tx%04x V\n", vcc); in lpfc_xcvr_data_show()
1978 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_xcvr_data_show()
1980 len += scnprintf(buf + len, PAGE_SIZE - len, "TxPower:\tx%04x mW\n", in lpfc_xcvr_data_show()
1982 len += scnprintf(buf + len, PAGE_SIZE - len, "RxPower:\tx%04x mW\n", in lpfc_xcvr_data_show()
1990 * lpfc_board_mode_show - Return the state of the board
1992 * @attr: device attribute, not used.
1998 lpfc_board_mode_show(struct device *dev, struct device_attribute *attr, in lpfc_board_mode_show() argument
2002 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_show()
2003 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_show()
2006 if (phba->link_state == LPFC_HBA_ERROR) in lpfc_board_mode_show()
2008 else if (phba->link_state == LPFC_WARM_START) in lpfc_board_mode_show()
2010 else if (phba->link_state == LPFC_INIT_START) in lpfc_board_mode_show()
2019 * lpfc_board_mode_store - Puts the hba in online, offline, warm or error state
2021 * @attr: device attribute, not used.
2026 * -EACCES if enable hba reset not enabled
2027 * -EINVAL if the buffer does not contain a valid string (see above)
2028 * -EIO if lpfc_workq_post_event() or lpfc_do_offline() fails
2032 lpfc_board_mode_store(struct device *dev, struct device_attribute *attr, in lpfc_board_mode_store() argument
2036 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_store()
2037 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_store()
2043 if (!phba->cfg_enable_hba_reset) { in lpfc_board_mode_store()
2044 status = -EACCES; in lpfc_board_mode_store()
2053 if(strncmp(buf, "online", sizeof("online") - 1) == 0) { in lpfc_board_mode_store()
2057 status = -ENOMEM; in lpfc_board_mode_store()
2062 status = -EIO; in lpfc_board_mode_store()
2063 } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) in lpfc_board_mode_store()
2065 else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) in lpfc_board_mode_store()
2066 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
2067 status = -EINVAL; in lpfc_board_mode_store()
2070 else if (strncmp(buf, "error", sizeof("error") - 1) == 0) in lpfc_board_mode_store()
2071 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
2072 status = -EINVAL; in lpfc_board_mode_store()
2075 else if (strncmp(buf, "dump", sizeof("dump") - 1) == 0) in lpfc_board_mode_store()
2077 else if (strncmp(buf, "fw_reset", sizeof("fw_reset") - 1) == 0) in lpfc_board_mode_store()
2079 else if (strncmp(buf, "dv_reset", sizeof("dv_reset") - 1) == 0) in lpfc_board_mode_store()
2081 else if (strncmp(buf, "pci_bus_reset", sizeof("pci_bus_reset") - 1) in lpfc_board_mode_store()
2084 else if (strncmp(buf, "heartbeat", sizeof("heartbeat") - 1) == 0) in lpfc_board_mode_store()
2086 else if (strncmp(buf, "trunk", sizeof("trunk") - 1) == 0) in lpfc_board_mode_store()
2089 status = -EINVAL; in lpfc_board_mode_store()
2101 buf, status, phba->pport->fc_flag); in lpfc_board_mode_store()
2107 * lpfc_get_hba_info - Return various bits of informaton about the adapter
2141 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_hba_info()
2142 !phba->mbox_mem_pool || in lpfc_get_hba_info()
2143 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_hba_info()
2146 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_hba_info()
2149 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_hba_info()
2154 pmb = &pmboxq->u.mb; in lpfc_get_hba_info()
2155 pmb->mbxCommand = MBX_READ_CONFIG; in lpfc_get_hba_info()
2156 pmb->mbxOwner = OWN_HOST; in lpfc_get_hba_info()
2157 pmboxq->ctx_buf = NULL; in lpfc_get_hba_info()
2159 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_hba_info()
2162 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_hba_info()
2166 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
2170 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_get_hba_info()
2171 sli4_hba = &phba->sli4_hba; in lpfc_get_hba_info()
2172 max_cfg_param = &sli4_hba->max_cfg_param; in lpfc_get_hba_info()
2175 if (!phba->sli4_hba.extents_in_use) { in lpfc_get_hba_info()
2177 *mrpi = max_cfg_param->max_rpi; in lpfc_get_hba_info()
2179 *mxri = max_cfg_param->max_xri; in lpfc_get_hba_info()
2181 max_vpi = max_cfg_param->max_vpi; in lpfc_get_hba_info()
2232 *mrpi = pmb->un.varRdConfig.max_rpi; in lpfc_get_hba_info()
2234 *arpi = pmb->un.varRdConfig.avail_rpi; in lpfc_get_hba_info()
2236 *mxri = pmb->un.varRdConfig.max_xri; in lpfc_get_hba_info()
2238 *axri = pmb->un.varRdConfig.avail_xri; in lpfc_get_hba_info()
2240 *mvpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
2243 if (phba->link_state == LPFC_HBA_READY) in lpfc_get_hba_info()
2244 *avpi = pmb->un.varRdConfig.avail_vpi; in lpfc_get_hba_info()
2246 *avpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
2254 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
2259 * lpfc_max_rpi_show - Return maximum rpi
2261 * @attr: device attribute, not used.
2273 lpfc_max_rpi_show(struct device *dev, struct device_attribute *attr, in lpfc_max_rpi_show() argument
2277 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_rpi_show()
2278 struct lpfc_hba *phba = vport->phba; in lpfc_max_rpi_show()
2279 uint32_t cnt; in lpfc_max_rpi_show() local
2281 if (lpfc_get_hba_info(phba, NULL, NULL, &cnt, NULL, NULL, NULL)) in lpfc_max_rpi_show()
2282 return scnprintf(buf, PAGE_SIZE, "%d\n", cnt); in lpfc_max_rpi_show()
2287 * lpfc_used_rpi_show - Return maximum rpi minus available rpi
2289 * @attr: device attribute, not used.
2301 lpfc_used_rpi_show(struct device *dev, struct device_attribute *attr, in lpfc_used_rpi_show() argument
2305 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_rpi_show()
2306 struct lpfc_hba *phba = vport->phba; in lpfc_used_rpi_show()
2309 u32 cnt = 0, acnt = 0; in lpfc_used_rpi_show() local
2311 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_used_rpi_show()
2312 sli4_hba = &phba->sli4_hba; in lpfc_used_rpi_show()
2313 max_cfg_param = &sli4_hba->max_cfg_param; in lpfc_used_rpi_show()
2315 max_cfg_param->rpi_used); in lpfc_used_rpi_show()
2317 if (lpfc_get_hba_info(phba, NULL, NULL, &cnt, &acnt, NULL, NULL)) in lpfc_used_rpi_show()
2318 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_rpi_show()
2324 * lpfc_max_xri_show - Return maximum xri
2326 * @attr: device attribute, not used.
2338 lpfc_max_xri_show(struct device *dev, struct device_attribute *attr, in lpfc_max_xri_show() argument
2342 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_xri_show()
2343 struct lpfc_hba *phba = vport->phba; in lpfc_max_xri_show()
2344 uint32_t cnt; in lpfc_max_xri_show() local
2346 if (lpfc_get_hba_info(phba, &cnt, NULL, NULL, NULL, NULL, NULL)) in lpfc_max_xri_show()
2347 return scnprintf(buf, PAGE_SIZE, "%d\n", cnt); in lpfc_max_xri_show()
2352 * lpfc_used_xri_show - Return maximum xpi minus the available xpi
2354 * @attr: device attribute, not used.
2366 lpfc_used_xri_show(struct device *dev, struct device_attribute *attr, in lpfc_used_xri_show() argument
2370 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_xri_show()
2371 struct lpfc_hba *phba = vport->phba; in lpfc_used_xri_show()
2374 u32 cnt = 0, acnt = 0; in lpfc_used_xri_show() local
2376 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_used_xri_show()
2377 sli4_hba = &phba->sli4_hba; in lpfc_used_xri_show()
2378 max_cfg_param = &sli4_hba->max_cfg_param; in lpfc_used_xri_show()
2380 max_cfg_param->xri_used); in lpfc_used_xri_show()
2382 if (lpfc_get_hba_info(phba, &cnt, &acnt, NULL, NULL, NULL, NULL)) in lpfc_used_xri_show()
2383 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_xri_show()
2389 * lpfc_max_vpi_show - Return maximum vpi
2391 * @attr: device attribute, not used.
2403 lpfc_max_vpi_show(struct device *dev, struct device_attribute *attr, in lpfc_max_vpi_show() argument
2407 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_vpi_show()
2408 struct lpfc_hba *phba = vport->phba; in lpfc_max_vpi_show()
2409 uint32_t cnt; in lpfc_max_vpi_show() local
2411 if (lpfc_get_hba_info(phba, NULL, NULL, NULL, NULL, &cnt, NULL)) in lpfc_max_vpi_show()
2412 return scnprintf(buf, PAGE_SIZE, "%d\n", cnt); in lpfc_max_vpi_show()
2417 * lpfc_used_vpi_show - Return maximum vpi minus the available vpi
2419 * @attr: device attribute, not used.
2431 lpfc_used_vpi_show(struct device *dev, struct device_attribute *attr, in lpfc_used_vpi_show() argument
2435 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_vpi_show()
2436 struct lpfc_hba *phba = vport->phba; in lpfc_used_vpi_show()
2439 u32 cnt = 0, acnt = 0; in lpfc_used_vpi_show() local
2441 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_used_vpi_show()
2442 sli4_hba = &phba->sli4_hba; in lpfc_used_vpi_show()
2443 max_cfg_param = &sli4_hba->max_cfg_param; in lpfc_used_vpi_show()
2445 max_cfg_param->vpi_used); in lpfc_used_vpi_show()
2447 if (lpfc_get_hba_info(phba, NULL, NULL, NULL, NULL, &cnt, &acnt)) in lpfc_used_vpi_show()
2448 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_vpi_show()
2454 * lpfc_npiv_info_show - Return text about NPIV support for the adapter
2456 * @attr: device attribute, not used.
2467 lpfc_npiv_info_show(struct device *dev, struct device_attribute *attr, in lpfc_npiv_info_show() argument
2471 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_npiv_info_show()
2472 struct lpfc_hba *phba = vport->phba; in lpfc_npiv_info_show()
2474 if (!(phba->max_vpi)) in lpfc_npiv_info_show()
2476 if (vport->port_type == LPFC_PHYSICAL_PORT) in lpfc_npiv_info_show()
2478 return scnprintf(buf, PAGE_SIZE, "NPIV Virtual (VPI %d)\n", vport->vpi); in lpfc_npiv_info_show()
2482 * lpfc_poll_show - Return text about poll support for the adapter
2484 * @attr: device attribute, not used.
2493 lpfc_poll_show(struct device *dev, struct device_attribute *attr, in lpfc_poll_show() argument
2497 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_show()
2498 struct lpfc_hba *phba = vport->phba; in lpfc_poll_show()
2500 return scnprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); in lpfc_poll_show()
2504 * lpfc_poll_store - Set the value of cfg_poll for the adapter
2506 * @attr: device attribute, not used.
2514 * -EINVAL if the buffer connot be converted or is out of range
2518 lpfc_poll_store(struct device *dev, struct device_attribute *attr, in lpfc_poll_store() argument
2522 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_store()
2523 struct lpfc_hba *phba = vport->phba; in lpfc_poll_store()
2529 return -EINVAL; in lpfc_poll_store()
2532 return -EINVAL; in lpfc_poll_store()
2535 return -EINVAL; in lpfc_poll_store()
2537 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_poll_store()
2542 phba->cfg_poll, val); in lpfc_poll_store()
2544 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2546 old_val = phba->cfg_poll; in lpfc_poll_store()
2551 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2552 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2553 return -EINVAL; in lpfc_poll_store()
2556 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2557 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2562 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2563 return -EINVAL; in lpfc_poll_store()
2569 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2570 del_timer(&phba->fcp_poll_timer); in lpfc_poll_store()
2571 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2572 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2573 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2574 return -EINVAL; in lpfc_poll_store()
2577 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2578 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2581 phba->cfg_poll = val; in lpfc_poll_store()
2583 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2589 * lpfc_sriov_hw_max_virtfn_show - Return maximum number of virtual functions
2591 * @attr: device attribute, not used.
2602 struct device_attribute *attr, in lpfc_sriov_hw_max_virtfn_show() argument
2606 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sriov_hw_max_virtfn_show()
2607 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_hw_max_virtfn_show()
2626 * -EINVAL if val is invalid
2631 if (lpfc_rangecheck(val, 0, 1) && phba->sli_rev == LPFC_SLI_REV4) { in lpfc_enable_bbcr_set()
2634 "%d\n", phba->cfg_enable_bbcr, val); in lpfc_enable_bbcr_set()
2635 phba->cfg_enable_bbcr = val; in lpfc_enable_bbcr_set()
2641 return -EINVAL; in lpfc_enable_bbcr_set()
2645 * lpfc_param_show - Return a cfg attribute value in decimal
2648 * Macro that given an attr e.g. hba_queue_depth expands
2649 * into a function with the name lpfc_hba_queue_depth_show.
2651 * lpfc_##attr##_show: Return the decimal value of an adapters cfg_xxx field.
2653 * @attr: device attribute, not used.
2658 #define lpfc_param_show(attr) \ argument
2660 lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
2664 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2665 struct lpfc_hba *phba = vport->phba;\
2667 phba->cfg_##attr);\
2671 * lpfc_param_hex_show - Return a cfg attribute value in hex
2674 * Macro that given an attr e.g. hba_queue_depth expands
2675 * into a function with the name lpfc_hba_queue_depth_show
2677 * lpfc_##attr##_show: Return the hex value of an adapters cfg_xxx field.
2679 * @attr: device attribute, not used.
2684 #define lpfc_param_hex_show(attr) \ argument
2686 lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
2690 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2691 struct lpfc_hba *phba = vport->phba;\
2693 val = phba->cfg_##attr;\
2695 phba->cfg_##attr);\
2699 * lpfc_param_init - Initializes a cfg attribute
2702 * Macro that given an attr e.g. hba_queue_depth expands
2703 * into a function with the name lpfc_hba_queue_depth_init. The macro also
2706 * lpfc_##attr##_init: Initializes an attribute.
2715 * -EINVAL if default used
2717 #define lpfc_param_init(attr, default, minval, maxval) \ argument
2719 lpfc_##attr##_init(struct lpfc_hba *phba, uint val) \
2722 phba->cfg_##attr = val;\
2726 "0449 lpfc_"#attr" attribute cannot be set to %d, "\
2728 phba->cfg_##attr = default;\
2729 return -EINVAL;\
2733 * lpfc_param_set - Set a cfg attribute value
2736 * Macro that given an attr e.g. hba_queue_depth expands
2737 * into a function with the name lpfc_hba_queue_depth_set
2739 * lpfc_##attr##_set: Sets an attribute value.
2750 * -EINVAL if val is invalid
2752 #define lpfc_param_set(attr, default, minval, maxval) \ argument
2754 lpfc_##attr##_set(struct lpfc_hba *phba, uint val) \
2758 "3052 lpfc_" #attr " changed from %d to %d\n", \
2759 phba->cfg_##attr, val); \
2760 phba->cfg_##attr = val;\
2764 "0450 lpfc_"#attr" attribute cannot be set to %d, "\
2766 return -EINVAL;\
2770 * lpfc_param_store - Set a vport attribute value
2773 * Macro that given an attr e.g. hba_queue_depth expands
2774 * into a function with the name lpfc_hba_queue_depth_store.
2776 * lpfc_##attr##_store: Set an sttribute value.
2778 * @attr: device attribute, not used.
2784 * use the lpfc_##attr##_set function to set the value.
2787 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2790 #define lpfc_param_store(attr) \ argument
2792 lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \
2796 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2797 struct lpfc_hba *phba = vport->phba;\
2800 return -EINVAL;\
2802 return -EINVAL;\
2803 if (lpfc_##attr##_set(phba, val) == 0) \
2806 return -EINVAL;\
2810 * lpfc_vport_param_show - Return decimal formatted cfg attribute value
2813 * Macro that given an attr e.g. hba_queue_depth expands
2814 * into a function with the name lpfc_hba_queue_depth_show
2816 * lpfc_##attr##_show: prints the attribute value in decimal.
2818 * @attr: device attribute, not used.
2823 #define lpfc_vport_param_show(attr) \ argument
2825 lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
2829 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2830 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
2834 * lpfc_vport_param_hex_show - Return hex formatted attribute value
2837 * Macro that given an attr e.g.
2838 * hba_queue_depth expands into a function with the name
2841 * lpfc_##attr##_show: prints the attribute value in hexadecimal.
2843 * @attr: device attribute, not used.
2848 #define lpfc_vport_param_hex_show(attr) \ argument
2850 lpfc_##attr##_show(struct device *dev, struct device_attribute *attr, \
2854 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2855 return scnprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
2859 * lpfc_vport_param_init - Initialize a vport cfg attribute
2862 * Macro that given an attr e.g. hba_queue_depth expands
2863 * into a function with the name lpfc_hba_queue_depth_init. The macro also
2866 * lpfc_##attr##_init: validates the min and max values then sets the
2874 * -EINVAL if default used
2876 #define lpfc_vport_param_init(attr, default, minval, maxval) \ argument
2878 lpfc_##attr##_init(struct lpfc_vport *vport, uint val) \
2881 vport->cfg_##attr = val;\
2885 "0423 lpfc_"#attr" attribute cannot be set to %d, "\
2887 vport->cfg_##attr = default;\
2888 return -EINVAL;\
2892 * lpfc_vport_param_set - Set a vport cfg attribute
2895 * Macro that given an attr e.g. hba_queue_depth expands
2896 * into a function with the name lpfc_hba_queue_depth_set
2898 * lpfc_##attr##_set: validates the min and max values then sets the
2906 * -EINVAL if val is invalid
2908 #define lpfc_vport_param_set(attr, default, minval, maxval) \ argument
2910 lpfc_##attr##_set(struct lpfc_vport *vport, uint val) \
2914 "3053 lpfc_" #attr \
2916 vport->cfg_##attr, vport->cfg_##attr, \
2918 vport->cfg_##attr = val;\
2922 "0424 lpfc_"#attr" attribute cannot be set to %d, "\
2924 return -EINVAL;\
2928 * lpfc_vport_param_store - Set a vport attribute
2931 * Macro that given an attr e.g. hba_queue_depth
2932 * expands into a function with the name lpfc_hba_queue_depth_store
2934 * lpfc_##attr##_store: convert the ascii text number to an integer, then
2935 * use the lpfc_##attr##_set function to set the value.
2941 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2944 #define lpfc_vport_param_store(attr) \ argument
2946 lpfc_##attr##_store(struct device *dev, struct device_attribute *attr, \
2950 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2953 return -EINVAL;\
2955 return -EINVAL;\
2956 if (lpfc_##attr##_set(vport, val) == 0) \
2959 return -EINVAL;\
3006 * lpfc_wwn_set - Convert string to the 8 byte WWN value.
3008 * @cnt: Length of string.
3012 * -EINVAL if the buffer does not contain a valid wwn
3016 lpfc_wwn_set(const char *buf, size_t cnt, char wwn[]) in lpfc_wwn_set() argument
3021 if (buf[cnt-1] == '\n') in lpfc_wwn_set()
3022 cnt--; in lpfc_wwn_set()
3024 if ((cnt < 16) || (cnt > 18) || ((cnt == 17) && (*buf++ != 'x')) || in lpfc_wwn_set()
3025 ((cnt == 18) && ((*buf++ != '0') || (*buf++ != 'x')))) in lpfc_wwn_set()
3026 return -EINVAL; in lpfc_wwn_set()
3030 /* Validate and store the new name */ in lpfc_wwn_set()
3033 j = ((j << 4) | ((*buf++ - 'a') + 10)); in lpfc_wwn_set()
3035 j = ((j << 4) | ((*buf++ - 'A') + 10)); in lpfc_wwn_set()
3037 j = ((j << 4) | (*buf++ - '0')); in lpfc_wwn_set()
3039 return -EINVAL; in lpfc_wwn_set()
3050 * lpfc_oas_tgt_show - Return wwpn of target whose luns maybe enabled for
3053 * @attr: device attribute, not used.
3060 lpfc_oas_tgt_show(struct device *dev, struct device_attribute *attr, in lpfc_oas_tgt_show() argument
3064 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_show()
3067 wwn_to_u64(phba->cfg_oas_tgt_wwpn)); in lpfc_oas_tgt_show()
3071 * lpfc_oas_tgt_store - Store wwpn of target whose luns maybe enabled for
3074 * @attr: device attribute, not used.
3079 * -EINVAL count is invalid, invalid wwpn byte invalid
3080 * -EPERM oas is not supported by hba
3084 lpfc_oas_tgt_store(struct device *dev, struct device_attribute *attr, in lpfc_oas_tgt_store() argument
3088 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_store()
3089 unsigned int cnt = count; in lpfc_oas_tgt_store() local
3093 if (!phba->cfg_fof) in lpfc_oas_tgt_store()
3094 return -EPERM; in lpfc_oas_tgt_store()
3097 if (buf[cnt-1] == '\n') in lpfc_oas_tgt_store()
3098 cnt--; in lpfc_oas_tgt_store()
3100 rc = lpfc_wwn_set(buf, cnt, wwpn); in lpfc_oas_tgt_store()
3104 memcpy(phba->cfg_oas_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
3105 memcpy(phba->sli4_hba.oas_next_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
3107 phba->cfg_oas_flags |= OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
3109 phba->cfg_oas_flags &= ~OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
3110 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_tgt_store()
3111 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_tgt_store()
3118 * lpfc_oas_priority_show - Return wwpn of target whose luns maybe enabled for
3121 * @attr: device attribute, not used.
3128 lpfc_oas_priority_show(struct device *dev, struct device_attribute *attr, in lpfc_oas_priority_show() argument
3132 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_show()
3134 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority); in lpfc_oas_priority_show()
3138 * lpfc_oas_priority_store - Store wwpn of target whose luns maybe enabled for
3141 * @attr: device attribute, not used.
3146 * -EINVAL count is invalid, invalid wwpn byte invalid
3147 * -EPERM oas is not supported by hba
3151 lpfc_oas_priority_store(struct device *dev, struct device_attribute *attr, in lpfc_oas_priority_store() argument
3155 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_store()
3156 unsigned int cnt = count; in lpfc_oas_priority_store() local
3160 if (!phba->cfg_fof) in lpfc_oas_priority_store()
3161 return -EPERM; in lpfc_oas_priority_store()
3164 if (buf[cnt-1] == '\n') in lpfc_oas_priority_store()
3165 cnt--; in lpfc_oas_priority_store()
3169 return -EINVAL; in lpfc_oas_priority_store()
3172 phba->cfg_oas_priority = (uint8_t)val; in lpfc_oas_priority_store()
3174 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_priority_store()
3181 * lpfc_oas_vpt_show - Return wwpn of vport whose targets maybe enabled
3184 * @attr: device attribute, not used.
3191 lpfc_oas_vpt_show(struct device *dev, struct device_attribute *attr, in lpfc_oas_vpt_show() argument
3195 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_show()
3198 wwn_to_u64(phba->cfg_oas_vpt_wwpn)); in lpfc_oas_vpt_show()
3202 * lpfc_oas_vpt_store - Store wwpn of vport whose targets maybe enabled
3205 * @attr: device attribute, not used.
3210 * -EINVAL count is invalid, invalid wwpn byte invalid
3211 * -EPERM oas is not supported by hba
3215 lpfc_oas_vpt_store(struct device *dev, struct device_attribute *attr, in lpfc_oas_vpt_store() argument
3219 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_store()
3220 unsigned int cnt = count; in lpfc_oas_vpt_store() local
3224 if (!phba->cfg_fof) in lpfc_oas_vpt_store()
3225 return -EPERM; in lpfc_oas_vpt_store()
3228 if (buf[cnt-1] == '\n') in lpfc_oas_vpt_store()
3229 cnt--; in lpfc_oas_vpt_store()
3231 rc = lpfc_wwn_set(buf, cnt, wwpn); in lpfc_oas_vpt_store()
3235 memcpy(phba->cfg_oas_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3236 memcpy(phba->sli4_hba.oas_next_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3238 phba->cfg_oas_flags |= OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3240 phba->cfg_oas_flags &= ~OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3241 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_vpt_store()
3242 if (phba->cfg_oas_priority == 0) in lpfc_oas_vpt_store()
3243 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_vpt_store()
3244 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_vpt_store()
3251 * lpfc_oas_lun_state_show - Return the current state (enabled or disabled)
3255 * @attr: device attribute, not used.
3262 lpfc_oas_lun_state_show(struct device *dev, struct device_attribute *attr, in lpfc_oas_lun_state_show() argument
3266 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_show()
3268 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_state); in lpfc_oas_lun_state_show()
3272 * lpfc_oas_lun_state_store - Store the state (enabled or disabled)
3276 * @attr: device attribute, not used.
3281 * -EINVAL count is invalid, invalid wwpn byte invalid
3282 * -EPERM oas is not supported by hba
3286 lpfc_oas_lun_state_store(struct device *dev, struct device_attribute *attr, in lpfc_oas_lun_state_store() argument
3290 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_store()
3293 if (!phba->cfg_fof) in lpfc_oas_lun_state_store()
3294 return -EPERM; in lpfc_oas_lun_state_store()
3297 return -EINVAL; in lpfc_oas_lun_state_store()
3300 return -EINVAL; in lpfc_oas_lun_state_store()
3303 return -EINVAL; in lpfc_oas_lun_state_store()
3305 phba->cfg_oas_lun_state = val; in lpfc_oas_lun_state_store()
3312 * lpfc_oas_lun_status_show - Return the status of the Optimized Access
3316 * @attr: device attribute, not used.
3323 lpfc_oas_lun_status_show(struct device *dev, struct device_attribute *attr, in lpfc_oas_lun_status_show() argument
3327 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_status_show()
3329 if (!(phba->cfg_oas_flags & OAS_LUN_VALID)) in lpfc_oas_lun_status_show()
3330 return -EFAULT; in lpfc_oas_lun_status_show()
3332 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_status); in lpfc_oas_lun_status_show()
3339 * lpfc_oas_lun_state_set - enable or disable a lun for Optimized Access Storage
3350 * -EPERM OAS is not enabled or not supported by this port.
3361 if (!phba->cfg_fof) in lpfc_oas_lun_state_set()
3362 return -EPERM; in lpfc_oas_lun_state_set()
3368 rc = -ENOMEM; in lpfc_oas_lun_state_set()
3378 * lpfc_oas_lun_get_next - get the next lun that has been enabled for Optimized
3404 phba->sli4_hba.oas_next_vpt_wwpn, in lpfc_oas_lun_get_next()
3406 phba->sli4_hba.oas_next_tgt_wwpn, in lpfc_oas_lun_get_next()
3407 &phba->sli4_hba.oas_next_lun, in lpfc_oas_lun_get_next()
3417 * lpfc_oas_lun_state_change - enable/disable a lun for OAS operations
3430 * -ENOMEM: failed to enable an lun for OAS operations
3431 * -EPERM: OAS is not enabled
3447 * lpfc_oas_lun_show - Return oas enabled luns from a chosen target
3449 * @attr: device attribute, not used.
3457 * -EFAULT: target or vport wwpn was not set properly.
3458 * -EPERM: oas is not enabled.
3461 lpfc_oas_lun_show(struct device *dev, struct device_attribute *attr, in lpfc_oas_lun_show() argument
3465 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_show()
3470 if (!phba->cfg_fof) in lpfc_oas_lun_show()
3471 return -EPERM; in lpfc_oas_lun_show()
3473 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_show()
3474 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_VPORT)) in lpfc_oas_lun_show()
3475 return -EFAULT; in lpfc_oas_lun_show()
3477 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_show()
3478 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_TARGET)) in lpfc_oas_lun_show()
3479 return -EFAULT; in lpfc_oas_lun_show()
3481 oas_lun = lpfc_oas_lun_get_next(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_show()
3482 phba->cfg_oas_tgt_wwpn, in lpfc_oas_lun_show()
3483 &phba->cfg_oas_lun_status, in lpfc_oas_lun_show()
3484 &phba->cfg_oas_priority); in lpfc_oas_lun_show()
3486 phba->cfg_oas_flags |= OAS_LUN_VALID; in lpfc_oas_lun_show()
3488 len += scnprintf(buf + len, PAGE_SIZE-len, "0x%llx", oas_lun); in lpfc_oas_lun_show()
3494 * lpfc_oas_lun_store - Sets the OAS state for lun
3496 * @attr: device attribute, not used.
3505 * -EFAULT: target or vport wwpn was not set properly.
3506 * -EPERM: oas is not enabled.
3510 lpfc_oas_lun_store(struct device *dev, struct device_attribute *attr, in lpfc_oas_lun_store() argument
3514 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_store()
3519 if (!phba->cfg_fof) in lpfc_oas_lun_store()
3520 return -EPERM; in lpfc_oas_lun_store()
3522 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_store()
3523 return -EFAULT; in lpfc_oas_lun_store()
3525 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_store()
3526 return -EFAULT; in lpfc_oas_lun_store()
3529 return -EINVAL; in lpfc_oas_lun_store()
3532 return -EINVAL; in lpfc_oas_lun_store()
3534 pri = phba->cfg_oas_priority; in lpfc_oas_lun_store()
3536 pri = phba->cfg_XLanePriority; in lpfc_oas_lun_store()
3541 wwn_to_u64(phba->cfg_oas_vpt_wwpn), in lpfc_oas_lun_store()
3542 wwn_to_u64(phba->cfg_oas_tgt_wwpn), scsi_lun, in lpfc_oas_lun_store()
3543 pri, phba->cfg_oas_lun_state); in lpfc_oas_lun_store()
3545 rc = lpfc_oas_lun_state_change(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_store()
3546 phba->cfg_oas_tgt_wwpn, scsi_lun, in lpfc_oas_lun_store()
3547 phba->cfg_oas_lun_state, pri); in lpfc_oas_lun_store()
3566 " 0 - none,"
3567 " 1 - poll with interrupts enabled"
3568 " 3 - poll and disable FCP ring interrupts");
3579 "SLI mode selector: 3 - select SLI-3");
3617 lpfc_pls_show(struct device *dev, struct device_attribute *attr, char *buf) in lpfc_pls_show() argument
3620 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pls_show()
3623 phba->sli4_hba.pc_sli4_params.pls); in lpfc_pls_show()
3629 lpfc_pt_show(struct device *dev, struct device_attribute *attr, char *buf) in lpfc_pt_show() argument
3632 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pt_show()
3635 (phba->hba_flag & HBA_PERSISTENT_TOPO) ? 1 : 0); in lpfc_pt_show()
3642 # 1 - (1024)
3643 # 2 - (2048)
3644 # 3 - (3072)
3645 # 4 - (4096)
3646 # 5 - (5120)
3649 lpfc_iocb_hw_show(struct device *dev, struct device_attribute *attr, char *buf) in lpfc_iocb_hw_show() argument
3652 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_iocb_hw_show()
3654 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max); in lpfc_iocb_hw_show()
3660 lpfc_txq_hw_show(struct device *dev, struct device_attribute *attr, char *buf) in lpfc_txq_hw_show() argument
3663 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txq_hw_show()
3667 pring ? pring->txq_max : 0); in lpfc_txq_hw_show()
3673 lpfc_txcmplq_hw_show(struct device *dev, struct device_attribute *attr, in lpfc_txcmplq_hw_show() argument
3677 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txcmplq_hw_show()
3681 pring ? pring->txcmplq_max : 0); in lpfc_txcmplq_hw_show()
3699 * lpfc_nodev_tmo_show - Return the hba dev loss timeout value
3701 * @attr: device attribute, not used.
3707 lpfc_nodev_tmo_show(struct device *dev, struct device_attribute *attr, in lpfc_nodev_tmo_show() argument
3711 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nodev_tmo_show()
3713 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); in lpfc_nodev_tmo_show()
3717 * lpfc_nodev_tmo_init - Set the hba nodev timeout value
3729 * -EINVAL val out of range
3734 if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { in lpfc_nodev_tmo_init()
3735 vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; in lpfc_nodev_tmo_init()
3745 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_init()
3746 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_init()
3753 vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; in lpfc_nodev_tmo_init()
3754 return -EINVAL; in lpfc_nodev_tmo_init()
3758 * lpfc_update_rport_devloss_tmo - Update dev loss tmo value
3775 spin_lock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3776 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_update_rport_devloss_tmo()
3777 if (ndlp->rport) in lpfc_update_rport_devloss_tmo()
3778 ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; in lpfc_update_rport_devloss_tmo()
3780 spin_lock(&ndlp->lock); in lpfc_update_rport_devloss_tmo()
3783 remoteport = rport->remoteport; in lpfc_update_rport_devloss_tmo()
3784 spin_unlock(&ndlp->lock); in lpfc_update_rport_devloss_tmo()
3787 vport->cfg_devloss_tmo); in lpfc_update_rport_devloss_tmo()
3790 spin_unlock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3794 * lpfc_nodev_tmo_set - Set the vport nodev tmo and devloss tmo values
3806 * -EINVAL val out of range
3811 if (vport->dev_loss_tmo_changed || in lpfc_nodev_tmo_set()
3819 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_set()
3820 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_set()
3833 return -EINVAL; in lpfc_nodev_tmo_set()
3854 * lpfc_devloss_tmo_set - Sets vport nodev tmo, devloss tmo values, changed bit in lpfc_vport_param_init()
3865 * -EINVAL val out of range in lpfc_vport_param_init()
3871 vport->cfg_nodev_tmo = val; in lpfc_vport_param_init()
3872 vport->cfg_devloss_tmo = val; in lpfc_vport_param_init()
3873 vport->dev_loss_tmo_changed = 1; in lpfc_vport_param_init()
3883 return -EINVAL; in lpfc_vport_param_init()
3920 * Supported Values: 1 - register just FCP
3921 * 3 - register both FCP and NVME
3926 "Enable FC4 Protocol support - FCP / NVME");
3935 "Verbose logging bit-mask");
3971 * -EINVAL if val is invalid
3980 return -EINVAL; in lpfc_tgt_queue_depth_set()
3982 if (val == vport->cfg_tgt_queue_depth) in lpfc_tgt_queue_depth_set()
3985 spin_lock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3986 vport->cfg_tgt_queue_depth = val; in lpfc_tgt_queue_depth_set()
3989 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) in lpfc_tgt_queue_depth_set()
3990 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_tgt_queue_depth_set()
3992 spin_unlock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
4040 * lpfc_restrict_login_init - Set the vport restrict login flag
4052 * -EINVAL val out of range
4062 vport->cfg_restrict_login = 1; in lpfc_restrict_login_init()
4063 return -EINVAL; in lpfc_restrict_login_init()
4065 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_restrict_login_init()
4066 vport->cfg_restrict_login = 0; in lpfc_restrict_login_init()
4069 vport->cfg_restrict_login = val; in lpfc_restrict_login_init()
4074 * lpfc_restrict_login_set - Set the vport restrict login flag
4087 * -EINVAL val out of range
4097 vport->cfg_restrict_login = 1; in lpfc_restrict_login_set()
4098 return -EINVAL; in lpfc_restrict_login_set()
4100 if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { in lpfc_restrict_login_set()
4104 vport->cfg_restrict_login = 0; in lpfc_restrict_login_set()
4107 vport->cfg_restrict_login = val; in lpfc_restrict_login_set()
4116 # Fibre channel "ALPA". In the FC-AL Profile there is an "informative
4122 # Turning on the scan-down variable (on = 1, off = 0) will
4135 # 0x0 = attempt loop mode then point-to-point
4137 # 0x02 = attempt point-to-point mode only
4139 # 0x06 = attempt point-to-point mode then loop
4140 # Set point-to-point mode if you want to run as an N_Port.
4148 * lpfc_topology_store - Set the adapters topology field
4150 * @attr:device attribute, not used.
4162 * non-zero return value from lpfc_issue_lip()
4163 * -EINVAL val out of range
4166 lpfc_topology_store(struct device *dev, struct device_attribute *attr, in lpfc_topology_store() argument
4170 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_topology_store()
4171 struct lpfc_hba *phba = vport->phba; in lpfc_topology_store()
4185 return -EINVAL; in lpfc_topology_store()
4187 return -EINVAL; in lpfc_topology_store()
4190 prev_val = phba->cfg_topology; in lpfc_topology_store()
4191 if (phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G && in lpfc_topology_store()
4196 return -EINVAL; in lpfc_topology_store()
4200 * - persistent topology enabled in lpfc_topology_store()
4201 * - ASIC_GEN_NUM >= 0xC, with no private loop support in lpfc_topology_store()
4204 &phba->sli4_hba.sli_intf); in lpfc_topology_store()
4206 &phba->sli4_hba.sli_intf); in lpfc_topology_store()
4207 if ((phba->hba_flag & HBA_PERSISTENT_TOPO || in lpfc_topology_store()
4208 (!phba->sli4_hba.pc_sli4_params.pls && in lpfc_topology_store()
4214 return -EINVAL; in lpfc_topology_store()
4216 phba->cfg_topology = val; in lpfc_topology_store()
4223 if (prev_val != val && phba->sli_rev == LPFC_SLI_REV4) in lpfc_topology_store()
4224 phba->fc_topology_changed = 1; in lpfc_topology_store()
4225 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_topology_store()
4227 phba->cfg_topology = prev_val; in lpfc_topology_store()
4228 return -EINVAL; in lpfc_topology_store()
4235 phba->brd_no, val); in lpfc_topology_store()
4236 return -EINVAL; in lpfc_topology_store()
4246 * @attr: device attribute structure.
4254 lpfc_static_vport_show(struct device *dev, struct device_attribute *attr, in lpfc_static_vport_show() argument
4258 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_static_vport_show()
4259 if (vport->vport_flag & STATIC_VPORT) in lpfc_static_vport_show()
4278 * lpfc_link_speed_store - Set the adapters link speed
4280 * @attr: Unused.
4293 * non-zero return value from lpfc_issue_lip()
4294 * -EINVAL val out of range
4297 lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, in lpfc_link_speed_store() argument
4301 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_speed_store()
4302 struct lpfc_hba *phba = vport->phba; in lpfc_link_speed_store()
4309 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_link_speed_store()
4311 phba->hba_flag & HBA_FORCED_LINK_SPEED) in lpfc_link_speed_store()
4312 return -EPERM; in lpfc_link_speed_store()
4320 return -EINVAL; in lpfc_link_speed_store()
4322 return -EINVAL; in lpfc_link_speed_store()
4326 phba->cfg_link_speed, val, nolip ? "(nolip)" : "(lip)"); in lpfc_link_speed_store()
4328 if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || in lpfc_link_speed_store()
4329 ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || in lpfc_link_speed_store()
4330 ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || in lpfc_link_speed_store()
4331 ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || in lpfc_link_speed_store()
4332 ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) || in lpfc_link_speed_store()
4333 ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb)) || in lpfc_link_speed_store()
4334 ((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb)) || in lpfc_link_speed_store()
4335 ((val == LPFC_USER_LINK_SPEED_64G) && !(phba->lmt & LMT_64Gb))) { in lpfc_link_speed_store()
4340 return -EINVAL; in lpfc_link_speed_store()
4343 phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_speed_store()
4348 return -EINVAL; in lpfc_link_speed_store()
4360 prev_val = phba->cfg_link_speed; in lpfc_link_speed_store()
4361 phba->cfg_link_speed = val; in lpfc_link_speed_store()
4365 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_link_speed_store()
4367 phba->cfg_link_speed = prev_val; in lpfc_link_speed_store()
4368 return -EINVAL; in lpfc_link_speed_store()
4379 return -EINVAL; in lpfc_link_speed_store()
4389 * lpfc_link_speed_init - Set the adapters link speed in lpfc_param_show()
4402 * -EINVAL val out of range in lpfc_param_show()
4407 if (val >= LPFC_USER_LINK_SPEED_16G && phba->cfg_topology == 4) { in lpfc_param_show()
4412 phba->cfg_topology = 0; in lpfc_param_show()
4424 phba->cfg_link_speed = val; in lpfc_param_show()
4431 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_param_show()
4432 return -EINVAL; in lpfc_param_show()
4444 # N.B. Parts of LPFC_ATTR open-coded since some of the underlying
4445 # infrastructure (phba->cfg_aer_support) is gone.
4451 lpfc_aer_support_show(struct device *dev, struct device_attribute *attr, in lpfc_aer_support_show() argument
4458 * lpfc_aer_support_store - Set the adapter for aer support
4461 * @attr: device attribute, not used.
4472 * -EINVAL if val out of range
4475 lpfc_aer_support_store(struct device *dev, struct device_attribute *attr, in lpfc_aer_support_store() argument
4481 return -EINVAL; in lpfc_aer_support_store()
4483 return -EINVAL; in lpfc_aer_support_store()
4492 * lpfc_aer_cleanup_state - Clean up aer state to the aer enabled device
4494 * @attr: device attribute, not used.
4506 * -EINVAL if the buf does not contain 1
4507 * -EPERM if the OS cannot clear AER error status, i.e., when platform
4511 lpfc_aer_cleanup_state(struct device *dev, struct device_attribute *attr, in lpfc_aer_cleanup_state() argument
4515 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_aer_cleanup_state()
4516 struct lpfc_hba *phba = vport->phba; in lpfc_aer_cleanup_state()
4517 int val, rc = -1; in lpfc_aer_cleanup_state()
4520 return -EINVAL; in lpfc_aer_cleanup_state()
4522 return -EINVAL; in lpfc_aer_cleanup_state()
4524 return -EINVAL; in lpfc_aer_cleanup_state()
4526 rc = pci_aer_clear_nonfatal_status(phba->pcidev); in lpfc_aer_cleanup_state()
4531 return -EPERM; in lpfc_aer_cleanup_state()
4538 * lpfc_sriov_nr_virtfn_store - Enable the adapter for sr-iov virtual functions
4541 * @attr: device attribute, not used.
4547 * try to enable or disable SR-IOV virtual functions according to the
4557 * cfg_sriov_nr_virtfn; otherwise, -EINVAL shall be returned and driver
4560 * If none-zero virtual functions have already been enabled to the
4562 * -EINVAL will be returned and the driver does nothing;
4564 * If the nr_vfn provided is zero and none-zero virtual functions have
4574 * -EINVAL if val out of range or intended mode is not supported.
4577 lpfc_sriov_nr_virtfn_store(struct device *dev, struct device_attribute *attr, in lpfc_sriov_nr_virtfn_store() argument
4581 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sriov_nr_virtfn_store()
4582 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_nr_virtfn_store()
4583 struct pci_dev *pdev = phba->pcidev; in lpfc_sriov_nr_virtfn_store()
4584 int val = 0, rc = -EINVAL; in lpfc_sriov_nr_virtfn_store()
4588 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4590 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4592 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4596 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4598 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4604 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4608 phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4609 return -EEXIST; in lpfc_sriov_nr_virtfn_store()
4613 phba->cfg_sriov_nr_virtfn = val; in lpfc_sriov_nr_virtfn_store()
4618 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4621 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4623 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4624 rc = -EPERM; in lpfc_sriov_nr_virtfn_store()
4632 "Enable PCIe device SR-IOV virtual fn");
4638 * lpfc_request_firmware_upgrade_store - Request for Linux generic firmware upgrade
4641 * @attr: device attribute, not used.
4650 * -EINVAL if val out of range or intended mode is not supported.
4654 struct device_attribute *attr, in lpfc_request_firmware_upgrade_store() argument
4658 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_request_firmware_upgrade_store()
4659 struct lpfc_hba *phba = vport->phba; in lpfc_request_firmware_upgrade_store()
4664 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4666 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4668 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4672 rc = -EPERM; in lpfc_request_firmware_upgrade_store()
4684 * lpfc_request_firmware_upgrade_init - Enable initial linux generic fw upgrade in lpfc_param_show()
4693 * -EINVAL val out of range in lpfc_param_show()
4699 phba->cfg_request_firmware_upgrade = val; in lpfc_param_show()
4702 return -EINVAL; in lpfc_param_show()
4712 * @attr: device attribute, not used.
4722 * 0 - on success
4723 * -EIO - if command is not sent
4726 lpfc_force_rscn_store(struct device *dev, struct device_attribute *attr, in lpfc_force_rscn_store() argument
4730 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_force_rscn_store()
4735 return -EIO; in lpfc_force_rscn_store()
4752 * lpfc_force_rscn_init - Force an RSCN to be sent to all remote NPorts in lpfc_param_show()
4770 * @attr: device attribute, not used.
4771 * @buf: string with the number of fast-path FCP interrupts per second.
4776 * maximum number of fast-path FCP interrupts per second.
4781 * -EINVAL if val out of range or intended mode is not supported.
4784 lpfc_fcp_imax_store(struct device *dev, struct device_attribute *attr, in lpfc_fcp_imax_store() argument
4788 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_imax_store()
4789 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_imax_store()
4795 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_fcp_imax_store()
4796 return -EINVAL; in lpfc_fcp_imax_store()
4800 return -EINVAL; in lpfc_fcp_imax_store()
4802 return -EINVAL; in lpfc_fcp_imax_store()
4810 return -EINVAL; in lpfc_fcp_imax_store()
4812 phba->cfg_auto_imax = (val) ? 0 : 1; in lpfc_fcp_imax_store()
4813 if (phba->cfg_fcp_imax && !val) { in lpfc_fcp_imax_store()
4814 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_fcp_imax_store()
4818 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_fcp_imax_store()
4819 eqi->icnt = 0; in lpfc_fcp_imax_store()
4823 phba->cfg_fcp_imax = (uint32_t)val; in lpfc_fcp_imax_store()
4825 if (phba->cfg_fcp_imax) in lpfc_fcp_imax_store()
4826 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_fcp_imax_store()
4830 for (i = 0; i < phba->cfg_irq_chann; i += LPFC_MAX_EQ_DELAY_EQID_CNT) in lpfc_fcp_imax_store()
4838 # lpfc_fcp_imax: The maximum number of fast-path FCP interrupts per second
4850 * lpfc_fcp_imax_init - Set the initial sr-iov virtual function enable in lpfc_param_show()
4856 * maximum number of fast-path FCP interrupts per second. in lpfc_param_show()
4860 * -EINVAL val out of range in lpfc_param_show()
4865 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_param_show()
4866 phba->cfg_fcp_imax = 0; in lpfc_param_show()
4872 phba->cfg_fcp_imax = val; in lpfc_param_show()
4879 phba->cfg_fcp_imax = LPFC_DEF_IMAX; in lpfc_param_show()
4890 * @attr: device attribute, not used.
4899 * -ERANGE: if val is not in the valid range
4900 * -EINVAL: if bad value format or intended mode is not supported.
4903 lpfc_cq_max_proc_limit_store(struct device *dev, struct device_attribute *attr, in lpfc_cq_max_proc_limit_store() argument
4907 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_cq_max_proc_limit_store()
4908 struct lpfc_hba *phba = vport->phba; in lpfc_cq_max_proc_limit_store()
4914 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_store()
4915 return -EINVAL; in lpfc_cq_max_proc_limit_store()
4919 return -EINVAL; in lpfc_cq_max_proc_limit_store()
4921 return -EINVAL; in lpfc_cq_max_proc_limit_store()
4924 return -ERANGE; in lpfc_cq_max_proc_limit_store()
4926 phba->cfg_cq_max_proc_limit = (uint32_t)val; in lpfc_cq_max_proc_limit_store()
4929 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_cq_max_proc_limit_store()
4931 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_cq_max_proc_limit_store()
4935 list_for_each_entry(cq, &eq->child_list, list) in lpfc_cq_max_proc_limit_store()
4936 cq->max_proc_limit = min(phba->cfg_cq_max_proc_limit, in lpfc_cq_max_proc_limit_store()
4937 cq->entry_count); in lpfc_cq_max_proc_limit_store()
4957 * than re-enabling interrupts.
4965 * lpfc_cq_max_proc_limit_init - Set the initial cq max_proc_limit
4981 phba->cfg_cq_max_proc_limit = LPFC_CQ_DEF_MAX_PROC_LIMIT; in lpfc_cq_max_proc_limit_init()
4983 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_init()
4987 phba->cfg_cq_max_proc_limit = val; in lpfc_cq_max_proc_limit_init()
4994 phba->cfg_cq_max_proc_limit); in lpfc_cq_max_proc_limit_init()
5002 * lpfc_fcp_cpu_map_show - Display current driver CPU affinity
5004 * @attr: device attribute, not used.
5010 lpfc_fcp_cpu_map_show(struct device *dev, struct device_attribute *attr, in lpfc_fcp_cpu_map_show() argument
5014 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_cpu_map_show()
5015 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_cpu_map_show()
5019 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_fcp_cpu_map_show()
5020 (phba->intr_type != MSIX)) in lpfc_fcp_cpu_map_show()
5023 switch (phba->cfg_fcp_cpu_map) { in lpfc_fcp_cpu_map_show()
5025 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
5027 phba->cfg_fcp_cpu_map); in lpfc_fcp_cpu_map_show()
5030 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
5033 phba->cfg_fcp_cpu_map, num_online_cpus(), in lpfc_fcp_cpu_map_show()
5035 phba->sli4_hba.num_possible_cpu); in lpfc_fcp_cpu_map_show()
5039 while (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
5040 phba->sli4_hba.num_possible_cpu) { in lpfc_fcp_cpu_map_show()
5041 cpup = &phba->sli4_hba.cpu_map[phba->sli4_hba.curr_disp_cpu]; in lpfc_fcp_cpu_map_show()
5043 if (!cpu_present(phba->sli4_hba.curr_disp_cpu)) in lpfc_fcp_cpu_map_show()
5044 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5046 phba->sli4_hba.curr_disp_cpu); in lpfc_fcp_cpu_map_show()
5047 else if (cpup->eq == LPFC_VECTOR_MAP_EMPTY) { in lpfc_fcp_cpu_map_show()
5048 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
5050 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5053 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5054 cpup->phys_id, cpup->core_id, in lpfc_fcp_cpu_map_show()
5055 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5056 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
5059 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5062 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5063 cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
5064 cpup->core_id, in lpfc_fcp_cpu_map_show()
5065 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5066 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
5068 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
5070 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5073 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5074 cpup->phys_id, in lpfc_fcp_cpu_map_show()
5075 cpup->core_id, in lpfc_fcp_cpu_map_show()
5076 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5077 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
5078 lpfc_get_irq(cpup->eq)); in lpfc_fcp_cpu_map_show()
5081 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5084 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5085 cpup->eq, cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
5086 cpup->core_id, in lpfc_fcp_cpu_map_show()
5087 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5088 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
5089 lpfc_get_irq(cpup->eq)); in lpfc_fcp_cpu_map_show()
5092 phba->sli4_hba.curr_disp_cpu++; in lpfc_fcp_cpu_map_show()
5095 if (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
5096 phba->sli4_hba.num_possible_cpu && in lpfc_fcp_cpu_map_show()
5097 (len >= (PAGE_SIZE - 64))) { in lpfc_fcp_cpu_map_show()
5099 PAGE_SIZE - len, "more...\n"); in lpfc_fcp_cpu_map_show()
5104 if (phba->sli4_hba.curr_disp_cpu == phba->sli4_hba.num_possible_cpu) in lpfc_fcp_cpu_map_show()
5105 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_fcp_cpu_map_show()
5111 * lpfc_fcp_cpu_map_store - Change CPU affinity of driver vectors
5113 * @attr: device attribute, not used.
5118 * -EINVAL - Not implemented yet.
5121 lpfc_fcp_cpu_map_store(struct device *dev, struct device_attribute *attr, in lpfc_fcp_cpu_map_store() argument
5124 return -EINVAL; in lpfc_fcp_cpu_map_store()
5132 # 0 - Do not affinitze IRQ vectors
5133 # 1 - Affintize HBA vectors with respect to each HBA
5143 * lpfc_fcp_cpu_map_init - Set the initial sr-iov virtual function enable
5148 * If val is in a valid range [0-2], then affinitze the adapter's
5153 * -EINVAL val out of range
5158 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_fcp_cpu_map_init()
5159 phba->cfg_fcp_cpu_map = 0; in lpfc_fcp_cpu_map_init()
5164 phba->cfg_fcp_cpu_map = val; in lpfc_fcp_cpu_map_init()
5171 phba->cfg_fcp_cpu_map = LPFC_HBA_CPU_MAP; in lpfc_fcp_cpu_map_init()
5206 * Parameter supported on physical port only - no NPIV support.
5227 # the parameter is set to a non-zero value, the I/O queue depth is controlled
5241 if (val == vport->cfg_max_scsicmpl_time) in lpfc_max_scsicmpl_time_set()
5244 return -EINVAL; in lpfc_max_scsicmpl_time_set()
5245 vport->cfg_max_scsicmpl_time = val; in lpfc_max_scsicmpl_time_set()
5247 spin_lock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5248 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_max_scsicmpl_time_set()
5249 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) in lpfc_max_scsicmpl_time_set()
5251 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_max_scsicmpl_time_set()
5253 spin_unlock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5291 "issuing commands [0] - Hardware Queue, [1] - Current CPU");
5303 "[0] - GID_FT, [1] - GID_PT");
5309 # For [1], bus reset issues target reset to non-FCP2 devices
5312 "FCP2 devices [0] - issue tgt reset, [1] - no tgt reset");
5365 # Traditional FDMI support means the driver will assume FDMI-2 support;
5366 # however, if that fails, it will fallback to FDMI-1.
5390 # there are FC targets, such as JBODs, that only recognize 8-bits of
5423 # 2 = MSI-X enabled (default)
5427 "MSI-X (2), if possible");
5486 * lpfc_cpumask_irq_mode_init - initalizes cpumask of phba based on
5495 struct cpumask *aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_cpumask_irq_mode_init()
5499 if (phba->irq_chann_mode == NUMA_MODE) { in lpfc_cpumask_irq_mode_init()
5501 numa_node = dev_to_node(&phba->pcidev->dev); in lpfc_cpumask_irq_mode_init()
5503 phba->irq_chann_mode = NORMAL_MODE; in lpfc_cpumask_irq_mode_init()
5509 switch (phba->irq_chann_mode) { in lpfc_cpumask_irq_mode_init()
5534 phba->irq_chann_mode = NUMA_MODE; in lpfc_assign_default_irq_chann()
5538 phba->irq_chann_mode = NHT_MODE; in lpfc_assign_default_irq_chann()
5541 phba->irq_chann_mode = NORMAL_MODE; in lpfc_assign_default_irq_chann()
5546 phba->irq_chann_mode = NORMAL_MODE; in lpfc_assign_default_irq_chann()
5553 * of EQ / MSI-X vectors the driver will create. This should never be
5568 /* lpfc_irq_chann_init - Set the hba irq_chann initial value
5579 * -EINVAL if value was out of range
5586 if (phba->cfg_use_msi != 2) { in lpfc_irq_chann_init()
5589 phba->cfg_use_msi); in lpfc_irq_chann_init()
5590 phba->irq_chann_mode = NORMAL_MODE; in lpfc_irq_chann_init()
5591 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5597 phba->cfg_hdw_queue == LPFC_HBA_HDWQ_DEF && in lpfc_irq_chann_init()
5598 phba->sli_rev == LPFC_SLI_REV4) in lpfc_irq_chann_init()
5601 if (phba->irq_chann_mode != NORMAL_MODE) { in lpfc_irq_chann_init()
5602 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_chann_init()
5608 phba->irq_chann_mode); in lpfc_irq_chann_init()
5609 phba->irq_chann_mode = NORMAL_MODE; in lpfc_irq_chann_init()
5610 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5612 phba->cfg_irq_chann = cpumask_weight(aff_mask); in lpfc_irq_chann_init()
5617 if (phba->irq_chann_mode == NHT_MODE) in lpfc_irq_chann_init()
5618 phba->cfg_hdw_queue = phba->cfg_irq_chann; in lpfc_irq_chann_init()
5622 "(mode: %d)\n", phba->cfg_irq_chann, in lpfc_irq_chann_init()
5623 phba->irq_chann_mode); in lpfc_irq_chann_init()
5634 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5635 return -EINVAL; in lpfc_irq_chann_init()
5637 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_irq_chann_init()
5638 phba->cfg_irq_chann = val; in lpfc_irq_chann_init()
5640 phba->cfg_irq_chann = 2; in lpfc_irq_chann_init()
5641 phba->cfg_hdw_queue = 1; in lpfc_irq_chann_init()
5649 * lpfc_irq_chann_show - Display value of irq_chann
5651 * @attr: device attribute, not used.
5657 lpfc_irq_chann_show(struct device *dev, struct device_attribute *attr, in lpfc_irq_chann_show() argument
5661 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_irq_chann_show()
5662 struct lpfc_hba *phba = vport->phba; in lpfc_irq_chann_show()
5664 return scnprintf(buf, PAGE_SIZE, "%u\n", phba->cfg_irq_chann); in lpfc_irq_chann_show()
5696 # 0x0 - 0x7f = CS_CTL field in FC header (high 7 bits)
5702 # lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF)
5711 # - Bit mask of host protection capabilities used to register with the
5712 # SCSI mid-layer
5713 # - Only meaningful if BG is turned on (lpfc_enable_bg=1).
5714 # - Allows you to ultimately specify which profiles to use
5715 # - Default will result in registering capabilities for all profiles.
5716 # - SHOST_DIF_TYPE1_PROTECTION 1
5718 # - SHOST_DIX_TYPE0_PROTECTION 8
5720 # - SHOST_DIX_TYPE1_PROTECTION 16
5732 "T10-DIF host protection capabilities mask");
5736 # - Bit mask of protection guard types to register with the SCSI mid-layer
5737 # - Guard types are currently either 1) T10-DIF CRC 2) IP checksum
5738 # - Allows you to ultimately specify which profiles to use
5739 # - Default will result in registering capabilities for all guard types
5744 "T10-DIF host protection guard type");
5748 * FLOGI/FDISC accept and FCID/Fabric name/Fabric portname is changed.
5752 * When this parameter is set to non-zero value, initial Nport discovery is
5754 * accept and FCID/Fabric name/Fabric portname is changed.
5757 * accept and FCID/Fabric name/Fabric portname is changed.
5764 * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
5768 * Because of the additional overhead involved in setting up T10-DIF,
5777 * lpfc_sg_seg_cnt_show - Display the scatter/gather list sizes
5780 * @attr: device attribute, not used.
5786 lpfc_sg_seg_cnt_show(struct device *dev, struct device_attribute *attr, in lpfc_sg_seg_cnt_show() argument
5790 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sg_seg_cnt_show()
5791 struct lpfc_hba *phba = vport->phba; in lpfc_sg_seg_cnt_show()
5795 phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); in lpfc_sg_seg_cnt_show()
5797 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_sg_seg_cnt_show()
5799 phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sg_seg_cnt_show()
5800 phba->cfg_nvme_seg_cnt); in lpfc_sg_seg_cnt_show()
5807 * lpfc_sg_seg_cnt_init - Set the hba sg_seg_cnt initial value
5818 * -EINVAL if value was out of range
5824 phba->cfg_sg_seg_cnt = val; in lpfc_sg_seg_cnt_init()
5831 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT; in lpfc_sg_seg_cnt_init()
5832 return -EINVAL; in lpfc_sg_seg_cnt_init()
5846 * [1-4] = Multiple of 1/4th Mb of host memory for FW logging
5859 return -EINVAL; in lpfc_ras_fwlog_buffsize_set()
5861 if (phba->cfg_ras_fwlog_buffsize == val) in lpfc_ras_fwlog_buffsize_set()
5864 if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn)) in lpfc_ras_fwlog_buffsize_set()
5865 return -EINVAL; in lpfc_ras_fwlog_buffsize_set()
5867 spin_lock_irq(&phba->hbalock); in lpfc_ras_fwlog_buffsize_set()
5868 state = phba->ras_fwlog.state; in lpfc_ras_fwlog_buffsize_set()
5869 spin_unlock_irq(&phba->hbalock); in lpfc_ras_fwlog_buffsize_set()
5874 return -EBUSY; in lpfc_ras_fwlog_buffsize_set()
5881 phba->cfg_ras_fwlog_buffsize = val; in lpfc_ras_fwlog_buffsize_set()
5888 if (phba->ras_fwlog.ras_enabled) in lpfc_ras_fwlog_buffsize_set()
5889 ret = lpfc_sli4_ras_fwlog_init(phba, phba->cfg_ras_fwlog_level, in lpfc_ras_fwlog_buffsize_set()
5931 int lpfc_use_cgn_signal = 1; /* 0 - only use FPINs, 1 - Use signals if avail */
5954 * 4 - 255 = vmid support enabled for 4-255 VMs
5991 &dev_attr_nvme_info.attr,
5992 &dev_attr_scsi_stat.attr,
5993 &dev_attr_bg_info.attr,
5994 &dev_attr_bg_guard_err.attr,
5995 &dev_attr_bg_apptag_err.attr,
5996 &dev_attr_bg_reftag_err.attr,
5997 &dev_attr_info.attr,
5998 &dev_attr_serialnum.attr,
5999 &dev_attr_modeldesc.attr,
6000 &dev_attr_modelname.attr,
6001 &dev_attr_programtype.attr,
6002 &dev_attr_portnum.attr,
6003 &dev_attr_fwrev.attr,
6004 &dev_attr_hdw.attr,
6005 &dev_attr_option_rom_version.attr,
6006 &dev_attr_link_state.attr,
6007 &dev_attr_num_discovered_ports.attr,
6008 &dev_attr_lpfc_drvr_version.attr,
6009 &dev_attr_lpfc_enable_fip.attr,
6010 &dev_attr_lpfc_temp_sensor.attr,
6011 &dev_attr_lpfc_log_verbose.attr,
6012 &dev_attr_lpfc_lun_queue_depth.attr,
6013 &dev_attr_lpfc_tgt_queue_depth.attr,
6014 &dev_attr_lpfc_hba_queue_depth.attr,
6015 &dev_attr_lpfc_peer_port_login.attr,
6016 &dev_attr_lpfc_nodev_tmo.attr,
6017 &dev_attr_lpfc_devloss_tmo.attr,
6018 &dev_attr_lpfc_enable_fc4_type.attr,
6019 &dev_attr_lpfc_fcp_class.attr,
6020 &dev_attr_lpfc_use_adisc.attr,
6021 &dev_attr_lpfc_first_burst_size.attr,
6022 &dev_attr_lpfc_ack0.attr,
6023 &dev_attr_lpfc_xri_rebalancing.attr,
6024 &dev_attr_lpfc_topology.attr,
6025 &dev_attr_lpfc_scan_down.attr,
6026 &dev_attr_lpfc_link_speed.attr,
6027 &dev_attr_lpfc_fcp_io_sched.attr,
6028 &dev_attr_lpfc_ns_query.attr,
6029 &dev_attr_lpfc_fcp2_no_tgt_reset.attr,
6030 &dev_attr_lpfc_cr_delay.attr,
6031 &dev_attr_lpfc_cr_count.attr,
6032 &dev_attr_lpfc_multi_ring_support.attr,
6033 &dev_attr_lpfc_multi_ring_rctl.attr,
6034 &dev_attr_lpfc_multi_ring_type.attr,
6035 &dev_attr_lpfc_fdmi_on.attr,
6036 &dev_attr_lpfc_enable_SmartSAN.attr,
6037 &dev_attr_lpfc_max_luns.attr,
6038 &dev_attr_lpfc_enable_npiv.attr,
6039 &dev_attr_lpfc_fcf_failover_policy.attr,
6040 &dev_attr_lpfc_enable_rrq.attr,
6041 &dev_attr_lpfc_fcp_wait_abts_rsp.attr,
6042 &dev_attr_nport_evt_cnt.attr,
6043 &dev_attr_board_mode.attr,
6044 &dev_attr_lpfc_xcvr_data.attr,
6045 &dev_attr_max_vpi.attr,
6046 &dev_attr_used_vpi.attr,
6047 &dev_attr_max_rpi.attr,
6048 &dev_attr_used_rpi.attr,
6049 &dev_attr_max_xri.attr,
6050 &dev_attr_used_xri.attr,
6051 &dev_attr_npiv_info.attr,
6052 &dev_attr_issue_reset.attr,
6053 &dev_attr_lpfc_poll.attr,
6054 &dev_attr_lpfc_poll_tmo.attr,
6055 &dev_attr_lpfc_task_mgmt_tmo.attr,
6056 &dev_attr_lpfc_use_msi.attr,
6057 &dev_attr_lpfc_nvme_oas.attr,
6058 &dev_attr_lpfc_nvme_embed_cmd.attr,
6059 &dev_attr_lpfc_fcp_imax.attr,
6060 &dev_attr_lpfc_force_rscn.attr,
6061 &dev_attr_lpfc_cq_poll_threshold.attr,
6062 &dev_attr_lpfc_cq_max_proc_limit.attr,
6063 &dev_attr_lpfc_fcp_cpu_map.attr,
6064 &dev_attr_lpfc_fcp_mq_threshold.attr,
6065 &dev_attr_lpfc_hdw_queue.attr,
6066 &dev_attr_lpfc_irq_chann.attr,
6067 &dev_attr_lpfc_suppress_rsp.attr,
6068 &dev_attr_lpfc_nvmet_mrq.attr,
6069 &dev_attr_lpfc_nvmet_mrq_post.attr,
6070 &dev_attr_lpfc_nvme_enable_fb.attr,
6071 &dev_attr_lpfc_nvmet_fb_size.attr,
6072 &dev_attr_lpfc_enable_bg.attr,
6073 &dev_attr_lpfc_enable_hba_reset.attr,
6074 &dev_attr_lpfc_enable_hba_heartbeat.attr,
6075 &dev_attr_lpfc_EnableXLane.attr,
6076 &dev_attr_lpfc_XLanePriority.attr,
6077 &dev_attr_lpfc_xlane_lun.attr,
6078 &dev_attr_lpfc_xlane_tgt.attr,
6079 &dev_attr_lpfc_xlane_vpt.attr,
6080 &dev_attr_lpfc_xlane_lun_state.attr,
6081 &dev_attr_lpfc_xlane_lun_status.attr,
6082 &dev_attr_lpfc_xlane_priority.attr,
6083 &dev_attr_lpfc_sg_seg_cnt.attr,
6084 &dev_attr_lpfc_max_scsicmpl_time.attr,
6085 &dev_attr_lpfc_aer_support.attr,
6086 &dev_attr_lpfc_aer_state_cleanup.attr,
6087 &dev_attr_lpfc_sriov_nr_virtfn.attr,
6088 &dev_attr_lpfc_req_fw_upgrade.attr,
6089 &dev_attr_lpfc_suppress_link_up.attr,
6090 &dev_attr_iocb_hw.attr,
6091 &dev_attr_pls.attr,
6092 &dev_attr_pt.attr,
6093 &dev_attr_txq_hw.attr,
6094 &dev_attr_txcmplq_hw.attr,
6095 &dev_attr_lpfc_sriov_hw_max_virtfn.attr,
6096 &dev_attr_protocol.attr,
6097 &dev_attr_lpfc_xlane_supported.attr,
6098 &dev_attr_lpfc_enable_mds_diags.attr,
6099 &dev_attr_lpfc_ras_fwlog_buffsize.attr,
6100 &dev_attr_lpfc_ras_fwlog_level.attr,
6101 &dev_attr_lpfc_ras_fwlog_func.attr,
6102 &dev_attr_lpfc_enable_bbcr.attr,
6103 &dev_attr_lpfc_enable_dpp.attr,
6104 &dev_attr_lpfc_enable_mi.attr,
6105 &dev_attr_cmf_info.attr,
6106 &dev_attr_lpfc_max_vmid.attr,
6107 &dev_attr_lpfc_vmid_inactivity_timeout.attr,
6108 &dev_attr_lpfc_vmid_app_header.attr,
6109 &dev_attr_lpfc_vmid_priority_tagging.attr,
6123 &dev_attr_info.attr,
6124 &dev_attr_link_state.attr,
6125 &dev_attr_num_discovered_ports.attr,
6126 &dev_attr_lpfc_drvr_version.attr,
6127 &dev_attr_lpfc_log_verbose.attr,
6128 &dev_attr_lpfc_lun_queue_depth.attr,
6129 &dev_attr_lpfc_tgt_queue_depth.attr,
6130 &dev_attr_lpfc_nodev_tmo.attr,
6131 &dev_attr_lpfc_devloss_tmo.attr,
6132 &dev_attr_lpfc_hba_queue_depth.attr,
6133 &dev_attr_lpfc_peer_port_login.attr,
6134 &dev_attr_lpfc_restrict_login.attr,
6135 &dev_attr_lpfc_fcp_class.attr,
6136 &dev_attr_lpfc_use_adisc.attr,
6137 &dev_attr_lpfc_first_burst_size.attr,
6138 &dev_attr_lpfc_max_luns.attr,
6139 &dev_attr_nport_evt_cnt.attr,
6140 &dev_attr_npiv_info.attr,
6141 &dev_attr_lpfc_enable_da_id.attr,
6142 &dev_attr_lpfc_max_scsicmpl_time.attr,
6143 &dev_attr_lpfc_static_vport.attr,
6144 &dev_attr_cmf_info.attr,
6158 * sysfs_ctlreg_write - Write method for writing to ctlreg
6171 * -ERANGE off and count combo out of range
6172 * -EINVAL off, count or buff address invalid
6173 * -EPERM adapter is offline
6184 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_write()
6185 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_write()
6187 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_write()
6188 return -EPERM; in sysfs_ctlreg_write()
6191 return -ERANGE; in sysfs_ctlreg_write()
6197 return -EINVAL; in sysfs_ctlreg_write()
6201 return -EINVAL; in sysfs_ctlreg_write()
6203 if (!(vport->fc_flag & FC_OFFLINE_MODE)) in sysfs_ctlreg_write()
6204 return -EPERM; in sysfs_ctlreg_write()
6206 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6207 for (buf_off = 0; buf_off < count - LPFC_REG_WRITE_KEY_SIZE; in sysfs_ctlreg_write()
6210 phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_write()
6212 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6218 * sysfs_ctlreg_read - Read method for reading from ctlreg
6231 * -ERANGE off and count combo out of range
6232 * -EINVAL off, count or buff address invalid
6244 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_read()
6245 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_read()
6247 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_read()
6248 return -EPERM; in sysfs_ctlreg_read()
6251 return -ERANGE; in sysfs_ctlreg_read()
6254 count = FF_REG_AREA_SIZE - off; in sysfs_ctlreg_read()
6259 return -EINVAL; in sysfs_ctlreg_read()
6261 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6265 *tmp_ptr = readl(phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_read()
6268 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6274 .attr = {
6275 .name = "ctlreg",
6284 * sysfs_mbox_write - Write method for writing information via mbox
6297 * -EPERM operation not permitted
6304 return -EPERM; in sysfs_mbox_write()
6308 * sysfs_mbox_read - Read method for reading information via mbox
6321 * -EPERM operation not permitted
6328 return -EPERM; in sysfs_mbox_read()
6332 .attr = {
6333 .name = "mbox",
6342 * lpfc_alloc_sysfs_attr - Creates the ctlreg and mbox entries
6356 if (vport->port_type == LPFC_NPIV_PORT) in lpfc_alloc_sysfs_attr()
6359 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6364 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6371 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_alloc_sysfs_attr()
6377 * lpfc_free_sysfs_attr - Removes the ctlreg and mbox entries
6386 if (vport->port_type == LPFC_NPIV_PORT) in lpfc_free_sysfs_attr()
6388 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr); in lpfc_free_sysfs_attr()
6389 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_free_sysfs_attr()
6397 * lpfc_get_host_symbolic_name - Copy symbolic name into the scsi host
6403 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_get_host_symbolic_name()
6410 * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
6416 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_id()
6419 fc_host_port_id(shost) = vport->fc_myDID; in lpfc_get_host_port_id()
6423 * lpfc_get_host_port_type - Set the value of the scsi host port type
6429 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_type()
6430 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_type()
6432 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_type()
6434 if (vport->port_type == LPFC_NPIV_PORT) { in lpfc_get_host_port_type()
6437 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_host_port_type()
6438 if (vport->fc_flag & FC_PUBLIC_LOOP) in lpfc_get_host_port_type()
6443 if (vport->fc_flag & FC_FABRIC) in lpfc_get_host_port_type()
6451 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_type()
6455 * lpfc_get_host_port_state - Set the value of the scsi host port state
6461 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_state()
6462 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_state()
6464 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_state()
6466 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_host_port_state()
6469 switch (phba->link_state) { in lpfc_get_host_port_state()
6478 if (vport->port_state < LPFC_VPORT_READY) in lpfc_get_host_port_state()
6494 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_state()
6498 * lpfc_get_host_speed - Set the value of the scsi host speed
6504 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_speed()
6505 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_speed()
6507 spin_lock_irq(shost->host_lock); in lpfc_get_host_speed()
6509 if ((lpfc_is_link_up(phba)) && (!(phba->hba_flag & HBA_FCOE_MODE))) { in lpfc_get_host_speed()
6510 switch(phba->fc_linkspeed) { in lpfc_get_host_speed()
6545 } else if (lpfc_is_link_up(phba) && (phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_get_host_speed()
6546 switch (phba->fc_linkspeed) { in lpfc_get_host_speed()
6572 spin_unlock_irq(shost->host_lock); in lpfc_get_host_speed()
6576 * lpfc_get_host_fabric_name - Set the value of the scsi host fabric name
6582 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_fabric_name()
6583 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_fabric_name()
6586 spin_lock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
6588 if ((vport->port_state > LPFC_FLOGI) && in lpfc_get_host_fabric_name()
6589 ((vport->fc_flag & FC_FABRIC) || in lpfc_get_host_fabric_name()
6590 ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) && in lpfc_get_host_fabric_name()
6591 (vport->fc_flag & FC_PUBLIC_LOOP)))) in lpfc_get_host_fabric_name()
6592 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); in lpfc_get_host_fabric_name()
6597 spin_unlock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
6603 * lpfc_get_stats - Return statistical information about the adapter
6617 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_stats()
6618 struct lpfc_hba *phba = vport->phba; in lpfc_get_stats()
6619 struct lpfc_sli *psli = &phba->sli; in lpfc_get_stats()
6620 struct fc_host_statistics *hs = &phba->link_stats; in lpfc_get_stats()
6621 struct lpfc_lnk_stat * lso = &psli->lnk_stat_offsets; in lpfc_get_stats()
6630 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_stats()
6631 !phba->mbox_mem_pool || in lpfc_get_stats()
6632 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_stats()
6635 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_stats()
6638 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_stats()
6643 pmb = &pmboxq->u.mb; in lpfc_get_stats()
6644 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_get_stats()
6645 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6646 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6647 pmboxq->vport = vport; in lpfc_get_stats()
6649 if (vport->fc_flag & FC_OFFLINE_MODE) { in lpfc_get_stats()
6652 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6656 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6659 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6666 hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt; in lpfc_get_stats()
6667 hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt; in lpfc_get_stats()
6676 if (pmb->un.varRdStatus.xkb & RD_ST_XKB) { in lpfc_get_stats()
6677 hs->tx_words = (u64) in lpfc_get_stats()
6678 ((((u64)(pmb->un.varRdStatus.xmit_xkb & in lpfc_get_stats()
6680 (u64)pmb->un.varRdStatus.xmitByteCnt) * in lpfc_get_stats()
6682 hs->rx_words = (u64) in lpfc_get_stats()
6683 ((((u64)(pmb->un.varRdStatus.rcv_xkb & in lpfc_get_stats()
6685 (u64)pmb->un.varRdStatus.rcvByteCnt) * in lpfc_get_stats()
6688 hs->tx_words = (uint64_t) in lpfc_get_stats()
6689 ((uint64_t)pmb->un.varRdStatus.xmitByteCnt in lpfc_get_stats()
6691 hs->rx_words = (uint64_t) in lpfc_get_stats()
6692 ((uint64_t)pmb->un.varRdStatus.rcvByteCnt in lpfc_get_stats()
6697 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_get_stats()
6698 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6699 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6700 pmboxq->vport = vport; in lpfc_get_stats()
6702 if (vport->fc_flag & FC_OFFLINE_MODE) { in lpfc_get_stats()
6705 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6709 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6712 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6717 hs->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_get_stats()
6718 hs->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_get_stats()
6719 hs->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_get_stats()
6720 hs->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_get_stats()
6721 hs->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_get_stats()
6722 hs->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6723 hs->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6725 hs->cn_sig_warn = atomic64_read(&phba->cgn_acqe_stat.warn); in lpfc_get_stats()
6726 hs->cn_sig_alarm = atomic64_read(&phba->cgn_acqe_stat.alarm); in lpfc_get_stats()
6728 hs->link_failure_count -= lso->link_failure_count; in lpfc_get_stats()
6729 hs->loss_of_sync_count -= lso->loss_of_sync_count; in lpfc_get_stats()
6730 hs->loss_of_signal_count -= lso->loss_of_signal_count; in lpfc_get_stats()
6731 hs->prim_seq_protocol_err_count -= lso->prim_seq_protocol_err_count; in lpfc_get_stats()
6732 hs->invalid_tx_word_count -= lso->invalid_tx_word_count; in lpfc_get_stats()
6733 hs->invalid_crc_count -= lso->invalid_crc_count; in lpfc_get_stats()
6734 hs->error_frames -= lso->error_frames; in lpfc_get_stats()
6736 if (phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_stats()
6737 hs->lip_count = -1; in lpfc_get_stats()
6738 hs->nos_count = (phba->link_events >> 1); in lpfc_get_stats()
6739 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6740 } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_stats()
6741 hs->lip_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6742 hs->lip_count -= lso->link_events; in lpfc_get_stats()
6743 hs->nos_count = -1; in lpfc_get_stats()
6745 hs->lip_count = -1; in lpfc_get_stats()
6746 hs->nos_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6747 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6750 hs->dumped_frames = -1; in lpfc_get_stats()
6752 hs->seconds_since_last_reset = ktime_get_seconds() - psli->stats_start; in lpfc_get_stats()
6754 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6760 * lpfc_reset_stats - Copy the adapter link stats information
6766 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_reset_stats()
6767 struct lpfc_hba *phba = vport->phba; in lpfc_reset_stats()
6768 struct lpfc_sli *psli = &phba->sli; in lpfc_reset_stats()
6769 struct lpfc_lnk_stat *lso = &psli->lnk_stat_offsets; in lpfc_reset_stats()
6774 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_reset_stats()
6777 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_reset_stats()
6782 pmb = &pmboxq->u.mb; in lpfc_reset_stats()
6783 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_reset_stats()
6784 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6785 pmb->un.varWords[0] = 0x1; /* reset request */ in lpfc_reset_stats()
6786 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6787 pmboxq->vport = vport; in lpfc_reset_stats()
6789 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6790 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) { in lpfc_reset_stats()
6793 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6797 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6800 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6806 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_reset_stats()
6807 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6808 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6809 pmboxq->vport = vport; in lpfc_reset_stats()
6811 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6812 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) { in lpfc_reset_stats()
6815 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6819 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6822 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6827 lso->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_reset_stats()
6828 lso->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_reset_stats()
6829 lso->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_reset_stats()
6830 lso->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_reset_stats()
6831 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_reset_stats()
6832 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6833 lso->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6834 if (phba->hba_flag & HBA_FCOE_MODE) in lpfc_reset_stats()
6835 lso->link_events = (phba->link_events >> 1); in lpfc_reset_stats()
6837 lso->link_events = (phba->fc_eventTag >> 1); in lpfc_reset_stats()
6839 atomic64_set(&phba->cgn_acqe_stat.warn, 0); in lpfc_reset_stats()
6840 atomic64_set(&phba->cgn_acqe_stat.alarm, 0); in lpfc_reset_stats()
6842 memset(&shost_to_fc_host(shost)->fpin_stats, 0, in lpfc_reset_stats()
6843 sizeof(shost_to_fc_host(shost)->fpin_stats)); in lpfc_reset_stats()
6845 psli->stats_start = ktime_get_seconds(); in lpfc_reset_stats()
6847 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6858 * lpfc_get_node_by_target - Return the nodelist for a target
6868 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in lpfc_get_node_by_target()
6869 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_node_by_target()
6872 spin_lock_irq(shost->host_lock); in lpfc_get_node_by_target()
6874 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_get_node_by_target()
6875 if (ndlp->nlp_state == NLP_STE_MAPPED_NODE && in lpfc_get_node_by_target()
6876 starget->id == ndlp->nlp_sid) { in lpfc_get_node_by_target()
6877 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
6881 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
6886 * lpfc_get_starget_port_id - Set the target port id to the ndlp DID or -1
6894 fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1; in lpfc_get_starget_port_id()
6898 * lpfc_get_starget_node_name - Set the target node name
6901 * Description: Set the target node name to the ndlp node name wwn or zero.
6909 ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0; in lpfc_get_starget_node_name()
6913 * lpfc_get_starget_port_name - Set the target port name
6916 * Description: set the target port name to the ndlp port name wwn or zero.
6924 ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0; in lpfc_get_starget_port_name()
6928 * lpfc_set_rport_loss_tmo - Set the rport dev loss tmo
6939 struct lpfc_rport_data *rdata = rport->dd_data; in lpfc_set_rport_loss_tmo()
6940 struct lpfc_nodelist *ndlp = rdata->pnode; in lpfc_set_rport_loss_tmo()
6946 rport->dev_loss_tmo = timeout; in lpfc_set_rport_loss_tmo()
6948 rport->dev_loss_tmo = 1; in lpfc_set_rport_loss_tmo()
6951 dev_info(&rport->dev, "Cannot find remote node to " in lpfc_set_rport_loss_tmo()
6953 rport->port_id); in lpfc_set_rport_loss_tmo()
6960 if (nrport && nrport->remoteport) in lpfc_set_rport_loss_tmo()
6961 nvme_fc_set_remoteport_devloss(nrport->remoteport, in lpfc_set_rport_loss_tmo()
6962 rport->dev_loss_tmo); in lpfc_set_rport_loss_tmo()
6967 * lpfc_rport_show_function - Return rport target information
6970 * Macro that uses field to generate a function with the name lpfc_show_rport_
6981 struct device_attribute *attr, \
6985 struct lpfc_rport_data *rdata = rport->hostdata; \
6987 (rdata->target) ? cast rdata->target->field : 0); \
6995 * lpfc_set_vport_symbolic_name - Set the vport's symbolic name
6996 * @fc_vport: The fc_vport who's symbolic name has been changed.
6999 * This function is called by the transport after the @fc_vport's symbolic name
7000 * has been changed. This function re-registers the symbolic name with the
7006 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; in lpfc_set_vport_symbolic_name()
7008 if (vport->port_state == LPFC_VPORT_READY) in lpfc_set_vport_symbolic_name()
7013 * lpfc_hba_log_verbose_init - Set hba's log verbose level
7025 phba->cfg_log_verbose = verbose; in lpfc_hba_log_verbose_init()
7161 * lpfc_get_hba_function_mode - Used to determine the HBA function in FCoE
7169 switch (phba->pcidev->device) { in lpfc_get_hba_function_mode()
7177 phba->hba_flag |= HBA_FCOE_MODE; in lpfc_get_hba_function_mode()
7181 phba->hba_flag &= ~HBA_FCOE_MODE; in lpfc_get_hba_function_mode()
7186 * lpfc_get_cfgparam - Used during probe_one to init the adapter structure
7230 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_get_cfgparam()
7231 phba->cfg_EnableXLane = 0; in lpfc_get_cfgparam()
7234 memset(phba->cfg_oas_tgt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7235 memset(phba->cfg_oas_vpt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7236 phba->cfg_oas_lun_state = 0; in lpfc_get_cfgparam()
7237 phba->cfg_oas_lun_status = 0; in lpfc_get_cfgparam()
7238 phba->cfg_oas_flags = 0; in lpfc_get_cfgparam()
7239 phba->cfg_oas_priority = 0; in lpfc_get_cfgparam()
7243 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_cfgparam()
7244 phba->cfg_poll = 0; in lpfc_get_cfgparam()
7246 phba->cfg_poll = lpfc_poll; in lpfc_get_cfgparam()
7252 if (phba->cfg_enable_bg && phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_cfgparam()
7256 phba->cfg_enable_bg = 0; in lpfc_get_cfgparam()
7257 } else if (phba->cfg_enable_bg) { in lpfc_get_cfgparam()
7258 phba->sli3_options |= LPFC_SLI3_BG_ENABLED; in lpfc_get_cfgparam()
7277 phba->cgn_p.cgn_param_mode = LPFC_CFG_OFF; in lpfc_get_cfgparam()
7278 phba->cmf_active_mode = LPFC_CFG_OFF; in lpfc_get_cfgparam()
7283 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_get_cfgparam()
7285 phba->nvmet_support = 0; in lpfc_get_cfgparam()
7286 phba->cfg_nvmet_mrq = 0; in lpfc_get_cfgparam()
7287 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7288 phba->cfg_enable_bbcr = 0; in lpfc_get_cfgparam()
7289 phba->cfg_xri_rebalancing = 0; in lpfc_get_cfgparam()
7292 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_cfgparam()
7293 phba->cfg_enable_fc4_type |= LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7296 phba->cfg_auto_imax = (phba->cfg_fcp_imax) ? 0 : 1; in lpfc_get_cfgparam()
7298 phba->cfg_enable_pbde = 0; in lpfc_get_cfgparam()
7301 if (phba->cfg_hdw_queue == 0) in lpfc_get_cfgparam()
7302 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7303 if (phba->cfg_irq_chann == 0) in lpfc_get_cfgparam()
7304 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7305 if (phba->cfg_irq_chann > phba->cfg_hdw_queue && in lpfc_get_cfgparam()
7306 phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_cfgparam()
7307 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_get_cfgparam()
7325 * lpfc_nvme_mod_param_dep - Adjust module parameter value based on
7334 if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu) { in lpfc_nvme_mod_param_dep()
7335 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7338 if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu) { in lpfc_nvme_mod_param_dep()
7339 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7342 if (phba->cfg_irq_chann > phba->cfg_hdw_queue) { in lpfc_nvme_mod_param_dep()
7343 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7348 "2006 Reducing Queues - CPU limitation: " in lpfc_nvme_mod_param_dep()
7350 phba->cfg_irq_chann, in lpfc_nvme_mod_param_dep()
7351 phba->cfg_hdw_queue); in lpfc_nvme_mod_param_dep()
7353 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_nvme_mod_param_dep()
7354 phba->nvmet_support) { in lpfc_nvme_mod_param_dep()
7355 phba->cfg_enable_fc4_type &= ~LPFC_ENABLE_FCP; in lpfc_nvme_mod_param_dep()
7360 phba->cfg_nvme_enable_fb, in lpfc_nvme_mod_param_dep()
7361 phba->cfg_nvmet_fb_size, in lpfc_nvme_mod_param_dep()
7364 if (phba->cfg_nvme_enable_fb == 0) in lpfc_nvme_mod_param_dep()
7365 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7367 if (phba->cfg_nvmet_fb_size > LPFC_NVMET_FB_SZ_MAX) in lpfc_nvme_mod_param_dep()
7368 phba->cfg_nvmet_fb_size = LPFC_NVMET_FB_SZ_MAX; in lpfc_nvme_mod_param_dep()
7371 if (!phba->cfg_nvmet_mrq) in lpfc_nvme_mod_param_dep()
7372 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7375 if (phba->cfg_nvmet_mrq > phba->cfg_hdw_queue) { in lpfc_nvme_mod_param_dep()
7376 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7379 phba->cfg_nvmet_mrq); in lpfc_nvme_mod_param_dep()
7381 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_nvme_mod_param_dep()
7382 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_nvme_mod_param_dep()
7386 phba->nvmet_support = 0; in lpfc_nvme_mod_param_dep()
7387 phba->cfg_nvmet_mrq = 0; in lpfc_nvme_mod_param_dep()
7388 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7393 * lpfc_get_vport_cfgparam - Used during port create, init the vport structure