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

4  * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term *
6 * Copyright (C) 2004-2016 Emulex. All rights reserved. *
9 * Portions Copyright (C) 2004-2005 Christoph Hellwig *
17 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
72 " trunk - link was \"low\" speed",
74 " existing trunk - link was \"middle\" speed",
76 " trunk - link was \"high\" speed",
77 "Attached to non-trunking port - F_Port",
78 "Attached to non-trunking port - N_Port",
80 "non-FLOGI frame received",
87 * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules
95 * Hex 0-9 becomes ascii '0' to '9'.
96 * Hex a-f becomes ascii '=' to 'B' capital B.
108 hdw[7 - i] = 0x30 + j; in lpfc_jedec_to_ascii()
110 hdw[7 - i] = 0x61 + j - 10; in lpfc_jedec_to_ascii()
122 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_cmf_info_show()
123 struct lpfc_hba *phba = vport->phba; in lpfc_cmf_info_show()
127 int cpu; in lpfc_cmf_info_show() local
131 if (phba->cgn_i) in lpfc_cmf_info_show()
132 cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; in lpfc_cmf_info_show()
137 phba->sli4_hba.pc_sli4_params.mi_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()
259 for_each_present_cpu(cpu) { in lpfc_cmf_info_show()
260 cgs = per_cpu_ptr(phba->cmf_stat, cpu); in lpfc_cmf_info_show()
261 total += atomic64_read(&cgs->total_bytes); in lpfc_cmf_info_show()
262 rcv += atomic64_read(&cgs->rcv_bytes); in lpfc_cmf_info_show()
267 atomic_read(&phba->cmf_busy), in lpfc_cmf_info_show()
268 phba->cmf_active_info, rcv, total); in lpfc_cmf_info_show()
276 (unsigned long)phba->cmf_link_byte_count, in lpfc_cmf_info_show()
277 (unsigned long)phba->cmf_max_bytes_per_interval); in lpfc_cmf_info_show()
283 if (unlikely(len >= (PAGE_SIZE - 1))) { in lpfc_cmf_info_show()
288 strscpy(buf + PAGE_SIZE - 1 - sizeof(LPFC_INFO_MORE_STR), in lpfc_cmf_info_show()
295 * lpfc_drvr_version_show - Return the Emulex driver string with version number
310 * lpfc_enable_fip_show - Return the fip mode of the HBA
322 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_enable_fip_show()
323 struct lpfc_hba *phba = vport->phba; in lpfc_enable_fip_show()
325 if (test_bit(HBA_FIP_SUPPORT, &phba->hba_flag)) in lpfc_enable_fip_show()
337 struct lpfc_hba *phba = vport->phba; in lpfc_nvme_info_show()
353 if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) { in lpfc_nvme_info_show()
357 if (phba->nvmet_support) { in lpfc_nvme_info_show()
358 if (!phba->targetport) { in lpfc_nvme_info_show()
361 wwn_to_u64(vport->fc_portname.u.wwn)); in lpfc_nvme_info_show()
365 if (phba->targetport->port_id) in lpfc_nvme_info_show()
378 phba->brd_no, in lpfc_nvme_info_show()
379 wwn_to_u64(vport->fc_portname.u.wwn), in lpfc_nvme_info_show()
380 wwn_to_u64(vport->fc_nodename.u.wwn), in lpfc_nvme_info_show()
381 phba->targetport->port_id); in lpfc_nvme_info_show()
389 tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private; in lpfc_nvme_info_show()
392 atomic_read(&tgtp->rcv_ls_req_in), in lpfc_nvme_info_show()
393 atomic_read(&tgtp->rcv_ls_req_drop), in lpfc_nvme_info_show()
394 atomic_read(&tgtp->xmt_ls_abort)); in lpfc_nvme_info_show()
398 if (atomic_read(&tgtp->rcv_ls_req_in) != in lpfc_nvme_info_show()
399 atomic_read(&tgtp->rcv_ls_req_out)) { in lpfc_nvme_info_show()
402 atomic_read(&tgtp->rcv_ls_req_in), in lpfc_nvme_info_show()
403 atomic_read(&tgtp->rcv_ls_req_out)); in lpfc_nvme_info_show()
410 atomic_read(&tgtp->xmt_ls_rsp), in lpfc_nvme_info_show()
411 atomic_read(&tgtp->xmt_ls_drop), in lpfc_nvme_info_show()
412 atomic_read(&tgtp->xmt_ls_rsp_cmpl)); in lpfc_nvme_info_show()
418 atomic_read(&tgtp->xmt_ls_rsp_aborted), in lpfc_nvme_info_show()
419 atomic_read(&tgtp->xmt_ls_rsp_xb_set), in lpfc_nvme_info_show()
420 atomic_read(&tgtp->xmt_ls_rsp_error)); in lpfc_nvme_info_show()
427 atomic_read(&tgtp->rcv_fcp_cmd_in), in lpfc_nvme_info_show()
428 atomic_read(&tgtp->rcv_fcp_cmd_defer), in lpfc_nvme_info_show()
429 atomic_read(&tgtp->xmt_fcp_release), in lpfc_nvme_info_show()
430 atomic_read(&tgtp->rcv_fcp_cmd_drop)); in lpfc_nvme_info_show()
434 if (atomic_read(&tgtp->rcv_fcp_cmd_in) != in lpfc_nvme_info_show()
435 atomic_read(&tgtp->rcv_fcp_cmd_out)) { in lpfc_nvme_info_show()
438 atomic_read(&tgtp->rcv_fcp_cmd_in), in lpfc_nvme_info_show()
439 atomic_read(&tgtp->rcv_fcp_cmd_out)); in lpfc_nvme_info_show()
447 atomic_read(&tgtp->xmt_fcp_read), in lpfc_nvme_info_show()
448 atomic_read(&tgtp->xmt_fcp_read_rsp), in lpfc_nvme_info_show()
449 atomic_read(&tgtp->xmt_fcp_write), in lpfc_nvme_info_show()
450 atomic_read(&tgtp->xmt_fcp_rsp), in lpfc_nvme_info_show()
451 atomic_read(&tgtp->xmt_fcp_drop)); in lpfc_nvme_info_show()
457 atomic_read(&tgtp->xmt_fcp_rsp_cmpl), in lpfc_nvme_info_show()
458 atomic_read(&tgtp->xmt_fcp_rsp_error), in lpfc_nvme_info_show()
459 atomic_read(&tgtp->xmt_fcp_rsp_drop)); in lpfc_nvme_info_show()
465 atomic_read(&tgtp->xmt_fcp_rsp_aborted), in lpfc_nvme_info_show()
466 atomic_read(&tgtp->xmt_fcp_rsp_xb_set), in lpfc_nvme_info_show()
467 atomic_read(&tgtp->xmt_fcp_xri_abort_cqe)); in lpfc_nvme_info_show()
473 atomic_read(&tgtp->xmt_fcp_abort), in lpfc_nvme_info_show()
474 atomic_read(&tgtp->xmt_fcp_abort_cmpl)); in lpfc_nvme_info_show()
480 atomic_read(&tgtp->xmt_abort_sol), in lpfc_nvme_info_show()
481 atomic_read(&tgtp->xmt_abort_unsol), in lpfc_nvme_info_show()
482 atomic_read(&tgtp->xmt_abort_rsp), in lpfc_nvme_info_show()
483 atomic_read(&tgtp->xmt_abort_rsp_error)); in lpfc_nvme_info_show()
489 atomic_read(&tgtp->defer_ctx), in lpfc_nvme_info_show()
490 atomic_read(&tgtp->defer_fod), in lpfc_nvme_info_show()
491 atomic_read(&tgtp->defer_wqfull)); in lpfc_nvme_info_show()
496 tot = atomic_read(&tgtp->rcv_fcp_cmd_drop); in lpfc_nvme_info_show()
497 tot += atomic_read(&tgtp->xmt_fcp_release); in lpfc_nvme_info_show()
498 tot = atomic_read(&tgtp->rcv_fcp_cmd_in) - tot; in lpfc_nvme_info_show()
503 phba->sli4_hba.nvmet_xri_cnt, in lpfc_nvme_info_show()
504 phba->sli4_hba.nvmet_io_wait_cnt, in lpfc_nvme_info_show()
505 phba->sli4_hba.nvmet_io_wait_total, in lpfc_nvme_info_show()
511 localport = vport->localport; in lpfc_nvme_info_show()
515 wwn_to_u64(vport->fc_portname.u.wwn)); in lpfc_nvme_info_show()
518 lport = (struct lpfc_nvme_lport *)localport->private; in lpfc_nvme_info_show()
524 phba->brd_no, in lpfc_nvme_info_show()
525 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_nvme_info_show()
526 phba->sli4_hba.io_xri_max, in lpfc_nvme_info_show()
532 if (localport->port_id) in lpfc_nvme_info_show()
540 phba->brd_no, in lpfc_nvme_info_show()
541 wwn_to_u64(vport->fc_portname.u.wwn), in lpfc_nvme_info_show()
542 wwn_to_u64(vport->fc_nodename.u.wwn), in lpfc_nvme_info_show()
543 localport->port_id, statep); in lpfc_nvme_info_show()
547 spin_lock_irqsave(&vport->fc_nodes_list_lock, iflags); in lpfc_nvme_info_show()
549 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_nvme_info_show()
551 spin_lock(&ndlp->lock); in lpfc_nvme_info_show()
554 nrport = rport->remoteport; in lpfc_nvme_info_show()
555 spin_unlock(&ndlp->lock); in lpfc_nvme_info_show()
560 switch (nrport->port_state) { in lpfc_nvme_info_show()
575 if (phba->brd_no >= 10) { in lpfc_nvme_info_show()
581 nrport->port_name); in lpfc_nvme_info_show()
586 nrport->node_name); in lpfc_nvme_info_show()
591 nrport->port_id); in lpfc_nvme_info_show()
596 if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR) { in lpfc_nvme_info_show()
600 if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET) { in lpfc_nvme_info_show()
604 if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY) { in lpfc_nvme_info_show()
608 if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR | in lpfc_nvme_info_show()
612 nrport->port_role); in lpfc_nvme_info_show()
621 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags); in lpfc_nvme_info_show()
631 atomic_read(&lport->fc4NvmeLsRequests), in lpfc_nvme_info_show()
632 atomic_read(&lport->fc4NvmeLsCmpls), in lpfc_nvme_info_show()
633 atomic_read(&lport->xmt_ls_abort)); in lpfc_nvme_info_show()
639 atomic_read(&lport->xmt_ls_err), in lpfc_nvme_info_show()
640 atomic_read(&lport->cmpl_ls_xb), in lpfc_nvme_info_show()
641 atomic_read(&lport->cmpl_ls_err)); in lpfc_nvme_info_show()
647 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_nvme_info_show()
648 cstat = &phba->sli4_hba.hdwq[i].nvme_cstat; in lpfc_nvme_info_show()
649 tot = cstat->io_cmpls; in lpfc_nvme_info_show()
651 data1 = cstat->input_requests; in lpfc_nvme_info_show()
652 data2 = cstat->output_requests; in lpfc_nvme_info_show()
653 data3 = cstat->control_requests; in lpfc_nvme_info_show()
659 totin, totout, totout - totin); in lpfc_nvme_info_show()
666 atomic_read(&lport->xmt_fcp_abort), in lpfc_nvme_info_show()
667 atomic_read(&lport->xmt_fcp_noxri), in lpfc_nvme_info_show()
668 atomic_read(&lport->xmt_fcp_bad_ndlp), in lpfc_nvme_info_show()
669 atomic_read(&lport->xmt_fcp_qdepth), in lpfc_nvme_info_show()
670 atomic_read(&lport->xmt_fcp_wqerr), in lpfc_nvme_info_show()
671 atomic_read(&lport->xmt_fcp_err)); in lpfc_nvme_info_show()
677 atomic_read(&lport->cmpl_fcp_xb), in lpfc_nvme_info_show()
678 atomic_read(&lport->cmpl_fcp_err)); in lpfc_nvme_info_show()
685 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags); in lpfc_nvme_info_show()
690 if (unlikely(len >= (PAGE_SIZE - 1))) { in lpfc_nvme_info_show()
695 strscpy(buf + PAGE_SIZE - 1 - sizeof(LPFC_INFO_MORE_STR), in lpfc_nvme_info_show()
709 struct lpfc_hba *phba = vport->phba; in lpfc_scsi_stat_show()
717 if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_FCP) || in lpfc_scsi_stat_show()
718 (phba->sli_rev != LPFC_SLI_REV4)) in lpfc_scsi_stat_show()
725 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_scsi_stat_show()
726 cstat = &phba->sli4_hba.hdwq[i].scsi_cstat; in lpfc_scsi_stat_show()
727 tot = cstat->io_cmpls; in lpfc_scsi_stat_show()
729 data1 = cstat->input_requests; in lpfc_scsi_stat_show()
730 data2 = cstat->output_requests; in lpfc_scsi_stat_show()
731 data3 = cstat->control_requests; in lpfc_scsi_stat_show()
740 tot, ((data1 + data2 + data3) - tot)); in lpfc_scsi_stat_show()
745 "OutIO %016llx\n", totin, totout, totout - totin); in lpfc_scsi_stat_show()
759 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_info_show()
760 struct lpfc_hba *phba = vport->phba; in lpfc_bg_info_show()
762 if (phba->cfg_enable_bg) { in lpfc_bg_info_show()
763 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_bg_info_show()
779 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_guard_err_show()
780 struct lpfc_hba *phba = vport->phba; in lpfc_bg_guard_err_show()
783 (unsigned long long)phba->bg_guard_err_cnt); in lpfc_bg_guard_err_show()
791 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_apptag_err_show()
792 struct lpfc_hba *phba = vport->phba; in lpfc_bg_apptag_err_show()
795 (unsigned long long)phba->bg_apptag_err_cnt); in lpfc_bg_apptag_err_show()
803 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_reftag_err_show()
804 struct lpfc_hba *phba = vport->phba; in lpfc_bg_reftag_err_show()
807 (unsigned long long)phba->bg_reftag_err_cnt); in lpfc_bg_reftag_err_show()
811 * lpfc_info_show - Return some pci info about the host in ascii
828 * lpfc_serialnum_show - Return the hba serial number in ascii
840 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_serialnum_show()
841 struct lpfc_hba *phba = vport->phba; in lpfc_serialnum_show()
843 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->SerialNumber); in lpfc_serialnum_show()
847 * lpfc_temp_sensor_show - Return the temperature sensor level
863 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_temp_sensor_show()
864 struct lpfc_hba *phba = vport->phba; in lpfc_temp_sensor_show()
865 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->temp_sensor_support); in lpfc_temp_sensor_show()
869 * lpfc_modeldesc_show - Return the model description of the hba
881 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_modeldesc_show()
882 struct lpfc_hba *phba = vport->phba; in lpfc_modeldesc_show()
884 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelDesc); in lpfc_modeldesc_show()
888 * lpfc_modelname_show - Return the model name of the hba
900 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_modelname_show()
901 struct lpfc_hba *phba = vport->phba; in lpfc_modelname_show()
903 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelName); in lpfc_modelname_show()
907 * lpfc_programtype_show - Return the program type of the hba
919 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_programtype_show()
920 struct lpfc_hba *phba = vport->phba; in lpfc_programtype_show()
922 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ProgramType); in lpfc_programtype_show()
926 * lpfc_vportnum_show - Return the port number in ascii of the hba
938 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_vportnum_show()
939 struct lpfc_hba *phba = vport->phba; in lpfc_vportnum_show()
941 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->Port); in lpfc_vportnum_show()
945 * lpfc_fwrev_show - Return the firmware rev running in the hba
957 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_fwrev_show()
958 struct lpfc_hba *phba = vport->phba; in lpfc_fwrev_show()
965 if_type = phba->sli4_hba.pc_sli4_params.if_type; in lpfc_fwrev_show()
966 sli_family = phba->sli4_hba.pc_sli4_params.sli_family; in lpfc_fwrev_show()
968 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_fwrev_show()
969 len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d\n", in lpfc_fwrev_show()
970 fwrev, phba->sli_rev); in lpfc_fwrev_show()
972 len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d:%d:%x\n", in lpfc_fwrev_show()
973 fwrev, phba->sli_rev, if_type, sli_family); in lpfc_fwrev_show()
979 * lpfc_hdw_show - Return the jedec information about the hba
991 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_hdw_show()
992 struct lpfc_hba *phba = vport->phba; in lpfc_hdw_show()
993 lpfc_vpd_t *vp = &phba->vpd; in lpfc_hdw_show()
995 lpfc_jedec_to_ascii(vp->rev.biuRev, hdw); in lpfc_hdw_show()
997 vp->rev.smRev, vp->rev.smFwRev); in lpfc_hdw_show()
1001 * lpfc_option_rom_version_show - Return the adapter ROM FCode version
1013 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_option_rom_version_show()
1014 struct lpfc_hba *phba = vport->phba; in lpfc_option_rom_version_show()
1017 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_option_rom_version_show()
1019 phba->OptionROMVersion); in lpfc_option_rom_version_show()
1026 * lpfc_link_state_show - Return the link state of the port
1041 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_state_show()
1042 struct lpfc_hba *phba = vport->phba; in lpfc_link_state_show()
1045 switch (phba->link_state) { in lpfc_link_state_show()
1052 if (test_bit(LINK_DISABLED, &phba->hba_flag)) in lpfc_link_state_show()
1053 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
1054 "Link Down - User disabled\n"); in lpfc_link_state_show()
1056 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
1062 len += scnprintf(buf + len, PAGE_SIZE-len, "Link Up - "); in lpfc_link_state_show()
1064 switch (vport->port_state) { in lpfc_link_state_show()
1066 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
1076 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1080 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1085 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1090 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1094 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_state_show()
1095 if (test_bit(FC_PUBLIC_LOOP, &vport->fc_flag)) in lpfc_link_state_show()
1096 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
1099 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
1102 if (test_bit(FC_FABRIC, &vport->fc_flag)) { in lpfc_link_state_show()
1103 if (phba->sli_rev == LPFC_SLI_REV4 && in lpfc_link_state_show()
1104 vport->port_type == LPFC_PHYSICAL_PORT && in lpfc_link_state_show()
1105 phba->sli4_hba.fawwpn_flag & in lpfc_link_state_show()
1108 PAGE_SIZE - len, in lpfc_link_state_show()
1109 " Fabric FA-PWWN\n"); in lpfc_link_state_show()
1112 PAGE_SIZE - len, in lpfc_link_state_show()
1115 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
1116 " Point-2-Point\n"); in lpfc_link_state_show()
1121 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_link_state_show()
1123 &phba->sli4_hba.sli_intf) == in lpfc_link_state_show()
1125 struct lpfc_trunk_link link = phba->trunk_link; in lpfc_link_state_show()
1127 if (bf_get(lpfc_conf_trunk_port0, &phba->sli4_hba)) in lpfc_link_state_show()
1128 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1134 if (bf_get(lpfc_conf_trunk_port1, &phba->sli4_hba)) in lpfc_link_state_show()
1135 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1141 if (bf_get(lpfc_conf_trunk_port2, &phba->sli4_hba)) in lpfc_link_state_show()
1142 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1148 if (bf_get(lpfc_conf_trunk_port3, &phba->sli4_hba)) in lpfc_link_state_show()
1149 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
1161 * lpfc_sli4_protocol_show - Return the fip mode of the HBA
1173 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sli4_protocol_show()
1174 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_protocol_show()
1176 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_sli4_protocol_show()
1179 if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL) { in lpfc_sli4_protocol_show()
1180 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_GE) in lpfc_sli4_protocol_show()
1182 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC) in lpfc_sli4_protocol_show()
1189 * lpfc_oas_supported_show - Return whether or not Optimized Access Storage
1202 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_oas_supported_show()
1203 struct lpfc_hba *phba = vport->phba; in lpfc_oas_supported_show()
1206 phba->sli4_hba.pc_sli4_params.oas_supported); in lpfc_oas_supported_show()
1210 * lpfc_link_state_store - Transition the link_state on an HBA port
1217 * -EINVAL if the buffer is not "up" or "down"
1218 * return from link state change function if non-zero
1226 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_state_store()
1227 struct lpfc_hba *phba = vport->phba; in lpfc_link_state_store()
1229 int status = -EINVAL; in lpfc_link_state_store()
1231 if ((strncmp(buf, "up", sizeof("up") - 1) == 0) && in lpfc_link_state_store()
1232 (phba->link_state == LPFC_LINK_DOWN)) in lpfc_link_state_store()
1233 status = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_link_state_store()
1234 else if ((strncmp(buf, "down", sizeof("down") - 1) == 0) && in lpfc_link_state_store()
1235 (phba->link_state >= LPFC_LINK_UP)) in lpfc_link_state_store()
1236 status = phba->lpfc_hba_down_link(phba, MBX_NOWAIT); in lpfc_link_state_store()
1245 * lpfc_num_discovered_ports_show - Return sum of mapped and unmapped vports
1261 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_num_discovered_ports_show()
1264 atomic_read(&vport->fc_map_cnt) + in lpfc_num_discovered_ports_show()
1265 atomic_read(&vport->fc_unmap_cnt)); in lpfc_num_discovered_ports_show()
1269 * lpfc_issue_lip - Misnomer, name carried over from long ago
1273 * Bring the link down gracefully then re-init the link. The firmware will
1274 * re-init the fiber channel interface as required. Does not issue a LIP.
1277 * -EPERM port offline or management commands are being blocked
1278 * -ENOMEM cannot allocate memory for the mailbox command
1279 * -EIO error sending the mailbox command
1285 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_issue_lip()
1286 struct lpfc_hba *phba = vport->phba; in lpfc_issue_lip()
1294 if (test_bit(FC_OFFLINE_MODE, &vport->fc_flag) || in lpfc_issue_lip()
1295 test_bit(LINK_DISABLED, &phba->hba_flag) || in lpfc_issue_lip()
1296 (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO)) in lpfc_issue_lip()
1297 return -EPERM; in lpfc_issue_lip()
1299 pmboxq = mempool_alloc(phba->mbox_mem_pool,GFP_KERNEL); in lpfc_issue_lip()
1302 return -ENOMEM; in lpfc_issue_lip()
1305 pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK; in lpfc_issue_lip()
1306 pmboxq->u.mb.mbxOwner = OWN_HOST; in lpfc_issue_lip()
1308 if (test_bit(FC_PT2PT, &vport->fc_flag)) in lpfc_issue_lip()
1309 clear_bit(FC_PT2PT_NO_NVME, &vport->fc_flag); in lpfc_issue_lip()
1314 (pmboxq->u.mb.mbxStatus == 0 || in lpfc_issue_lip()
1315 pmboxq->u.mb.mbxStatus == MBXERR_LINK_DOWN)) { in lpfc_issue_lip()
1317 lpfc_init_link(phba, pmboxq, phba->cfg_topology, in lpfc_issue_lip()
1318 phba->cfg_link_speed); in lpfc_issue_lip()
1320 phba->fc_ratov * 2); in lpfc_issue_lip()
1322 (pmboxq->u.mb.mbxStatus == MBXERR_SEC_NO_PERMISSION)) in lpfc_issue_lip()
1330 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_issue_lip()
1333 return -EIO; in lpfc_issue_lip()
1360 * lpfc_do_offline - Issues a mailbox command to bring the link down
1368 * lpfc_workq_post_event() returns a non-zero return code if call fails.
1371 * -EIO error posting the event
1389 return -ENOMEM; in lpfc_do_offline()
1394 return -EIO; in lpfc_do_offline()
1396 psli = &phba->sli; in lpfc_do_offline()
1403 spin_lock_irq(&phba->hbalock); in lpfc_do_offline()
1404 if (!(psli->sli_flag & LPFC_QUEUE_FREE_INIT)) { in lpfc_do_offline()
1405 psli->sli_flag |= LPFC_QUEUE_FREE_WAIT; in lpfc_do_offline()
1407 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1410 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1415 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_do_offline()
1416 for (i = 0; i < psli->num_rings; i++) { in lpfc_do_offline()
1417 pring = &psli->sli3_ring[i]; in lpfc_do_offline()
1418 if (!lpfc_emptyq_wait(phba, &pring->txcmplq, in lpfc_do_offline()
1419 &phba->hbalock)) in lpfc_do_offline()
1423 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_do_offline()
1424 pring = qp->pring; in lpfc_do_offline()
1427 if (!lpfc_emptyq_wait(phba, &pring->txcmplq, in lpfc_do_offline()
1428 &pring->ring_lock)) in lpfc_do_offline()
1433 spin_lock_irq(&phba->hbalock); in lpfc_do_offline()
1434 psli->sli_flag &= ~LPFC_QUEUE_FREE_WAIT; in lpfc_do_offline()
1435 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1441 return -ENOMEM; in lpfc_do_offline()
1446 return -EIO; in lpfc_do_offline()
1452 * lpfc_reset_pci_bus - resets PCI bridge controller's secondary bus of an HBA
1456 * Issues a PCI secondary bus reset for the phba->pcidev.
1465 * -ENOTSUPP, cfg_enable_hba_reset must be of value 2
1466 * -ENODEV, NULL ptr to pcidev
1467 * -EBADSLT, detected invalid device
1468 * -EBUSY, port is not in offline state
1474 struct pci_dev *pdev = phba->pcidev; in lpfc_reset_pci_bus()
1480 if (phba->cfg_enable_hba_reset != 2) in lpfc_reset_pci_bus()
1481 return -ENOTSUPP; in lpfc_reset_pci_bus()
1485 return -ENODEV; in lpfc_reset_pci_bus()
1493 list_for_each_entry(ptr, &pdev->bus->devices, bus_list) { in lpfc_reset_pci_bus()
1498 ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_reset_pci_bus()
1500 &phba_other->pport->fc_flag)) { in lpfc_reset_pci_bus()
1505 phba_other->wwpn[0], in lpfc_reset_pci_bus()
1506 phba_other->wwpn[1], in lpfc_reset_pci_bus()
1507 phba_other->wwpn[2], in lpfc_reset_pci_bus()
1508 phba_other->wwpn[3], in lpfc_reset_pci_bus()
1509 phba_other->wwpn[4], in lpfc_reset_pci_bus()
1510 phba_other->wwpn[5], in lpfc_reset_pci_bus()
1511 phba_other->wwpn[6], in lpfc_reset_pci_bus()
1512 phba_other->wwpn[7]); in lpfc_reset_pci_bus()
1513 return -EBUSY; in lpfc_reset_pci_bus()
1529 * lpfc_selective_reset - Offline then onlines the port
1542 * -EIO reset not configured or error posting the event
1552 if (!phba->cfg_enable_hba_reset) in lpfc_selective_reset()
1553 return -EACCES; in lpfc_selective_reset()
1555 if (!test_bit(FC_OFFLINE_MODE, &phba->pport->fc_flag)) { in lpfc_selective_reset()
1566 return -ENOMEM; in lpfc_selective_reset()
1571 return -EIO; in lpfc_selective_reset()
1577 * lpfc_issue_reset - Selectively resets an adapter
1593 * -EINVAL if the buffer does not contain the string "selective"
1594 * length of buf if lpfc-selective_reset() if the call succeeds
1602 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_issue_reset()
1603 struct lpfc_hba *phba = vport->phba; in lpfc_issue_reset()
1604 int status = -EINVAL; in lpfc_issue_reset()
1606 if (!phba->cfg_enable_hba_reset) in lpfc_issue_reset()
1607 return -EACCES; in lpfc_issue_reset()
1609 if (strncmp(buf, "selective", sizeof("selective") - 1) == 0) in lpfc_issue_reset()
1610 status = phba->lpfc_selective_reset(phba); in lpfc_issue_reset()
1619 * lpfc_sli4_pdev_status_reg_wait - Wait for pdev status register for readyness
1623 * SLI4 interface type-2 device to wait on the sliport status register for
1627 * zero for success, -EPERM when port does not have privilege to perform the
1628 * reset, -EIO when port timeout from recovering from the reset.
1641 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1643 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1648 return -EPERM; in lpfc_sli4_pdev_status_reg_wait()
1654 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1659 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1674 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1678 * lpfc_sli4_pdev_reg_request - Request physical dev to perform a register acc
1683 * Request SLI4 interface type-2 device to perform a physical register set
1693 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pdev_reg_request()
1700 if (!phba->cfg_enable_hba_reset) in lpfc_sli4_pdev_reg_request()
1701 return -EACCES; in lpfc_sli4_pdev_reg_request()
1703 if ((phba->sli_rev < LPFC_SLI_REV4) || in lpfc_sli4_pdev_reg_request()
1704 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_pdev_reg_request()
1706 return -EPERM; in lpfc_sli4_pdev_reg_request()
1709 before_fc_flag = phba->pport->fc_flag; in lpfc_sli4_pdev_reg_request()
1710 sriov_nr_virtfn = phba->cfg_sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1714 phba->fw_dump_cmpl = &online_compl; in lpfc_sli4_pdev_reg_request()
1716 /* Disable SR-IOV virtual functions if enabled */ in lpfc_sli4_pdev_reg_request()
1717 if (phba->cfg_sriov_nr_virtfn) { in lpfc_sli4_pdev_reg_request()
1719 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_pdev_reg_request()
1731 reg_val = readl(phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1741 writel(reg_val, phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1744 readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); in lpfc_sli4_pdev_reg_request()
1749 if (rc == -EPERM) { in lpfc_sli4_pdev_reg_request()
1754 } else if (rc == -EIO) { in lpfc_sli4_pdev_reg_request()
1759 if (phba->fw_dump_cmpl) in lpfc_sli4_pdev_reg_request()
1760 phba->fw_dump_cmpl = NULL; in lpfc_sli4_pdev_reg_request()
1766 if (phba->fw_dump_cmpl) in lpfc_sli4_pdev_reg_request()
1767 phba->fw_dump_cmpl = NULL; in lpfc_sli4_pdev_reg_request()
1776 wait_for_completion(phba->fw_dump_cmpl); in lpfc_sli4_pdev_reg_request()
1792 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_pdev_reg_request()
1798 phba->cfg_sriov_nr_virtfn = sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1804 rc = -ENOMEM; in lpfc_sli4_pdev_reg_request()
1806 rc = -EIO; in lpfc_sli4_pdev_reg_request()
1812 * lpfc_nport_evt_cnt_show - Return the number of nport events
1824 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nport_evt_cnt_show()
1825 struct lpfc_hba *phba = vport->phba; in lpfc_nport_evt_cnt_show()
1827 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); in lpfc_nport_evt_cnt_show()
1849 return -EINVAL; /* Invalid command */ in lpfc_set_trunking()
1863 return -EINVAL; in lpfc_set_trunking()
1869 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_set_trunking()
1871 return -ENOMEM; in lpfc_set_trunking()
1873 payload_len = sizeof(struct lpfc_mbx_set_trunk_mode) - in lpfc_set_trunking()
1880 &mbox->u.mqe.un.set_trunk_mode, in lpfc_set_trunking()
1887 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_set_trunking()
1897 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_xcvr_data_show()
1898 struct lpfc_hba *phba = vport->phba; in lpfc_xcvr_data_show()
1914 len = scnprintf(buf, PAGE_SIZE - len, in lpfc_xcvr_data_show()
1921 len = scnprintf(buf, PAGE_SIZE - len, "SFP info NA:\n"); in lpfc_xcvr_data_show()
1925 strscpy(chbuf, &rdp_context->page_a0[SSF_VENDOR_NAME], 16); in lpfc_xcvr_data_show()
1927 len = scnprintf(buf, PAGE_SIZE - len, "VendorName:\t%s\n", chbuf); in lpfc_xcvr_data_show()
1928 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_xcvr_data_show()
1929 "VendorOUI:\t%02x-%02x-%02x\n", in lpfc_xcvr_data_show()
1930 (uint8_t)rdp_context->page_a0[SSF_VENDOR_OUI], in lpfc_xcvr_data_show()
1931 (uint8_t)rdp_context->page_a0[SSF_VENDOR_OUI + 1], in lpfc_xcvr_data_show()
1932 (uint8_t)rdp_context->page_a0[SSF_VENDOR_OUI + 2]); in lpfc_xcvr_data_show()
1933 strscpy(chbuf, &rdp_context->page_a0[SSF_VENDOR_PN], 16); in lpfc_xcvr_data_show()
1934 len += scnprintf(buf + len, PAGE_SIZE - len, "VendorPN:\t%s\n", chbuf); in lpfc_xcvr_data_show()
1935 strscpy(chbuf, &rdp_context->page_a0[SSF_VENDOR_SN], 16); in lpfc_xcvr_data_show()
1936 len += scnprintf(buf + len, PAGE_SIZE - len, "VendorSN:\t%s\n", chbuf); in lpfc_xcvr_data_show()
1937 strscpy(chbuf, &rdp_context->page_a0[SSF_VENDOR_REV], 4); in lpfc_xcvr_data_show()
1938 len += scnprintf(buf + len, PAGE_SIZE - len, "VendorRev:\t%s\n", chbuf); in lpfc_xcvr_data_show()
1939 strscpy(chbuf, &rdp_context->page_a0[SSF_DATE_CODE], 8); in lpfc_xcvr_data_show()
1940 len += scnprintf(buf + len, PAGE_SIZE - len, "DateCode:\t%s\n", chbuf); in lpfc_xcvr_data_show()
1941 len += scnprintf(buf + len, PAGE_SIZE - len, "Identifier:\t%xh\n", in lpfc_xcvr_data_show()
1942 (uint8_t)rdp_context->page_a0[SSF_IDENTIFIER]); in lpfc_xcvr_data_show()
1943 len += scnprintf(buf + len, PAGE_SIZE - len, "ExtIdentifier:\t%xh\n", in lpfc_xcvr_data_show()
1944 (uint8_t)rdp_context->page_a0[SSF_EXT_IDENTIFIER]); in lpfc_xcvr_data_show()
1945 len += scnprintf(buf + len, PAGE_SIZE - len, "Connector:\t%xh\n", in lpfc_xcvr_data_show()
1946 (uint8_t)rdp_context->page_a0[SSF_CONNECTOR]); in lpfc_xcvr_data_show()
1947 wavelength = (rdp_context->page_a0[SSF_WAVELENGTH_B1] << 8) | in lpfc_xcvr_data_show()
1948 rdp_context->page_a0[SSF_WAVELENGTH_B0]; in lpfc_xcvr_data_show()
1950 len += scnprintf(buf + len, PAGE_SIZE - len, "Wavelength:\t%d nm\n", in lpfc_xcvr_data_show()
1953 &rdp_context->page_a0[SSF_TRANSCEIVER_CODE_B7]; in lpfc_xcvr_data_show()
1955 len += scnprintf(buf + len, PAGE_SIZE - len, "Speeds: \t"); in lpfc_xcvr_data_show()
1957 len += scnprintf(buf + len, PAGE_SIZE - len, "Unknown\n"); in lpfc_xcvr_data_show()
1959 if (trasn_code_byte7->fc_sp_100MB) in lpfc_xcvr_data_show()
1960 len += scnprintf(buf + len, PAGE_SIZE - len, "1 "); in lpfc_xcvr_data_show()
1961 if (trasn_code_byte7->fc_sp_200mb) in lpfc_xcvr_data_show()
1962 len += scnprintf(buf + len, PAGE_SIZE - len, "2 "); in lpfc_xcvr_data_show()
1963 if (trasn_code_byte7->fc_sp_400MB) in lpfc_xcvr_data_show()
1964 len += scnprintf(buf + len, PAGE_SIZE - len, "4 "); in lpfc_xcvr_data_show()
1965 if (trasn_code_byte7->fc_sp_800MB) in lpfc_xcvr_data_show()
1966 len += scnprintf(buf + len, PAGE_SIZE - len, "8 "); in lpfc_xcvr_data_show()
1967 if (trasn_code_byte7->fc_sp_1600MB) in lpfc_xcvr_data_show()
1968 len += scnprintf(buf + len, PAGE_SIZE - len, "16 "); in lpfc_xcvr_data_show()
1969 if (trasn_code_byte7->fc_sp_3200MB) in lpfc_xcvr_data_show()
1970 len += scnprintf(buf + len, PAGE_SIZE - len, "32 "); in lpfc_xcvr_data_show()
1971 if (trasn_code_byte7->speed_chk_ecc) in lpfc_xcvr_data_show()
1972 len += scnprintf(buf + len, PAGE_SIZE - len, "64 "); in lpfc_xcvr_data_show()
1973 len += scnprintf(buf + len, PAGE_SIZE - len, "GB\n"); in lpfc_xcvr_data_show()
1975 temperature = (rdp_context->page_a2[SFF_TEMPERATURE_B1] << 8 | in lpfc_xcvr_data_show()
1976 rdp_context->page_a2[SFF_TEMPERATURE_B0]); in lpfc_xcvr_data_show()
1977 vcc = (rdp_context->page_a2[SFF_VCC_B1] << 8 | in lpfc_xcvr_data_show()
1978 rdp_context->page_a2[SFF_VCC_B0]); in lpfc_xcvr_data_show()
1979 tx_power = (rdp_context->page_a2[SFF_TXPOWER_B1] << 8 | in lpfc_xcvr_data_show()
1980 rdp_context->page_a2[SFF_TXPOWER_B0]); in lpfc_xcvr_data_show()
1981 tx_bias = (rdp_context->page_a2[SFF_TX_BIAS_CURRENT_B1] << 8 | in lpfc_xcvr_data_show()
1982 rdp_context->page_a2[SFF_TX_BIAS_CURRENT_B0]); in lpfc_xcvr_data_show()
1983 rx_power = (rdp_context->page_a2[SFF_RXPOWER_B1] << 8 | in lpfc_xcvr_data_show()
1984 rdp_context->page_a2[SFF_RXPOWER_B0]); in lpfc_xcvr_data_show()
1986 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_xcvr_data_show()
1988 len += scnprintf(buf + len, PAGE_SIZE - len, "Vcc:\t\tx%04x V\n", vcc); in lpfc_xcvr_data_show()
1989 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_xcvr_data_show()
1991 len += scnprintf(buf + len, PAGE_SIZE - len, "TxPower:\tx%04x mW\n", in lpfc_xcvr_data_show()
1993 len += scnprintf(buf + len, PAGE_SIZE - len, "RxPower:\tx%04x mW\n", in lpfc_xcvr_data_show()
2001 * lpfc_board_mode_show - Return the state of the board
2013 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_show()
2014 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_show()
2017 if (phba->link_state == LPFC_HBA_ERROR) in lpfc_board_mode_show()
2019 else if (phba->link_state == LPFC_WARM_START) in lpfc_board_mode_show()
2021 else if (phba->link_state == LPFC_INIT_START) in lpfc_board_mode_show()
2030 * lpfc_board_mode_store - Puts the hba in online, offline, warm or error state
2037 * -EACCES if enable hba reset not enabled
2038 * -EINVAL if the buffer does not contain a valid string (see above)
2039 * -EIO if lpfc_workq_post_event() or lpfc_do_offline() fails
2047 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_store()
2048 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_store()
2054 if (!phba->cfg_enable_hba_reset) { in lpfc_board_mode_store()
2055 status = -EACCES; in lpfc_board_mode_store()
2064 if(strncmp(buf, "online", sizeof("online") - 1) == 0) { in lpfc_board_mode_store()
2068 status = -ENOMEM; in lpfc_board_mode_store()
2073 status = -EIO; in lpfc_board_mode_store()
2074 } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) in lpfc_board_mode_store()
2076 else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) in lpfc_board_mode_store()
2077 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
2078 status = -EINVAL; in lpfc_board_mode_store()
2081 else if (strncmp(buf, "error", sizeof("error") - 1) == 0) in lpfc_board_mode_store()
2082 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
2083 status = -EINVAL; in lpfc_board_mode_store()
2086 else if (strncmp(buf, "dump", sizeof("dump") - 1) == 0) in lpfc_board_mode_store()
2088 else if (strncmp(buf, "fw_reset", sizeof("fw_reset") - 1) == 0) in lpfc_board_mode_store()
2090 else if (strncmp(buf, "dv_reset", sizeof("dv_reset") - 1) == 0) in lpfc_board_mode_store()
2092 else if (strncmp(buf, "pci_bus_reset", sizeof("pci_bus_reset") - 1) in lpfc_board_mode_store()
2095 else if (strncmp(buf, "heartbeat", sizeof("heartbeat") - 1) == 0) in lpfc_board_mode_store()
2097 else if (strncmp(buf, "trunk", sizeof("trunk") - 1) == 0) in lpfc_board_mode_store()
2100 status = -EINVAL; in lpfc_board_mode_store()
2112 buf, status, phba->pport->fc_flag); in lpfc_board_mode_store()
2118 * lpfc_get_hba_info - Return various bits of informaton about the adapter
2152 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_hba_info()
2153 !phba->mbox_mem_pool || in lpfc_get_hba_info()
2154 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_hba_info()
2157 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_hba_info()
2160 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_hba_info()
2165 pmb = &pmboxq->u.mb; in lpfc_get_hba_info()
2166 pmb->mbxCommand = MBX_READ_CONFIG; in lpfc_get_hba_info()
2167 pmb->mbxOwner = OWN_HOST; in lpfc_get_hba_info()
2168 pmboxq->ctx_buf = NULL; in lpfc_get_hba_info()
2170 if (test_bit(FC_OFFLINE_MODE, &phba->pport->fc_flag)) in lpfc_get_hba_info()
2173 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_hba_info()
2177 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
2181 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_get_hba_info()
2182 sli4_hba = &phba->sli4_hba; in lpfc_get_hba_info()
2183 max_cfg_param = &sli4_hba->max_cfg_param; in lpfc_get_hba_info()
2186 if (!phba->sli4_hba.extents_in_use) { in lpfc_get_hba_info()
2188 *mrpi = max_cfg_param->max_rpi; in lpfc_get_hba_info()
2190 *mxri = max_cfg_param->max_xri; in lpfc_get_hba_info()
2192 max_vpi = max_cfg_param->max_vpi; in lpfc_get_hba_info()
2243 *mrpi = pmb->un.varRdConfig.max_rpi; in lpfc_get_hba_info()
2245 *arpi = pmb->un.varRdConfig.avail_rpi; in lpfc_get_hba_info()
2247 *mxri = pmb->un.varRdConfig.max_xri; in lpfc_get_hba_info()
2249 *axri = pmb->un.varRdConfig.avail_xri; in lpfc_get_hba_info()
2251 *mvpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
2254 if (phba->link_state == LPFC_HBA_READY) in lpfc_get_hba_info()
2255 *avpi = pmb->un.varRdConfig.avail_vpi; in lpfc_get_hba_info()
2257 *avpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
2265 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
2270 * lpfc_max_rpi_show - Return maximum rpi
2288 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_rpi_show()
2289 struct lpfc_hba *phba = vport->phba; in lpfc_max_rpi_show()
2298 * lpfc_used_rpi_show - Return maximum rpi minus available rpi
2316 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_rpi_show()
2317 struct lpfc_hba *phba = vport->phba; in lpfc_used_rpi_show()
2322 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_used_rpi_show()
2323 sli4_hba = &phba->sli4_hba; in lpfc_used_rpi_show()
2324 max_cfg_param = &sli4_hba->max_cfg_param; in lpfc_used_rpi_show()
2326 max_cfg_param->rpi_used); in lpfc_used_rpi_show()
2329 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_rpi_show()
2335 * lpfc_max_xri_show - Return maximum xri
2353 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_xri_show()
2354 struct lpfc_hba *phba = vport->phba; in lpfc_max_xri_show()
2363 * lpfc_used_xri_show - Return maximum xpi minus the available xpi
2381 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_xri_show()
2382 struct lpfc_hba *phba = vport->phba; in lpfc_used_xri_show()
2387 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_used_xri_show()
2388 sli4_hba = &phba->sli4_hba; in lpfc_used_xri_show()
2389 max_cfg_param = &sli4_hba->max_cfg_param; in lpfc_used_xri_show()
2391 max_cfg_param->xri_used); in lpfc_used_xri_show()
2394 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_xri_show()
2400 * lpfc_max_vpi_show - Return maximum vpi
2418 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_vpi_show()
2419 struct lpfc_hba *phba = vport->phba; in lpfc_max_vpi_show()
2428 * lpfc_used_vpi_show - Return maximum vpi minus the available vpi
2446 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_vpi_show()
2447 struct lpfc_hba *phba = vport->phba; in lpfc_used_vpi_show()
2452 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_used_vpi_show()
2453 sli4_hba = &phba->sli4_hba; in lpfc_used_vpi_show()
2454 max_cfg_param = &sli4_hba->max_cfg_param; in lpfc_used_vpi_show()
2456 max_cfg_param->vpi_used); in lpfc_used_vpi_show()
2459 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_vpi_show()
2465 * lpfc_npiv_info_show - Return text about NPIV support for the adapter
2482 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_npiv_info_show()
2483 struct lpfc_hba *phba = vport->phba; in lpfc_npiv_info_show()
2485 if (!(phba->max_vpi)) in lpfc_npiv_info_show()
2487 if (vport->port_type == LPFC_PHYSICAL_PORT) in lpfc_npiv_info_show()
2489 return scnprintf(buf, PAGE_SIZE, "NPIV Virtual (VPI %d)\n", vport->vpi); in lpfc_npiv_info_show()
2493 * lpfc_poll_show - Return text about poll support for the adapter
2508 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_show()
2509 struct lpfc_hba *phba = vport->phba; in lpfc_poll_show()
2511 return scnprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); in lpfc_poll_show()
2515 * lpfc_poll_store - Set the value of cfg_poll for the adapter
2525 * -EINVAL if the buffer connot be converted or is out of range
2533 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_store()
2534 struct lpfc_hba *phba = vport->phba; in lpfc_poll_store()
2540 return -EINVAL; in lpfc_poll_store()
2543 return -EINVAL; in lpfc_poll_store()
2546 return -EINVAL; in lpfc_poll_store()
2548 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_poll_store()
2553 phba->cfg_poll, val); in lpfc_poll_store()
2555 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2557 old_val = phba->cfg_poll; in lpfc_poll_store()
2562 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2563 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2564 return -EINVAL; in lpfc_poll_store()
2567 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2568 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2573 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2574 return -EINVAL; in lpfc_poll_store()
2580 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2581 del_timer(&phba->fcp_poll_timer); in lpfc_poll_store()
2582 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2583 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2584 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2585 return -EINVAL; in lpfc_poll_store()
2588 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2589 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2592 phba->cfg_poll = val; in lpfc_poll_store()
2594 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2600 * lpfc_sriov_hw_max_virtfn_show - Return maximum number of virtual functions
2617 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sriov_hw_max_virtfn_show()
2618 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_hw_max_virtfn_show()
2637 * -EINVAL if val is invalid
2642 if (lpfc_rangecheck(val, 0, 1) && phba->sli_rev == LPFC_SLI_REV4) { in lpfc_enable_bbcr_set()
2645 "%d\n", phba->cfg_enable_bbcr, val); in lpfc_enable_bbcr_set()
2646 phba->cfg_enable_bbcr = val; in lpfc_enable_bbcr_set()
2652 return -EINVAL; in lpfc_enable_bbcr_set()
2656 * lpfc_param_show - Return a cfg attribute value in decimal
2675 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2676 struct lpfc_hba *phba = vport->phba;\
2678 phba->cfg_##attr);\
2682 * lpfc_param_hex_show - Return a cfg attribute value in hex
2701 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2702 struct lpfc_hba *phba = vport->phba;\
2704 val = phba->cfg_##attr;\
2706 phba->cfg_##attr);\
2710 * lpfc_param_init - Initializes a cfg attribute
2726 * -EINVAL if default used
2733 phba->cfg_##attr = val;\
2739 phba->cfg_##attr = default;\
2740 return -EINVAL;\
2744 * lpfc_param_set - Set a cfg attribute value
2761 * -EINVAL if val is invalid
2770 phba->cfg_##attr, val); \
2771 phba->cfg_##attr = val;\
2777 return -EINVAL;\
2781 * lpfc_param_store - Set a vport attribute value
2798 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2807 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2808 struct lpfc_hba *phba = vport->phba;\
2811 return -EINVAL;\
2813 return -EINVAL;\
2817 return -EINVAL;\
2821 * lpfc_vport_param_show - Return decimal formatted cfg attribute value
2840 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2841 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
2845 * lpfc_vport_param_hex_show - Return hex formatted attribute value
2865 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2866 return scnprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
2870 * lpfc_vport_param_init - Initialize a vport cfg attribute
2885 * -EINVAL if default used
2892 vport->cfg_##attr = val;\
2898 vport->cfg_##attr = default;\
2899 return -EINVAL;\
2903 * lpfc_vport_param_set - Set a vport cfg attribute
2917 * -EINVAL if val is invalid
2927 vport->cfg_##attr, vport->cfg_##attr, \
2929 vport->cfg_##attr = val;\
2935 return -EINVAL;\
2939 * lpfc_vport_param_store - Set a vport attribute
2952 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2961 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2964 return -EINVAL;\
2966 return -EINVAL;\
2970 return -EINVAL;\
3017 * lpfc_wwn_set - Convert string to the 8 byte WWN value.
3023 * -EINVAL if the buffer does not contain a valid wwn
3032 if (buf[cnt-1] == '\n') in lpfc_wwn_set()
3033 cnt--; in lpfc_wwn_set()
3037 return -EINVAL; in lpfc_wwn_set()
3044 j = ((j << 4) | ((*buf++ - 'a') + 10)); in lpfc_wwn_set()
3046 j = ((j << 4) | ((*buf++ - 'A') + 10)); in lpfc_wwn_set()
3048 j = ((j << 4) | (*buf++ - '0')); in lpfc_wwn_set()
3050 return -EINVAL; in lpfc_wwn_set()
3061 * lpfc_oas_tgt_show - Return wwpn of target whose luns maybe enabled for
3075 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_show()
3078 wwn_to_u64(phba->cfg_oas_tgt_wwpn)); in lpfc_oas_tgt_show()
3082 * lpfc_oas_tgt_store - Store wwpn of target whose luns maybe enabled for
3090 * -EINVAL count is invalid, invalid wwpn byte invalid
3091 * -EPERM oas is not supported by hba
3099 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_store()
3104 if (!phba->cfg_fof) in lpfc_oas_tgt_store()
3105 return -EPERM; in lpfc_oas_tgt_store()
3108 if (buf[cnt-1] == '\n') in lpfc_oas_tgt_store()
3109 cnt--; in lpfc_oas_tgt_store()
3115 memcpy(phba->cfg_oas_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
3116 memcpy(phba->sli4_hba.oas_next_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
3118 phba->cfg_oas_flags |= OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
3120 phba->cfg_oas_flags &= ~OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
3121 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_tgt_store()
3122 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_tgt_store()
3129 * lpfc_oas_priority_show - Return wwpn of target whose luns maybe enabled for
3143 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_show()
3145 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority); in lpfc_oas_priority_show()
3149 * lpfc_oas_priority_store - Store wwpn of target whose luns maybe enabled for
3157 * -EINVAL count is invalid, invalid wwpn byte invalid
3158 * -EPERM oas is not supported by hba
3166 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_store()
3171 if (!phba->cfg_fof) in lpfc_oas_priority_store()
3172 return -EPERM; in lpfc_oas_priority_store()
3175 if (buf[cnt-1] == '\n') in lpfc_oas_priority_store()
3176 cnt--; in lpfc_oas_priority_store()
3180 return -EINVAL; in lpfc_oas_priority_store()
3183 phba->cfg_oas_priority = (uint8_t)val; in lpfc_oas_priority_store()
3185 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_priority_store()
3192 * lpfc_oas_vpt_show - Return wwpn of vport whose targets maybe enabled
3206 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_show()
3209 wwn_to_u64(phba->cfg_oas_vpt_wwpn)); in lpfc_oas_vpt_show()
3213 * lpfc_oas_vpt_store - Store wwpn of vport whose targets maybe enabled
3221 * -EINVAL count is invalid, invalid wwpn byte invalid
3222 * -EPERM oas is not supported by hba
3230 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_store()
3235 if (!phba->cfg_fof) in lpfc_oas_vpt_store()
3236 return -EPERM; in lpfc_oas_vpt_store()
3239 if (buf[cnt-1] == '\n') in lpfc_oas_vpt_store()
3240 cnt--; in lpfc_oas_vpt_store()
3246 memcpy(phba->cfg_oas_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3247 memcpy(phba->sli4_hba.oas_next_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3249 phba->cfg_oas_flags |= OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3251 phba->cfg_oas_flags &= ~OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3252 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_vpt_store()
3253 if (phba->cfg_oas_priority == 0) in lpfc_oas_vpt_store()
3254 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_vpt_store()
3255 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_vpt_store()
3262 * lpfc_oas_lun_state_show - Return the current state (enabled or disabled)
3277 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_show()
3279 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_state); in lpfc_oas_lun_state_show()
3283 * lpfc_oas_lun_state_store - Store the state (enabled or disabled)
3292 * -EINVAL count is invalid, invalid wwpn byte invalid
3293 * -EPERM oas is not supported by hba
3301 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_store()
3304 if (!phba->cfg_fof) in lpfc_oas_lun_state_store()
3305 return -EPERM; in lpfc_oas_lun_state_store()
3308 return -EINVAL; in lpfc_oas_lun_state_store()
3311 return -EINVAL; in lpfc_oas_lun_state_store()
3314 return -EINVAL; in lpfc_oas_lun_state_store()
3316 phba->cfg_oas_lun_state = val; in lpfc_oas_lun_state_store()
3323 * lpfc_oas_lun_status_show - Return the status of the Optimized Access
3338 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_status_show()
3340 if (!(phba->cfg_oas_flags & OAS_LUN_VALID)) in lpfc_oas_lun_status_show()
3341 return -EFAULT; in lpfc_oas_lun_status_show()
3343 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_status); in lpfc_oas_lun_status_show()
3350 * lpfc_oas_lun_state_set - enable or disable a lun for Optimized Access Storage
3361 * -EPERM OAS is not enabled or not supported by this port.
3372 if (!phba->cfg_fof) in lpfc_oas_lun_state_set()
3373 return -EPERM; in lpfc_oas_lun_state_set()
3379 rc = -ENOMEM; in lpfc_oas_lun_state_set()
3389 * lpfc_oas_lun_get_next - get the next lun that has been enabled for Optimized
3415 phba->sli4_hba.oas_next_vpt_wwpn, in lpfc_oas_lun_get_next()
3417 phba->sli4_hba.oas_next_tgt_wwpn, in lpfc_oas_lun_get_next()
3418 &phba->sli4_hba.oas_next_lun, in lpfc_oas_lun_get_next()
3428 * lpfc_oas_lun_state_change - enable/disable a lun for OAS operations
3441 * -ENOMEM: failed to enable an lun for OAS operations
3442 * -EPERM: OAS is not enabled
3458 * lpfc_oas_lun_show - Return oas enabled luns from a chosen target
3468 * -EFAULT: target or vport wwpn was not set properly.
3469 * -EPERM: oas is not enabled.
3476 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_show()
3481 if (!phba->cfg_fof) in lpfc_oas_lun_show()
3482 return -EPERM; in lpfc_oas_lun_show()
3484 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_show()
3485 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_VPORT)) in lpfc_oas_lun_show()
3486 return -EFAULT; in lpfc_oas_lun_show()
3488 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_show()
3489 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_TARGET)) in lpfc_oas_lun_show()
3490 return -EFAULT; in lpfc_oas_lun_show()
3492 oas_lun = lpfc_oas_lun_get_next(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_show()
3493 phba->cfg_oas_tgt_wwpn, in lpfc_oas_lun_show()
3494 &phba->cfg_oas_lun_status, in lpfc_oas_lun_show()
3495 &phba->cfg_oas_priority); in lpfc_oas_lun_show()
3497 phba->cfg_oas_flags |= OAS_LUN_VALID; in lpfc_oas_lun_show()
3499 len += scnprintf(buf + len, PAGE_SIZE-len, "0x%llx", oas_lun); in lpfc_oas_lun_show()
3505 * lpfc_oas_lun_store - Sets the OAS state for lun
3516 * -EFAULT: target or vport wwpn was not set properly.
3517 * -EPERM: oas is not enabled.
3525 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_store()
3530 if (!phba->cfg_fof) in lpfc_oas_lun_store()
3531 return -EPERM; in lpfc_oas_lun_store()
3533 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_store()
3534 return -EFAULT; in lpfc_oas_lun_store()
3536 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_store()
3537 return -EFAULT; in lpfc_oas_lun_store()
3540 return -EINVAL; in lpfc_oas_lun_store()
3543 return -EINVAL; in lpfc_oas_lun_store()
3545 pri = phba->cfg_oas_priority; in lpfc_oas_lun_store()
3547 pri = phba->cfg_XLanePriority; in lpfc_oas_lun_store()
3552 wwn_to_u64(phba->cfg_oas_vpt_wwpn), in lpfc_oas_lun_store()
3553 wwn_to_u64(phba->cfg_oas_tgt_wwpn), scsi_lun, in lpfc_oas_lun_store()
3554 pri, phba->cfg_oas_lun_state); in lpfc_oas_lun_store()
3556 rc = lpfc_oas_lun_state_change(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_store()
3557 phba->cfg_oas_tgt_wwpn, scsi_lun, in lpfc_oas_lun_store()
3558 phba->cfg_oas_lun_state, pri); in lpfc_oas_lun_store()
3577 " 0 - none,"
3578 " 1 - poll with interrupts enabled"
3579 " 3 - poll and disable FCP ring interrupts");
3590 "SLI mode selector: 3 - select SLI-3");
3631 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pls_show()
3634 phba->sli4_hba.pc_sli4_params.pls); in lpfc_pls_show()
3643 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pt_show()
3647 &phba->hba_flag) ? 1 : 0); in lpfc_pt_show()
3654 # 1 - (1024)
3655 # 2 - (2048)
3656 # 3 - (3072)
3657 # 4 - (4096)
3658 # 5 - (5120)
3664 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_iocb_hw_show()
3666 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max); in lpfc_iocb_hw_show()
3675 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txq_hw_show()
3679 pring ? pring->txq_max : 0); in lpfc_txq_hw_show()
3689 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txcmplq_hw_show()
3693 pring ? pring->txcmplq_max : 0); in lpfc_txcmplq_hw_show()
3711 * lpfc_nodev_tmo_show - Return the hba dev loss timeout value
3723 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nodev_tmo_show()
3725 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); in lpfc_nodev_tmo_show()
3729 * lpfc_nodev_tmo_init - Set the hba nodev timeout value
3741 * -EINVAL val out of range
3746 if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { in lpfc_nodev_tmo_init()
3747 vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; in lpfc_nodev_tmo_init()
3757 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_init()
3758 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_init()
3765 vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; in lpfc_nodev_tmo_init()
3766 return -EINVAL; in lpfc_nodev_tmo_init()
3770 * lpfc_update_rport_devloss_tmo - Update dev loss tmo value
3786 spin_lock_irqsave(&vport->fc_nodes_list_lock, iflags); in lpfc_update_rport_devloss_tmo()
3787 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_update_rport_devloss_tmo()
3788 if (ndlp->rport) in lpfc_update_rport_devloss_tmo()
3789 ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; in lpfc_update_rport_devloss_tmo()
3791 spin_lock(&ndlp->lock); in lpfc_update_rport_devloss_tmo()
3794 remoteport = rport->remoteport; in lpfc_update_rport_devloss_tmo()
3795 spin_unlock(&ndlp->lock); in lpfc_update_rport_devloss_tmo()
3798 vport->cfg_devloss_tmo); in lpfc_update_rport_devloss_tmo()
3801 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags); in lpfc_update_rport_devloss_tmo()
3805 * lpfc_nodev_tmo_set - Set the vport nodev tmo and devloss tmo values
3817 * -EINVAL val out of range
3822 if (vport->dev_loss_tmo_changed || in lpfc_nodev_tmo_set()
3830 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_set()
3831 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_set()
3844 return -EINVAL; in lpfc_nodev_tmo_set()
3865 * lpfc_devloss_tmo_set - Sets vport nodev tmo, devloss tmo values, changed bit in lpfc_vport_param_init()
3876 * -EINVAL val out of range in lpfc_vport_param_init()
3882 vport->cfg_nodev_tmo = val; in lpfc_vport_param_init()
3883 vport->cfg_devloss_tmo = val; in lpfc_vport_param_init()
3884 vport->dev_loss_tmo_changed = 1; in lpfc_vport_param_init()
3894 return -EINVAL; in lpfc_vport_param_init()
3931 * Supported Values: 1 - register just FCP
3932 * 3 - register both FCP and NVME
3937 "Enable FC4 Protocol support - FCP / NVME");
3946 "Verbose logging bit-mask");
3982 * -EINVAL if val is invalid
3991 return -EINVAL; in lpfc_tgt_queue_depth_set()
3993 if (val == vport->cfg_tgt_queue_depth) in lpfc_tgt_queue_depth_set()
3996 vport->cfg_tgt_queue_depth = val; in lpfc_tgt_queue_depth_set()
3999 spin_lock_irqsave(&vport->fc_nodes_list_lock, iflags); in lpfc_tgt_queue_depth_set()
4000 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) in lpfc_tgt_queue_depth_set()
4001 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_tgt_queue_depth_set()
4002 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags); in lpfc_tgt_queue_depth_set()
4050 * lpfc_restrict_login_init - Set the vport restrict login flag
4062 * -EINVAL val out of range
4072 vport->cfg_restrict_login = 1; in lpfc_restrict_login_init()
4073 return -EINVAL; in lpfc_restrict_login_init()
4075 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_restrict_login_init()
4076 vport->cfg_restrict_login = 0; in lpfc_restrict_login_init()
4079 vport->cfg_restrict_login = val; in lpfc_restrict_login_init()
4084 * lpfc_restrict_login_set - Set the vport restrict login flag
4097 * -EINVAL val out of range
4107 vport->cfg_restrict_login = 1; in lpfc_restrict_login_set()
4108 return -EINVAL; in lpfc_restrict_login_set()
4110 if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { in lpfc_restrict_login_set()
4114 vport->cfg_restrict_login = 0; in lpfc_restrict_login_set()
4117 vport->cfg_restrict_login = val; in lpfc_restrict_login_set()
4126 # Fibre channel "ALPA". In the FC-AL Profile there is an "informative
4132 # Turning on the scan-down variable (on = 1, off = 0) will
4145 # 0x0 = attempt loop mode then point-to-point
4147 # 0x02 = attempt point-to-point mode only
4149 # 0x06 = attempt point-to-point mode then loop
4150 # Set point-to-point mode if you want to run as an N_Port.
4158 * lpfc_topology_store - Set the adapters topology field
4172 * non-zero return value from lpfc_issue_lip()
4173 * -EINVAL val out of range
4180 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_topology_store()
4181 struct lpfc_hba *phba = vport->phba; in lpfc_topology_store()
4195 return -EINVAL; in lpfc_topology_store()
4197 return -EINVAL; in lpfc_topology_store()
4200 prev_val = phba->cfg_topology; in lpfc_topology_store()
4201 if (phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G && in lpfc_topology_store()
4206 return -EINVAL; in lpfc_topology_store()
4210 * - persistent topology enabled in lpfc_topology_store()
4211 * - ASIC_GEN_NUM >= 0xC, with no private loop support in lpfc_topology_store()
4214 &phba->sli4_hba.sli_intf); in lpfc_topology_store()
4216 &phba->sli4_hba.sli_intf); in lpfc_topology_store()
4217 if ((test_bit(HBA_PERSISTENT_TOPO, &phba->hba_flag) || in lpfc_topology_store()
4218 (!phba->sli4_hba.pc_sli4_params.pls && in lpfc_topology_store()
4224 return -EINVAL; in lpfc_topology_store()
4226 phba->cfg_topology = val; in lpfc_topology_store()
4233 if (prev_val != val && phba->sli_rev == LPFC_SLI_REV4) in lpfc_topology_store()
4234 phba->fc_topology_changed = 1; in lpfc_topology_store()
4235 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_topology_store()
4237 phba->cfg_topology = prev_val; in lpfc_topology_store()
4238 return -EINVAL; in lpfc_topology_store()
4245 phba->brd_no, val); in lpfc_topology_store()
4246 return -EINVAL; in lpfc_topology_store()
4268 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_static_vport_show()
4269 if (vport->vport_flag & STATIC_VPORT) in lpfc_static_vport_show()
4288 * lpfc_link_speed_store - Set the adapters link speed
4303 * non-zero return value from lpfc_issue_lip()
4304 * -EINVAL val out of range
4311 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_speed_store()
4312 struct lpfc_hba *phba = vport->phba; in lpfc_link_speed_store()
4319 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_link_speed_store()
4321 test_bit(HBA_FORCED_LINK_SPEED, &phba->hba_flag)) in lpfc_link_speed_store()
4322 return -EPERM; in lpfc_link_speed_store()
4330 return -EINVAL; in lpfc_link_speed_store()
4332 return -EINVAL; in lpfc_link_speed_store()
4336 phba->cfg_link_speed, val, nolip ? "(nolip)" : "(lip)"); in lpfc_link_speed_store()
4338 if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || in lpfc_link_speed_store()
4339 ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || in lpfc_link_speed_store()
4340 ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || in lpfc_link_speed_store()
4341 ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || in lpfc_link_speed_store()
4342 ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) || in lpfc_link_speed_store()
4343 ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb)) || in lpfc_link_speed_store()
4344 ((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb)) || in lpfc_link_speed_store()
4345 ((val == LPFC_USER_LINK_SPEED_64G) && !(phba->lmt & LMT_64Gb))) { in lpfc_link_speed_store()
4350 return -EINVAL; in lpfc_link_speed_store()
4353 phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_speed_store()
4358 return -EINVAL; in lpfc_link_speed_store()
4370 prev_val = phba->cfg_link_speed; in lpfc_link_speed_store()
4371 phba->cfg_link_speed = val; in lpfc_link_speed_store()
4375 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_link_speed_store()
4377 phba->cfg_link_speed = prev_val; in lpfc_link_speed_store()
4378 return -EINVAL; in lpfc_link_speed_store()
4389 return -EINVAL; in lpfc_link_speed_store()
4399 * lpfc_link_speed_init - Set the adapters link speed in lpfc_param_show()
4412 * -EINVAL val out of range in lpfc_param_show()
4417 if (val >= LPFC_USER_LINK_SPEED_16G && phba->cfg_topology == 4) { in lpfc_param_show()
4422 phba->cfg_topology = 0; in lpfc_param_show()
4434 phba->cfg_link_speed = val; in lpfc_param_show()
4441 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_param_show()
4442 return -EINVAL; in lpfc_param_show()
4454 # N.B. Parts of LPFC_ATTR open-coded since some of the underlying
4455 # infrastructure (phba->cfg_aer_support) is gone.
4468 * lpfc_aer_support_store - Set the adapter for aer support
4482 * -EINVAL if val out of range
4491 return -EINVAL; in lpfc_aer_support_store()
4493 return -EINVAL; in lpfc_aer_support_store()
4502 * lpfc_aer_cleanup_state - Clean up aer state to the aer enabled device
4516 * -EINVAL if the buf does not contain 1
4517 * -EPERM if the OS cannot clear AER error status, i.e., when platform
4525 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_aer_cleanup_state()
4526 struct lpfc_hba *phba = vport->phba; in lpfc_aer_cleanup_state()
4527 int val, rc = -1; in lpfc_aer_cleanup_state()
4530 return -EINVAL; in lpfc_aer_cleanup_state()
4532 return -EINVAL; in lpfc_aer_cleanup_state()
4534 return -EINVAL; in lpfc_aer_cleanup_state()
4536 rc = pci_aer_clear_nonfatal_status(phba->pcidev); in lpfc_aer_cleanup_state()
4541 return -EPERM; in lpfc_aer_cleanup_state()
4548 * lpfc_sriov_nr_virtfn_store - Enable the adapter for sr-iov virtual functions
4557 * try to enable or disable SR-IOV virtual functions according to the
4567 * cfg_sriov_nr_virtfn; otherwise, -EINVAL shall be returned and driver
4570 * If none-zero virtual functions have already been enabled to the
4572 * -EINVAL will be returned and the driver does nothing;
4574 * If the nr_vfn provided is zero and none-zero virtual functions have
4584 * -EINVAL if val out of range or intended mode is not supported.
4591 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sriov_nr_virtfn_store()
4592 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_nr_virtfn_store()
4593 struct pci_dev *pdev = phba->pcidev; in lpfc_sriov_nr_virtfn_store()
4594 int val = 0, rc = -EINVAL; in lpfc_sriov_nr_virtfn_store()
4598 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4600 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4602 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4606 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4608 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4614 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4618 phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4619 return -EEXIST; in lpfc_sriov_nr_virtfn_store()
4623 phba->cfg_sriov_nr_virtfn = val; in lpfc_sriov_nr_virtfn_store()
4628 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4631 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4633 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4634 rc = -EPERM; in lpfc_sriov_nr_virtfn_store()
4642 "Enable PCIe device SR-IOV virtual fn");
4648 * lpfc_request_firmware_upgrade_store - Request for Linux generic firmware upgrade
4660 * -EINVAL if val out of range or intended mode is not supported.
4668 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_request_firmware_upgrade_store()
4669 struct lpfc_hba *phba = vport->phba; in lpfc_request_firmware_upgrade_store()
4674 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4676 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4678 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4682 rc = -EPERM; in lpfc_request_firmware_upgrade_store()
4694 * lpfc_request_firmware_upgrade_init - Enable initial linux generic fw upgrade in lpfc_param_show()
4703 * -EINVAL val out of range in lpfc_param_show()
4709 phba->cfg_request_firmware_upgrade = val; in lpfc_param_show()
4712 return -EINVAL; in lpfc_param_show()
4732 * 0 - on success
4733 * -EIO - if command is not sent
4740 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_force_rscn_store()
4745 return -EIO; in lpfc_force_rscn_store()
4762 * lpfc_force_rscn_init - Force an RSCN to be sent to all remote NPorts in lpfc_param_show()
4781 * @buf: string with the number of fast-path FCP interrupts per second.
4786 * maximum number of fast-path FCP interrupts per second.
4791 * -EINVAL if val out of range or intended mode is not supported.
4798 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_imax_store()
4799 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_imax_store()
4805 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_fcp_imax_store()
4806 return -EINVAL; in lpfc_fcp_imax_store()
4810 return -EINVAL; in lpfc_fcp_imax_store()
4812 return -EINVAL; in lpfc_fcp_imax_store()
4820 return -EINVAL; in lpfc_fcp_imax_store()
4822 phba->cfg_auto_imax = (val) ? 0 : 1; in lpfc_fcp_imax_store()
4823 if (phba->cfg_fcp_imax && !val) { in lpfc_fcp_imax_store()
4824 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_fcp_imax_store()
4828 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_fcp_imax_store()
4829 eqi->icnt = 0; in lpfc_fcp_imax_store()
4833 phba->cfg_fcp_imax = (uint32_t)val; in lpfc_fcp_imax_store()
4835 if (phba->cfg_fcp_imax) in lpfc_fcp_imax_store()
4836 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_fcp_imax_store()
4840 for (i = 0; i < phba->cfg_irq_chann; i += LPFC_MAX_EQ_DELAY_EQID_CNT) in lpfc_fcp_imax_store()
4848 # lpfc_fcp_imax: The maximum number of fast-path FCP interrupts per second
4860 * lpfc_fcp_imax_init - Set the initial sr-iov virtual function enable in lpfc_param_show()
4866 * maximum number of fast-path FCP interrupts per second. in lpfc_param_show()
4870 * -EINVAL val out of range in lpfc_param_show()
4875 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_param_show()
4876 phba->cfg_fcp_imax = 0; in lpfc_param_show()
4882 phba->cfg_fcp_imax = val; in lpfc_param_show()
4889 phba->cfg_fcp_imax = LPFC_DEF_IMAX; in lpfc_param_show()
4909 * -ERANGE: if val is not in the valid range
4910 * -EINVAL: if bad value format or intended mode is not supported.
4917 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_cq_max_proc_limit_store()
4918 struct lpfc_hba *phba = vport->phba; in lpfc_cq_max_proc_limit_store()
4924 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_store()
4925 return -EINVAL; in lpfc_cq_max_proc_limit_store()
4929 return -EINVAL; in lpfc_cq_max_proc_limit_store()
4931 return -EINVAL; in lpfc_cq_max_proc_limit_store()
4934 return -ERANGE; in lpfc_cq_max_proc_limit_store()
4936 phba->cfg_cq_max_proc_limit = (uint32_t)val; in lpfc_cq_max_proc_limit_store()
4939 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_cq_max_proc_limit_store()
4941 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_cq_max_proc_limit_store()
4945 list_for_each_entry(cq, &eq->child_list, list) in lpfc_cq_max_proc_limit_store()
4946 cq->max_proc_limit = min(phba->cfg_cq_max_proc_limit, in lpfc_cq_max_proc_limit_store()
4947 cq->entry_count); in lpfc_cq_max_proc_limit_store()
4967 * than re-enabling interrupts.
4975 * lpfc_cq_max_proc_limit_init - Set the initial cq max_proc_limit
4991 phba->cfg_cq_max_proc_limit = LPFC_CQ_DEF_MAX_PROC_LIMIT; in lpfc_cq_max_proc_limit_init()
4993 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_init()
4997 phba->cfg_cq_max_proc_limit = val; in lpfc_cq_max_proc_limit_init()
5004 phba->cfg_cq_max_proc_limit); in lpfc_cq_max_proc_limit_init()
5012 * lpfc_fcp_cpu_map_show - Display current driver CPU affinity
5024 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_cpu_map_show()
5025 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_cpu_map_show()
5029 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_fcp_cpu_map_show()
5030 (phba->intr_type != MSIX)) in lpfc_fcp_cpu_map_show()
5033 switch (phba->cfg_fcp_cpu_map) { in lpfc_fcp_cpu_map_show()
5035 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
5037 phba->cfg_fcp_cpu_map); in lpfc_fcp_cpu_map_show()
5040 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
5041 "fcp_cpu_map: HBA centric mapping (%d): " in lpfc_fcp_cpu_map_show()
5043 phba->cfg_fcp_cpu_map, num_online_cpus(), in lpfc_fcp_cpu_map_show()
5045 phba->sli4_hba.num_possible_cpu); in lpfc_fcp_cpu_map_show()
5049 while (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
5050 phba->sli4_hba.num_possible_cpu) { in lpfc_fcp_cpu_map_show()
5051 cpup = &phba->sli4_hba.cpu_map[phba->sli4_hba.curr_disp_cpu]; in lpfc_fcp_cpu_map_show()
5053 if (!cpu_present(phba->sli4_hba.curr_disp_cpu)) in lpfc_fcp_cpu_map_show()
5054 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5055 "CPU %02d not present\n", in lpfc_fcp_cpu_map_show()
5056 phba->sli4_hba.curr_disp_cpu); in lpfc_fcp_cpu_map_show()
5057 else if (cpup->eq == LPFC_VECTOR_MAP_EMPTY) { in lpfc_fcp_cpu_map_show()
5058 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
5060 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5061 "CPU %02d hdwq None " in lpfc_fcp_cpu_map_show()
5063 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5064 cpup->phys_id, 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()
5069 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5070 "CPU %02d EQ None hdwq %04d " in lpfc_fcp_cpu_map_show()
5072 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5073 cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
5074 cpup->core_id, in lpfc_fcp_cpu_map_show()
5075 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5076 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
5078 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
5080 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5081 "CPU %02d hdwq None " in lpfc_fcp_cpu_map_show()
5083 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5084 cpup->phys_id, in lpfc_fcp_cpu_map_show()
5085 cpup->core_id, in lpfc_fcp_cpu_map_show()
5086 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5087 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
5088 lpfc_get_irq(cpup->eq)); in lpfc_fcp_cpu_map_show()
5091 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5092 "CPU %02d EQ %04d hdwq %04d " in lpfc_fcp_cpu_map_show()
5094 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5095 cpup->eq, cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
5096 cpup->core_id, in lpfc_fcp_cpu_map_show()
5097 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5098 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
5099 lpfc_get_irq(cpup->eq)); in lpfc_fcp_cpu_map_show()
5102 phba->sli4_hba.curr_disp_cpu++; in lpfc_fcp_cpu_map_show()
5105 if (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
5106 phba->sli4_hba.num_possible_cpu && in lpfc_fcp_cpu_map_show()
5107 (len >= (PAGE_SIZE - 64))) { in lpfc_fcp_cpu_map_show()
5109 PAGE_SIZE - len, "more...\n"); in lpfc_fcp_cpu_map_show()
5114 if (phba->sli4_hba.curr_disp_cpu == phba->sli4_hba.num_possible_cpu) in lpfc_fcp_cpu_map_show()
5115 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_fcp_cpu_map_show()
5121 * lpfc_fcp_cpu_map_store - Change CPU affinity of driver vectors
5128 * -EINVAL - Not implemented yet.
5134 return -EINVAL; in lpfc_fcp_cpu_map_store()
5142 # 0 - Do not affinitze IRQ vectors
5143 # 1 - Affintize HBA vectors with respect to each HBA
5153 * lpfc_fcp_cpu_map_init - Set the initial sr-iov virtual function enable
5158 * If val is in a valid range [0-2], then affinitze the adapter's
5163 * -EINVAL val out of range
5168 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_fcp_cpu_map_init()
5169 phba->cfg_fcp_cpu_map = 0; in lpfc_fcp_cpu_map_init()
5174 phba->cfg_fcp_cpu_map = val; in lpfc_fcp_cpu_map_init()
5181 phba->cfg_fcp_cpu_map = LPFC_HBA_CPU_MAP; in lpfc_fcp_cpu_map_init()
5216 * Parameter supported on physical port only - no NPIV support.
5237 # the parameter is set to a non-zero value, the I/O queue depth is controlled
5251 if (val == vport->cfg_max_scsicmpl_time) in lpfc_max_scsicmpl_time_set()
5254 return -EINVAL; in lpfc_max_scsicmpl_time_set()
5255 vport->cfg_max_scsicmpl_time = val; in lpfc_max_scsicmpl_time_set()
5257 spin_lock_irqsave(&vport->fc_nodes_list_lock, iflags); in lpfc_max_scsicmpl_time_set()
5258 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_max_scsicmpl_time_set()
5259 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) in lpfc_max_scsicmpl_time_set()
5261 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_max_scsicmpl_time_set()
5263 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags); in lpfc_max_scsicmpl_time_set()
5287 * current CPU.
5292 * The driver dynamically sets this to 1 (BY_CPU) if it's able to set up cpu
5294 * CPU. Otherwise, the default 0 (Round Robin) scheduling of FCP/NVME I/Os
5301 "issuing commands [0] - Hardware Queue, [1] - Current CPU");
5313 "[0] - GID_FT, [1] - GID_PT");
5319 # For [1], bus reset issues target reset to non-FCP2 devices
5322 "FCP2 devices [0] - issue tgt reset, [1] - no tgt reset");
5375 # Traditional FDMI support means the driver will assume FDMI-2 support;
5376 # however, if that fails, it will fallback to FDMI-1.
5400 # there are FC targets, such as JBODs, that only recognize 8-bits of
5433 # 2 = MSI-X enabled (default)
5437 "MSI-X (2), if possible");
5496 * lpfc_cpumask_irq_mode_init - initalizes cpumask of phba based on
5503 unsigned int cpu, first_cpu, numa_node = NUMA_NO_NODE; in lpfc_cpumask_irq_mode_init() local
5505 struct cpumask *aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_cpumask_irq_mode_init()
5509 if (phba->irq_chann_mode == NUMA_MODE) { in lpfc_cpumask_irq_mode_init()
5511 numa_node = dev_to_node(&phba->pcidev->dev); in lpfc_cpumask_irq_mode_init()
5513 phba->irq_chann_mode = NORMAL_MODE; in lpfc_cpumask_irq_mode_init()
5518 for_each_possible_cpu(cpu) { in lpfc_cpumask_irq_mode_init()
5519 switch (phba->irq_chann_mode) { in lpfc_cpumask_irq_mode_init()
5521 if (cpu_to_node(cpu) == numa_node) in lpfc_cpumask_irq_mode_init()
5522 cpumask_set_cpu(cpu, aff_mask); in lpfc_cpumask_irq_mode_init()
5525 sibling_mask = topology_sibling_cpumask(cpu); in lpfc_cpumask_irq_mode_init()
5544 phba->irq_chann_mode = NUMA_MODE; in lpfc_assign_default_irq_chann()
5548 phba->irq_chann_mode = NHT_MODE; in lpfc_assign_default_irq_chann()
5551 phba->irq_chann_mode = NORMAL_MODE; in lpfc_assign_default_irq_chann()
5556 phba->irq_chann_mode = NORMAL_MODE; in lpfc_assign_default_irq_chann()
5563 * of EQ / MSI-X vectors the driver will create. This should never be
5578 /* lpfc_irq_chann_init - Set the hba irq_chann initial value
5589 * -EINVAL if value was out of range
5596 if (phba->cfg_use_msi != 2) { in lpfc_irq_chann_init()
5599 phba->cfg_use_msi); in lpfc_irq_chann_init()
5600 phba->irq_chann_mode = NORMAL_MODE; in lpfc_irq_chann_init()
5601 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5607 phba->cfg_hdw_queue == LPFC_HBA_HDWQ_DEF && in lpfc_irq_chann_init()
5608 phba->sli_rev == LPFC_SLI_REV4) in lpfc_irq_chann_init()
5611 if (phba->irq_chann_mode != NORMAL_MODE) { in lpfc_irq_chann_init()
5612 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_chann_init()
5618 phba->irq_chann_mode); in lpfc_irq_chann_init()
5619 phba->irq_chann_mode = NORMAL_MODE; in lpfc_irq_chann_init()
5620 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5622 phba->cfg_irq_chann = cpumask_weight(aff_mask); in lpfc_irq_chann_init()
5627 if (phba->irq_chann_mode == NHT_MODE) in lpfc_irq_chann_init()
5628 phba->cfg_hdw_queue = phba->cfg_irq_chann; in lpfc_irq_chann_init()
5632 "(mode: %d)\n", phba->cfg_irq_chann, in lpfc_irq_chann_init()
5633 phba->irq_chann_mode); in lpfc_irq_chann_init()
5644 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5645 return -EINVAL; in lpfc_irq_chann_init()
5647 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_irq_chann_init()
5648 phba->cfg_irq_chann = val; in lpfc_irq_chann_init()
5650 phba->cfg_irq_chann = 2; in lpfc_irq_chann_init()
5651 phba->cfg_hdw_queue = 1; in lpfc_irq_chann_init()
5659 * lpfc_irq_chann_show - Display value of irq_chann
5671 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_irq_chann_show()
5672 struct lpfc_hba *phba = vport->phba; in lpfc_irq_chann_show()
5674 return scnprintf(buf, PAGE_SIZE, "%u\n", phba->cfg_irq_chann); in lpfc_irq_chann_show()
5706 # 0x0 - 0x7f = CS_CTL field in FC header (high 7 bits)
5712 # lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF)
5721 # - Bit mask of host protection capabilities used to register with the
5722 # SCSI mid-layer
5723 # - Only meaningful if BG is turned on (lpfc_enable_bg=1).
5724 # - Allows you to ultimately specify which profiles to use
5725 # - Default will result in registering capabilities for all profiles.
5726 # - SHOST_DIF_TYPE1_PROTECTION 1
5728 # - SHOST_DIX_TYPE0_PROTECTION 8
5730 # - SHOST_DIX_TYPE1_PROTECTION 16
5742 "T10-DIF host protection capabilities mask");
5746 # - Bit mask of protection guard types to register with the SCSI mid-layer
5747 # - Guard types are currently either 1) T10-DIF CRC 2) IP checksum
5748 # - Allows you to ultimately specify which profiles to use
5749 # - Default will result in registering capabilities for all guard types
5754 "T10-DIF host protection guard type");
5762 * When this parameter is set to non-zero value, initial Nport discovery is
5774 * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
5778 * Because of the additional overhead involved in setting up T10-DIF,
5787 * lpfc_sg_seg_cnt_show - Display the scatter/gather list sizes
5800 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sg_seg_cnt_show()
5801 struct lpfc_hba *phba = vport->phba; in lpfc_sg_seg_cnt_show()
5805 phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); in lpfc_sg_seg_cnt_show()
5807 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_sg_seg_cnt_show()
5809 phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sg_seg_cnt_show()
5810 phba->cfg_nvme_seg_cnt); in lpfc_sg_seg_cnt_show()
5817 * lpfc_sg_seg_cnt_init - Set the hba sg_seg_cnt initial value
5828 * -EINVAL if value was out of range
5834 phba->cfg_sg_seg_cnt = val; in lpfc_sg_seg_cnt_init()
5841 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT; in lpfc_sg_seg_cnt_init()
5842 return -EINVAL; in lpfc_sg_seg_cnt_init()
5856 * [1-4] = Multiple of 1/4th Mb of host memory for FW logging
5869 return -EINVAL; in lpfc_ras_fwlog_buffsize_set()
5871 if (phba->cfg_ras_fwlog_buffsize == val) in lpfc_ras_fwlog_buffsize_set()
5874 if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn)) in lpfc_ras_fwlog_buffsize_set()
5875 return -EINVAL; in lpfc_ras_fwlog_buffsize_set()
5877 spin_lock_irq(&phba->ras_fwlog_lock); in lpfc_ras_fwlog_buffsize_set()
5878 state = phba->ras_fwlog.state; in lpfc_ras_fwlog_buffsize_set()
5879 spin_unlock_irq(&phba->ras_fwlog_lock); in lpfc_ras_fwlog_buffsize_set()
5884 return -EBUSY; in lpfc_ras_fwlog_buffsize_set()
5891 phba->cfg_ras_fwlog_buffsize = val; in lpfc_ras_fwlog_buffsize_set()
5898 if (phba->ras_fwlog.ras_enabled) in lpfc_ras_fwlog_buffsize_set()
5899 ret = lpfc_sli4_ras_fwlog_init(phba, phba->cfg_ras_fwlog_level, in lpfc_ras_fwlog_buffsize_set()
5941 int lpfc_use_cgn_signal = 1; /* 0 - only use FPINs, 1 - Use signals if avail */
5964 * 4 - 255 = vmid support enabled for 4-255 VMs
6168 * sysfs_ctlreg_write - Write method for writing to ctlreg
6181 * -ERANGE off and count combo out of range
6182 * -EINVAL off, count or buff address invalid
6183 * -EPERM adapter is offline
6194 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_write()
6195 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_write()
6197 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_write()
6198 return -EPERM; in sysfs_ctlreg_write()
6201 return -ERANGE; in sysfs_ctlreg_write()
6207 return -EINVAL; in sysfs_ctlreg_write()
6211 return -EINVAL; in sysfs_ctlreg_write()
6213 if (!test_bit(FC_OFFLINE_MODE, &vport->fc_flag)) in sysfs_ctlreg_write()
6214 return -EPERM; in sysfs_ctlreg_write()
6216 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6217 for (buf_off = 0; buf_off < count - LPFC_REG_WRITE_KEY_SIZE; in sysfs_ctlreg_write()
6220 phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_write()
6222 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6228 * sysfs_ctlreg_read - Read method for reading from ctlreg
6241 * -ERANGE off and count combo out of range
6242 * -EINVAL off, count or buff address invalid
6254 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_read()
6255 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_read()
6257 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_read()
6258 return -EPERM; in sysfs_ctlreg_read()
6261 return -ERANGE; in sysfs_ctlreg_read()
6264 count = FF_REG_AREA_SIZE - off; in sysfs_ctlreg_read()
6269 return -EINVAL; in sysfs_ctlreg_read()
6271 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6275 *tmp_ptr = readl(phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_read()
6278 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6294 * sysfs_mbox_write - Write method for writing information via mbox
6307 * -EPERM operation not permitted
6314 return -EPERM; in sysfs_mbox_write()
6318 * sysfs_mbox_read - Read method for reading information via mbox
6331 * -EPERM operation not permitted
6338 return -EPERM; in sysfs_mbox_read()
6352 * lpfc_alloc_sysfs_attr - Creates the ctlreg and mbox entries
6366 if (vport->port_type == LPFC_NPIV_PORT) in lpfc_alloc_sysfs_attr()
6369 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6374 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6381 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_alloc_sysfs_attr()
6387 * lpfc_free_sysfs_attr - Removes the ctlreg and mbox entries
6396 if (vport->port_type == LPFC_NPIV_PORT) in lpfc_free_sysfs_attr()
6398 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr); in lpfc_free_sysfs_attr()
6399 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_free_sysfs_attr()
6407 * lpfc_get_host_symbolic_name - Copy symbolic name into the scsi host
6413 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_get_host_symbolic_name()
6420 * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
6426 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_id()
6428 /* note: fc_myDID already in cpu endianness */ in lpfc_get_host_port_id()
6429 fc_host_port_id(shost) = vport->fc_myDID; in lpfc_get_host_port_id()
6433 * lpfc_get_host_port_type - Set the value of the scsi host port type
6439 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_type()
6440 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_type()
6442 if (vport->port_type == LPFC_NPIV_PORT) { in lpfc_get_host_port_type()
6445 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_host_port_type()
6446 if (test_bit(FC_PUBLIC_LOOP, &vport->fc_flag)) in lpfc_get_host_port_type()
6451 if (test_bit(FC_FABRIC, &vport->fc_flag)) in lpfc_get_host_port_type()
6461 * lpfc_get_host_port_state - Set the value of the scsi host port state
6467 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_state()
6468 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_state()
6470 if (test_bit(FC_OFFLINE_MODE, &vport->fc_flag)) in lpfc_get_host_port_state()
6473 switch (phba->link_state) { in lpfc_get_host_port_state()
6482 if (vport->port_state < LPFC_VPORT_READY) in lpfc_get_host_port_state()
6500 * lpfc_get_host_speed - Set the value of the scsi host speed
6506 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_speed()
6507 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_speed()
6510 !test_bit(HBA_FCOE_MODE, &phba->hba_flag)) { in lpfc_get_host_speed()
6511 switch(phba->fc_linkspeed) { in lpfc_get_host_speed()
6547 test_bit(HBA_FCOE_MODE, &phba->hba_flag)) { in lpfc_get_host_speed()
6548 switch (phba->fc_linkspeed) { 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 if (vport->port_state > LPFC_FLOGI && in lpfc_get_host_fabric_name()
6587 (test_bit(FC_FABRIC, &vport->fc_flag) || in lpfc_get_host_fabric_name()
6588 (phba->fc_topology == LPFC_TOPOLOGY_LOOP && in lpfc_get_host_fabric_name()
6589 test_bit(FC_PUBLIC_LOOP, &vport->fc_flag)))) in lpfc_get_host_fabric_name()
6590 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); in lpfc_get_host_fabric_name()
6599 * lpfc_get_stats - Return statistical information about the adapter
6613 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_stats()
6614 struct lpfc_hba *phba = vport->phba; in lpfc_get_stats()
6615 struct lpfc_sli *psli = &phba->sli; in lpfc_get_stats()
6616 struct fc_host_statistics *hs = &phba->link_stats; in lpfc_get_stats()
6617 struct lpfc_lnk_stat * lso = &psli->lnk_stat_offsets; in lpfc_get_stats()
6626 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_stats()
6627 !phba->mbox_mem_pool || in lpfc_get_stats()
6628 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_stats()
6631 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_stats()
6634 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_stats()
6639 pmb = &pmboxq->u.mb; in lpfc_get_stats()
6640 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_get_stats()
6641 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6642 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6643 pmboxq->vport = vport; in lpfc_get_stats()
6645 if (test_bit(FC_OFFLINE_MODE, &vport->fc_flag)) { in lpfc_get_stats()
6648 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6652 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6655 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6662 hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt; in lpfc_get_stats()
6663 hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt; in lpfc_get_stats()
6672 if (pmb->un.varRdStatus.xkb & RD_ST_XKB) { in lpfc_get_stats()
6673 hs->tx_words = (u64) in lpfc_get_stats()
6674 ((((u64)(pmb->un.varRdStatus.xmit_xkb & in lpfc_get_stats()
6676 (u64)pmb->un.varRdStatus.xmitByteCnt) * in lpfc_get_stats()
6678 hs->rx_words = (u64) in lpfc_get_stats()
6679 ((((u64)(pmb->un.varRdStatus.rcv_xkb & in lpfc_get_stats()
6681 (u64)pmb->un.varRdStatus.rcvByteCnt) * in lpfc_get_stats()
6684 hs->tx_words = (uint64_t) in lpfc_get_stats()
6685 ((uint64_t)pmb->un.varRdStatus.xmitByteCnt in lpfc_get_stats()
6687 hs->rx_words = (uint64_t) in lpfc_get_stats()
6688 ((uint64_t)pmb->un.varRdStatus.rcvByteCnt in lpfc_get_stats()
6693 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_get_stats()
6694 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6695 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6696 pmboxq->vport = vport; in lpfc_get_stats()
6698 if (test_bit(FC_OFFLINE_MODE, &vport->fc_flag)) { in lpfc_get_stats()
6701 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6705 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6708 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6713 hs->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_get_stats()
6714 hs->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_get_stats()
6715 hs->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_get_stats()
6716 hs->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_get_stats()
6717 hs->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_get_stats()
6718 hs->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6719 hs->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6721 hs->cn_sig_warn = atomic64_read(&phba->cgn_acqe_stat.warn); in lpfc_get_stats()
6722 hs->cn_sig_alarm = atomic64_read(&phba->cgn_acqe_stat.alarm); in lpfc_get_stats()
6724 hs->link_failure_count -= lso->link_failure_count; in lpfc_get_stats()
6725 hs->loss_of_sync_count -= lso->loss_of_sync_count; in lpfc_get_stats()
6726 hs->loss_of_signal_count -= lso->loss_of_signal_count; in lpfc_get_stats()
6727 hs->prim_seq_protocol_err_count -= lso->prim_seq_protocol_err_count; in lpfc_get_stats()
6728 hs->invalid_tx_word_count -= lso->invalid_tx_word_count; in lpfc_get_stats()
6729 hs->invalid_crc_count -= lso->invalid_crc_count; in lpfc_get_stats()
6730 hs->error_frames -= lso->error_frames; in lpfc_get_stats()
6732 if (test_bit(HBA_FCOE_MODE, &phba->hba_flag)) { in lpfc_get_stats()
6733 hs->lip_count = -1; in lpfc_get_stats()
6734 hs->nos_count = (phba->link_events >> 1); in lpfc_get_stats()
6735 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6736 } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_stats()
6737 hs->lip_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6738 hs->lip_count -= lso->link_events; in lpfc_get_stats()
6739 hs->nos_count = -1; in lpfc_get_stats()
6741 hs->lip_count = -1; in lpfc_get_stats()
6742 hs->nos_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6743 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6746 hs->dumped_frames = -1; in lpfc_get_stats()
6748 hs->seconds_since_last_reset = ktime_get_seconds() - psli->stats_start; in lpfc_get_stats()
6750 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6756 * lpfc_reset_stats - Copy the adapter link stats information
6762 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_reset_stats()
6763 struct lpfc_hba *phba = vport->phba; in lpfc_reset_stats()
6764 struct lpfc_sli *psli = &phba->sli; in lpfc_reset_stats()
6765 struct lpfc_lnk_stat *lso = &psli->lnk_stat_offsets; in lpfc_reset_stats()
6770 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_reset_stats()
6773 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_reset_stats()
6778 pmb = &pmboxq->u.mb; in lpfc_reset_stats()
6779 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_reset_stats()
6780 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6781 pmb->un.varWords[0] = 0x1; /* reset request */ in lpfc_reset_stats()
6782 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6783 pmboxq->vport = vport; in lpfc_reset_stats()
6785 if (test_bit(FC_OFFLINE_MODE, &vport->fc_flag) || in lpfc_reset_stats()
6786 !(psli->sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_reset_stats()
6789 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6793 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6796 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6802 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_reset_stats()
6803 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6804 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6805 pmboxq->vport = vport; in lpfc_reset_stats()
6807 if (test_bit(FC_OFFLINE_MODE, &vport->fc_flag) || in lpfc_reset_stats()
6808 !(psli->sli_flag & LPFC_SLI_ACTIVE)) { in lpfc_reset_stats()
6811 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6815 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6818 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6823 lso->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_reset_stats()
6824 lso->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_reset_stats()
6825 lso->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_reset_stats()
6826 lso->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_reset_stats()
6827 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_reset_stats()
6828 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6829 lso->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6830 if (test_bit(HBA_FCOE_MODE, &phba->hba_flag)) in lpfc_reset_stats()
6831 lso->link_events = (phba->link_events >> 1); in lpfc_reset_stats()
6833 lso->link_events = (phba->fc_eventTag >> 1); in lpfc_reset_stats()
6835 atomic64_set(&phba->cgn_acqe_stat.warn, 0); in lpfc_reset_stats()
6836 atomic64_set(&phba->cgn_acqe_stat.alarm, 0); in lpfc_reset_stats()
6838 memset(&shost_to_fc_host(shost)->fpin_stats, 0, in lpfc_reset_stats()
6839 sizeof(shost_to_fc_host(shost)->fpin_stats)); in lpfc_reset_stats()
6841 psli->stats_start = ktime_get_seconds(); in lpfc_reset_stats()
6843 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6854 * lpfc_get_node_by_target - Return the nodelist for a target
6864 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in lpfc_get_node_by_target()
6865 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_node_by_target()
6869 spin_lock_irqsave(&vport->fc_nodes_list_lock, iflags); in lpfc_get_node_by_target()
6871 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_get_node_by_target()
6872 if (ndlp->nlp_state == NLP_STE_MAPPED_NODE && in lpfc_get_node_by_target()
6873 starget->id == ndlp->nlp_sid) { in lpfc_get_node_by_target()
6874 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, in lpfc_get_node_by_target()
6879 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags); in lpfc_get_node_by_target()
6884 * lpfc_get_starget_port_id - Set the target port id to the ndlp DID or -1
6892 fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1; in lpfc_get_starget_port_id()
6896 * lpfc_get_starget_node_name - Set the target node name
6907 ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0; in lpfc_get_starget_node_name()
6911 * lpfc_get_starget_port_name - Set the target port name
6922 ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0; in lpfc_get_starget_port_name()
6926 * lpfc_set_rport_loss_tmo - Set the rport dev loss tmo
6937 struct lpfc_rport_data *rdata = rport->dd_data; in lpfc_set_rport_loss_tmo()
6938 struct lpfc_nodelist *ndlp = rdata->pnode; in lpfc_set_rport_loss_tmo()
6944 rport->dev_loss_tmo = timeout; in lpfc_set_rport_loss_tmo()
6946 rport->dev_loss_tmo = 1; in lpfc_set_rport_loss_tmo()
6949 dev_info(&rport->dev, "Cannot find remote node to " in lpfc_set_rport_loss_tmo()
6951 rport->port_id); in lpfc_set_rport_loss_tmo()
6958 if (nrport && nrport->remoteport) in lpfc_set_rport_loss_tmo()
6959 nvme_fc_set_remoteport_devloss(nrport->remoteport, in lpfc_set_rport_loss_tmo()
6960 rport->dev_loss_tmo); in lpfc_set_rport_loss_tmo()
6965 * lpfc_rport_show_function - Return rport target information
6983 struct lpfc_rport_data *rdata = rport->hostdata; \
6985 (rdata->target) ? cast rdata->target->field : 0); \
6993 * lpfc_set_vport_symbolic_name - Set the vport's symbolic name
6998 * has been changed. This function re-registers the symbolic name with the
7004 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; in lpfc_set_vport_symbolic_name()
7006 if (vport->port_state == LPFC_VPORT_READY) in lpfc_set_vport_symbolic_name()
7011 * lpfc_hba_log_verbose_init - Set hba's log verbose level
7023 phba->cfg_log_verbose = verbose; in lpfc_hba_log_verbose_init()
7159 * lpfc_get_hba_function_mode - Used to determine the HBA function in FCoE
7167 switch (phba->pcidev->device) { in lpfc_get_hba_function_mode()
7175 set_bit(HBA_FCOE_MODE, &phba->hba_flag); in lpfc_get_hba_function_mode()
7179 clear_bit(HBA_FCOE_MODE, &phba->hba_flag); in lpfc_get_hba_function_mode()
7184 * lpfc_get_cfgparam - Used during probe_one to init the adapter structure
7228 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_get_cfgparam()
7229 phba->cfg_EnableXLane = 0; in lpfc_get_cfgparam()
7232 memset(phba->cfg_oas_tgt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7233 memset(phba->cfg_oas_vpt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7234 phba->cfg_oas_lun_state = 0; in lpfc_get_cfgparam()
7235 phba->cfg_oas_lun_status = 0; in lpfc_get_cfgparam()
7236 phba->cfg_oas_flags = 0; in lpfc_get_cfgparam()
7237 phba->cfg_oas_priority = 0; in lpfc_get_cfgparam()
7241 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_cfgparam()
7242 phba->cfg_poll = 0; in lpfc_get_cfgparam()
7244 phba->cfg_poll = lpfc_poll; in lpfc_get_cfgparam()
7250 if (phba->cfg_enable_bg && test_bit(HBA_FCOE_MODE, &phba->hba_flag)) { in lpfc_get_cfgparam()
7254 phba->cfg_enable_bg = 0; in lpfc_get_cfgparam()
7255 } else if (phba->cfg_enable_bg) { in lpfc_get_cfgparam()
7256 phba->sli3_options |= LPFC_SLI3_BG_ENABLED; in lpfc_get_cfgparam()
7275 phba->cgn_p.cgn_param_mode = LPFC_CFG_OFF; in lpfc_get_cfgparam()
7276 phba->cmf_active_mode = LPFC_CFG_OFF; in lpfc_get_cfgparam()
7281 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_get_cfgparam()
7283 phba->nvmet_support = 0; in lpfc_get_cfgparam()
7284 phba->cfg_nvmet_mrq = 0; in lpfc_get_cfgparam()
7285 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7286 phba->cfg_enable_bbcr = 0; in lpfc_get_cfgparam()
7287 phba->cfg_xri_rebalancing = 0; in lpfc_get_cfgparam()
7290 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_cfgparam()
7291 phba->cfg_enable_fc4_type |= LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7294 phba->cfg_auto_imax = (phba->cfg_fcp_imax) ? 0 : 1; in lpfc_get_cfgparam()
7296 phba->cfg_enable_pbde = 0; in lpfc_get_cfgparam()
7299 if (phba->cfg_hdw_queue == 0) in lpfc_get_cfgparam()
7300 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7301 if (phba->cfg_irq_chann == 0) in lpfc_get_cfgparam()
7302 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7303 if (phba->cfg_irq_chann > phba->cfg_hdw_queue && in lpfc_get_cfgparam()
7304 phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_cfgparam()
7305 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_get_cfgparam()
7323 * lpfc_nvme_mod_param_dep - Adjust module parameter value based on
7332 if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu) { in lpfc_nvme_mod_param_dep()
7333 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7336 if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu) { in lpfc_nvme_mod_param_dep()
7337 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7340 if (phba->cfg_irq_chann > phba->cfg_hdw_queue) { in lpfc_nvme_mod_param_dep()
7341 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7346 "2006 Reducing Queues - CPU limitation: " in lpfc_nvme_mod_param_dep()
7348 phba->cfg_irq_chann, in lpfc_nvme_mod_param_dep()
7349 phba->cfg_hdw_queue); in lpfc_nvme_mod_param_dep()
7351 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_nvme_mod_param_dep()
7352 phba->nvmet_support) { in lpfc_nvme_mod_param_dep()
7353 phba->cfg_enable_fc4_type &= ~LPFC_ENABLE_FCP; in lpfc_nvme_mod_param_dep()
7358 phba->cfg_nvme_enable_fb, in lpfc_nvme_mod_param_dep()
7359 phba->cfg_nvmet_fb_size, in lpfc_nvme_mod_param_dep()
7362 if (phba->cfg_nvme_enable_fb == 0) in lpfc_nvme_mod_param_dep()
7363 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7365 if (phba->cfg_nvmet_fb_size > LPFC_NVMET_FB_SZ_MAX) in lpfc_nvme_mod_param_dep()
7366 phba->cfg_nvmet_fb_size = LPFC_NVMET_FB_SZ_MAX; in lpfc_nvme_mod_param_dep()
7369 if (!phba->cfg_nvmet_mrq) in lpfc_nvme_mod_param_dep()
7370 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7373 if (phba->cfg_nvmet_mrq > phba->cfg_hdw_queue) { in lpfc_nvme_mod_param_dep()
7374 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7377 phba->cfg_nvmet_mrq); in lpfc_nvme_mod_param_dep()
7379 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_nvme_mod_param_dep()
7380 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_nvme_mod_param_dep()
7384 phba->nvmet_support = 0; in lpfc_nvme_mod_param_dep()
7385 phba->cfg_nvmet_mrq = 0; in lpfc_nvme_mod_param_dep()
7386 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7391 * lpfc_get_vport_cfgparam - Used during port create, init the vport structure