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

4  * Copyright (C) 2017-2020 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 *
74 " trunk - link was \"low\" speed",
76 " existing trunk - link was \"middle\" speed",
78 " trunk - link was \"high\" speed",
79 "Attached to non-trunking port - F_Port",
80 "Attached to non-trunking port - N_Port",
82 "non-FLOGI frame received",
89 * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules
97 * Hex 0-9 becomes ascii '0' to '9'.
98 * Hex a-f becomes ascii '=' to 'B' capital B.
110 hdw[7 - i] = 0x30 + j; in lpfc_jedec_to_ascii()
112 hdw[7 - i] = 0x61 + j - 10; in lpfc_jedec_to_ascii()
120 * lpfc_drvr_version_show - Return the Emulex driver string with version number
135 * lpfc_enable_fip_show - Return the fip mode of the HBA
147 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_enable_fip_show()
148 struct lpfc_hba *phba = vport->phba; in lpfc_enable_fip_show()
150 if (phba->hba_flag & HBA_FIP_SUPPORT) in lpfc_enable_fip_show()
162 struct lpfc_hba *phba = vport->phba; in lpfc_nvme_info_show()
177 if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_NVME)) { in lpfc_nvme_info_show()
181 if (phba->nvmet_support) { in lpfc_nvme_info_show()
182 if (!phba->targetport) { in lpfc_nvme_info_show()
185 wwn_to_u64(vport->fc_portname.u.wwn)); in lpfc_nvme_info_show()
189 if (phba->targetport->port_id) in lpfc_nvme_info_show()
202 phba->brd_no, in lpfc_nvme_info_show()
203 wwn_to_u64(vport->fc_portname.u.wwn), in lpfc_nvme_info_show()
204 wwn_to_u64(vport->fc_nodename.u.wwn), in lpfc_nvme_info_show()
205 phba->targetport->port_id); in lpfc_nvme_info_show()
213 tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private; in lpfc_nvme_info_show()
216 atomic_read(&tgtp->rcv_ls_req_in), in lpfc_nvme_info_show()
217 atomic_read(&tgtp->rcv_ls_req_drop), in lpfc_nvme_info_show()
218 atomic_read(&tgtp->xmt_ls_abort)); in lpfc_nvme_info_show()
222 if (atomic_read(&tgtp->rcv_ls_req_in) != in lpfc_nvme_info_show()
223 atomic_read(&tgtp->rcv_ls_req_out)) { in lpfc_nvme_info_show()
226 atomic_read(&tgtp->rcv_ls_req_in), in lpfc_nvme_info_show()
227 atomic_read(&tgtp->rcv_ls_req_out)); in lpfc_nvme_info_show()
234 atomic_read(&tgtp->xmt_ls_rsp), in lpfc_nvme_info_show()
235 atomic_read(&tgtp->xmt_ls_drop), in lpfc_nvme_info_show()
236 atomic_read(&tgtp->xmt_ls_rsp_cmpl)); in lpfc_nvme_info_show()
242 atomic_read(&tgtp->xmt_ls_rsp_aborted), in lpfc_nvme_info_show()
243 atomic_read(&tgtp->xmt_ls_rsp_xb_set), in lpfc_nvme_info_show()
244 atomic_read(&tgtp->xmt_ls_rsp_error)); in lpfc_nvme_info_show()
251 atomic_read(&tgtp->rcv_fcp_cmd_in), in lpfc_nvme_info_show()
252 atomic_read(&tgtp->rcv_fcp_cmd_defer), in lpfc_nvme_info_show()
253 atomic_read(&tgtp->xmt_fcp_release), in lpfc_nvme_info_show()
254 atomic_read(&tgtp->rcv_fcp_cmd_drop)); in lpfc_nvme_info_show()
258 if (atomic_read(&tgtp->rcv_fcp_cmd_in) != in lpfc_nvme_info_show()
259 atomic_read(&tgtp->rcv_fcp_cmd_out)) { in lpfc_nvme_info_show()
262 atomic_read(&tgtp->rcv_fcp_cmd_in), in lpfc_nvme_info_show()
263 atomic_read(&tgtp->rcv_fcp_cmd_out)); in lpfc_nvme_info_show()
271 atomic_read(&tgtp->xmt_fcp_read), in lpfc_nvme_info_show()
272 atomic_read(&tgtp->xmt_fcp_read_rsp), in lpfc_nvme_info_show()
273 atomic_read(&tgtp->xmt_fcp_write), in lpfc_nvme_info_show()
274 atomic_read(&tgtp->xmt_fcp_rsp), in lpfc_nvme_info_show()
275 atomic_read(&tgtp->xmt_fcp_drop)); in lpfc_nvme_info_show()
281 atomic_read(&tgtp->xmt_fcp_rsp_cmpl), in lpfc_nvme_info_show()
282 atomic_read(&tgtp->xmt_fcp_rsp_error), in lpfc_nvme_info_show()
283 atomic_read(&tgtp->xmt_fcp_rsp_drop)); in lpfc_nvme_info_show()
289 atomic_read(&tgtp->xmt_fcp_rsp_aborted), in lpfc_nvme_info_show()
290 atomic_read(&tgtp->xmt_fcp_rsp_xb_set), in lpfc_nvme_info_show()
291 atomic_read(&tgtp->xmt_fcp_xri_abort_cqe)); in lpfc_nvme_info_show()
297 atomic_read(&tgtp->xmt_fcp_abort), in lpfc_nvme_info_show()
298 atomic_read(&tgtp->xmt_fcp_abort_cmpl)); in lpfc_nvme_info_show()
304 atomic_read(&tgtp->xmt_abort_sol), in lpfc_nvme_info_show()
305 atomic_read(&tgtp->xmt_abort_unsol), in lpfc_nvme_info_show()
306 atomic_read(&tgtp->xmt_abort_rsp), in lpfc_nvme_info_show()
307 atomic_read(&tgtp->xmt_abort_rsp_error)); in lpfc_nvme_info_show()
313 atomic_read(&tgtp->defer_ctx), in lpfc_nvme_info_show()
314 atomic_read(&tgtp->defer_fod), in lpfc_nvme_info_show()
315 atomic_read(&tgtp->defer_wqfull)); in lpfc_nvme_info_show()
320 tot = atomic_read(&tgtp->rcv_fcp_cmd_drop); in lpfc_nvme_info_show()
321 tot += atomic_read(&tgtp->xmt_fcp_release); in lpfc_nvme_info_show()
322 tot = atomic_read(&tgtp->rcv_fcp_cmd_in) - tot; in lpfc_nvme_info_show()
327 phba->sli4_hba.nvmet_xri_cnt, in lpfc_nvme_info_show()
328 phba->sli4_hba.nvmet_io_wait_cnt, in lpfc_nvme_info_show()
329 phba->sli4_hba.nvmet_io_wait_total, in lpfc_nvme_info_show()
335 localport = vport->localport; in lpfc_nvme_info_show()
339 wwn_to_u64(vport->fc_portname.u.wwn)); in lpfc_nvme_info_show()
342 lport = (struct lpfc_nvme_lport *)localport->private; in lpfc_nvme_info_show()
348 phba->brd_no, in lpfc_nvme_info_show()
349 phba->sli4_hba.max_cfg_param.max_xri, in lpfc_nvme_info_show()
350 phba->sli4_hba.io_xri_max, in lpfc_nvme_info_show()
356 if (localport->port_id) in lpfc_nvme_info_show()
364 phba->brd_no, in lpfc_nvme_info_show()
365 wwn_to_u64(vport->fc_portname.u.wwn), in lpfc_nvme_info_show()
366 wwn_to_u64(vport->fc_nodename.u.wwn), in lpfc_nvme_info_show()
367 localport->port_id, statep); in lpfc_nvme_info_show()
371 spin_lock_irq(shost->host_lock); in lpfc_nvme_info_show()
373 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_nvme_info_show()
375 spin_lock(&vport->phba->hbalock); in lpfc_nvme_info_show()
378 nrport = rport->remoteport; in lpfc_nvme_info_show()
379 spin_unlock(&vport->phba->hbalock); in lpfc_nvme_info_show()
384 switch (nrport->port_state) { in lpfc_nvme_info_show()
399 if (phba->brd_no >= 10) { in lpfc_nvme_info_show()
405 nrport->port_name); in lpfc_nvme_info_show()
410 nrport->node_name); in lpfc_nvme_info_show()
415 nrport->port_id); in lpfc_nvme_info_show()
420 if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR) { in lpfc_nvme_info_show()
424 if (nrport->port_role & FC_PORT_ROLE_NVME_TARGET) { in lpfc_nvme_info_show()
428 if (nrport->port_role & FC_PORT_ROLE_NVME_DISCOVERY) { in lpfc_nvme_info_show()
432 if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR | in lpfc_nvme_info_show()
436 nrport->port_role); in lpfc_nvme_info_show()
445 spin_unlock_irq(shost->host_lock); in lpfc_nvme_info_show()
455 atomic_read(&lport->fc4NvmeLsRequests), in lpfc_nvme_info_show()
456 atomic_read(&lport->fc4NvmeLsCmpls), in lpfc_nvme_info_show()
457 atomic_read(&lport->xmt_ls_abort)); in lpfc_nvme_info_show()
463 atomic_read(&lport->xmt_ls_err), in lpfc_nvme_info_show()
464 atomic_read(&lport->cmpl_ls_xb), in lpfc_nvme_info_show()
465 atomic_read(&lport->cmpl_ls_err)); in lpfc_nvme_info_show()
471 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_nvme_info_show()
472 cstat = &phba->sli4_hba.hdwq[i].nvme_cstat; in lpfc_nvme_info_show()
473 tot = cstat->io_cmpls; in lpfc_nvme_info_show()
475 data1 = cstat->input_requests; in lpfc_nvme_info_show()
476 data2 = cstat->output_requests; in lpfc_nvme_info_show()
477 data3 = cstat->control_requests; in lpfc_nvme_info_show()
483 totin, totout, totout - totin); in lpfc_nvme_info_show()
490 atomic_read(&lport->xmt_fcp_abort), in lpfc_nvme_info_show()
491 atomic_read(&lport->xmt_fcp_noxri), in lpfc_nvme_info_show()
492 atomic_read(&lport->xmt_fcp_bad_ndlp), in lpfc_nvme_info_show()
493 atomic_read(&lport->xmt_fcp_qdepth), in lpfc_nvme_info_show()
494 atomic_read(&lport->xmt_fcp_err), in lpfc_nvme_info_show()
495 atomic_read(&lport->xmt_fcp_wqerr)); in lpfc_nvme_info_show()
501 atomic_read(&lport->cmpl_fcp_xb), in lpfc_nvme_info_show()
502 atomic_read(&lport->cmpl_fcp_err)); in lpfc_nvme_info_show()
509 spin_unlock_irq(shost->host_lock); in lpfc_nvme_info_show()
514 if (unlikely(len >= (PAGE_SIZE - 1))) { in lpfc_nvme_info_show()
519 strlcpy(buf + PAGE_SIZE - 1 - in lpfc_nvme_info_show()
520 strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1), in lpfc_nvme_info_show()
522 strnlen(LPFC_NVME_INFO_MORE_STR, PAGE_SIZE - 1) in lpfc_nvme_info_show()
535 struct lpfc_hba *phba = vport->phba; in lpfc_scsi_stat_show()
543 if (!(vport->cfg_enable_fc4_type & LPFC_ENABLE_FCP) || in lpfc_scsi_stat_show()
544 (phba->sli_rev != LPFC_SLI_REV4)) in lpfc_scsi_stat_show()
551 for (i = 0; i < phba->cfg_hdw_queue; i++) { in lpfc_scsi_stat_show()
552 cstat = &phba->sli4_hba.hdwq[i].scsi_cstat; in lpfc_scsi_stat_show()
553 tot = cstat->io_cmpls; in lpfc_scsi_stat_show()
555 data1 = cstat->input_requests; in lpfc_scsi_stat_show()
556 data2 = cstat->output_requests; in lpfc_scsi_stat_show()
557 data3 = cstat->control_requests; in lpfc_scsi_stat_show()
566 tot, ((data1 + data2 + data3) - tot)); in lpfc_scsi_stat_show()
571 "OutIO %016llx\n", totin, totout, totout - totin); in lpfc_scsi_stat_show()
585 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_info_show()
586 struct lpfc_hba *phba = vport->phba; in lpfc_bg_info_show()
588 if (phba->cfg_enable_bg) { in lpfc_bg_info_show()
589 if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) in lpfc_bg_info_show()
605 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_guard_err_show()
606 struct lpfc_hba *phba = vport->phba; in lpfc_bg_guard_err_show()
609 (unsigned long long)phba->bg_guard_err_cnt); in lpfc_bg_guard_err_show()
617 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_apptag_err_show()
618 struct lpfc_hba *phba = vport->phba; in lpfc_bg_apptag_err_show()
621 (unsigned long long)phba->bg_apptag_err_cnt); in lpfc_bg_apptag_err_show()
629 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_bg_reftag_err_show()
630 struct lpfc_hba *phba = vport->phba; in lpfc_bg_reftag_err_show()
633 (unsigned long long)phba->bg_reftag_err_cnt); in lpfc_bg_reftag_err_show()
637 * lpfc_info_show - Return some pci info about the host in ascii
654 * lpfc_serialnum_show - Return the hba serial number in ascii
666 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_serialnum_show()
667 struct lpfc_hba *phba = vport->phba; in lpfc_serialnum_show()
669 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->SerialNumber); in lpfc_serialnum_show()
673 * lpfc_temp_sensor_show - Return the temperature sensor level
689 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_temp_sensor_show()
690 struct lpfc_hba *phba = vport->phba; in lpfc_temp_sensor_show()
691 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->temp_sensor_support); in lpfc_temp_sensor_show()
695 * lpfc_modeldesc_show - Return the model description of the hba
707 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_modeldesc_show()
708 struct lpfc_hba *phba = vport->phba; in lpfc_modeldesc_show()
710 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelDesc); in lpfc_modeldesc_show()
714 * lpfc_modelname_show - Return the model name of the hba
726 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_modelname_show()
727 struct lpfc_hba *phba = vport->phba; in lpfc_modelname_show()
729 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ModelName); in lpfc_modelname_show()
733 * lpfc_programtype_show - Return the program type of the hba
745 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_programtype_show()
746 struct lpfc_hba *phba = vport->phba; in lpfc_programtype_show()
748 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->ProgramType); in lpfc_programtype_show()
752 * lpfc_mlomgmt_show - Return the Menlo Maintenance sli flag
763 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_mlomgmt_show()
764 struct lpfc_hba *phba = vport->phba; in lpfc_mlomgmt_show()
767 (phba->sli.sli_flag & LPFC_MENLO_MAINT)); in lpfc_mlomgmt_show()
771 * lpfc_vportnum_show - Return the port number in ascii of the hba
783 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_vportnum_show()
784 struct lpfc_hba *phba = vport->phba; in lpfc_vportnum_show()
786 return scnprintf(buf, PAGE_SIZE, "%s\n", phba->Port); in lpfc_vportnum_show()
790 * lpfc_fwrev_show - Return the firmware rev running in the hba
802 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_fwrev_show()
803 struct lpfc_hba *phba = vport->phba; in lpfc_fwrev_show()
810 if_type = phba->sli4_hba.pc_sli4_params.if_type; in lpfc_fwrev_show()
811 sli_family = phba->sli4_hba.pc_sli4_params.sli_family; in lpfc_fwrev_show()
813 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_fwrev_show()
814 len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d\n", in lpfc_fwrev_show()
815 fwrev, phba->sli_rev); in lpfc_fwrev_show()
817 len = scnprintf(buf, PAGE_SIZE, "%s, sli-%d:%d:%x\n", in lpfc_fwrev_show()
818 fwrev, phba->sli_rev, if_type, sli_family); in lpfc_fwrev_show()
824 * lpfc_hdw_show - Return the jedec information about the hba
836 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_hdw_show()
837 struct lpfc_hba *phba = vport->phba; in lpfc_hdw_show()
838 lpfc_vpd_t *vp = &phba->vpd; in lpfc_hdw_show()
840 lpfc_jedec_to_ascii(vp->rev.biuRev, hdw); in lpfc_hdw_show()
842 vp->rev.smRev, vp->rev.smFwRev); in lpfc_hdw_show()
846 * lpfc_option_rom_version_show - Return the adapter ROM FCode version
858 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_option_rom_version_show()
859 struct lpfc_hba *phba = vport->phba; in lpfc_option_rom_version_show()
862 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_option_rom_version_show()
864 phba->OptionROMVersion); in lpfc_option_rom_version_show()
871 * lpfc_state_show - Return the link state of the port
886 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_state_show()
887 struct lpfc_hba *phba = vport->phba; in lpfc_link_state_show()
890 switch (phba->link_state) { in lpfc_link_state_show()
897 if (phba->hba_flag & LINK_DISABLED) in lpfc_link_state_show()
898 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
899 "Link Down - User disabled\n"); in lpfc_link_state_show()
901 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
907 len += scnprintf(buf + len, PAGE_SIZE-len, "Link Up - "); in lpfc_link_state_show()
909 switch (vport->port_state) { in lpfc_link_state_show()
911 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
921 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
925 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
930 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
935 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
939 if (phba->sli.sli_flag & LPFC_MENLO_MAINT) in lpfc_link_state_show()
940 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
942 else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_state_show()
943 if (vport->fc_flag & FC_PUBLIC_LOOP) in lpfc_link_state_show()
944 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
947 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
950 if (vport->fc_flag & FC_FABRIC) in lpfc_link_state_show()
951 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
954 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_link_state_show()
955 " Point-2-Point\n"); in lpfc_link_state_show()
959 if ((phba->sli_rev == LPFC_SLI_REV4) && in lpfc_link_state_show()
961 &phba->sli4_hba.sli_intf) == in lpfc_link_state_show()
963 struct lpfc_trunk_link link = phba->trunk_link; in lpfc_link_state_show()
965 if (bf_get(lpfc_conf_trunk_port0, &phba->sli4_hba)) in lpfc_link_state_show()
966 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
972 if (bf_get(lpfc_conf_trunk_port1, &phba->sli4_hba)) in lpfc_link_state_show()
973 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
979 if (bf_get(lpfc_conf_trunk_port2, &phba->sli4_hba)) in lpfc_link_state_show()
980 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
986 if (bf_get(lpfc_conf_trunk_port3, &phba->sli4_hba)) in lpfc_link_state_show()
987 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_link_state_show()
999 * lpfc_sli4_protocol_show - Return the fip mode of the HBA
1011 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sli4_protocol_show()
1012 struct lpfc_hba *phba = vport->phba; in lpfc_sli4_protocol_show()
1014 if (phba->sli_rev < LPFC_SLI_REV4) in lpfc_sli4_protocol_show()
1017 if (phba->sli4_hba.lnk_info.lnk_dv == LPFC_LNK_DAT_VAL) { in lpfc_sli4_protocol_show()
1018 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_GE) in lpfc_sli4_protocol_show()
1020 if (phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC) in lpfc_sli4_protocol_show()
1027 * lpfc_oas_supported_show - Return whether or not Optimized Access Storage
1040 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_oas_supported_show()
1041 struct lpfc_hba *phba = vport->phba; in lpfc_oas_supported_show()
1044 phba->sli4_hba.pc_sli4_params.oas_supported); in lpfc_oas_supported_show()
1048 * lpfc_link_state_store - Transition the link_state on an HBA port
1055 * -EINVAL if the buffer is not "up" or "down"
1056 * return from link state change function if non-zero
1064 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_state_store()
1065 struct lpfc_hba *phba = vport->phba; in lpfc_link_state_store()
1067 int status = -EINVAL; in lpfc_link_state_store()
1069 if ((strncmp(buf, "up", sizeof("up") - 1) == 0) && in lpfc_link_state_store()
1070 (phba->link_state == LPFC_LINK_DOWN)) in lpfc_link_state_store()
1071 status = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); in lpfc_link_state_store()
1072 else if ((strncmp(buf, "down", sizeof("down") - 1) == 0) && in lpfc_link_state_store()
1073 (phba->link_state >= LPFC_LINK_UP)) in lpfc_link_state_store()
1074 status = phba->lpfc_hba_down_link(phba, MBX_NOWAIT); in lpfc_link_state_store()
1083 * lpfc_num_discovered_ports_show - Return sum of mapped and unmapped vports
1099 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_num_discovered_ports_show()
1102 vport->fc_map_cnt + vport->fc_unmap_cnt); in lpfc_num_discovered_ports_show()
1106 * lpfc_issue_lip - Misnomer, name carried over from long ago
1110 * Bring the link down gracefully then re-init the link. The firmware will
1111 * re-init the fiber channel interface as required. Does not issue a LIP.
1114 * -EPERM port offline or management commands are being blocked
1115 * -ENOMEM cannot allocate memory for the mailbox command
1116 * -EIO error sending the mailbox command
1122 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_issue_lip()
1123 struct lpfc_hba *phba = vport->phba; in lpfc_issue_lip()
1131 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_issue_lip()
1132 (phba->hba_flag & LINK_DISABLED) || in lpfc_issue_lip()
1133 (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO)) in lpfc_issue_lip()
1134 return -EPERM; in lpfc_issue_lip()
1136 pmboxq = mempool_alloc(phba->mbox_mem_pool,GFP_KERNEL); in lpfc_issue_lip()
1139 return -ENOMEM; in lpfc_issue_lip()
1142 pmboxq->u.mb.mbxCommand = MBX_DOWN_LINK; in lpfc_issue_lip()
1143 pmboxq->u.mb.mbxOwner = OWN_HOST; in lpfc_issue_lip()
1148 (pmboxq->u.mb.mbxStatus == 0 || in lpfc_issue_lip()
1149 pmboxq->u.mb.mbxStatus == MBXERR_LINK_DOWN)) { in lpfc_issue_lip()
1151 lpfc_init_link(phba, pmboxq, phba->cfg_topology, in lpfc_issue_lip()
1152 phba->cfg_link_speed); in lpfc_issue_lip()
1154 phba->fc_ratov * 2); in lpfc_issue_lip()
1156 (pmboxq->u.mb.mbxStatus == MBXERR_SEC_NO_PERMISSION)) in lpfc_issue_lip()
1164 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_issue_lip()
1167 return -EIO; in lpfc_issue_lip()
1195 * lpfc_do_offline - Issues a mailbox command to bring the link down
1203 * lpfc_workq_post_event() returns a non-zero return code if call fails.
1206 * -EIO error posting the event
1224 return -ENOMEM; in lpfc_do_offline()
1229 return -EIO; in lpfc_do_offline()
1231 psli = &phba->sli; in lpfc_do_offline()
1238 spin_lock_irq(&phba->hbalock); in lpfc_do_offline()
1239 if (!(psli->sli_flag & LPFC_QUEUE_FREE_INIT)) { in lpfc_do_offline()
1240 psli->sli_flag |= LPFC_QUEUE_FREE_WAIT; in lpfc_do_offline()
1242 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1245 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1250 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_do_offline()
1251 for (i = 0; i < psli->num_rings; i++) { in lpfc_do_offline()
1252 pring = &psli->sli3_ring[i]; in lpfc_do_offline()
1253 if (!lpfc_emptyq_wait(phba, &pring->txcmplq, in lpfc_do_offline()
1254 &phba->hbalock)) in lpfc_do_offline()
1258 list_for_each_entry(qp, &phba->sli4_hba.lpfc_wq_list, wq_list) { in lpfc_do_offline()
1259 pring = qp->pring; in lpfc_do_offline()
1262 if (!lpfc_emptyq_wait(phba, &pring->txcmplq, in lpfc_do_offline()
1263 &pring->ring_lock)) in lpfc_do_offline()
1268 spin_lock_irq(&phba->hbalock); in lpfc_do_offline()
1269 psli->sli_flag &= ~LPFC_QUEUE_FREE_WAIT; in lpfc_do_offline()
1270 spin_unlock_irq(&phba->hbalock); in lpfc_do_offline()
1276 return -ENOMEM; in lpfc_do_offline()
1281 return -EIO; in lpfc_do_offline()
1287 * lpfc_reset_pci_bus - resets PCI bridge controller's secondary bus of an HBA
1291 * Issues a PCI secondary bus reset for the phba->pcidev.
1300 * -ENOTSUPP, cfg_enable_hba_reset must be of value 2
1301 * -ENODEV, NULL ptr to pcidev
1302 * -EBADSLT, detected invalid device
1303 * -EBUSY, port is not in offline state
1309 struct pci_dev *pdev = phba->pcidev; in lpfc_reset_pci_bus()
1315 if (phba->cfg_enable_hba_reset != 2) in lpfc_reset_pci_bus()
1316 return -ENOTSUPP; in lpfc_reset_pci_bus()
1320 return -ENODEV; in lpfc_reset_pci_bus()
1328 list_for_each_entry(ptr, &pdev->bus->devices, bus_list) { in lpfc_reset_pci_bus()
1333 ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_reset_pci_bus()
1334 if (!(phba_other->pport->fc_flag & FC_OFFLINE_MODE)) { in lpfc_reset_pci_bus()
1339 phba_other->wwpn[0], in lpfc_reset_pci_bus()
1340 phba_other->wwpn[1], in lpfc_reset_pci_bus()
1341 phba_other->wwpn[2], in lpfc_reset_pci_bus()
1342 phba_other->wwpn[3], in lpfc_reset_pci_bus()
1343 phba_other->wwpn[4], in lpfc_reset_pci_bus()
1344 phba_other->wwpn[5], in lpfc_reset_pci_bus()
1345 phba_other->wwpn[6], in lpfc_reset_pci_bus()
1346 phba_other->wwpn[7]); in lpfc_reset_pci_bus()
1347 return -EBUSY; in lpfc_reset_pci_bus()
1363 * lpfc_selective_reset - Offline then onlines the port
1376 * -EIO reset not configured or error posting the event
1386 if (!phba->cfg_enable_hba_reset) in lpfc_selective_reset()
1387 return -EACCES; in lpfc_selective_reset()
1389 if (!(phba->pport->fc_flag & FC_OFFLINE_MODE)) { in lpfc_selective_reset()
1400 return -ENOMEM; in lpfc_selective_reset()
1405 return -EIO; in lpfc_selective_reset()
1411 * lpfc_issue_reset - Selectively resets an adapter
1427 * -EINVAL if the buffer does not contain the string "selective"
1428 * length of buf if lpfc-selective_reset() if the call succeeds
1436 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_issue_reset()
1437 struct lpfc_hba *phba = vport->phba; in lpfc_issue_reset()
1438 int status = -EINVAL; in lpfc_issue_reset()
1440 if (!phba->cfg_enable_hba_reset) in lpfc_issue_reset()
1441 return -EACCES; in lpfc_issue_reset()
1443 if (strncmp(buf, "selective", sizeof("selective") - 1) == 0) in lpfc_issue_reset()
1444 status = phba->lpfc_selective_reset(phba); in lpfc_issue_reset()
1453 * lpfc_sli4_pdev_status_reg_wait - Wait for pdev status register for readyness
1457 * SLI4 interface type-2 device to wait on the sliport status register for
1461 * zero for success, -EPERM when port does not have privilege to perform the
1462 * reset, -EIO when port timeout from recovering from the reset.
1475 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1477 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1482 return -EPERM; in lpfc_sli4_pdev_status_reg_wait()
1487 if (lpfc_readl(phba->sli4_hba.u.if_type2.STATUSregaddr, in lpfc_sli4_pdev_status_reg_wait()
1502 return -EIO; in lpfc_sli4_pdev_status_reg_wait()
1506 * lpfc_sli4_pdev_reg_request - Request physical dev to perform a register acc
1510 * Request SLI4 interface type-2 device to perform a physical register set
1520 struct pci_dev *pdev = phba->pcidev; in lpfc_sli4_pdev_reg_request()
1527 if (!phba->cfg_enable_hba_reset) in lpfc_sli4_pdev_reg_request()
1528 return -EACCES; in lpfc_sli4_pdev_reg_request()
1530 if ((phba->sli_rev < LPFC_SLI_REV4) || in lpfc_sli4_pdev_reg_request()
1531 (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) < in lpfc_sli4_pdev_reg_request()
1533 return -EPERM; in lpfc_sli4_pdev_reg_request()
1536 before_fc_flag = phba->pport->fc_flag; in lpfc_sli4_pdev_reg_request()
1537 sriov_nr_virtfn = phba->cfg_sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1539 /* Disable SR-IOV virtual functions if enabled */ in lpfc_sli4_pdev_reg_request()
1540 if (phba->cfg_sriov_nr_virtfn) { in lpfc_sli4_pdev_reg_request()
1542 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_pdev_reg_request()
1546 phba->hba_flag |= HBA_FW_DUMP_OP; in lpfc_sli4_pdev_reg_request()
1551 phba->hba_flag &= ~HBA_FW_DUMP_OP; in lpfc_sli4_pdev_reg_request()
1558 reg_val = readl(phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1568 writel(reg_val, phba->sli4_hba.conf_regs_memmap_p + in lpfc_sli4_pdev_reg_request()
1571 readl(phba->sli4_hba.conf_regs_memmap_p + LPFC_CTL_PDEV_CTL_OFFSET); in lpfc_sli4_pdev_reg_request()
1576 if (rc == -EPERM) { in lpfc_sli4_pdev_reg_request()
1581 } else if (rc == -EIO) { in lpfc_sli4_pdev_reg_request()
1607 phba->cfg_sriov_nr_virtfn = sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1613 rc = -ENOMEM; in lpfc_sli4_pdev_reg_request()
1615 rc = -EIO; in lpfc_sli4_pdev_reg_request()
1621 * lpfc_nport_evt_cnt_show - Return the number of nport events
1633 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nport_evt_cnt_show()
1634 struct lpfc_hba *phba = vport->phba; in lpfc_nport_evt_cnt_show()
1636 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); in lpfc_nport_evt_cnt_show()
1657 return -EINVAL; /* Invalid command */ in lpfc_set_trunking()
1671 return -EINVAL; in lpfc_set_trunking()
1677 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_set_trunking()
1679 return -ENOMEM; in lpfc_set_trunking()
1686 &mbox->u.mqe.un.set_trunk_mode, in lpfc_set_trunking()
1694 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_set_trunking()
1700 * lpfc_board_mode_show - Return the state of the board
1712 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_show()
1713 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_show()
1716 if (phba->link_state == LPFC_HBA_ERROR) in lpfc_board_mode_show()
1718 else if (phba->link_state == LPFC_WARM_START) in lpfc_board_mode_show()
1720 else if (phba->link_state == LPFC_INIT_START) in lpfc_board_mode_show()
1729 * lpfc_board_mode_store - Puts the hba in online, offline, warm or error state
1736 * -EACCES if enable hba reset not enabled
1737 * -EINVAL if the buffer does not contain a valid string (see above)
1738 * -EIO if lpfc_workq_post_event() or lpfc_do_offline() fails
1746 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_store()
1747 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_store()
1753 if (!phba->cfg_enable_hba_reset) { in lpfc_board_mode_store()
1754 status = -EACCES; in lpfc_board_mode_store()
1763 if(strncmp(buf, "online", sizeof("online") - 1) == 0) { in lpfc_board_mode_store()
1767 status = -ENOMEM; in lpfc_board_mode_store()
1772 status = -EIO; in lpfc_board_mode_store()
1773 } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) in lpfc_board_mode_store()
1775 else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) in lpfc_board_mode_store()
1776 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
1777 status = -EINVAL; in lpfc_board_mode_store()
1780 else if (strncmp(buf, "error", sizeof("error") - 1) == 0) in lpfc_board_mode_store()
1781 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
1782 status = -EINVAL; in lpfc_board_mode_store()
1785 else if (strncmp(buf, "dump", sizeof("dump") - 1) == 0) in lpfc_board_mode_store()
1787 else if (strncmp(buf, "fw_reset", sizeof("fw_reset") - 1) == 0) in lpfc_board_mode_store()
1789 else if (strncmp(buf, "dv_reset", sizeof("dv_reset") - 1) == 0) in lpfc_board_mode_store()
1791 else if (strncmp(buf, "pci_bus_reset", sizeof("pci_bus_reset") - 1) in lpfc_board_mode_store()
1794 else if (strncmp(buf, "trunk", sizeof("trunk") - 1) == 0) in lpfc_board_mode_store()
1797 status = -EINVAL; in lpfc_board_mode_store()
1809 buf, status, phba->pport->fc_flag); in lpfc_board_mode_store()
1815 * lpfc_get_hba_info - Return various bits of informaton about the adapter
1848 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_hba_info()
1849 !phba->mbox_mem_pool || in lpfc_get_hba_info()
1850 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_hba_info()
1853 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_hba_info()
1856 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_hba_info()
1861 pmb = &pmboxq->u.mb; in lpfc_get_hba_info()
1862 pmb->mbxCommand = MBX_READ_CONFIG; in lpfc_get_hba_info()
1863 pmb->mbxOwner = OWN_HOST; in lpfc_get_hba_info()
1864 pmboxq->ctx_buf = NULL; in lpfc_get_hba_info()
1866 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_hba_info()
1869 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_hba_info()
1873 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
1877 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_get_hba_info()
1878 rd_config = &pmboxq->u.mqe.un.rd_config; in lpfc_get_hba_info()
1882 *arpi = bf_get(lpfc_mbx_rd_conf_rpi_count, rd_config) - in lpfc_get_hba_info()
1883 phba->sli4_hba.max_cfg_param.rpi_used; in lpfc_get_hba_info()
1887 *axri = bf_get(lpfc_mbx_rd_conf_xri_count, rd_config) - in lpfc_get_hba_info()
1888 phba->sli4_hba.max_cfg_param.xri_used; in lpfc_get_hba_info()
1890 /* Account for differences with SLI-3. Get vpi count from in lpfc_get_hba_info()
1894 (bf_get(lpfc_mbx_rd_conf_vpi_count, rd_config) - 1) : 0; in lpfc_get_hba_info()
1902 *avpi = max_vpi - phba->sli4_hba.max_cfg_param.vpi_used; in lpfc_get_hba_info()
1905 *mrpi = pmb->un.varRdConfig.max_rpi; in lpfc_get_hba_info()
1907 *arpi = pmb->un.varRdConfig.avail_rpi; in lpfc_get_hba_info()
1909 *mxri = pmb->un.varRdConfig.max_xri; in lpfc_get_hba_info()
1911 *axri = pmb->un.varRdConfig.avail_xri; in lpfc_get_hba_info()
1913 *mvpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
1916 if (phba->link_state == LPFC_HBA_READY) in lpfc_get_hba_info()
1917 *avpi = pmb->un.varRdConfig.avail_vpi; in lpfc_get_hba_info()
1919 *avpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
1923 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
1928 * lpfc_max_rpi_show - Return maximum rpi
1946 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_rpi_show()
1947 struct lpfc_hba *phba = vport->phba; in lpfc_max_rpi_show()
1956 * lpfc_used_rpi_show - Return maximum rpi minus available rpi
1974 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_rpi_show()
1975 struct lpfc_hba *phba = vport->phba; in lpfc_used_rpi_show()
1979 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_rpi_show()
1984 * lpfc_max_xri_show - Return maximum xri
2002 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_xri_show()
2003 struct lpfc_hba *phba = vport->phba; in lpfc_max_xri_show()
2012 * lpfc_used_xri_show - Return maximum xpi minus the available xpi
2030 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_xri_show()
2031 struct lpfc_hba *phba = vport->phba; in lpfc_used_xri_show()
2035 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_xri_show()
2040 * lpfc_max_vpi_show - Return maximum vpi
2058 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_vpi_show()
2059 struct lpfc_hba *phba = vport->phba; in lpfc_max_vpi_show()
2068 * lpfc_used_vpi_show - Return maximum vpi minus the available vpi
2086 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_vpi_show()
2087 struct lpfc_hba *phba = vport->phba; in lpfc_used_vpi_show()
2091 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_vpi_show()
2096 * lpfc_npiv_info_show - Return text about NPIV support for the adapter
2113 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_npiv_info_show()
2114 struct lpfc_hba *phba = vport->phba; in lpfc_npiv_info_show()
2116 if (!(phba->max_vpi)) in lpfc_npiv_info_show()
2118 if (vport->port_type == LPFC_PHYSICAL_PORT) in lpfc_npiv_info_show()
2120 return scnprintf(buf, PAGE_SIZE, "NPIV Virtual (VPI %d)\n", vport->vpi); in lpfc_npiv_info_show()
2124 * lpfc_poll_show - Return text about poll support for the adapter
2139 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_show()
2140 struct lpfc_hba *phba = vport->phba; in lpfc_poll_show()
2142 return scnprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); in lpfc_poll_show()
2146 * lpfc_poll_store - Set the value of cfg_poll for the adapter
2156 * -EINVAL if the buffer connot be converted or is out of range
2164 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_store()
2165 struct lpfc_hba *phba = vport->phba; in lpfc_poll_store()
2171 return -EINVAL; in lpfc_poll_store()
2174 return -EINVAL; in lpfc_poll_store()
2177 return -EINVAL; in lpfc_poll_store()
2179 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_poll_store()
2184 phba->cfg_poll, val); in lpfc_poll_store()
2186 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2188 old_val = phba->cfg_poll; in lpfc_poll_store()
2193 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2194 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2195 return -EINVAL; in lpfc_poll_store()
2198 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2199 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2204 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2205 return -EINVAL; in lpfc_poll_store()
2211 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2212 del_timer(&phba->fcp_poll_timer); in lpfc_poll_store()
2213 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2214 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2215 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2216 return -EINVAL; in lpfc_poll_store()
2219 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2220 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2223 phba->cfg_poll = val; in lpfc_poll_store()
2225 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2231 * lpfc_sriov_hw_max_virtfn_show - Return maximum number of virtual functions
2248 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sriov_hw_max_virtfn_show()
2249 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_hw_max_virtfn_show()
2273 * -EINVAL if val is invalid
2278 if (lpfc_rangecheck(val, 0, 1) && phba->sli_rev == LPFC_SLI_REV4) { in lpfc_enable_bbcr_set()
2281 LPFC_DRIVER_NAME, phba->cfg_enable_bbcr, val); in lpfc_enable_bbcr_set()
2282 phba->cfg_enable_bbcr = val; in lpfc_enable_bbcr_set()
2288 return -EINVAL; in lpfc_enable_bbcr_set()
2292 * lpfc_param_show - Return a cfg attribute value in decimal
2311 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2312 struct lpfc_hba *phba = vport->phba;\
2314 phba->cfg_##attr);\
2318 * lpfc_param_hex_show - Return a cfg attribute value in hex
2337 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2338 struct lpfc_hba *phba = vport->phba;\
2340 val = phba->cfg_##attr;\
2342 phba->cfg_##attr);\
2346 * lpfc_param_init - Initializes a cfg attribute
2362 * -EINVAL if default used
2369 phba->cfg_##attr = val;\
2375 phba->cfg_##attr = default;\
2376 return -EINVAL;\
2380 * lpfc_param_set - Set a cfg attribute value
2397 * -EINVAL if val is invalid
2406 phba->cfg_##attr, val); \
2407 phba->cfg_##attr = val;\
2413 return -EINVAL;\
2417 * lpfc_param_store - Set a vport attribute value
2434 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2443 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2444 struct lpfc_hba *phba = vport->phba;\
2447 return -EINVAL;\
2449 return -EINVAL;\
2453 return -EINVAL;\
2457 * lpfc_vport_param_show - Return decimal formatted cfg attribute value
2476 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2477 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
2481 * lpfc_vport_param_hex_show - Return hex formatted attribute value
2501 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2502 return scnprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
2506 * lpfc_vport_param_init - Initialize a vport cfg attribute
2521 * -EINVAL if default used
2528 vport->cfg_##attr = val;\
2534 vport->cfg_##attr = default;\
2535 return -EINVAL;\
2539 * lpfc_vport_param_set - Set a vport cfg attribute
2553 * -EINVAL if val is invalid
2563 vport->cfg_##attr, vport->cfg_##attr, \
2565 vport->cfg_##attr = val;\
2571 return -EINVAL;\
2575 * lpfc_vport_param_store - Set a vport attribute
2588 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2597 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2600 return -EINVAL;\
2602 return -EINVAL;\
2606 return -EINVAL;\
2653 * lpfc_wwn_set - Convert string to the 8 byte WWN value.
2659 * -EINVAL if the buffer does not contain a valid wwn
2668 if (buf[cnt-1] == '\n') in lpfc_wwn_set()
2669 cnt--; in lpfc_wwn_set()
2673 return -EINVAL; in lpfc_wwn_set()
2680 j = ((j << 4) | ((*buf++ - 'a') + 10)); in lpfc_wwn_set()
2682 j = ((j << 4) | ((*buf++ - 'A') + 10)); in lpfc_wwn_set()
2684 j = ((j << 4) | (*buf++ - '0')); in lpfc_wwn_set()
2686 return -EINVAL; in lpfc_wwn_set()
2695 * lpfc_soft_wwn_enable_store - Allows setting of the wwn if the key is valid
2702 * -EINVAL if the buffer does not contain lpfc_soft_wwn_key
2710 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwn_enable_store()
2711 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwn_enable_store()
2713 uint8_t vvvl = vport->fc_sparam.cmn.valid_vendor_ver_level; in lpfc_soft_wwn_enable_store()
2714 u32 *fawwpn_key = (uint32_t *)&vport->fc_sparam.un.vendorVersion[0]; in lpfc_soft_wwn_enable_store()
2721 * desired, the key must be written again to re-enable the in lpfc_soft_wwn_enable_store()
2724 * The "key" is not secret - it is a hardcoded string shown in lpfc_soft_wwn_enable_store()
2732 return -EINVAL; in lpfc_soft_wwn_enable_store()
2736 if (buf[cnt-1] == '\n') in lpfc_soft_wwn_enable_store()
2737 cnt--; in lpfc_soft_wwn_enable_store()
2741 return -EINVAL; in lpfc_soft_wwn_enable_store()
2743 phba->soft_wwn_enable = 1; in lpfc_soft_wwn_enable_store()
2745 dev_printk(KERN_WARNING, &phba->pcidev->dev, in lpfc_soft_wwn_enable_store()
2747 phba->brd_no); in lpfc_soft_wwn_enable_store()
2748 dev_printk(KERN_WARNING, &phba->pcidev->dev, in lpfc_soft_wwn_enable_store()
2756 * lpfc_soft_wwpn_show - Return the cfg soft ww port name of the adapter
2768 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwpn_show()
2769 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwpn_show()
2772 (unsigned long long)phba->cfg_soft_wwpn); in lpfc_soft_wwpn_show()
2776 * lpfc_soft_wwpn_store - Set the ww port name of the adapter
2783 * -EACCES hba reset not enabled, adapter over temp
2784 * -EINVAL soft wwn not enabled, count is invalid, invalid wwpn byte invalid
2785 * -EIO error taking adapter offline or online
2793 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwpn_store()
2794 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwpn_store()
2801 if (!phba->cfg_enable_hba_reset) in lpfc_soft_wwpn_store()
2802 return -EACCES; in lpfc_soft_wwpn_store()
2803 spin_lock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2804 if (phba->over_temp_state == HBA_OVER_TEMP) { in lpfc_soft_wwpn_store()
2805 spin_unlock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2806 return -EACCES; in lpfc_soft_wwpn_store()
2808 spin_unlock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2810 if (buf[cnt-1] == '\n') in lpfc_soft_wwpn_store()
2811 cnt--; in lpfc_soft_wwpn_store()
2813 if (!phba->soft_wwn_enable) in lpfc_soft_wwpn_store()
2814 return -EINVAL; in lpfc_soft_wwpn_store()
2817 phba->soft_wwn_enable = 0; in lpfc_soft_wwpn_store()
2822 phba->soft_wwn_enable = 1; in lpfc_soft_wwpn_store()
2826 phba->cfg_soft_wwpn = wwn_to_u64(wwpn); in lpfc_soft_wwpn_store()
2827 fc_host_port_name(shost) = phba->cfg_soft_wwpn; in lpfc_soft_wwpn_store()
2828 if (phba->cfg_soft_wwnn) in lpfc_soft_wwpn_store()
2829 fc_host_node_name(shost) = phba->cfg_soft_wwnn; in lpfc_soft_wwpn_store()
2831 dev_printk(KERN_NOTICE, &phba->pcidev->dev, in lpfc_soft_wwpn_store()
2832 "lpfc%d: Reinitializing to use soft_wwpn\n", phba->brd_no); in lpfc_soft_wwpn_store()
2838 "reinit adapter - %d\n", stat1); in lpfc_soft_wwpn_store()
2843 return -ENOMEM; in lpfc_soft_wwpn_store()
2849 "reinit adapter - %d\n", stat2); in lpfc_soft_wwpn_store()
2850 return (stat1 || stat2) ? -EIO : count; in lpfc_soft_wwpn_store()
2855 * lpfc_soft_wwnn_show - Return the cfg soft ww node name for the adapter
2867 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_soft_wwnn_show()
2869 (unsigned long long)phba->cfg_soft_wwnn); in lpfc_soft_wwnn_show()
2873 * lpfc_soft_wwnn_store - sets the ww node name of the adapter
2879 * -EINVAL soft wwn not enabled, count is invalid, invalid wwnn byte invalid
2887 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_soft_wwnn_store()
2893 if (buf[cnt-1] == '\n') in lpfc_soft_wwnn_store()
2894 cnt--; in lpfc_soft_wwnn_store()
2896 if (!phba->soft_wwn_enable) in lpfc_soft_wwnn_store()
2897 return -EINVAL; in lpfc_soft_wwnn_store()
2907 phba->cfg_soft_wwnn = wwn_to_u64(wwnn); in lpfc_soft_wwnn_store()
2909 dev_printk(KERN_NOTICE, &phba->pcidev->dev, in lpfc_soft_wwnn_store()
2911 "setting of the soft_wwpn\n", phba->brd_no); in lpfc_soft_wwnn_store()
2918 * lpfc_oas_tgt_show - Return wwpn of target whose luns maybe enabled for
2932 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_show()
2935 wwn_to_u64(phba->cfg_oas_tgt_wwpn)); in lpfc_oas_tgt_show()
2939 * lpfc_oas_tgt_store - Store wwpn of target whose luns maybe enabled for
2947 * -EINVAL count is invalid, invalid wwpn byte invalid
2948 * -EPERM oas is not supported by hba
2956 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_store()
2961 if (!phba->cfg_fof) in lpfc_oas_tgt_store()
2962 return -EPERM; in lpfc_oas_tgt_store()
2965 if (buf[cnt-1] == '\n') in lpfc_oas_tgt_store()
2966 cnt--; in lpfc_oas_tgt_store()
2972 memcpy(phba->cfg_oas_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
2973 memcpy(phba->sli4_hba.oas_next_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
2975 phba->cfg_oas_flags |= OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
2977 phba->cfg_oas_flags &= ~OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
2978 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_tgt_store()
2979 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_tgt_store()
2986 * lpfc_oas_priority_show - Return wwpn of target whose luns maybe enabled for
3000 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_show()
3002 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority); in lpfc_oas_priority_show()
3006 * lpfc_oas_priority_store - Store wwpn of target whose luns maybe enabled for
3014 * -EINVAL count is invalid, invalid wwpn byte invalid
3015 * -EPERM oas is not supported by hba
3023 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_store()
3028 if (!phba->cfg_fof) in lpfc_oas_priority_store()
3029 return -EPERM; in lpfc_oas_priority_store()
3032 if (buf[cnt-1] == '\n') in lpfc_oas_priority_store()
3033 cnt--; in lpfc_oas_priority_store()
3037 return -EINVAL; in lpfc_oas_priority_store()
3040 phba->cfg_oas_priority = (uint8_t)val; in lpfc_oas_priority_store()
3042 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_priority_store()
3049 * lpfc_oas_vpt_show - Return wwpn of vport whose targets maybe enabled
3063 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_show()
3066 wwn_to_u64(phba->cfg_oas_vpt_wwpn)); in lpfc_oas_vpt_show()
3070 * lpfc_oas_vpt_store - Store wwpn of vport whose targets maybe enabled
3078 * -EINVAL count is invalid, invalid wwpn byte invalid
3079 * -EPERM oas is not supported by hba
3087 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_store()
3092 if (!phba->cfg_fof) in lpfc_oas_vpt_store()
3093 return -EPERM; in lpfc_oas_vpt_store()
3096 if (buf[cnt-1] == '\n') in lpfc_oas_vpt_store()
3097 cnt--; in lpfc_oas_vpt_store()
3103 memcpy(phba->cfg_oas_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3104 memcpy(phba->sli4_hba.oas_next_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3106 phba->cfg_oas_flags |= OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3108 phba->cfg_oas_flags &= ~OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3109 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_vpt_store()
3110 if (phba->cfg_oas_priority == 0) in lpfc_oas_vpt_store()
3111 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_vpt_store()
3112 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_vpt_store()
3119 * lpfc_oas_lun_state_show - Return the current state (enabled or disabled)
3134 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_show()
3136 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_state); in lpfc_oas_lun_state_show()
3140 * lpfc_oas_lun_state_store - Store the state (enabled or disabled)
3149 * -EINVAL count is invalid, invalid wwpn byte invalid
3150 * -EPERM oas is not supported by hba
3158 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_store()
3161 if (!phba->cfg_fof) in lpfc_oas_lun_state_store()
3162 return -EPERM; in lpfc_oas_lun_state_store()
3165 return -EINVAL; in lpfc_oas_lun_state_store()
3168 return -EINVAL; in lpfc_oas_lun_state_store()
3171 return -EINVAL; in lpfc_oas_lun_state_store()
3173 phba->cfg_oas_lun_state = val; in lpfc_oas_lun_state_store()
3180 * lpfc_oas_lun_status_show - Return the status of the Optimized Access
3195 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_status_show()
3197 if (!(phba->cfg_oas_flags & OAS_LUN_VALID)) in lpfc_oas_lun_status_show()
3198 return -EFAULT; in lpfc_oas_lun_status_show()
3200 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_status); in lpfc_oas_lun_status_show()
3207 * lpfc_oas_lun_state_set - enable or disable a lun for Optimized Access Storage
3216 * -EPERM OAS is not enabled or not supported by this port.
3227 if (!phba->cfg_fof) in lpfc_oas_lun_state_set()
3228 return -EPERM; in lpfc_oas_lun_state_set()
3234 rc = -ENOMEM; in lpfc_oas_lun_state_set()
3244 * lpfc_oas_lun_get_next - get the next lun that has been enabled for Optimized
3269 phba->sli4_hba.oas_next_vpt_wwpn, in lpfc_oas_lun_get_next()
3271 phba->sli4_hba.oas_next_tgt_wwpn, in lpfc_oas_lun_get_next()
3272 &phba->sli4_hba.oas_next_lun, in lpfc_oas_lun_get_next()
3282 * lpfc_oas_lun_state_change - enable/disable a lun for OAS operations
3294 * -ENOMEM: failed to enable an lun for OAS operations
3295 * -EPERM: OAS is not enabled
3311 * lpfc_oas_lun_show - Return oas enabled luns from a chosen target
3321 * -EFAULT: target or vport wwpn was not set properly.
3322 * -EPERM: oas is not enabled.
3329 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_show()
3334 if (!phba->cfg_fof) in lpfc_oas_lun_show()
3335 return -EPERM; in lpfc_oas_lun_show()
3337 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_show()
3338 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_VPORT)) in lpfc_oas_lun_show()
3339 return -EFAULT; in lpfc_oas_lun_show()
3341 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_show()
3342 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_TARGET)) in lpfc_oas_lun_show()
3343 return -EFAULT; in lpfc_oas_lun_show()
3345 oas_lun = lpfc_oas_lun_get_next(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_show()
3346 phba->cfg_oas_tgt_wwpn, in lpfc_oas_lun_show()
3347 &phba->cfg_oas_lun_status, in lpfc_oas_lun_show()
3348 &phba->cfg_oas_priority); in lpfc_oas_lun_show()
3350 phba->cfg_oas_flags |= OAS_LUN_VALID; in lpfc_oas_lun_show()
3352 len += scnprintf(buf + len, PAGE_SIZE-len, "0x%llx", oas_lun); in lpfc_oas_lun_show()
3358 * lpfc_oas_lun_store - Sets the OAS state for lun
3368 * -EFAULT: target or vport wwpn was not set properly.
3369 * -EPERM: oas is not enabled.
3377 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_store()
3382 if (!phba->cfg_fof) in lpfc_oas_lun_store()
3383 return -EPERM; in lpfc_oas_lun_store()
3385 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_store()
3386 return -EFAULT; in lpfc_oas_lun_store()
3388 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_store()
3389 return -EFAULT; in lpfc_oas_lun_store()
3392 return -EINVAL; in lpfc_oas_lun_store()
3395 return -EINVAL; in lpfc_oas_lun_store()
3397 pri = phba->cfg_oas_priority; in lpfc_oas_lun_store()
3399 pri = phba->cfg_XLanePriority; in lpfc_oas_lun_store()
3404 wwn_to_u64(phba->cfg_oas_vpt_wwpn), in lpfc_oas_lun_store()
3405 wwn_to_u64(phba->cfg_oas_tgt_wwpn), scsi_lun, in lpfc_oas_lun_store()
3406 pri, phba->cfg_oas_lun_state); in lpfc_oas_lun_store()
3408 rc = lpfc_oas_lun_state_change(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_store()
3409 phba->cfg_oas_tgt_wwpn, scsi_lun, in lpfc_oas_lun_store()
3410 phba->cfg_oas_lun_state, pri); in lpfc_oas_lun_store()
3429 " 0 - none,"
3430 " 1 - poll with interrupts enabled"
3431 " 3 - poll and disable FCP ring interrupts");
3443 " 0 - auto (SLI-3 if supported),"
3444 " 2 - select SLI-2 even on SLI-3 capable HBAs,"
3445 " 3 - select SLI-3");
3477 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pls_show()
3480 phba->sli4_hba.pc_sli4_params.pls); in lpfc_pls_show()
3489 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pt_show()
3492 (phba->hba_flag & HBA_PERSISTENT_TOPO) ? 1 : 0); in lpfc_pt_show()
3499 # 1 - (1024)
3500 # 2 - (2048)
3501 # 3 - (3072)
3502 # 4 - (4096)
3503 # 5 - (5120)
3509 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_iocb_hw_show()
3511 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max); in lpfc_iocb_hw_show()
3520 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txq_hw_show()
3524 pring ? pring->txq_max : 0); in lpfc_txq_hw_show()
3534 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txcmplq_hw_show()
3538 pring ? pring->txcmplq_max : 0); in lpfc_txcmplq_hw_show()
3556 * lpfc_nodev_tmo_show - Return the hba dev loss timeout value
3568 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nodev_tmo_show()
3570 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); in lpfc_nodev_tmo_show()
3574 * lpfc_nodev_tmo_init - Set the hba nodev timeout value
3586 * -EINVAL val out of range
3591 if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { in lpfc_nodev_tmo_init()
3592 vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; in lpfc_nodev_tmo_init()
3602 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_init()
3603 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_init()
3610 vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; in lpfc_nodev_tmo_init()
3611 return -EINVAL; in lpfc_nodev_tmo_init()
3615 * lpfc_update_rport_devloss_tmo - Update dev loss tmo value
3632 spin_lock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3633 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_update_rport_devloss_tmo()
3636 if (ndlp->rport) in lpfc_update_rport_devloss_tmo()
3637 ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; in lpfc_update_rport_devloss_tmo()
3639 spin_lock(&vport->phba->hbalock); in lpfc_update_rport_devloss_tmo()
3642 remoteport = rport->remoteport; in lpfc_update_rport_devloss_tmo()
3643 spin_unlock(&vport->phba->hbalock); in lpfc_update_rport_devloss_tmo()
3646 vport->cfg_devloss_tmo); in lpfc_update_rport_devloss_tmo()
3649 spin_unlock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3653 * lpfc_nodev_tmo_set - Set the vport nodev tmo and devloss tmo values
3665 * -EINVAL val out of range
3670 if (vport->dev_loss_tmo_changed || in lpfc_nodev_tmo_set()
3678 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_set()
3679 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_set()
3692 return -EINVAL; in lpfc_nodev_tmo_set()
3713 * lpfc_devloss_tmo_set - Sets vport nodev tmo, devloss tmo values, changed bit in lpfc_vport_param_init()
3724 * -EINVAL val out of range in lpfc_vport_param_init()
3730 vport->cfg_nodev_tmo = val; in lpfc_vport_param_init()
3731 vport->cfg_devloss_tmo = val; in lpfc_vport_param_init()
3732 vport->dev_loss_tmo_changed = 1; in lpfc_vport_param_init()
3742 return -EINVAL; in lpfc_vport_param_init()
3779 * Supported Values: 1 - register just FCP
3780 * 3 - register both FCP and NVME
3785 "Enable FC4 Protocol support - FCP / NVME");
3794 "Verbose logging bit-mask");
3830 * -EINVAL if val is invalid
3839 return -EINVAL; in lpfc_tgt_queue_depth_set()
3841 if (val == vport->cfg_tgt_queue_depth) in lpfc_tgt_queue_depth_set()
3844 spin_lock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3845 vport->cfg_tgt_queue_depth = val; in lpfc_tgt_queue_depth_set()
3848 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) in lpfc_tgt_queue_depth_set()
3849 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_tgt_queue_depth_set()
3851 spin_unlock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3899 * lpfc_restrict_login_init - Set the vport restrict login flag
3911 * -EINVAL val out of range
3921 vport->cfg_restrict_login = 1; in lpfc_restrict_login_init()
3922 return -EINVAL; in lpfc_restrict_login_init()
3924 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_restrict_login_init()
3925 vport->cfg_restrict_login = 0; in lpfc_restrict_login_init()
3928 vport->cfg_restrict_login = val; in lpfc_restrict_login_init()
3933 * lpfc_restrict_login_set - Set the vport restrict login flag
3946 * -EINVAL val out of range
3956 vport->cfg_restrict_login = 1; in lpfc_restrict_login_set()
3957 return -EINVAL; in lpfc_restrict_login_set()
3959 if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { in lpfc_restrict_login_set()
3963 vport->cfg_restrict_login = 0; in lpfc_restrict_login_set()
3966 vport->cfg_restrict_login = val; in lpfc_restrict_login_set()
3975 # Fibre channel "ALPA". In the FC-AL Profile there is an "informative
3981 # Turning on the scan-down variable (on = 1, off = 0) will
3994 # 0x0 = attempt loop mode then point-to-point
3996 # 0x02 = attempt point-to-point mode only
3998 # 0x06 = attempt point-to-point mode then loop
3999 # Set point-to-point mode if you want to run as an N_Port.
4007 * lpfc_topology_set - Set the adapters topology field
4019 * non-zero return value from lpfc_issue_lip()
4020 * -EINVAL val out of range
4027 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_topology_store()
4028 struct lpfc_hba *phba = vport->phba; in lpfc_topology_store()
4041 return -EINVAL; in lpfc_topology_store()
4043 return -EINVAL; in lpfc_topology_store()
4046 prev_val = phba->cfg_topology; in lpfc_topology_store()
4047 if (phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G && in lpfc_topology_store()
4052 return -EINVAL; in lpfc_topology_store()
4056 * - persistent topology enabled in lpfc_topology_store()
4057 * - G7/G6 with no private loop support in lpfc_topology_store()
4060 if ((phba->hba_flag & HBA_PERSISTENT_TOPO || in lpfc_topology_store()
4061 (!phba->sli4_hba.pc_sli4_params.pls && in lpfc_topology_store()
4062 (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC || in lpfc_topology_store()
4063 phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC))) && in lpfc_topology_store()
4067 return -EINVAL; in lpfc_topology_store()
4069 phba->cfg_topology = val; in lpfc_topology_store()
4076 if (prev_val != val && phba->sli_rev == LPFC_SLI_REV4) in lpfc_topology_store()
4077 phba->fc_topology_changed = 1; in lpfc_topology_store()
4078 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_topology_store()
4080 phba->cfg_topology = prev_val; in lpfc_topology_store()
4081 return -EINVAL; in lpfc_topology_store()
4088 phba->brd_no, val); in lpfc_topology_store()
4089 return -EINVAL; in lpfc_topology_store()
4111 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_static_vport_show()
4112 if (vport->vport_flag & STATIC_VPORT) in lpfc_static_vport_show()
4126 * lpfc_stat_data_ctrl_store - write call back for lpfc_stat_data_ctrl sysfs file
4149 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_stat_data_ctrl_store()
4150 struct lpfc_hba *phba = vport->phba; in lpfc_stat_data_ctrl_store()
4161 if (strlen(buf) > (LPFC_MAX_DATA_CTRL_LEN - 1)) in lpfc_stat_data_ctrl_store()
4162 return -EINVAL; in lpfc_stat_data_ctrl_store()
4166 /* Ignore this token - this is command token */ in lpfc_stat_data_ctrl_store()
4169 return -EINVAL; in lpfc_stat_data_ctrl_store()
4173 return -EINVAL; in lpfc_stat_data_ctrl_store()
4180 return -EINVAL; in lpfc_stat_data_ctrl_store()
4184 return -EINVAL; in lpfc_stat_data_ctrl_store()
4189 return -EINVAL; in lpfc_stat_data_ctrl_store()
4192 return -EINVAL; in lpfc_stat_data_ctrl_store()
4197 return -ENOMEM; in lpfc_stat_data_ctrl_store()
4199 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4201 spin_lock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4203 vports[i]->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4204 if (vports[i]->stat_data_enabled) in lpfc_stat_data_ctrl_store()
4206 spin_unlock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4210 phba->bucket_type = bucket_type; in lpfc_stat_data_ctrl_store()
4211 phba->bucket_base = base; in lpfc_stat_data_ctrl_store()
4212 phba->bucket_step = step; in lpfc_stat_data_ctrl_store()
4214 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4218 spin_lock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4219 vports[i]->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4220 spin_unlock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4229 return -ENOMEM; in lpfc_stat_data_ctrl_store()
4231 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4233 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4234 vports[i]->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4236 vport->stat_data_enabled = 0; in lpfc_stat_data_ctrl_store()
4237 vports[i]->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4238 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4241 phba->bucket_type = LPFC_NO_BUCKET; in lpfc_stat_data_ctrl_store()
4242 phba->bucket_base = 0; in lpfc_stat_data_ctrl_store()
4243 phba->bucket_step = 0; in lpfc_stat_data_ctrl_store()
4249 if (phba->bucket_type == LPFC_NO_BUCKET) in lpfc_stat_data_ctrl_store()
4250 return -EINVAL; in lpfc_stat_data_ctrl_store()
4251 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4252 if (vport->stat_data_enabled) { in lpfc_stat_data_ctrl_store()
4253 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4257 vport->stat_data_enabled = 1; in lpfc_stat_data_ctrl_store()
4258 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4263 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4264 if (vport->stat_data_enabled == 0) { in lpfc_stat_data_ctrl_store()
4265 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4269 vport->stat_data_enabled = 0; in lpfc_stat_data_ctrl_store()
4270 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4275 if ((phba->bucket_type == LPFC_NO_BUCKET) in lpfc_stat_data_ctrl_store()
4276 || !vport->stat_data_enabled) in lpfc_stat_data_ctrl_store()
4278 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4279 vport->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4281 vport->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4282 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4285 return -EINVAL; in lpfc_stat_data_ctrl_store()
4290 * lpfc_stat_data_ctrl_show - Read function for lpfc_stat_data_ctrl sysfs file
4303 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_stat_data_ctrl_show()
4304 struct lpfc_hba *phba = vport->phba; in lpfc_stat_data_ctrl_show()
4310 switch (phba->bucket_type) { in lpfc_stat_data_ctrl_show()
4325 vport->stat_data_enabled, vport->stat_data_blocked, in lpfc_stat_data_ctrl_show()
4326 bucket_type, phba->bucket_base, phba->bucket_step); in lpfc_stat_data_ctrl_show()
4328 if (phba->bucket_type != LPFC_NO_BUCKET) { in lpfc_stat_data_ctrl_show()
4330 if (phba->bucket_type == LPFC_LINEAR_BUCKET) in lpfc_stat_data_ctrl_show()
4331 bucket_value = phba->bucket_base + in lpfc_stat_data_ctrl_show()
4332 phba->bucket_step * i; in lpfc_stat_data_ctrl_show()
4334 bucket_value = phba->bucket_base + in lpfc_stat_data_ctrl_show()
4335 (1 << i) * phba->bucket_step; in lpfc_stat_data_ctrl_show()
4366 * sysfs_drvr_stat_data_read - Read function for lpfc_drvr_stat_data attribute
4386 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_drvr_stat_data_read()
4387 struct lpfc_hba *phba = vport->phba; in sysfs_drvr_stat_data_read()
4394 if (!vport->stat_data_enabled || vport->stat_data_blocked in sysfs_drvr_stat_data_read()
4395 || (phba->bucket_type == LPFC_NO_BUCKET)) in sysfs_drvr_stat_data_read()
4398 spin_lock_irq(shost->host_lock); in sysfs_drvr_stat_data_read()
4399 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in sysfs_drvr_stat_data_read()
4400 if (!NLP_CHK_NODE_ACT(ndlp) || !ndlp->lat_data) in sysfs_drvr_stat_data_read()
4404 nport_index--; in sysfs_drvr_stat_data_read()
4412 if (!ndlp->lat_data) in sysfs_drvr_stat_data_read()
4417 ndlp->nlp_portname.u.wwn[0], in sysfs_drvr_stat_data_read()
4418 ndlp->nlp_portname.u.wwn[1], in sysfs_drvr_stat_data_read()
4419 ndlp->nlp_portname.u.wwn[2], in sysfs_drvr_stat_data_read()
4420 ndlp->nlp_portname.u.wwn[3], in sysfs_drvr_stat_data_read()
4421 ndlp->nlp_portname.u.wwn[4], in sysfs_drvr_stat_data_read()
4422 ndlp->nlp_portname.u.wwn[5], in sysfs_drvr_stat_data_read()
4423 ndlp->nlp_portname.u.wwn[6], in sysfs_drvr_stat_data_read()
4424 ndlp->nlp_portname.u.wwn[7]); in sysfs_drvr_stat_data_read()
4430 ndlp->lat_data[i].cmd_count); in sysfs_drvr_stat_data_read()
4436 spin_unlock_irq(shost->host_lock); in sysfs_drvr_stat_data_read()
4456 * lpfc_link_speed_set - Set the adapters link speed
4469 * non-zero return value from lpfc_issue_lip()
4470 * -EINVAL val out of range
4477 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_speed_store()
4478 struct lpfc_hba *phba = vport->phba; in lpfc_link_speed_store()
4485 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_link_speed_store()
4487 phba->hba_flag & HBA_FORCED_LINK_SPEED) in lpfc_link_speed_store()
4488 return -EPERM; in lpfc_link_speed_store()
4496 return -EINVAL; in lpfc_link_speed_store()
4498 return -EINVAL; in lpfc_link_speed_store()
4502 phba->cfg_link_speed, val, nolip ? "(nolip)" : "(lip)"); in lpfc_link_speed_store()
4504 if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || in lpfc_link_speed_store()
4505 ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || in lpfc_link_speed_store()
4506 ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || in lpfc_link_speed_store()
4507 ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || in lpfc_link_speed_store()
4508 ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) || in lpfc_link_speed_store()
4509 ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb)) || in lpfc_link_speed_store()
4510 ((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb)) || in lpfc_link_speed_store()
4511 ((val == LPFC_USER_LINK_SPEED_64G) && !(phba->lmt & LMT_64Gb))) { in lpfc_link_speed_store()
4516 return -EINVAL; in lpfc_link_speed_store()
4519 phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_speed_store()
4524 return -EINVAL; in lpfc_link_speed_store()
4536 prev_val = phba->cfg_link_speed; in lpfc_link_speed_store()
4537 phba->cfg_link_speed = val; in lpfc_link_speed_store()
4541 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_link_speed_store()
4543 phba->cfg_link_speed = prev_val; in lpfc_link_speed_store()
4544 return -EINVAL; in lpfc_link_speed_store()
4555 return -EINVAL; in lpfc_link_speed_store()
4565 * lpfc_link_speed_init - Set the adapters link speed in lpfc_param_show()
4578 * -EINVAL val out of range in lpfc_param_show()
4583 if (val >= LPFC_USER_LINK_SPEED_16G && phba->cfg_topology == 4) { in lpfc_param_show()
4588 phba->cfg_topology = 0; in lpfc_param_show()
4600 phba->cfg_link_speed = val; in lpfc_param_show()
4607 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_param_show()
4608 return -EINVAL; in lpfc_param_show()
4625 * lpfc_aer_support_store - Set the adapter for aer support in lpfc_param_show()
4649 * -EINVAL if val out of range or intended mode is not supported. in lpfc_param_show()
4656 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_param_show()
4657 struct lpfc_hba *phba = vport->phba; in lpfc_param_show()
4658 int val = 0, rc = -EINVAL; in lpfc_param_show()
4661 return -EINVAL; in lpfc_param_show()
4663 return -EINVAL; in lpfc_param_show()
4667 if (phba->hba_flag & HBA_AER_ENABLED) { in lpfc_param_show()
4668 rc = pci_disable_pcie_error_reporting(phba->pcidev); in lpfc_param_show()
4670 spin_lock_irq(&phba->hbalock); in lpfc_param_show()
4671 phba->hba_flag &= ~HBA_AER_ENABLED; in lpfc_param_show()
4672 spin_unlock_irq(&phba->hbalock); in lpfc_param_show()
4673 phba->cfg_aer_support = 0; in lpfc_param_show()
4676 rc = -EPERM; in lpfc_param_show()
4678 phba->cfg_aer_support = 0; in lpfc_param_show()
4683 if (!(phba->hba_flag & HBA_AER_ENABLED)) { in lpfc_param_show()
4684 rc = pci_enable_pcie_error_reporting(phba->pcidev); in lpfc_param_show()
4686 spin_lock_irq(&phba->hbalock); in lpfc_param_show()
4687 phba->hba_flag |= HBA_AER_ENABLED; in lpfc_param_show()
4688 spin_unlock_irq(&phba->hbalock); in lpfc_param_show()
4689 phba->cfg_aer_support = 1; in lpfc_param_show()
4692 rc = -EPERM; in lpfc_param_show()
4694 phba->cfg_aer_support = 1; in lpfc_param_show()
4699 rc = -EINVAL; in lpfc_param_show()
4708 * lpfc_aer_cleanup_state - Clean up aer state to the aer enabled device
4723 * -EINVAL if the buf does not contain the 1 or the device is not currently
4731 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_aer_cleanup_state()
4732 struct lpfc_hba *phba = vport->phba; in lpfc_aer_cleanup_state()
4733 int val, rc = -1; in lpfc_aer_cleanup_state()
4736 return -EINVAL; in lpfc_aer_cleanup_state()
4738 return -EINVAL; in lpfc_aer_cleanup_state()
4740 return -EINVAL; in lpfc_aer_cleanup_state()
4742 if (phba->hba_flag & HBA_AER_ENABLED) in lpfc_aer_cleanup_state()
4743 rc = pci_aer_clear_nonfatal_status(phba->pcidev); in lpfc_aer_cleanup_state()
4748 return -EPERM; in lpfc_aer_cleanup_state()
4755 * lpfc_sriov_nr_virtfn_store - Enable the adapter for sr-iov virtual functions
4764 * try to enable or disable SR-IOV virtual functions according to the
4774 * cfg_sriov_nr_virtfn; otherwise, -EINVAL shall be returned and driver
4777 * If none-zero virtual functions have already been enabled to the
4779 * -EINVAL will be returned and the driver does nothing;
4781 * If the nr_vfn provided is zero and none-zero virtual functions have
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_sriov_nr_virtfn_store()
4799 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_nr_virtfn_store()
4800 struct pci_dev *pdev = phba->pcidev; in lpfc_sriov_nr_virtfn_store()
4801 int val = 0, rc = -EINVAL; in lpfc_sriov_nr_virtfn_store()
4805 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4807 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4809 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4813 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4815 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4821 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4825 phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4826 return -EEXIST; in lpfc_sriov_nr_virtfn_store()
4830 phba->cfg_sriov_nr_virtfn = val; in lpfc_sriov_nr_virtfn_store()
4835 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4838 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4840 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4841 rc = -EPERM; in lpfc_sriov_nr_virtfn_store()
4849 "Enable PCIe device SR-IOV virtual fn");
4855 * lpfc_request_firmware_store - Request for Linux generic firmware upgrade
4867 * -EINVAL if val out of range or intended mode is not supported.
4875 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_request_firmware_upgrade_store()
4876 struct lpfc_hba *phba = vport->phba; in lpfc_request_firmware_upgrade_store()
4881 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4883 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4885 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4889 rc = -EPERM; in lpfc_request_firmware_upgrade_store()
4901 * lpfc_request_firmware_upgrade_init - Enable initial linux generic fw upgrade in lpfc_param_show()
4910 * -EINVAL val out of range in lpfc_param_show()
4916 phba->cfg_request_firmware_upgrade = val; in lpfc_param_show()
4919 return -EINVAL; in lpfc_param_show()
4939 * 0 - on success
4940 * -EIO - if command is not sent
4947 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_force_rscn_store()
4952 return -EIO; in lpfc_force_rscn_store()
4969 * lpfc_force_rscn_init - Force an RSCN to be sent to all remote NPorts in lpfc_param_show()
4988 * @buf: string with the number of fast-path FCP interrupts per second.
4993 * maximum number of fast-path FCP interrupts per second.
4998 * -EINVAL if val out of range or intended mode is not supported.
5005 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_imax_store()
5006 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_imax_store()
5012 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_fcp_imax_store()
5013 return -EINVAL; in lpfc_fcp_imax_store()
5017 return -EINVAL; in lpfc_fcp_imax_store()
5019 return -EINVAL; in lpfc_fcp_imax_store()
5027 return -EINVAL; in lpfc_fcp_imax_store()
5029 phba->cfg_auto_imax = (val) ? 0 : 1; in lpfc_fcp_imax_store()
5030 if (phba->cfg_fcp_imax && !val) { in lpfc_fcp_imax_store()
5031 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_fcp_imax_store()
5035 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_fcp_imax_store()
5036 eqi->icnt = 0; in lpfc_fcp_imax_store()
5040 phba->cfg_fcp_imax = (uint32_t)val; in lpfc_fcp_imax_store()
5042 if (phba->cfg_fcp_imax) in lpfc_fcp_imax_store()
5043 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_fcp_imax_store()
5047 for (i = 0; i < phba->cfg_irq_chann; i += LPFC_MAX_EQ_DELAY_EQID_CNT) in lpfc_fcp_imax_store()
5055 # lpfc_fcp_imax: The maximum number of fast-path FCP interrupts per second
5067 * lpfc_fcp_imax_init - Set the initial sr-iov virtual function enable in lpfc_param_show()
5073 * maximum number of fast-path FCP interrupts per second. in lpfc_param_show()
5077 * -EINVAL val out of range in lpfc_param_show()
5082 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_param_show()
5083 phba->cfg_fcp_imax = 0; in lpfc_param_show()
5089 phba->cfg_fcp_imax = val; in lpfc_param_show()
5096 phba->cfg_fcp_imax = LPFC_DEF_IMAX; in lpfc_param_show()
5116 * -ERANGE: if val is not in the valid range
5117 * -EINVAL: if bad value format or intended mode is not supported.
5124 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_cq_max_proc_limit_store()
5125 struct lpfc_hba *phba = vport->phba; in lpfc_cq_max_proc_limit_store()
5131 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_store()
5132 return -EINVAL; in lpfc_cq_max_proc_limit_store()
5136 return -EINVAL; in lpfc_cq_max_proc_limit_store()
5138 return -EINVAL; in lpfc_cq_max_proc_limit_store()
5141 return -ERANGE; in lpfc_cq_max_proc_limit_store()
5143 phba->cfg_cq_max_proc_limit = (uint32_t)val; in lpfc_cq_max_proc_limit_store()
5146 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_cq_max_proc_limit_store()
5148 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_cq_max_proc_limit_store()
5152 list_for_each_entry(cq, &eq->child_list, list) in lpfc_cq_max_proc_limit_store()
5153 cq->max_proc_limit = min(phba->cfg_cq_max_proc_limit, in lpfc_cq_max_proc_limit_store()
5154 cq->entry_count); in lpfc_cq_max_proc_limit_store()
5174 * than re-enabling interrupts.
5182 * lpfc_cq_max_proc_limit_init - Set the initial cq max_proc_limit
5198 phba->cfg_cq_max_proc_limit = LPFC_CQ_DEF_MAX_PROC_LIMIT; in lpfc_cq_max_proc_limit_init()
5200 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_init()
5204 phba->cfg_cq_max_proc_limit = val; in lpfc_cq_max_proc_limit_init()
5211 phba->cfg_cq_max_proc_limit); in lpfc_cq_max_proc_limit_init()
5219 * lpfc_state_show - Display current driver CPU affinity
5231 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_cpu_map_show()
5232 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_cpu_map_show()
5236 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_fcp_cpu_map_show()
5237 (phba->intr_type != MSIX)) in lpfc_fcp_cpu_map_show()
5240 switch (phba->cfg_fcp_cpu_map) { in lpfc_fcp_cpu_map_show()
5242 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
5244 phba->cfg_fcp_cpu_map); in lpfc_fcp_cpu_map_show()
5247 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
5248 "fcp_cpu_map: HBA centric mapping (%d): " in lpfc_fcp_cpu_map_show()
5250 phba->cfg_fcp_cpu_map, num_online_cpus(), in lpfc_fcp_cpu_map_show()
5252 phba->sli4_hba.num_possible_cpu); in lpfc_fcp_cpu_map_show()
5256 while (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
5257 phba->sli4_hba.num_possible_cpu) { in lpfc_fcp_cpu_map_show()
5258 cpup = &phba->sli4_hba.cpu_map[phba->sli4_hba.curr_disp_cpu]; in lpfc_fcp_cpu_map_show()
5260 if (!cpu_present(phba->sli4_hba.curr_disp_cpu)) in lpfc_fcp_cpu_map_show()
5261 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5262 "CPU %02d not present\n", in lpfc_fcp_cpu_map_show()
5263 phba->sli4_hba.curr_disp_cpu); in lpfc_fcp_cpu_map_show()
5264 else if (cpup->eq == LPFC_VECTOR_MAP_EMPTY) { in lpfc_fcp_cpu_map_show()
5265 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
5267 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5268 "CPU %02d hdwq None " in lpfc_fcp_cpu_map_show()
5270 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5271 cpup->phys_id, cpup->core_id, in lpfc_fcp_cpu_map_show()
5272 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5273 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
5276 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5277 "CPU %02d EQ None hdwq %04d " in lpfc_fcp_cpu_map_show()
5279 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5280 cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
5281 cpup->core_id, in lpfc_fcp_cpu_map_show()
5282 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5283 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
5285 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
5287 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5288 "CPU %02d hdwq None " in lpfc_fcp_cpu_map_show()
5290 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5291 cpup->phys_id, in lpfc_fcp_cpu_map_show()
5292 cpup->core_id, in lpfc_fcp_cpu_map_show()
5293 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5294 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
5295 lpfc_get_irq(cpup->eq)); in lpfc_fcp_cpu_map_show()
5298 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5299 "CPU %02d EQ %04d hdwq %04d " in lpfc_fcp_cpu_map_show()
5301 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5302 cpup->eq, cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
5303 cpup->core_id, in lpfc_fcp_cpu_map_show()
5304 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5305 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
5306 lpfc_get_irq(cpup->eq)); in lpfc_fcp_cpu_map_show()
5309 phba->sli4_hba.curr_disp_cpu++; in lpfc_fcp_cpu_map_show()
5312 if (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
5313 phba->sli4_hba.num_possible_cpu && in lpfc_fcp_cpu_map_show()
5314 (len >= (PAGE_SIZE - 64))) { in lpfc_fcp_cpu_map_show()
5316 PAGE_SIZE - len, "more...\n"); in lpfc_fcp_cpu_map_show()
5321 if (phba->sli4_hba.curr_disp_cpu == phba->sli4_hba.num_possible_cpu) in lpfc_fcp_cpu_map_show()
5322 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_fcp_cpu_map_show()
5328 * lpfc_fcp_cpu_map_store - Change CPU affinity of driver vectors
5335 * -EINVAL - Not implemented yet.
5341 return -EINVAL; in lpfc_fcp_cpu_map_store()
5349 # 0 - Do not affinitze IRQ vectors
5350 # 1 - Affintize HBA vectors with respect to each HBA
5360 * lpfc_fcp_cpu_map_init - Set the initial sr-iov virtual function enable
5365 * If val is in a valid range [0-2], then affinitze the adapter's
5370 * -EINVAL val out of range
5375 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_fcp_cpu_map_init()
5376 phba->cfg_fcp_cpu_map = 0; in lpfc_fcp_cpu_map_init()
5381 phba->cfg_fcp_cpu_map = val; in lpfc_fcp_cpu_map_init()
5388 phba->cfg_fcp_cpu_map = LPFC_HBA_CPU_MAP; in lpfc_fcp_cpu_map_init()
5423 * Parameter supported on physical port only - no NPIV support.
5444 # the parameter is set to a non-zero value, the I/O queue depth is controlled
5458 if (val == vport->cfg_max_scsicmpl_time) in lpfc_max_scsicmpl_time_set()
5461 return -EINVAL; in lpfc_max_scsicmpl_time_set()
5462 vport->cfg_max_scsicmpl_time = val; in lpfc_max_scsicmpl_time_set()
5464 spin_lock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5465 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_max_scsicmpl_time_set()
5468 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) in lpfc_max_scsicmpl_time_set()
5470 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_max_scsicmpl_time_set()
5472 spin_unlock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5496 * current CPU.
5501 * The driver dynamically sets this to 1 (BY_CPU) if it's able to set up cpu
5503 * CPU. Otherwise, the default 0 (Round Robin) scheduling of FCP/NVME I/Os
5510 "issuing commands [0] - Hardware Queue, [1] - Current CPU");
5522 "[0] - GID_FT, [1] - GID_PT");
5528 # For [1], bus reset issues target reset to non-FCP2 devices
5531 "FCP2 devices [0] - issue tgt reset, [1] - no tgt reset");
5584 # Traditional FDMI support means the driver will assume FDMI-2 support;
5585 # however, if that fails, it will fallback to FDMI-1.
5609 # there are FC targets, such as JBODs, that only recognize 8-bits of
5642 # 2 = MSI-X enabled (default)
5646 "MSI-X (2), if possible");
5705 * lpfc_cpumask_irq_mode_init - initalizes cpumask of phba based on
5712 unsigned int cpu, first_cpu, numa_node = NUMA_NO_NODE; in lpfc_cpumask_irq_mode_init() local
5714 struct cpumask *aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_cpumask_irq_mode_init()
5718 if (phba->irq_chann_mode == NUMA_MODE) { in lpfc_cpumask_irq_mode_init()
5720 numa_node = dev_to_node(&phba->pcidev->dev); in lpfc_cpumask_irq_mode_init()
5722 phba->irq_chann_mode = NORMAL_MODE; in lpfc_cpumask_irq_mode_init()
5727 for_each_possible_cpu(cpu) { in lpfc_cpumask_irq_mode_init()
5728 switch (phba->irq_chann_mode) { in lpfc_cpumask_irq_mode_init()
5730 if (cpu_to_node(cpu) == numa_node) in lpfc_cpumask_irq_mode_init()
5731 cpumask_set_cpu(cpu, aff_mask); in lpfc_cpumask_irq_mode_init()
5734 sibling_mask = topology_sibling_cpumask(cpu); in lpfc_cpumask_irq_mode_init()
5753 phba->irq_chann_mode = NUMA_MODE; in lpfc_assign_default_irq_chann()
5757 phba->irq_chann_mode = NHT_MODE; in lpfc_assign_default_irq_chann()
5760 phba->irq_chann_mode = NORMAL_MODE; in lpfc_assign_default_irq_chann()
5765 phba->irq_chann_mode = NORMAL_MODE; in lpfc_assign_default_irq_chann()
5772 * of EQ / MSI-X vectors the driver will create. This should never be
5787 /* lpfc_irq_chann_init - Set the hba irq_chann initial value
5798 * -EINVAL if value was out of range
5805 if (phba->cfg_use_msi != 2) { in lpfc_irq_chann_init()
5808 phba->cfg_use_msi); in lpfc_irq_chann_init()
5809 phba->irq_chann_mode = NORMAL_MODE; in lpfc_irq_chann_init()
5810 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5818 if (phba->irq_chann_mode != NORMAL_MODE) { in lpfc_irq_chann_init()
5819 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_chann_init()
5825 phba->irq_chann_mode); in lpfc_irq_chann_init()
5826 phba->irq_chann_mode = NORMAL_MODE; in lpfc_irq_chann_init()
5827 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5829 phba->cfg_irq_chann = cpumask_weight(aff_mask); in lpfc_irq_chann_init()
5834 if (phba->irq_chann_mode == NHT_MODE) in lpfc_irq_chann_init()
5835 phba->cfg_hdw_queue = phba->cfg_irq_chann; in lpfc_irq_chann_init()
5839 "(mode: %d)\n", phba->cfg_irq_chann, in lpfc_irq_chann_init()
5840 phba->irq_chann_mode); in lpfc_irq_chann_init()
5851 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5852 return -EINVAL; in lpfc_irq_chann_init()
5854 phba->cfg_irq_chann = val; in lpfc_irq_chann_init()
5861 * lpfc_irq_chann_show - Display value of irq_chann
5873 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_irq_chann_show()
5874 struct lpfc_hba *phba = vport->phba; in lpfc_irq_chann_show()
5876 return scnprintf(buf, PAGE_SIZE, "%u\n", phba->cfg_irq_chann); in lpfc_irq_chann_show()
5908 # 0x0 - 0x7f = CS_CTL field in FC header (high 7 bits)
5914 # lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF)
5923 # - Bit mask of host protection capabilities used to register with the
5924 # SCSI mid-layer
5925 # - Only meaningful if BG is turned on (lpfc_enable_bg=1).
5926 # - Allows you to ultimately specify which profiles to use
5927 # - Default will result in registering capabilities for all profiles.
5928 # - SHOST_DIF_TYPE1_PROTECTION 1
5930 # - SHOST_DIX_TYPE0_PROTECTION 8
5932 # - SHOST_DIX_TYPE1_PROTECTION 16
5944 "T10-DIF host protection capabilities mask");
5948 # - Bit mask of protection guard types to register with the SCSI mid-layer
5949 # - Guard types are currently either 1) T10-DIF CRC 2) IP checksum
5950 # - Allows you to ultimately specify which profiles to use
5951 # - Default will result in registering capabilities for all guard types
5956 "T10-DIF host protection guard type");
5964 * When this parameter is set to non-zero value, initial Nport discovery is
5976 * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
5980 * Because of the additional overhead involved in setting up T10-DIF,
5989 * lpfc_sg_seg_cnt_show - Display the scatter/gather list sizes
6002 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sg_seg_cnt_show()
6003 struct lpfc_hba *phba = vport->phba; in lpfc_sg_seg_cnt_show()
6007 phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); in lpfc_sg_seg_cnt_show()
6010 phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sg_seg_cnt_show()
6011 phba->cfg_nvme_seg_cnt); in lpfc_sg_seg_cnt_show()
6018 * lpfc_sg_seg_cnt_init - Set the hba sg_seg_cnt initial value
6029 * -EINVAL if value was out of range
6035 phba->cfg_sg_seg_cnt = val; in lpfc_sg_seg_cnt_init()
6042 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT; in lpfc_sg_seg_cnt_init()
6043 return -EINVAL; in lpfc_sg_seg_cnt_init()
6057 * [1-4] = Multiple of 1/4th Mb of host memory for FW logging
6070 return -EINVAL; in lpfc_ras_fwlog_buffsize_set()
6072 if (phba->cfg_ras_fwlog_buffsize == val) in lpfc_ras_fwlog_buffsize_set()
6075 if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn)) in lpfc_ras_fwlog_buffsize_set()
6076 return -EINVAL; in lpfc_ras_fwlog_buffsize_set()
6078 spin_lock_irq(&phba->hbalock); in lpfc_ras_fwlog_buffsize_set()
6079 state = phba->ras_fwlog.state; in lpfc_ras_fwlog_buffsize_set()
6080 spin_unlock_irq(&phba->hbalock); in lpfc_ras_fwlog_buffsize_set()
6085 return -EBUSY; in lpfc_ras_fwlog_buffsize_set()
6092 phba->cfg_ras_fwlog_buffsize = val; in lpfc_ras_fwlog_buffsize_set()
6099 if (phba->ras_fwlog.ras_enabled) in lpfc_ras_fwlog_buffsize_set()
6100 ret = lpfc_sli4_ras_fwlog_init(phba, phba->cfg_ras_fwlog_level, in lpfc_ras_fwlog_buffsize_set()
6288 * sysfs_ctlreg_write - Write method for writing to ctlreg
6301 * -ERANGE off and count combo out of range
6302 * -EINVAL off, count or buff address invalid
6303 * -EPERM adapter is offline
6314 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_write()
6315 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_write()
6317 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_write()
6318 return -EPERM; in sysfs_ctlreg_write()
6321 return -ERANGE; in sysfs_ctlreg_write()
6327 return -EINVAL; in sysfs_ctlreg_write()
6331 return -EINVAL; in sysfs_ctlreg_write()
6333 if (!(vport->fc_flag & FC_OFFLINE_MODE)) in sysfs_ctlreg_write()
6334 return -EPERM; in sysfs_ctlreg_write()
6336 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6337 for (buf_off = 0; buf_off < count - LPFC_REG_WRITE_KEY_SIZE; in sysfs_ctlreg_write()
6340 phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_write()
6342 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6348 * sysfs_ctlreg_read - Read method for reading from ctlreg
6361 * -ERANGE off and count combo out of range
6362 * -EINVAL off, count or buff address invalid
6374 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_read()
6375 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_read()
6377 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_read()
6378 return -EPERM; in sysfs_ctlreg_read()
6381 return -ERANGE; in sysfs_ctlreg_read()
6384 count = FF_REG_AREA_SIZE - off; in sysfs_ctlreg_read()
6389 return -EINVAL; in sysfs_ctlreg_read()
6391 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6395 *tmp_ptr = readl(phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_read()
6398 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6414 * sysfs_mbox_write - Write method for writing information via mbox
6427 * -EPERM operation not permitted
6434 return -EPERM; in sysfs_mbox_write()
6438 * sysfs_mbox_read - Read method for reading information via mbox
6451 * -EPERM operation not permitted
6458 return -EPERM; in sysfs_mbox_read()
6472 * lpfc_alloc_sysfs_attr - Creates the ctlreg and mbox entries
6485 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6489 if (error || vport->port_type == LPFC_NPIV_PORT) in lpfc_alloc_sysfs_attr()
6492 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6497 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6504 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_alloc_sysfs_attr()
6506 sysfs_remove_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6513 * lpfc_free_sysfs_attr - Removes the ctlreg and mbox entries
6520 sysfs_remove_bin_file(&shost->shost_dev.kobj, in lpfc_free_sysfs_attr()
6523 if (vport->port_type == LPFC_NPIV_PORT) in lpfc_free_sysfs_attr()
6525 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr); in lpfc_free_sysfs_attr()
6526 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_free_sysfs_attr()
6534 * lpfc_get_host_symbolic_name - Copy symbolic name into the scsi host
6540 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_get_host_symbolic_name()
6547 * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
6553 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_id()
6555 /* note: fc_myDID already in cpu endianness */ in lpfc_get_host_port_id()
6556 fc_host_port_id(shost) = vport->fc_myDID; in lpfc_get_host_port_id()
6560 * lpfc_get_host_port_type - Set the value of the scsi host port type
6566 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_type()
6567 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_type()
6569 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_type()
6571 if (vport->port_type == LPFC_NPIV_PORT) { in lpfc_get_host_port_type()
6574 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_host_port_type()
6575 if (vport->fc_flag & FC_PUBLIC_LOOP) in lpfc_get_host_port_type()
6580 if (vport->fc_flag & FC_FABRIC) in lpfc_get_host_port_type()
6588 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_type()
6592 * lpfc_get_host_port_state - Set the value of the scsi host port state
6598 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_state()
6599 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_state()
6601 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_state()
6603 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_host_port_state()
6606 switch (phba->link_state) { in lpfc_get_host_port_state()
6615 if (vport->port_state < LPFC_VPORT_READY) in lpfc_get_host_port_state()
6631 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_state()
6635 * lpfc_get_host_speed - Set the value of the scsi host speed
6641 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_speed()
6642 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_speed()
6644 spin_lock_irq(shost->host_lock); in lpfc_get_host_speed()
6646 if ((lpfc_is_link_up(phba)) && (!(phba->hba_flag & HBA_FCOE_MODE))) { in lpfc_get_host_speed()
6647 switch(phba->fc_linkspeed) { in lpfc_get_host_speed()
6679 } else if (lpfc_is_link_up(phba) && (phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_get_host_speed()
6680 switch (phba->fc_linkspeed) { in lpfc_get_host_speed()
6706 spin_unlock_irq(shost->host_lock); in lpfc_get_host_speed()
6710 * lpfc_get_host_fabric_name - Set the value of the scsi host fabric name
6716 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_fabric_name()
6717 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_fabric_name()
6720 spin_lock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
6722 if ((vport->port_state > LPFC_FLOGI) && in lpfc_get_host_fabric_name()
6723 ((vport->fc_flag & FC_FABRIC) || in lpfc_get_host_fabric_name()
6724 ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) && in lpfc_get_host_fabric_name()
6725 (vport->fc_flag & FC_PUBLIC_LOOP)))) in lpfc_get_host_fabric_name()
6726 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); in lpfc_get_host_fabric_name()
6731 spin_unlock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
6737 * lpfc_get_stats - Return statistical information about the adapter
6751 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_stats()
6752 struct lpfc_hba *phba = vport->phba; in lpfc_get_stats()
6753 struct lpfc_sli *psli = &phba->sli; in lpfc_get_stats()
6754 struct fc_host_statistics *hs = &phba->link_stats; in lpfc_get_stats()
6755 struct lpfc_lnk_stat * lso = &psli->lnk_stat_offsets; in lpfc_get_stats()
6764 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_stats()
6765 !phba->mbox_mem_pool || in lpfc_get_stats()
6766 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_stats()
6769 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_stats()
6772 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_stats()
6777 pmb = &pmboxq->u.mb; in lpfc_get_stats()
6778 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_get_stats()
6779 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6780 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6781 pmboxq->vport = vport; in lpfc_get_stats()
6783 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_stats()
6786 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6790 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6796 hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt; in lpfc_get_stats()
6801 hs->tx_words = (uint64_t) in lpfc_get_stats()
6802 ((uint64_t)pmb->un.varRdStatus.xmitByteCnt in lpfc_get_stats()
6804 hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt; in lpfc_get_stats()
6805 hs->rx_words = (uint64_t) in lpfc_get_stats()
6806 ((uint64_t)pmb->un.varRdStatus.rcvByteCnt in lpfc_get_stats()
6810 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_get_stats()
6811 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6812 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6813 pmboxq->vport = vport; in lpfc_get_stats()
6815 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_stats()
6818 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6822 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6826 hs->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_get_stats()
6827 hs->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_get_stats()
6828 hs->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_get_stats()
6829 hs->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_get_stats()
6830 hs->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_get_stats()
6831 hs->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6832 hs->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6834 hs->link_failure_count -= lso->link_failure_count; in lpfc_get_stats()
6835 hs->loss_of_sync_count -= lso->loss_of_sync_count; in lpfc_get_stats()
6836 hs->loss_of_signal_count -= lso->loss_of_signal_count; in lpfc_get_stats()
6837 hs->prim_seq_protocol_err_count -= lso->prim_seq_protocol_err_count; in lpfc_get_stats()
6838 hs->invalid_tx_word_count -= lso->invalid_tx_word_count; in lpfc_get_stats()
6839 hs->invalid_crc_count -= lso->invalid_crc_count; in lpfc_get_stats()
6840 hs->error_frames -= lso->error_frames; in lpfc_get_stats()
6842 if (phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_stats()
6843 hs->lip_count = -1; in lpfc_get_stats()
6844 hs->nos_count = (phba->link_events >> 1); in lpfc_get_stats()
6845 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6846 } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_stats()
6847 hs->lip_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6848 hs->lip_count -= lso->link_events; in lpfc_get_stats()
6849 hs->nos_count = -1; in lpfc_get_stats()
6851 hs->lip_count = -1; in lpfc_get_stats()
6852 hs->nos_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6853 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6856 hs->dumped_frames = -1; in lpfc_get_stats()
6858 hs->seconds_since_last_reset = ktime_get_seconds() - psli->stats_start; in lpfc_get_stats()
6860 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6866 * lpfc_reset_stats - Copy the adapter link stats information
6872 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_reset_stats()
6873 struct lpfc_hba *phba = vport->phba; in lpfc_reset_stats()
6874 struct lpfc_sli *psli = &phba->sli; in lpfc_reset_stats()
6875 struct lpfc_lnk_stat *lso = &psli->lnk_stat_offsets; in lpfc_reset_stats()
6880 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_reset_stats()
6883 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_reset_stats()
6888 pmb = &pmboxq->u.mb; in lpfc_reset_stats()
6889 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_reset_stats()
6890 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6891 pmb->un.varWords[0] = 0x1; /* reset request */ in lpfc_reset_stats()
6892 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6893 pmboxq->vport = vport; in lpfc_reset_stats()
6895 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6896 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) in lpfc_reset_stats()
6899 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6903 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6908 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_reset_stats()
6909 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6910 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6911 pmboxq->vport = vport; in lpfc_reset_stats()
6913 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6914 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) in lpfc_reset_stats()
6917 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6921 mempool_free( pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6925 lso->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_reset_stats()
6926 lso->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_reset_stats()
6927 lso->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_reset_stats()
6928 lso->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_reset_stats()
6929 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_reset_stats()
6930 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6931 lso->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6932 if (phba->hba_flag & HBA_FCOE_MODE) in lpfc_reset_stats()
6933 lso->link_events = (phba->link_events >> 1); in lpfc_reset_stats()
6935 lso->link_events = (phba->fc_eventTag >> 1); in lpfc_reset_stats()
6937 psli->stats_start = ktime_get_seconds(); in lpfc_reset_stats()
6939 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6950 * lpfc_get_node_by_target - Return the nodelist for a target
6960 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in lpfc_get_node_by_target()
6961 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_node_by_target()
6964 spin_lock_irq(shost->host_lock); in lpfc_get_node_by_target()
6966 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_get_node_by_target()
6968 ndlp->nlp_state == NLP_STE_MAPPED_NODE && in lpfc_get_node_by_target()
6969 starget->id == ndlp->nlp_sid) { in lpfc_get_node_by_target()
6970 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
6974 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
6979 * lpfc_get_starget_port_id - Set the target port id to the ndlp DID or -1
6987 fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1; in lpfc_get_starget_port_id()
6991 * lpfc_get_starget_node_name - Set the target node name
7002 ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0; in lpfc_get_starget_node_name()
7006 * lpfc_get_starget_port_name - Set the target port name
7017 ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0; in lpfc_get_starget_port_name()
7021 * lpfc_set_rport_loss_tmo - Set the rport dev loss tmo
7032 struct lpfc_rport_data *rdata = rport->dd_data; in lpfc_set_rport_loss_tmo()
7033 struct lpfc_nodelist *ndlp = rdata->pnode; in lpfc_set_rport_loss_tmo()
7039 rport->dev_loss_tmo = timeout; in lpfc_set_rport_loss_tmo()
7041 rport->dev_loss_tmo = 1; in lpfc_set_rport_loss_tmo()
7044 dev_info(&rport->dev, "Cannot find remote node to " in lpfc_set_rport_loss_tmo()
7046 rport->port_id); in lpfc_set_rport_loss_tmo()
7053 if (nrport && nrport->remoteport) in lpfc_set_rport_loss_tmo()
7054 nvme_fc_set_remoteport_devloss(nrport->remoteport, in lpfc_set_rport_loss_tmo()
7055 rport->dev_loss_tmo); in lpfc_set_rport_loss_tmo()
7060 * lpfc_rport_show_function - Return rport target information
7078 struct lpfc_rport_data *rdata = rport->hostdata; \
7080 (rdata->target) ? cast rdata->target->field : 0); \
7088 * lpfc_set_vport_symbolic_name - Set the vport's symbolic name
7093 * has been changed. This function re-registers the symbolic name with the
7099 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; in lpfc_set_vport_symbolic_name()
7101 if (vport->port_state == LPFC_VPORT_READY) in lpfc_set_vport_symbolic_name()
7106 * lpfc_hba_log_verbose_init - Set hba's log verbose level
7117 phba->cfg_log_verbose = verbose; in lpfc_hba_log_verbose_init()
7253 * lpfc_get_hba_function_mode - Used to determine the HBA function in FCoE
7261 switch (phba->pcidev->device) { in lpfc_get_hba_function_mode()
7270 phba->hba_flag |= HBA_FCOE_MODE; in lpfc_get_hba_function_mode()
7274 phba->hba_flag &= ~HBA_FCOE_MODE; in lpfc_get_hba_function_mode()
7279 * lpfc_get_cfgparam - Used during probe_one to init the adapter structure
7317 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_get_cfgparam()
7318 phba->cfg_EnableXLane = 0; in lpfc_get_cfgparam()
7321 memset(phba->cfg_oas_tgt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7322 memset(phba->cfg_oas_vpt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7323 phba->cfg_oas_lun_state = 0; in lpfc_get_cfgparam()
7324 phba->cfg_oas_lun_status = 0; in lpfc_get_cfgparam()
7325 phba->cfg_oas_flags = 0; in lpfc_get_cfgparam()
7326 phba->cfg_oas_priority = 0; in lpfc_get_cfgparam()
7330 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_cfgparam()
7331 phba->cfg_poll = 0; in lpfc_get_cfgparam()
7333 phba->cfg_poll = lpfc_poll; in lpfc_get_cfgparam()
7339 if (phba->cfg_enable_bg && phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_cfgparam()
7343 phba->cfg_enable_bg = 0; in lpfc_get_cfgparam()
7344 } else if (phba->cfg_enable_bg) { in lpfc_get_cfgparam()
7345 phba->sli3_options |= LPFC_SLI3_BG_ENABLED; in lpfc_get_cfgparam()
7363 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_get_cfgparam()
7365 phba->nvmet_support = 0; in lpfc_get_cfgparam()
7366 phba->cfg_nvmet_mrq = 0; in lpfc_get_cfgparam()
7367 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7368 phba->cfg_enable_bbcr = 0; in lpfc_get_cfgparam()
7369 phba->cfg_xri_rebalancing = 0; in lpfc_get_cfgparam()
7372 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_cfgparam()
7373 phba->cfg_enable_fc4_type |= LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7376 phba->cfg_auto_imax = (phba->cfg_fcp_imax) ? 0 : 1; in lpfc_get_cfgparam()
7378 phba->cfg_enable_pbde = 0; in lpfc_get_cfgparam()
7381 if (phba->cfg_hdw_queue == 0) in lpfc_get_cfgparam()
7382 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7383 if (phba->cfg_irq_chann == 0) in lpfc_get_cfgparam()
7384 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7385 if (phba->cfg_irq_chann > phba->cfg_hdw_queue) in lpfc_get_cfgparam()
7386 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_get_cfgparam()
7388 phba->cfg_soft_wwnn = 0L; in lpfc_get_cfgparam()
7389 phba->cfg_soft_wwpn = 0L; in lpfc_get_cfgparam()
7407 * lpfc_nvme_mod_param_dep - Adjust module parameter value based on
7416 if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu) { in lpfc_nvme_mod_param_dep()
7417 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7420 if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu) { in lpfc_nvme_mod_param_dep()
7421 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7424 if (phba->cfg_irq_chann > phba->cfg_hdw_queue) { in lpfc_nvme_mod_param_dep()
7425 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7430 "2006 Reducing Queues - CPU limitation: " in lpfc_nvme_mod_param_dep()
7432 phba->cfg_irq_chann, in lpfc_nvme_mod_param_dep()
7433 phba->cfg_hdw_queue); in lpfc_nvme_mod_param_dep()
7435 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_nvme_mod_param_dep()
7436 phba->nvmet_support) { in lpfc_nvme_mod_param_dep()
7437 phba->cfg_enable_fc4_type &= ~LPFC_ENABLE_FCP; in lpfc_nvme_mod_param_dep()
7442 phba->cfg_nvme_enable_fb, in lpfc_nvme_mod_param_dep()
7443 phba->cfg_nvmet_fb_size, in lpfc_nvme_mod_param_dep()
7446 if (phba->cfg_nvme_enable_fb == 0) in lpfc_nvme_mod_param_dep()
7447 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7449 if (phba->cfg_nvmet_fb_size > LPFC_NVMET_FB_SZ_MAX) in lpfc_nvme_mod_param_dep()
7450 phba->cfg_nvmet_fb_size = LPFC_NVMET_FB_SZ_MAX; in lpfc_nvme_mod_param_dep()
7453 if (!phba->cfg_nvmet_mrq) in lpfc_nvme_mod_param_dep()
7454 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7457 if (phba->cfg_nvmet_mrq > phba->cfg_hdw_queue) { in lpfc_nvme_mod_param_dep()
7458 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7461 phba->cfg_nvmet_mrq); in lpfc_nvme_mod_param_dep()
7463 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_nvme_mod_param_dep()
7464 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_nvme_mod_param_dep()
7468 phba->nvmet_support = 0; in lpfc_nvme_mod_param_dep()
7469 phba->cfg_nvmet_mrq = 0; in lpfc_nvme_mod_param_dep()
7470 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7475 * lpfc_get_vport_cfgparam - Used during port create, init the vport structure