• Home
  • Raw
  • Download

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()
1541 phba->fw_dump_cmpl = &online_compl; in lpfc_sli4_pdev_reg_request()
1543 /* Disable SR-IOV virtual functions if enabled */ in lpfc_sli4_pdev_reg_request()
1544 if (phba->cfg_sriov_nr_virtfn) { in lpfc_sli4_pdev_reg_request()
1546 phba->cfg_sriov_nr_virtfn = 0; 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()
1586 if (phba->fw_dump_cmpl) in lpfc_sli4_pdev_reg_request()
1587 phba->fw_dump_cmpl = NULL; in lpfc_sli4_pdev_reg_request()
1593 if (phba->fw_dump_cmpl) in lpfc_sli4_pdev_reg_request()
1594 phba->fw_dump_cmpl = NULL; in lpfc_sli4_pdev_reg_request()
1603 wait_for_completion(phba->fw_dump_cmpl); in lpfc_sli4_pdev_reg_request()
1619 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sli4_pdev_reg_request()
1625 phba->cfg_sriov_nr_virtfn = sriov_nr_virtfn; in lpfc_sli4_pdev_reg_request()
1631 rc = -ENOMEM; in lpfc_sli4_pdev_reg_request()
1633 rc = -EIO; in lpfc_sli4_pdev_reg_request()
1639 * lpfc_nport_evt_cnt_show - Return the number of nport events
1651 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nport_evt_cnt_show()
1652 struct lpfc_hba *phba = vport->phba; in lpfc_nport_evt_cnt_show()
1654 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); in lpfc_nport_evt_cnt_show()
1675 return -EINVAL; /* Invalid command */ in lpfc_set_trunking()
1689 return -EINVAL; in lpfc_set_trunking()
1695 mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_set_trunking()
1697 return -ENOMEM; in lpfc_set_trunking()
1704 &mbox->u.mqe.un.set_trunk_mode, in lpfc_set_trunking()
1711 mempool_free(mbox, phba->mbox_mem_pool); in lpfc_set_trunking()
1717 * lpfc_board_mode_show - Return the state of the board
1729 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_show()
1730 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_show()
1733 if (phba->link_state == LPFC_HBA_ERROR) in lpfc_board_mode_show()
1735 else if (phba->link_state == LPFC_WARM_START) in lpfc_board_mode_show()
1737 else if (phba->link_state == LPFC_INIT_START) in lpfc_board_mode_show()
1746 * lpfc_board_mode_store - Puts the hba in online, offline, warm or error state
1753 * -EACCES if enable hba reset not enabled
1754 * -EINVAL if the buffer does not contain a valid string (see above)
1755 * -EIO if lpfc_workq_post_event() or lpfc_do_offline() fails
1763 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_board_mode_store()
1764 struct lpfc_hba *phba = vport->phba; in lpfc_board_mode_store()
1770 if (!phba->cfg_enable_hba_reset) { in lpfc_board_mode_store()
1771 status = -EACCES; in lpfc_board_mode_store()
1780 if(strncmp(buf, "online", sizeof("online") - 1) == 0) { in lpfc_board_mode_store()
1784 status = -ENOMEM; in lpfc_board_mode_store()
1789 status = -EIO; in lpfc_board_mode_store()
1790 } else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) in lpfc_board_mode_store()
1792 else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) in lpfc_board_mode_store()
1793 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
1794 status = -EINVAL; in lpfc_board_mode_store()
1797 else if (strncmp(buf, "error", sizeof("error") - 1) == 0) in lpfc_board_mode_store()
1798 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_board_mode_store()
1799 status = -EINVAL; in lpfc_board_mode_store()
1802 else if (strncmp(buf, "dump", sizeof("dump") - 1) == 0) in lpfc_board_mode_store()
1804 else if (strncmp(buf, "fw_reset", sizeof("fw_reset") - 1) == 0) in lpfc_board_mode_store()
1806 else if (strncmp(buf, "dv_reset", sizeof("dv_reset") - 1) == 0) in lpfc_board_mode_store()
1808 else if (strncmp(buf, "pci_bus_reset", sizeof("pci_bus_reset") - 1) in lpfc_board_mode_store()
1811 else if (strncmp(buf, "trunk", sizeof("trunk") - 1) == 0) in lpfc_board_mode_store()
1814 status = -EINVAL; in lpfc_board_mode_store()
1826 buf, status, phba->pport->fc_flag); in lpfc_board_mode_store()
1832 * lpfc_get_hba_info - Return various bits of informaton about the adapter
1865 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_hba_info()
1866 !phba->mbox_mem_pool || in lpfc_get_hba_info()
1867 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_hba_info()
1870 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_hba_info()
1873 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_hba_info()
1878 pmb = &pmboxq->u.mb; in lpfc_get_hba_info()
1879 pmb->mbxCommand = MBX_READ_CONFIG; in lpfc_get_hba_info()
1880 pmb->mbxOwner = OWN_HOST; in lpfc_get_hba_info()
1881 pmboxq->ctx_buf = NULL; in lpfc_get_hba_info()
1883 if (phba->pport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_hba_info()
1886 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_hba_info()
1890 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
1894 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_get_hba_info()
1895 rd_config = &pmboxq->u.mqe.un.rd_config; in lpfc_get_hba_info()
1899 *arpi = bf_get(lpfc_mbx_rd_conf_rpi_count, rd_config) - in lpfc_get_hba_info()
1900 phba->sli4_hba.max_cfg_param.rpi_used; in lpfc_get_hba_info()
1904 *axri = bf_get(lpfc_mbx_rd_conf_xri_count, rd_config) - in lpfc_get_hba_info()
1905 phba->sli4_hba.max_cfg_param.xri_used; in lpfc_get_hba_info()
1907 /* Account for differences with SLI-3. Get vpi count from in lpfc_get_hba_info()
1911 (bf_get(lpfc_mbx_rd_conf_vpi_count, rd_config) - 1) : 0; in lpfc_get_hba_info()
1919 *avpi = max_vpi - phba->sli4_hba.max_cfg_param.vpi_used; in lpfc_get_hba_info()
1922 *mrpi = pmb->un.varRdConfig.max_rpi; in lpfc_get_hba_info()
1924 *arpi = pmb->un.varRdConfig.avail_rpi; in lpfc_get_hba_info()
1926 *mxri = pmb->un.varRdConfig.max_xri; in lpfc_get_hba_info()
1928 *axri = pmb->un.varRdConfig.avail_xri; in lpfc_get_hba_info()
1930 *mvpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
1933 if (phba->link_state == LPFC_HBA_READY) in lpfc_get_hba_info()
1934 *avpi = pmb->un.varRdConfig.avail_vpi; in lpfc_get_hba_info()
1936 *avpi = pmb->un.varRdConfig.max_vpi; in lpfc_get_hba_info()
1940 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_hba_info()
1945 * lpfc_max_rpi_show - Return maximum rpi
1963 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_rpi_show()
1964 struct lpfc_hba *phba = vport->phba; in lpfc_max_rpi_show()
1973 * lpfc_used_rpi_show - Return maximum rpi minus available rpi
1991 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_rpi_show()
1992 struct lpfc_hba *phba = vport->phba; in lpfc_used_rpi_show()
1996 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_rpi_show()
2001 * lpfc_max_xri_show - Return maximum xri
2019 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_xri_show()
2020 struct lpfc_hba *phba = vport->phba; in lpfc_max_xri_show()
2029 * lpfc_used_xri_show - Return maximum xpi minus the available xpi
2047 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_xri_show()
2048 struct lpfc_hba *phba = vport->phba; in lpfc_used_xri_show()
2052 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_xri_show()
2057 * lpfc_max_vpi_show - Return maximum vpi
2075 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_max_vpi_show()
2076 struct lpfc_hba *phba = vport->phba; in lpfc_max_vpi_show()
2085 * lpfc_used_vpi_show - Return maximum vpi minus the available vpi
2103 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_used_vpi_show()
2104 struct lpfc_hba *phba = vport->phba; in lpfc_used_vpi_show()
2108 return scnprintf(buf, PAGE_SIZE, "%d\n", (cnt - acnt)); in lpfc_used_vpi_show()
2113 * lpfc_npiv_info_show - Return text about NPIV support for the adapter
2130 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_npiv_info_show()
2131 struct lpfc_hba *phba = vport->phba; in lpfc_npiv_info_show()
2133 if (!(phba->max_vpi)) in lpfc_npiv_info_show()
2135 if (vport->port_type == LPFC_PHYSICAL_PORT) in lpfc_npiv_info_show()
2137 return scnprintf(buf, PAGE_SIZE, "NPIV Virtual (VPI %d)\n", vport->vpi); in lpfc_npiv_info_show()
2141 * lpfc_poll_show - Return text about poll support for the adapter
2156 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_show()
2157 struct lpfc_hba *phba = vport->phba; in lpfc_poll_show()
2159 return scnprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); in lpfc_poll_show()
2163 * lpfc_poll_store - Set the value of cfg_poll for the adapter
2173 * -EINVAL if the buffer connot be converted or is out of range
2181 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_poll_store()
2182 struct lpfc_hba *phba = vport->phba; in lpfc_poll_store()
2188 return -EINVAL; in lpfc_poll_store()
2191 return -EINVAL; in lpfc_poll_store()
2194 return -EINVAL; in lpfc_poll_store()
2196 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_poll_store()
2201 phba->cfg_poll, val); in lpfc_poll_store()
2203 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2205 old_val = phba->cfg_poll; in lpfc_poll_store()
2210 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2211 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2212 return -EINVAL; in lpfc_poll_store()
2215 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2216 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2221 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2222 return -EINVAL; in lpfc_poll_store()
2228 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2229 del_timer(&phba->fcp_poll_timer); in lpfc_poll_store()
2230 spin_lock_irq(&phba->hbalock); in lpfc_poll_store()
2231 if (lpfc_readl(phba->HCregaddr, &creg_val)) { in lpfc_poll_store()
2232 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2233 return -EINVAL; in lpfc_poll_store()
2236 writel(creg_val, phba->HCregaddr); in lpfc_poll_store()
2237 readl(phba->HCregaddr); /* flush */ in lpfc_poll_store()
2240 phba->cfg_poll = val; in lpfc_poll_store()
2242 spin_unlock_irq(&phba->hbalock); in lpfc_poll_store()
2248 * lpfc_sriov_hw_max_virtfn_show - Return maximum number of virtual functions
2265 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_sriov_hw_max_virtfn_show()
2266 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_hw_max_virtfn_show()
2290 * -EINVAL if val is invalid
2295 if (lpfc_rangecheck(val, 0, 1) && phba->sli_rev == LPFC_SLI_REV4) { in lpfc_enable_bbcr_set()
2298 LPFC_DRIVER_NAME, phba->cfg_enable_bbcr, val); in lpfc_enable_bbcr_set()
2299 phba->cfg_enable_bbcr = val; in lpfc_enable_bbcr_set()
2305 return -EINVAL; in lpfc_enable_bbcr_set()
2309 * lpfc_param_show - Return a cfg attribute value in decimal
2328 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2329 struct lpfc_hba *phba = vport->phba;\
2331 phba->cfg_##attr);\
2335 * lpfc_param_hex_show - Return a cfg attribute value in hex
2354 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2355 struct lpfc_hba *phba = vport->phba;\
2357 val = phba->cfg_##attr;\
2359 phba->cfg_##attr);\
2363 * lpfc_param_init - Initializes a cfg attribute
2379 * -EINVAL if default used
2386 phba->cfg_##attr = val;\
2392 phba->cfg_##attr = default;\
2393 return -EINVAL;\
2397 * lpfc_param_set - Set a cfg attribute value
2414 * -EINVAL if val is invalid
2423 phba->cfg_##attr, val); \
2424 phba->cfg_##attr = val;\
2430 return -EINVAL;\
2434 * lpfc_param_store - Set a vport attribute value
2451 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2460 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2461 struct lpfc_hba *phba = vport->phba;\
2464 return -EINVAL;\
2466 return -EINVAL;\
2470 return -EINVAL;\
2474 * lpfc_vport_param_show - Return decimal formatted cfg attribute value
2493 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2494 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
2498 * lpfc_vport_param_hex_show - Return hex formatted attribute value
2518 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2519 return scnprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
2523 * lpfc_vport_param_init - Initialize a vport cfg attribute
2538 * -EINVAL if default used
2545 vport->cfg_##attr = val;\
2551 vport->cfg_##attr = default;\
2552 return -EINVAL;\
2556 * lpfc_vport_param_set - Set a vport cfg attribute
2570 * -EINVAL if val is invalid
2580 vport->cfg_##attr, vport->cfg_##attr, \
2582 vport->cfg_##attr = val;\
2588 return -EINVAL;\
2592 * lpfc_vport_param_store - Set a vport attribute
2605 * -EINVAL if val is invalid or lpfc_##attr##_set() fails
2614 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
2617 return -EINVAL;\
2619 return -EINVAL;\
2623 return -EINVAL;\
2670 * lpfc_wwn_set - Convert string to the 8 byte WWN value.
2676 * -EINVAL if the buffer does not contain a valid wwn
2685 if (buf[cnt-1] == '\n') in lpfc_wwn_set()
2686 cnt--; in lpfc_wwn_set()
2690 return -EINVAL; in lpfc_wwn_set()
2697 j = ((j << 4) | ((*buf++ - 'a') + 10)); in lpfc_wwn_set()
2699 j = ((j << 4) | ((*buf++ - 'A') + 10)); in lpfc_wwn_set()
2701 j = ((j << 4) | (*buf++ - '0')); in lpfc_wwn_set()
2703 return -EINVAL; in lpfc_wwn_set()
2712 * lpfc_soft_wwn_enable_store - Allows setting of the wwn if the key is valid
2719 * -EINVAL if the buffer does not contain lpfc_soft_wwn_key
2727 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwn_enable_store()
2728 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwn_enable_store()
2730 uint8_t vvvl = vport->fc_sparam.cmn.valid_vendor_ver_level; in lpfc_soft_wwn_enable_store()
2731 u32 *fawwpn_key = (uint32_t *)&vport->fc_sparam.un.vendorVersion[0]; in lpfc_soft_wwn_enable_store()
2738 * desired, the key must be written again to re-enable the in lpfc_soft_wwn_enable_store()
2741 * The "key" is not secret - it is a hardcoded string shown in lpfc_soft_wwn_enable_store()
2749 return -EINVAL; in lpfc_soft_wwn_enable_store()
2753 if (buf[cnt-1] == '\n') in lpfc_soft_wwn_enable_store()
2754 cnt--; in lpfc_soft_wwn_enable_store()
2758 return -EINVAL; in lpfc_soft_wwn_enable_store()
2760 phba->soft_wwn_enable = 1; in lpfc_soft_wwn_enable_store()
2762 dev_printk(KERN_WARNING, &phba->pcidev->dev, in lpfc_soft_wwn_enable_store()
2764 phba->brd_no); in lpfc_soft_wwn_enable_store()
2765 dev_printk(KERN_WARNING, &phba->pcidev->dev, in lpfc_soft_wwn_enable_store()
2773 * lpfc_soft_wwpn_show - Return the cfg soft ww port name of the adapter
2785 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwpn_show()
2786 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwpn_show()
2789 (unsigned long long)phba->cfg_soft_wwpn); in lpfc_soft_wwpn_show()
2793 * lpfc_soft_wwpn_store - Set the ww port name of the adapter
2800 * -EACCES hba reset not enabled, adapter over temp
2801 * -EINVAL soft wwn not enabled, count is invalid, invalid wwpn byte invalid
2802 * -EIO error taking adapter offline or online
2810 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_soft_wwpn_store()
2811 struct lpfc_hba *phba = vport->phba; in lpfc_soft_wwpn_store()
2818 if (!phba->cfg_enable_hba_reset) in lpfc_soft_wwpn_store()
2819 return -EACCES; in lpfc_soft_wwpn_store()
2820 spin_lock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2821 if (phba->over_temp_state == HBA_OVER_TEMP) { in lpfc_soft_wwpn_store()
2822 spin_unlock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2823 return -EACCES; in lpfc_soft_wwpn_store()
2825 spin_unlock_irq(&phba->hbalock); in lpfc_soft_wwpn_store()
2827 if (buf[cnt-1] == '\n') in lpfc_soft_wwpn_store()
2828 cnt--; in lpfc_soft_wwpn_store()
2830 if (!phba->soft_wwn_enable) in lpfc_soft_wwpn_store()
2831 return -EINVAL; in lpfc_soft_wwpn_store()
2834 phba->soft_wwn_enable = 0; in lpfc_soft_wwpn_store()
2839 phba->soft_wwn_enable = 1; in lpfc_soft_wwpn_store()
2843 phba->cfg_soft_wwpn = wwn_to_u64(wwpn); in lpfc_soft_wwpn_store()
2844 fc_host_port_name(shost) = phba->cfg_soft_wwpn; in lpfc_soft_wwpn_store()
2845 if (phba->cfg_soft_wwnn) in lpfc_soft_wwpn_store()
2846 fc_host_node_name(shost) = phba->cfg_soft_wwnn; in lpfc_soft_wwpn_store()
2848 dev_printk(KERN_NOTICE, &phba->pcidev->dev, in lpfc_soft_wwpn_store()
2849 "lpfc%d: Reinitializing to use soft_wwpn\n", phba->brd_no); in lpfc_soft_wwpn_store()
2855 "reinit adapter - %d\n", stat1); in lpfc_soft_wwpn_store()
2860 return -ENOMEM; in lpfc_soft_wwpn_store()
2866 "reinit adapter - %d\n", stat2); in lpfc_soft_wwpn_store()
2867 return (stat1 || stat2) ? -EIO : count; in lpfc_soft_wwpn_store()
2872 * lpfc_soft_wwnn_show - Return the cfg soft ww node name for the adapter
2884 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_soft_wwnn_show()
2886 (unsigned long long)phba->cfg_soft_wwnn); in lpfc_soft_wwnn_show()
2890 * lpfc_soft_wwnn_store - sets the ww node name of the adapter
2896 * -EINVAL soft wwn not enabled, count is invalid, invalid wwnn byte invalid
2904 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_soft_wwnn_store()
2910 if (buf[cnt-1] == '\n') in lpfc_soft_wwnn_store()
2911 cnt--; in lpfc_soft_wwnn_store()
2913 if (!phba->soft_wwn_enable) in lpfc_soft_wwnn_store()
2914 return -EINVAL; in lpfc_soft_wwnn_store()
2924 phba->cfg_soft_wwnn = wwn_to_u64(wwnn); in lpfc_soft_wwnn_store()
2926 dev_printk(KERN_NOTICE, &phba->pcidev->dev, in lpfc_soft_wwnn_store()
2928 "setting of the soft_wwpn\n", phba->brd_no); in lpfc_soft_wwnn_store()
2935 * lpfc_oas_tgt_show - Return wwpn of target whose luns maybe enabled for
2949 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_show()
2952 wwn_to_u64(phba->cfg_oas_tgt_wwpn)); in lpfc_oas_tgt_show()
2956 * lpfc_oas_tgt_store - Store wwpn of target whose luns maybe enabled for
2964 * -EINVAL count is invalid, invalid wwpn byte invalid
2965 * -EPERM oas is not supported by hba
2973 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_tgt_store()
2978 if (!phba->cfg_fof) in lpfc_oas_tgt_store()
2979 return -EPERM; in lpfc_oas_tgt_store()
2982 if (buf[cnt-1] == '\n') in lpfc_oas_tgt_store()
2983 cnt--; in lpfc_oas_tgt_store()
2989 memcpy(phba->cfg_oas_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
2990 memcpy(phba->sli4_hba.oas_next_tgt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_tgt_store()
2992 phba->cfg_oas_flags |= OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
2994 phba->cfg_oas_flags &= ~OAS_FIND_ANY_TARGET; in lpfc_oas_tgt_store()
2995 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_tgt_store()
2996 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_tgt_store()
3003 * lpfc_oas_priority_show - Return wwpn of target whose luns maybe enabled for
3017 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_show()
3019 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority); in lpfc_oas_priority_show()
3023 * lpfc_oas_priority_store - Store wwpn of target whose luns maybe enabled for
3031 * -EINVAL count is invalid, invalid wwpn byte invalid
3032 * -EPERM oas is not supported by hba
3040 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_priority_store()
3045 if (!phba->cfg_fof) in lpfc_oas_priority_store()
3046 return -EPERM; in lpfc_oas_priority_store()
3049 if (buf[cnt-1] == '\n') in lpfc_oas_priority_store()
3050 cnt--; in lpfc_oas_priority_store()
3054 return -EINVAL; in lpfc_oas_priority_store()
3057 phba->cfg_oas_priority = (uint8_t)val; in lpfc_oas_priority_store()
3059 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_priority_store()
3066 * lpfc_oas_vpt_show - Return wwpn of vport whose targets maybe enabled
3080 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_show()
3083 wwn_to_u64(phba->cfg_oas_vpt_wwpn)); in lpfc_oas_vpt_show()
3087 * lpfc_oas_vpt_store - Store wwpn of vport whose targets maybe enabled
3095 * -EINVAL count is invalid, invalid wwpn byte invalid
3096 * -EPERM oas is not supported by hba
3104 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_vpt_store()
3109 if (!phba->cfg_fof) in lpfc_oas_vpt_store()
3110 return -EPERM; in lpfc_oas_vpt_store()
3113 if (buf[cnt-1] == '\n') in lpfc_oas_vpt_store()
3114 cnt--; in lpfc_oas_vpt_store()
3120 memcpy(phba->cfg_oas_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3121 memcpy(phba->sli4_hba.oas_next_vpt_wwpn, wwpn, (8 * sizeof(uint8_t))); in lpfc_oas_vpt_store()
3123 phba->cfg_oas_flags |= OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3125 phba->cfg_oas_flags &= ~OAS_FIND_ANY_VPORT; in lpfc_oas_vpt_store()
3126 phba->cfg_oas_flags &= ~OAS_LUN_VALID; in lpfc_oas_vpt_store()
3127 if (phba->cfg_oas_priority == 0) in lpfc_oas_vpt_store()
3128 phba->cfg_oas_priority = phba->cfg_XLanePriority; in lpfc_oas_vpt_store()
3129 phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN; in lpfc_oas_vpt_store()
3136 * lpfc_oas_lun_state_show - Return the current state (enabled or disabled)
3151 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_show()
3153 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_state); in lpfc_oas_lun_state_show()
3157 * lpfc_oas_lun_state_store - Store the state (enabled or disabled)
3166 * -EINVAL count is invalid, invalid wwpn byte invalid
3167 * -EPERM oas is not supported by hba
3175 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_state_store()
3178 if (!phba->cfg_fof) in lpfc_oas_lun_state_store()
3179 return -EPERM; in lpfc_oas_lun_state_store()
3182 return -EINVAL; in lpfc_oas_lun_state_store()
3185 return -EINVAL; in lpfc_oas_lun_state_store()
3188 return -EINVAL; in lpfc_oas_lun_state_store()
3190 phba->cfg_oas_lun_state = val; in lpfc_oas_lun_state_store()
3197 * lpfc_oas_lun_status_show - Return the status of the Optimized Access
3212 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_status_show()
3214 if (!(phba->cfg_oas_flags & OAS_LUN_VALID)) in lpfc_oas_lun_status_show()
3215 return -EFAULT; in lpfc_oas_lun_status_show()
3217 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_lun_status); in lpfc_oas_lun_status_show()
3224 * lpfc_oas_lun_state_set - enable or disable a lun for Optimized Access Storage
3233 * -EPERM OAS is not enabled or not supported by this port.
3244 if (!phba->cfg_fof) in lpfc_oas_lun_state_set()
3245 return -EPERM; in lpfc_oas_lun_state_set()
3251 rc = -ENOMEM; in lpfc_oas_lun_state_set()
3261 * lpfc_oas_lun_get_next - get the next lun that has been enabled for Optimized
3286 phba->sli4_hba.oas_next_vpt_wwpn, in lpfc_oas_lun_get_next()
3288 phba->sli4_hba.oas_next_tgt_wwpn, in lpfc_oas_lun_get_next()
3289 &phba->sli4_hba.oas_next_lun, in lpfc_oas_lun_get_next()
3299 * lpfc_oas_lun_state_change - enable/disable a lun for OAS operations
3311 * -ENOMEM: failed to enable an lun for OAS operations
3312 * -EPERM: OAS is not enabled
3328 * lpfc_oas_lun_show - Return oas enabled luns from a chosen target
3338 * -EFAULT: target or vport wwpn was not set properly.
3339 * -EPERM: oas is not enabled.
3346 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_show()
3351 if (!phba->cfg_fof) in lpfc_oas_lun_show()
3352 return -EPERM; in lpfc_oas_lun_show()
3354 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_show()
3355 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_VPORT)) in lpfc_oas_lun_show()
3356 return -EFAULT; in lpfc_oas_lun_show()
3358 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_show()
3359 if (!(phba->cfg_oas_flags & OAS_FIND_ANY_TARGET)) in lpfc_oas_lun_show()
3360 return -EFAULT; in lpfc_oas_lun_show()
3362 oas_lun = lpfc_oas_lun_get_next(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_show()
3363 phba->cfg_oas_tgt_wwpn, in lpfc_oas_lun_show()
3364 &phba->cfg_oas_lun_status, in lpfc_oas_lun_show()
3365 &phba->cfg_oas_priority); in lpfc_oas_lun_show()
3367 phba->cfg_oas_flags |= OAS_LUN_VALID; in lpfc_oas_lun_show()
3369 len += scnprintf(buf + len, PAGE_SIZE-len, "0x%llx", oas_lun); in lpfc_oas_lun_show()
3375 * lpfc_oas_lun_store - Sets the OAS state for lun
3385 * -EFAULT: target or vport wwpn was not set properly.
3386 * -EPERM: oas is not enabled.
3394 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_oas_lun_store()
3399 if (!phba->cfg_fof) in lpfc_oas_lun_store()
3400 return -EPERM; in lpfc_oas_lun_store()
3402 if (wwn_to_u64(phba->cfg_oas_vpt_wwpn) == 0) in lpfc_oas_lun_store()
3403 return -EFAULT; in lpfc_oas_lun_store()
3405 if (wwn_to_u64(phba->cfg_oas_tgt_wwpn) == 0) in lpfc_oas_lun_store()
3406 return -EFAULT; in lpfc_oas_lun_store()
3409 return -EINVAL; in lpfc_oas_lun_store()
3412 return -EINVAL; in lpfc_oas_lun_store()
3414 pri = phba->cfg_oas_priority; in lpfc_oas_lun_store()
3416 pri = phba->cfg_XLanePriority; in lpfc_oas_lun_store()
3421 wwn_to_u64(phba->cfg_oas_vpt_wwpn), in lpfc_oas_lun_store()
3422 wwn_to_u64(phba->cfg_oas_tgt_wwpn), scsi_lun, in lpfc_oas_lun_store()
3423 pri, phba->cfg_oas_lun_state); in lpfc_oas_lun_store()
3425 rc = lpfc_oas_lun_state_change(phba, phba->cfg_oas_vpt_wwpn, in lpfc_oas_lun_store()
3426 phba->cfg_oas_tgt_wwpn, scsi_lun, in lpfc_oas_lun_store()
3427 phba->cfg_oas_lun_state, pri); in lpfc_oas_lun_store()
3446 " 0 - none,"
3447 " 1 - poll with interrupts enabled"
3448 " 3 - poll and disable FCP ring interrupts");
3460 " 0 - auto (SLI-3 if supported),"
3461 " 2 - select SLI-2 even on SLI-3 capable HBAs,"
3462 " 3 - select SLI-3");
3494 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pls_show()
3497 phba->sli4_hba.pc_sli4_params.pls); in lpfc_pls_show()
3506 struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; in lpfc_pt_show()
3509 (phba->hba_flag & HBA_PERSISTENT_TOPO) ? 1 : 0); in lpfc_pt_show()
3516 # 1 - (1024)
3517 # 2 - (2048)
3518 # 3 - (3072)
3519 # 4 - (4096)
3520 # 5 - (5120)
3526 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_iocb_hw_show()
3528 return scnprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max); in lpfc_iocb_hw_show()
3537 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txq_hw_show()
3541 pring ? pring->txq_max : 0); in lpfc_txq_hw_show()
3551 struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; in lpfc_txcmplq_hw_show()
3555 pring ? pring->txcmplq_max : 0); in lpfc_txcmplq_hw_show()
3573 * lpfc_nodev_tmo_show - Return the hba dev loss timeout value
3585 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_nodev_tmo_show()
3587 return scnprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo); in lpfc_nodev_tmo_show()
3591 * lpfc_nodev_tmo_init - Set the hba nodev timeout value
3603 * -EINVAL val out of range
3608 if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) { in lpfc_nodev_tmo_init()
3609 vport->cfg_nodev_tmo = vport->cfg_devloss_tmo; in lpfc_nodev_tmo_init()
3619 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_init()
3620 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_init()
3627 vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO; in lpfc_nodev_tmo_init()
3628 return -EINVAL; in lpfc_nodev_tmo_init()
3632 * lpfc_update_rport_devloss_tmo - Update dev loss tmo value
3649 spin_lock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3650 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_update_rport_devloss_tmo()
3653 if (ndlp->rport) in lpfc_update_rport_devloss_tmo()
3654 ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo; in lpfc_update_rport_devloss_tmo()
3656 spin_lock(&vport->phba->hbalock); in lpfc_update_rport_devloss_tmo()
3659 remoteport = rport->remoteport; in lpfc_update_rport_devloss_tmo()
3660 spin_unlock(&vport->phba->hbalock); in lpfc_update_rport_devloss_tmo()
3663 vport->cfg_devloss_tmo); in lpfc_update_rport_devloss_tmo()
3666 spin_unlock_irq(shost->host_lock); in lpfc_update_rport_devloss_tmo()
3670 * lpfc_nodev_tmo_set - Set the vport nodev tmo and devloss tmo values
3682 * -EINVAL val out of range
3687 if (vport->dev_loss_tmo_changed || in lpfc_nodev_tmo_set()
3695 vport->cfg_nodev_tmo = val; in lpfc_nodev_tmo_set()
3696 vport->cfg_devloss_tmo = val; in lpfc_nodev_tmo_set()
3709 return -EINVAL; in lpfc_nodev_tmo_set()
3730 * lpfc_devloss_tmo_set - Sets vport nodev tmo, devloss tmo values, changed bit in lpfc_vport_param_init()
3741 * -EINVAL val out of range in lpfc_vport_param_init()
3747 vport->cfg_nodev_tmo = val; in lpfc_vport_param_init()
3748 vport->cfg_devloss_tmo = val; in lpfc_vport_param_init()
3749 vport->dev_loss_tmo_changed = 1; in lpfc_vport_param_init()
3759 return -EINVAL; in lpfc_vport_param_init()
3796 * Supported Values: 1 - register just FCP
3797 * 3 - register both FCP and NVME
3802 "Enable FC4 Protocol support - FCP / NVME");
3811 "Verbose logging bit-mask");
3847 * -EINVAL if val is invalid
3856 return -EINVAL; in lpfc_tgt_queue_depth_set()
3858 if (val == vport->cfg_tgt_queue_depth) in lpfc_tgt_queue_depth_set()
3861 spin_lock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3862 vport->cfg_tgt_queue_depth = val; in lpfc_tgt_queue_depth_set()
3865 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) in lpfc_tgt_queue_depth_set()
3866 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_tgt_queue_depth_set()
3868 spin_unlock_irq(shost->host_lock); in lpfc_tgt_queue_depth_set()
3916 * lpfc_restrict_login_init - Set the vport restrict login flag
3928 * -EINVAL val out of range
3938 vport->cfg_restrict_login = 1; in lpfc_restrict_login_init()
3939 return -EINVAL; in lpfc_restrict_login_init()
3941 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_restrict_login_init()
3942 vport->cfg_restrict_login = 0; in lpfc_restrict_login_init()
3945 vport->cfg_restrict_login = val; in lpfc_restrict_login_init()
3950 * lpfc_restrict_login_set - Set the vport restrict login flag
3963 * -EINVAL val out of range
3973 vport->cfg_restrict_login = 1; in lpfc_restrict_login_set()
3974 return -EINVAL; in lpfc_restrict_login_set()
3976 if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) { in lpfc_restrict_login_set()
3980 vport->cfg_restrict_login = 0; in lpfc_restrict_login_set()
3983 vport->cfg_restrict_login = val; in lpfc_restrict_login_set()
3992 # Fibre channel "ALPA". In the FC-AL Profile there is an "informative
3998 # Turning on the scan-down variable (on = 1, off = 0) will
4011 # 0x0 = attempt loop mode then point-to-point
4013 # 0x02 = attempt point-to-point mode only
4015 # 0x06 = attempt point-to-point mode then loop
4016 # Set point-to-point mode if you want to run as an N_Port.
4024 * lpfc_topology_set - Set the adapters topology field
4036 * non-zero return value from lpfc_issue_lip()
4037 * -EINVAL val out of range
4044 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_topology_store()
4045 struct lpfc_hba *phba = vport->phba; in lpfc_topology_store()
4058 return -EINVAL; in lpfc_topology_store()
4060 return -EINVAL; in lpfc_topology_store()
4063 prev_val = phba->cfg_topology; in lpfc_topology_store()
4064 if (phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G && in lpfc_topology_store()
4069 return -EINVAL; in lpfc_topology_store()
4073 * - persistent topology enabled in lpfc_topology_store()
4074 * - G7/G6 with no private loop support in lpfc_topology_store()
4077 if ((phba->hba_flag & HBA_PERSISTENT_TOPO || in lpfc_topology_store()
4078 (!phba->sli4_hba.pc_sli4_params.pls && in lpfc_topology_store()
4079 (phba->pcidev->device == PCI_DEVICE_ID_LANCER_G6_FC || in lpfc_topology_store()
4080 phba->pcidev->device == PCI_DEVICE_ID_LANCER_G7_FC))) && in lpfc_topology_store()
4084 return -EINVAL; in lpfc_topology_store()
4086 phba->cfg_topology = val; in lpfc_topology_store()
4093 if (prev_val != val && phba->sli_rev == LPFC_SLI_REV4) in lpfc_topology_store()
4094 phba->fc_topology_changed = 1; in lpfc_topology_store()
4095 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_topology_store()
4097 phba->cfg_topology = prev_val; in lpfc_topology_store()
4098 return -EINVAL; in lpfc_topology_store()
4105 phba->brd_no, val); in lpfc_topology_store()
4106 return -EINVAL; in lpfc_topology_store()
4128 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_static_vport_show()
4129 if (vport->vport_flag & STATIC_VPORT) in lpfc_static_vport_show()
4143 * lpfc_stat_data_ctrl_store - write call back for lpfc_stat_data_ctrl sysfs file
4166 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_stat_data_ctrl_store()
4167 struct lpfc_hba *phba = vport->phba; in lpfc_stat_data_ctrl_store()
4178 if (strlen(buf) > (LPFC_MAX_DATA_CTRL_LEN - 1)) in lpfc_stat_data_ctrl_store()
4179 return -EINVAL; in lpfc_stat_data_ctrl_store()
4183 /* Ignore this token - this is command token */ in lpfc_stat_data_ctrl_store()
4186 return -EINVAL; in lpfc_stat_data_ctrl_store()
4190 return -EINVAL; in lpfc_stat_data_ctrl_store()
4197 return -EINVAL; in lpfc_stat_data_ctrl_store()
4201 return -EINVAL; in lpfc_stat_data_ctrl_store()
4206 return -EINVAL; in lpfc_stat_data_ctrl_store()
4209 return -EINVAL; in lpfc_stat_data_ctrl_store()
4214 return -ENOMEM; in lpfc_stat_data_ctrl_store()
4216 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()
4220 vports[i]->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4221 if (vports[i]->stat_data_enabled) in lpfc_stat_data_ctrl_store()
4223 spin_unlock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4227 phba->bucket_type = bucket_type; in lpfc_stat_data_ctrl_store()
4228 phba->bucket_base = base; in lpfc_stat_data_ctrl_store()
4229 phba->bucket_step = step; in lpfc_stat_data_ctrl_store()
4231 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4235 spin_lock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4236 vports[i]->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4237 spin_unlock_irq(v_shost->host_lock); in lpfc_stat_data_ctrl_store()
4246 return -ENOMEM; in lpfc_stat_data_ctrl_store()
4248 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_stat_data_ctrl_store()
4250 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4251 vports[i]->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4253 vport->stat_data_enabled = 0; in lpfc_stat_data_ctrl_store()
4254 vports[i]->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4255 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4258 phba->bucket_type = LPFC_NO_BUCKET; in lpfc_stat_data_ctrl_store()
4259 phba->bucket_base = 0; in lpfc_stat_data_ctrl_store()
4260 phba->bucket_step = 0; in lpfc_stat_data_ctrl_store()
4266 if (phba->bucket_type == LPFC_NO_BUCKET) in lpfc_stat_data_ctrl_store()
4267 return -EINVAL; in lpfc_stat_data_ctrl_store()
4268 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4269 if (vport->stat_data_enabled) { in lpfc_stat_data_ctrl_store()
4270 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4274 vport->stat_data_enabled = 1; in lpfc_stat_data_ctrl_store()
4275 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4280 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4281 if (vport->stat_data_enabled == 0) { in lpfc_stat_data_ctrl_store()
4282 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4286 vport->stat_data_enabled = 0; in lpfc_stat_data_ctrl_store()
4287 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4292 if ((phba->bucket_type == LPFC_NO_BUCKET) in lpfc_stat_data_ctrl_store()
4293 || !vport->stat_data_enabled) in lpfc_stat_data_ctrl_store()
4295 spin_lock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4296 vport->stat_data_blocked = 1; in lpfc_stat_data_ctrl_store()
4298 vport->stat_data_blocked = 0; in lpfc_stat_data_ctrl_store()
4299 spin_unlock_irq(shost->host_lock); in lpfc_stat_data_ctrl_store()
4302 return -EINVAL; in lpfc_stat_data_ctrl_store()
4307 * lpfc_stat_data_ctrl_show - Read function for lpfc_stat_data_ctrl sysfs file
4320 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_stat_data_ctrl_show()
4321 struct lpfc_hba *phba = vport->phba; in lpfc_stat_data_ctrl_show()
4327 switch (phba->bucket_type) { in lpfc_stat_data_ctrl_show()
4342 vport->stat_data_enabled, vport->stat_data_blocked, in lpfc_stat_data_ctrl_show()
4343 bucket_type, phba->bucket_base, phba->bucket_step); in lpfc_stat_data_ctrl_show()
4345 if (phba->bucket_type != LPFC_NO_BUCKET) { in lpfc_stat_data_ctrl_show()
4347 if (phba->bucket_type == LPFC_LINEAR_BUCKET) in lpfc_stat_data_ctrl_show()
4348 bucket_value = phba->bucket_base + in lpfc_stat_data_ctrl_show()
4349 phba->bucket_step * i; in lpfc_stat_data_ctrl_show()
4351 bucket_value = phba->bucket_base + in lpfc_stat_data_ctrl_show()
4352 (1 << i) * phba->bucket_step; in lpfc_stat_data_ctrl_show()
4383 * sysfs_drvr_stat_data_read - Read function for lpfc_drvr_stat_data attribute
4403 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_drvr_stat_data_read()
4404 struct lpfc_hba *phba = vport->phba; in sysfs_drvr_stat_data_read()
4411 if (!vport->stat_data_enabled || vport->stat_data_blocked in sysfs_drvr_stat_data_read()
4412 || (phba->bucket_type == LPFC_NO_BUCKET)) in sysfs_drvr_stat_data_read()
4415 spin_lock_irq(shost->host_lock); in sysfs_drvr_stat_data_read()
4416 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in sysfs_drvr_stat_data_read()
4417 if (!NLP_CHK_NODE_ACT(ndlp) || !ndlp->lat_data) in sysfs_drvr_stat_data_read()
4421 nport_index--; in sysfs_drvr_stat_data_read()
4429 if (!ndlp->lat_data) in sysfs_drvr_stat_data_read()
4434 ndlp->nlp_portname.u.wwn[0], in sysfs_drvr_stat_data_read()
4435 ndlp->nlp_portname.u.wwn[1], in sysfs_drvr_stat_data_read()
4436 ndlp->nlp_portname.u.wwn[2], in sysfs_drvr_stat_data_read()
4437 ndlp->nlp_portname.u.wwn[3], in sysfs_drvr_stat_data_read()
4438 ndlp->nlp_portname.u.wwn[4], in sysfs_drvr_stat_data_read()
4439 ndlp->nlp_portname.u.wwn[5], in sysfs_drvr_stat_data_read()
4440 ndlp->nlp_portname.u.wwn[6], in sysfs_drvr_stat_data_read()
4441 ndlp->nlp_portname.u.wwn[7]); in sysfs_drvr_stat_data_read()
4447 ndlp->lat_data[i].cmd_count); in sysfs_drvr_stat_data_read()
4453 spin_unlock_irq(shost->host_lock); in sysfs_drvr_stat_data_read()
4473 * lpfc_link_speed_set - Set the adapters link speed
4486 * non-zero return value from lpfc_issue_lip()
4487 * -EINVAL val out of range
4494 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_link_speed_store()
4495 struct lpfc_hba *phba = vport->phba; in lpfc_link_speed_store()
4502 if_type = bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf); in lpfc_link_speed_store()
4504 phba->hba_flag & HBA_FORCED_LINK_SPEED) in lpfc_link_speed_store()
4505 return -EPERM; in lpfc_link_speed_store()
4513 return -EINVAL; in lpfc_link_speed_store()
4515 return -EINVAL; in lpfc_link_speed_store()
4519 phba->cfg_link_speed, val, nolip ? "(nolip)" : "(lip)"); in lpfc_link_speed_store()
4521 if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || in lpfc_link_speed_store()
4522 ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || in lpfc_link_speed_store()
4523 ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || in lpfc_link_speed_store()
4524 ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || in lpfc_link_speed_store()
4525 ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) || in lpfc_link_speed_store()
4526 ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb)) || in lpfc_link_speed_store()
4527 ((val == LPFC_USER_LINK_SPEED_32G) && !(phba->lmt & LMT_32Gb)) || in lpfc_link_speed_store()
4528 ((val == LPFC_USER_LINK_SPEED_64G) && !(phba->lmt & LMT_64Gb))) { in lpfc_link_speed_store()
4533 return -EINVAL; in lpfc_link_speed_store()
4536 phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_link_speed_store()
4541 return -EINVAL; in lpfc_link_speed_store()
4553 prev_val = phba->cfg_link_speed; in lpfc_link_speed_store()
4554 phba->cfg_link_speed = val; in lpfc_link_speed_store()
4558 err = lpfc_issue_lip(lpfc_shost_from_vport(phba->pport)); in lpfc_link_speed_store()
4560 phba->cfg_link_speed = prev_val; in lpfc_link_speed_store()
4561 return -EINVAL; in lpfc_link_speed_store()
4572 return -EINVAL; in lpfc_link_speed_store()
4582 * lpfc_link_speed_init - Set the adapters link speed in lpfc_param_show()
4595 * -EINVAL val out of range in lpfc_param_show()
4600 if (val >= LPFC_USER_LINK_SPEED_16G && phba->cfg_topology == 4) { in lpfc_param_show()
4605 phba->cfg_topology = 0; in lpfc_param_show()
4617 phba->cfg_link_speed = val; in lpfc_param_show()
4624 phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; in lpfc_param_show()
4625 return -EINVAL; in lpfc_param_show()
4642 * lpfc_aer_support_store - Set the adapter for aer support in lpfc_param_show()
4666 * -EINVAL if val out of range or intended mode is not supported. in lpfc_param_show()
4673 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_param_show()
4674 struct lpfc_hba *phba = vport->phba; in lpfc_param_show()
4675 int val = 0, rc = -EINVAL; in lpfc_param_show()
4678 return -EINVAL; in lpfc_param_show()
4680 return -EINVAL; in lpfc_param_show()
4684 if (phba->hba_flag & HBA_AER_ENABLED) { in lpfc_param_show()
4685 rc = pci_disable_pcie_error_reporting(phba->pcidev); in lpfc_param_show()
4687 spin_lock_irq(&phba->hbalock); in lpfc_param_show()
4688 phba->hba_flag &= ~HBA_AER_ENABLED; in lpfc_param_show()
4689 spin_unlock_irq(&phba->hbalock); in lpfc_param_show()
4690 phba->cfg_aer_support = 0; in lpfc_param_show()
4693 rc = -EPERM; in lpfc_param_show()
4695 phba->cfg_aer_support = 0; in lpfc_param_show()
4700 if (!(phba->hba_flag & HBA_AER_ENABLED)) { in lpfc_param_show()
4701 rc = pci_enable_pcie_error_reporting(phba->pcidev); in lpfc_param_show()
4703 spin_lock_irq(&phba->hbalock); in lpfc_param_show()
4704 phba->hba_flag |= HBA_AER_ENABLED; in lpfc_param_show()
4705 spin_unlock_irq(&phba->hbalock); in lpfc_param_show()
4706 phba->cfg_aer_support = 1; in lpfc_param_show()
4709 rc = -EPERM; in lpfc_param_show()
4711 phba->cfg_aer_support = 1; in lpfc_param_show()
4716 rc = -EINVAL; in lpfc_param_show()
4725 * lpfc_aer_cleanup_state - Clean up aer state to the aer enabled device
4740 * -EINVAL if the buf does not contain the 1 or the device is not currently
4748 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_aer_cleanup_state()
4749 struct lpfc_hba *phba = vport->phba; in lpfc_aer_cleanup_state()
4750 int val, rc = -1; in lpfc_aer_cleanup_state()
4753 return -EINVAL; in lpfc_aer_cleanup_state()
4755 return -EINVAL; in lpfc_aer_cleanup_state()
4757 return -EINVAL; in lpfc_aer_cleanup_state()
4759 if (phba->hba_flag & HBA_AER_ENABLED) in lpfc_aer_cleanup_state()
4760 rc = pci_aer_clear_nonfatal_status(phba->pcidev); in lpfc_aer_cleanup_state()
4765 return -EPERM; in lpfc_aer_cleanup_state()
4772 * lpfc_sriov_nr_virtfn_store - Enable the adapter for sr-iov virtual functions
4781 * try to enable or disable SR-IOV virtual functions according to the
4791 * cfg_sriov_nr_virtfn; otherwise, -EINVAL shall be returned and driver
4794 * If none-zero virtual functions have already been enabled to the
4796 * -EINVAL will be returned and the driver does nothing;
4798 * If the nr_vfn provided is zero and none-zero virtual functions have
4808 * -EINVAL if val out of range or intended mode is not supported.
4815 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sriov_nr_virtfn_store()
4816 struct lpfc_hba *phba = vport->phba; in lpfc_sriov_nr_virtfn_store()
4817 struct pci_dev *pdev = phba->pcidev; in lpfc_sriov_nr_virtfn_store()
4818 int val = 0, rc = -EINVAL; in lpfc_sriov_nr_virtfn_store()
4822 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4824 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4826 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4830 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4832 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4838 if (phba->cfg_sriov_nr_virtfn > 0) { in lpfc_sriov_nr_virtfn_store()
4842 phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4843 return -EEXIST; in lpfc_sriov_nr_virtfn_store()
4847 phba->cfg_sriov_nr_virtfn = val; in lpfc_sriov_nr_virtfn_store()
4852 return -EINVAL; in lpfc_sriov_nr_virtfn_store()
4855 rc = lpfc_sli_probe_sriov_nr_virtfn(phba, phba->cfg_sriov_nr_virtfn); in lpfc_sriov_nr_virtfn_store()
4857 phba->cfg_sriov_nr_virtfn = 0; in lpfc_sriov_nr_virtfn_store()
4858 rc = -EPERM; in lpfc_sriov_nr_virtfn_store()
4866 "Enable PCIe device SR-IOV virtual fn");
4872 * lpfc_request_firmware_store - Request for Linux generic firmware upgrade
4884 * -EINVAL if val out of range or intended mode is not supported.
4892 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_request_firmware_upgrade_store()
4893 struct lpfc_hba *phba = vport->phba; in lpfc_request_firmware_upgrade_store()
4898 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4900 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4902 return -EINVAL; in lpfc_request_firmware_upgrade_store()
4906 rc = -EPERM; in lpfc_request_firmware_upgrade_store()
4918 * lpfc_request_firmware_upgrade_init - Enable initial linux generic fw upgrade in lpfc_param_show()
4927 * -EINVAL val out of range in lpfc_param_show()
4933 phba->cfg_request_firmware_upgrade = val; in lpfc_param_show()
4936 return -EINVAL; in lpfc_param_show()
4956 * 0 - on success
4957 * -EIO - if command is not sent
4964 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_force_rscn_store()
4969 return -EIO; in lpfc_force_rscn_store()
4986 * lpfc_force_rscn_init - Force an RSCN to be sent to all remote NPorts in lpfc_param_show()
5005 * @buf: string with the number of fast-path FCP interrupts per second.
5010 * maximum number of fast-path FCP interrupts per second.
5015 * -EINVAL if val out of range or intended mode is not supported.
5022 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_imax_store()
5023 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_imax_store()
5029 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_fcp_imax_store()
5030 return -EINVAL; in lpfc_fcp_imax_store()
5034 return -EINVAL; in lpfc_fcp_imax_store()
5036 return -EINVAL; in lpfc_fcp_imax_store()
5044 return -EINVAL; in lpfc_fcp_imax_store()
5046 phba->cfg_auto_imax = (val) ? 0 : 1; in lpfc_fcp_imax_store()
5047 if (phba->cfg_fcp_imax && !val) { in lpfc_fcp_imax_store()
5048 queue_delayed_work(phba->wq, &phba->eq_delay_work, in lpfc_fcp_imax_store()
5052 eqi = per_cpu_ptr(phba->sli4_hba.eq_info, i); in lpfc_fcp_imax_store()
5053 eqi->icnt = 0; in lpfc_fcp_imax_store()
5057 phba->cfg_fcp_imax = (uint32_t)val; in lpfc_fcp_imax_store()
5059 if (phba->cfg_fcp_imax) in lpfc_fcp_imax_store()
5060 usdelay = LPFC_SEC_TO_USEC / phba->cfg_fcp_imax; in lpfc_fcp_imax_store()
5064 for (i = 0; i < phba->cfg_irq_chann; i += LPFC_MAX_EQ_DELAY_EQID_CNT) in lpfc_fcp_imax_store()
5072 # lpfc_fcp_imax: The maximum number of fast-path FCP interrupts per second
5084 * lpfc_fcp_imax_init - Set the initial sr-iov virtual function enable in lpfc_param_show()
5090 * maximum number of fast-path FCP interrupts per second. in lpfc_param_show()
5094 * -EINVAL val out of range in lpfc_param_show()
5099 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_param_show()
5100 phba->cfg_fcp_imax = 0; in lpfc_param_show()
5106 phba->cfg_fcp_imax = val; in lpfc_param_show()
5113 phba->cfg_fcp_imax = LPFC_DEF_IMAX; in lpfc_param_show()
5133 * -ERANGE: if val is not in the valid range
5134 * -EINVAL: if bad value format or intended mode is not supported.
5141 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_cq_max_proc_limit_store()
5142 struct lpfc_hba *phba = vport->phba; in lpfc_cq_max_proc_limit_store()
5148 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_store()
5149 return -EINVAL; in lpfc_cq_max_proc_limit_store()
5153 return -EINVAL; in lpfc_cq_max_proc_limit_store()
5155 return -EINVAL; in lpfc_cq_max_proc_limit_store()
5158 return -ERANGE; in lpfc_cq_max_proc_limit_store()
5160 phba->cfg_cq_max_proc_limit = (uint32_t)val; in lpfc_cq_max_proc_limit_store()
5163 for (i = 0; i < phba->cfg_irq_chann; i++) { in lpfc_cq_max_proc_limit_store()
5165 eq = phba->sli4_hba.hba_eq_hdl[i].eq; in lpfc_cq_max_proc_limit_store()
5169 list_for_each_entry(cq, &eq->child_list, list) in lpfc_cq_max_proc_limit_store()
5170 cq->max_proc_limit = min(phba->cfg_cq_max_proc_limit, in lpfc_cq_max_proc_limit_store()
5171 cq->entry_count); in lpfc_cq_max_proc_limit_store()
5191 * than re-enabling interrupts.
5199 * lpfc_cq_max_proc_limit_init - Set the initial cq max_proc_limit
5215 phba->cfg_cq_max_proc_limit = LPFC_CQ_DEF_MAX_PROC_LIMIT; in lpfc_cq_max_proc_limit_init()
5217 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_cq_max_proc_limit_init()
5221 phba->cfg_cq_max_proc_limit = val; in lpfc_cq_max_proc_limit_init()
5228 phba->cfg_cq_max_proc_limit); in lpfc_cq_max_proc_limit_init()
5236 * lpfc_state_show - Display current driver CPU affinity
5248 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_fcp_cpu_map_show()
5249 struct lpfc_hba *phba = vport->phba; in lpfc_fcp_cpu_map_show()
5253 if ((phba->sli_rev != LPFC_SLI_REV4) || in lpfc_fcp_cpu_map_show()
5254 (phba->intr_type != MSIX)) in lpfc_fcp_cpu_map_show()
5257 switch (phba->cfg_fcp_cpu_map) { in lpfc_fcp_cpu_map_show()
5259 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
5261 phba->cfg_fcp_cpu_map); in lpfc_fcp_cpu_map_show()
5264 len += scnprintf(buf + len, PAGE_SIZE-len, in lpfc_fcp_cpu_map_show()
5265 "fcp_cpu_map: HBA centric mapping (%d): " in lpfc_fcp_cpu_map_show()
5267 phba->cfg_fcp_cpu_map, num_online_cpus(), in lpfc_fcp_cpu_map_show()
5269 phba->sli4_hba.num_possible_cpu); in lpfc_fcp_cpu_map_show()
5273 while (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
5274 phba->sli4_hba.num_possible_cpu) { in lpfc_fcp_cpu_map_show()
5275 cpup = &phba->sli4_hba.cpu_map[phba->sli4_hba.curr_disp_cpu]; in lpfc_fcp_cpu_map_show()
5277 if (!cpu_present(phba->sli4_hba.curr_disp_cpu)) in lpfc_fcp_cpu_map_show()
5278 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5279 "CPU %02d not present\n", in lpfc_fcp_cpu_map_show()
5280 phba->sli4_hba.curr_disp_cpu); in lpfc_fcp_cpu_map_show()
5281 else if (cpup->eq == LPFC_VECTOR_MAP_EMPTY) { in lpfc_fcp_cpu_map_show()
5282 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
5284 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5285 "CPU %02d hdwq None " in lpfc_fcp_cpu_map_show()
5287 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5288 cpup->phys_id, cpup->core_id, in lpfc_fcp_cpu_map_show()
5289 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5290 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
5293 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5294 "CPU %02d EQ None hdwq %04d " in lpfc_fcp_cpu_map_show()
5296 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5297 cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
5298 cpup->core_id, in lpfc_fcp_cpu_map_show()
5299 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5300 (cpup->flag & LPFC_CPU_MAP_UNASSIGN)); in lpfc_fcp_cpu_map_show()
5302 if (cpup->hdwq == LPFC_VECTOR_MAP_EMPTY) in lpfc_fcp_cpu_map_show()
5304 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5305 "CPU %02d hdwq None " in lpfc_fcp_cpu_map_show()
5307 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5308 cpup->phys_id, in lpfc_fcp_cpu_map_show()
5309 cpup->core_id, in lpfc_fcp_cpu_map_show()
5310 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5311 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
5312 lpfc_get_irq(cpup->eq)); in lpfc_fcp_cpu_map_show()
5315 buf + len, PAGE_SIZE - len, in lpfc_fcp_cpu_map_show()
5316 "CPU %02d EQ %04d hdwq %04d " in lpfc_fcp_cpu_map_show()
5318 phba->sli4_hba.curr_disp_cpu, in lpfc_fcp_cpu_map_show()
5319 cpup->eq, cpup->hdwq, cpup->phys_id, in lpfc_fcp_cpu_map_show()
5320 cpup->core_id, in lpfc_fcp_cpu_map_show()
5321 (cpup->flag & LPFC_CPU_MAP_HYPER), in lpfc_fcp_cpu_map_show()
5322 (cpup->flag & LPFC_CPU_MAP_UNASSIGN), in lpfc_fcp_cpu_map_show()
5323 lpfc_get_irq(cpup->eq)); in lpfc_fcp_cpu_map_show()
5326 phba->sli4_hba.curr_disp_cpu++; in lpfc_fcp_cpu_map_show()
5329 if (phba->sli4_hba.curr_disp_cpu < in lpfc_fcp_cpu_map_show()
5330 phba->sli4_hba.num_possible_cpu && in lpfc_fcp_cpu_map_show()
5331 (len >= (PAGE_SIZE - 64))) { in lpfc_fcp_cpu_map_show()
5333 PAGE_SIZE - len, "more...\n"); in lpfc_fcp_cpu_map_show()
5338 if (phba->sli4_hba.curr_disp_cpu == phba->sli4_hba.num_possible_cpu) in lpfc_fcp_cpu_map_show()
5339 phba->sli4_hba.curr_disp_cpu = 0; in lpfc_fcp_cpu_map_show()
5345 * lpfc_fcp_cpu_map_store - Change CPU affinity of driver vectors
5352 * -EINVAL - Not implemented yet.
5358 return -EINVAL; in lpfc_fcp_cpu_map_store()
5366 # 0 - Do not affinitze IRQ vectors
5367 # 1 - Affintize HBA vectors with respect to each HBA
5377 * lpfc_fcp_cpu_map_init - Set the initial sr-iov virtual function enable
5382 * If val is in a valid range [0-2], then affinitze the adapter's
5387 * -EINVAL val out of range
5392 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_fcp_cpu_map_init()
5393 phba->cfg_fcp_cpu_map = 0; in lpfc_fcp_cpu_map_init()
5398 phba->cfg_fcp_cpu_map = val; in lpfc_fcp_cpu_map_init()
5405 phba->cfg_fcp_cpu_map = LPFC_HBA_CPU_MAP; in lpfc_fcp_cpu_map_init()
5440 * Parameter supported on physical port only - no NPIV support.
5461 # the parameter is set to a non-zero value, the I/O queue depth is controlled
5475 if (val == vport->cfg_max_scsicmpl_time) in lpfc_max_scsicmpl_time_set()
5478 return -EINVAL; in lpfc_max_scsicmpl_time_set()
5479 vport->cfg_max_scsicmpl_time = val; in lpfc_max_scsicmpl_time_set()
5481 spin_lock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5482 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_max_scsicmpl_time_set()
5485 if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) in lpfc_max_scsicmpl_time_set()
5487 ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; in lpfc_max_scsicmpl_time_set()
5489 spin_unlock_irq(shost->host_lock); in lpfc_max_scsicmpl_time_set()
5513 * current CPU.
5518 * The driver dynamically sets this to 1 (BY_CPU) if it's able to set up cpu
5520 * CPU. Otherwise, the default 0 (Round Robin) scheduling of FCP/NVME I/Os
5527 "issuing commands [0] - Hardware Queue, [1] - Current CPU");
5539 "[0] - GID_FT, [1] - GID_PT");
5545 # For [1], bus reset issues target reset to non-FCP2 devices
5548 "FCP2 devices [0] - issue tgt reset, [1] - no tgt reset");
5601 # Traditional FDMI support means the driver will assume FDMI-2 support;
5602 # however, if that fails, it will fallback to FDMI-1.
5626 # there are FC targets, such as JBODs, that only recognize 8-bits of
5659 # 2 = MSI-X enabled (default)
5663 "MSI-X (2), if possible");
5722 * lpfc_cpumask_irq_mode_init - initalizes cpumask of phba based on
5729 unsigned int cpu, first_cpu, numa_node = NUMA_NO_NODE; in lpfc_cpumask_irq_mode_init() local
5731 struct cpumask *aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_cpumask_irq_mode_init()
5735 if (phba->irq_chann_mode == NUMA_MODE) { in lpfc_cpumask_irq_mode_init()
5737 numa_node = dev_to_node(&phba->pcidev->dev); in lpfc_cpumask_irq_mode_init()
5739 phba->irq_chann_mode = NORMAL_MODE; in lpfc_cpumask_irq_mode_init()
5744 for_each_possible_cpu(cpu) { in lpfc_cpumask_irq_mode_init()
5745 switch (phba->irq_chann_mode) { in lpfc_cpumask_irq_mode_init()
5747 if (cpu_to_node(cpu) == numa_node) in lpfc_cpumask_irq_mode_init()
5748 cpumask_set_cpu(cpu, aff_mask); in lpfc_cpumask_irq_mode_init()
5751 sibling_mask = topology_sibling_cpumask(cpu); in lpfc_cpumask_irq_mode_init()
5770 phba->irq_chann_mode = NUMA_MODE; in lpfc_assign_default_irq_chann()
5774 phba->irq_chann_mode = NHT_MODE; in lpfc_assign_default_irq_chann()
5777 phba->irq_chann_mode = NORMAL_MODE; in lpfc_assign_default_irq_chann()
5782 phba->irq_chann_mode = NORMAL_MODE; in lpfc_assign_default_irq_chann()
5789 * of EQ / MSI-X vectors the driver will create. This should never be
5804 /* lpfc_irq_chann_init - Set the hba irq_chann initial value
5815 * -EINVAL if value was out of range
5822 if (phba->cfg_use_msi != 2) { in lpfc_irq_chann_init()
5825 phba->cfg_use_msi); 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()
5835 if (phba->irq_chann_mode != NORMAL_MODE) { in lpfc_irq_chann_init()
5836 aff_mask = &phba->sli4_hba.irq_aff_mask; in lpfc_irq_chann_init()
5842 phba->irq_chann_mode); in lpfc_irq_chann_init()
5843 phba->irq_chann_mode = NORMAL_MODE; in lpfc_irq_chann_init()
5844 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5846 phba->cfg_irq_chann = cpumask_weight(aff_mask); in lpfc_irq_chann_init()
5851 if (phba->irq_chann_mode == NHT_MODE) in lpfc_irq_chann_init()
5852 phba->cfg_hdw_queue = phba->cfg_irq_chann; in lpfc_irq_chann_init()
5856 "(mode: %d)\n", phba->cfg_irq_chann, in lpfc_irq_chann_init()
5857 phba->irq_chann_mode); in lpfc_irq_chann_init()
5868 phba->cfg_irq_chann = LPFC_IRQ_CHANN_DEF; in lpfc_irq_chann_init()
5869 return -EINVAL; in lpfc_irq_chann_init()
5871 phba->cfg_irq_chann = val; in lpfc_irq_chann_init()
5878 * lpfc_irq_chann_show - Display value of irq_chann
5890 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_irq_chann_show()
5891 struct lpfc_hba *phba = vport->phba; in lpfc_irq_chann_show()
5893 return scnprintf(buf, PAGE_SIZE, "%u\n", phba->cfg_irq_chann); in lpfc_irq_chann_show()
5925 # 0x0 - 0x7f = CS_CTL field in FC header (high 7 bits)
5931 # lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF)
5940 # - Bit mask of host protection capabilities used to register with the
5941 # SCSI mid-layer
5942 # - Only meaningful if BG is turned on (lpfc_enable_bg=1).
5943 # - Allows you to ultimately specify which profiles to use
5944 # - Default will result in registering capabilities for all profiles.
5945 # - SHOST_DIF_TYPE1_PROTECTION 1
5947 # - SHOST_DIX_TYPE0_PROTECTION 8
5949 # - SHOST_DIX_TYPE1_PROTECTION 16
5961 "T10-DIF host protection capabilities mask");
5965 # - Bit mask of protection guard types to register with the SCSI mid-layer
5966 # - Guard types are currently either 1) T10-DIF CRC 2) IP checksum
5967 # - Allows you to ultimately specify which profiles to use
5968 # - Default will result in registering capabilities for all guard types
5973 "T10-DIF host protection guard type");
5981 * When this parameter is set to non-zero value, initial Nport discovery is
5993 * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
5997 * Because of the additional overhead involved in setting up T10-DIF,
6006 * lpfc_sg_seg_cnt_show - Display the scatter/gather list sizes
6019 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_sg_seg_cnt_show()
6020 struct lpfc_hba *phba = vport->phba; in lpfc_sg_seg_cnt_show()
6024 phba->cfg_sg_dma_buf_size, phba->cfg_total_seg_cnt); in lpfc_sg_seg_cnt_show()
6026 len += scnprintf(buf + len, PAGE_SIZE - len, in lpfc_sg_seg_cnt_show()
6028 phba->cfg_sg_seg_cnt, phba->cfg_scsi_seg_cnt, in lpfc_sg_seg_cnt_show()
6029 phba->cfg_nvme_seg_cnt); in lpfc_sg_seg_cnt_show()
6036 * lpfc_sg_seg_cnt_init - Set the hba sg_seg_cnt initial value
6047 * -EINVAL if value was out of range
6053 phba->cfg_sg_seg_cnt = val; in lpfc_sg_seg_cnt_init()
6060 phba->cfg_sg_seg_cnt = LPFC_DEFAULT_SG_SEG_CNT; in lpfc_sg_seg_cnt_init()
6061 return -EINVAL; in lpfc_sg_seg_cnt_init()
6075 * [1-4] = Multiple of 1/4th Mb of host memory for FW logging
6088 return -EINVAL; in lpfc_ras_fwlog_buffsize_set()
6090 if (phba->cfg_ras_fwlog_buffsize == val) in lpfc_ras_fwlog_buffsize_set()
6093 if (phba->cfg_ras_fwlog_func != PCI_FUNC(phba->pcidev->devfn)) in lpfc_ras_fwlog_buffsize_set()
6094 return -EINVAL; in lpfc_ras_fwlog_buffsize_set()
6096 spin_lock_irq(&phba->hbalock); in lpfc_ras_fwlog_buffsize_set()
6097 state = phba->ras_fwlog.state; in lpfc_ras_fwlog_buffsize_set()
6098 spin_unlock_irq(&phba->hbalock); in lpfc_ras_fwlog_buffsize_set()
6103 return -EBUSY; in lpfc_ras_fwlog_buffsize_set()
6110 phba->cfg_ras_fwlog_buffsize = val; in lpfc_ras_fwlog_buffsize_set()
6117 if (phba->ras_fwlog.ras_enabled) in lpfc_ras_fwlog_buffsize_set()
6118 ret = lpfc_sli4_ras_fwlog_init(phba, phba->cfg_ras_fwlog_level, in lpfc_ras_fwlog_buffsize_set()
6306 * sysfs_ctlreg_write - Write method for writing to ctlreg
6319 * -ERANGE off and count combo out of range
6320 * -EINVAL off, count or buff address invalid
6321 * -EPERM adapter is offline
6332 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_write()
6333 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_write()
6335 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_write()
6336 return -EPERM; in sysfs_ctlreg_write()
6339 return -ERANGE; in sysfs_ctlreg_write()
6345 return -EINVAL; in sysfs_ctlreg_write()
6349 return -EINVAL; in sysfs_ctlreg_write()
6351 if (!(vport->fc_flag & FC_OFFLINE_MODE)) in sysfs_ctlreg_write()
6352 return -EPERM; in sysfs_ctlreg_write()
6354 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6355 for (buf_off = 0; buf_off < count - LPFC_REG_WRITE_KEY_SIZE; in sysfs_ctlreg_write()
6358 phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_write()
6360 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_write()
6366 * sysfs_ctlreg_read - Read method for reading from ctlreg
6379 * -ERANGE off and count combo out of range
6380 * -EINVAL off, count or buff address invalid
6392 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in sysfs_ctlreg_read()
6393 struct lpfc_hba *phba = vport->phba; in sysfs_ctlreg_read()
6395 if (phba->sli_rev >= LPFC_SLI_REV4) in sysfs_ctlreg_read()
6396 return -EPERM; in sysfs_ctlreg_read()
6399 return -ERANGE; in sysfs_ctlreg_read()
6402 count = FF_REG_AREA_SIZE - off; in sysfs_ctlreg_read()
6407 return -EINVAL; in sysfs_ctlreg_read()
6409 spin_lock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6413 *tmp_ptr = readl(phba->ctrl_regs_memmap_p + off + buf_off); in sysfs_ctlreg_read()
6416 spin_unlock_irq(&phba->hbalock); in sysfs_ctlreg_read()
6432 * sysfs_mbox_write - Write method for writing information via mbox
6445 * -EPERM operation not permitted
6452 return -EPERM; in sysfs_mbox_write()
6456 * sysfs_mbox_read - Read method for reading information via mbox
6469 * -EPERM operation not permitted
6476 return -EPERM; in sysfs_mbox_read()
6490 * lpfc_alloc_sysfs_attr - Creates the ctlreg and mbox entries
6503 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6507 if (error || vport->port_type == LPFC_NPIV_PORT) in lpfc_alloc_sysfs_attr()
6510 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6515 error = sysfs_create_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6522 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_alloc_sysfs_attr()
6524 sysfs_remove_bin_file(&shost->shost_dev.kobj, in lpfc_alloc_sysfs_attr()
6531 * lpfc_free_sysfs_attr - Removes the ctlreg and mbox entries
6538 sysfs_remove_bin_file(&shost->shost_dev.kobj, in lpfc_free_sysfs_attr()
6541 if (vport->port_type == LPFC_NPIV_PORT) in lpfc_free_sysfs_attr()
6543 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr); in lpfc_free_sysfs_attr()
6544 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); in lpfc_free_sysfs_attr()
6552 * lpfc_get_host_symbolic_name - Copy symbolic name into the scsi host
6558 struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata; in lpfc_get_host_symbolic_name()
6565 * lpfc_get_host_port_id - Copy the vport DID into the scsi host port id
6571 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_id()
6573 /* note: fc_myDID already in cpu endianness */ in lpfc_get_host_port_id()
6574 fc_host_port_id(shost) = vport->fc_myDID; in lpfc_get_host_port_id()
6578 * lpfc_get_host_port_type - Set the value of the scsi host port type
6584 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_type()
6585 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_type()
6587 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_type()
6589 if (vport->port_type == LPFC_NPIV_PORT) { in lpfc_get_host_port_type()
6592 if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_host_port_type()
6593 if (vport->fc_flag & FC_PUBLIC_LOOP) in lpfc_get_host_port_type()
6598 if (vport->fc_flag & FC_FABRIC) in lpfc_get_host_port_type()
6606 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_type()
6610 * lpfc_get_host_port_state - Set the value of the scsi host port state
6616 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_port_state()
6617 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_port_state()
6619 spin_lock_irq(shost->host_lock); in lpfc_get_host_port_state()
6621 if (vport->fc_flag & FC_OFFLINE_MODE) in lpfc_get_host_port_state()
6624 switch (phba->link_state) { in lpfc_get_host_port_state()
6633 if (vport->port_state < LPFC_VPORT_READY) in lpfc_get_host_port_state()
6649 spin_unlock_irq(shost->host_lock); in lpfc_get_host_port_state()
6653 * lpfc_get_host_speed - Set the value of the scsi host speed
6659 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_speed()
6660 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_speed()
6662 spin_lock_irq(shost->host_lock); in lpfc_get_host_speed()
6664 if ((lpfc_is_link_up(phba)) && (!(phba->hba_flag & HBA_FCOE_MODE))) { in lpfc_get_host_speed()
6665 switch(phba->fc_linkspeed) { in lpfc_get_host_speed()
6697 } else if (lpfc_is_link_up(phba) && (phba->hba_flag & HBA_FCOE_MODE)) { in lpfc_get_host_speed()
6698 switch (phba->fc_linkspeed) { in lpfc_get_host_speed()
6724 spin_unlock_irq(shost->host_lock); in lpfc_get_host_speed()
6728 * lpfc_get_host_fabric_name - Set the value of the scsi host fabric name
6734 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_host_fabric_name()
6735 struct lpfc_hba *phba = vport->phba; in lpfc_get_host_fabric_name()
6738 spin_lock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
6740 if ((vport->port_state > LPFC_FLOGI) && in lpfc_get_host_fabric_name()
6741 ((vport->fc_flag & FC_FABRIC) || in lpfc_get_host_fabric_name()
6742 ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) && in lpfc_get_host_fabric_name()
6743 (vport->fc_flag & FC_PUBLIC_LOOP)))) in lpfc_get_host_fabric_name()
6744 node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); in lpfc_get_host_fabric_name()
6749 spin_unlock_irq(shost->host_lock); in lpfc_get_host_fabric_name()
6755 * lpfc_get_stats - Return statistical information about the adapter
6769 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_stats()
6770 struct lpfc_hba *phba = vport->phba; in lpfc_get_stats()
6771 struct lpfc_sli *psli = &phba->sli; in lpfc_get_stats()
6772 struct fc_host_statistics *hs = &phba->link_stats; in lpfc_get_stats()
6773 struct lpfc_lnk_stat * lso = &psli->lnk_stat_offsets; in lpfc_get_stats()
6782 if (phba->link_state < LPFC_LINK_DOWN || in lpfc_get_stats()
6783 !phba->mbox_mem_pool || in lpfc_get_stats()
6784 (phba->sli.sli_flag & LPFC_SLI_ACTIVE) == 0) in lpfc_get_stats()
6787 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_get_stats()
6790 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_get_stats()
6795 pmb = &pmboxq->u.mb; in lpfc_get_stats()
6796 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_get_stats()
6797 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6798 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6799 pmboxq->vport = vport; in lpfc_get_stats()
6801 if (vport->fc_flag & FC_OFFLINE_MODE) { in lpfc_get_stats()
6804 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6808 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6811 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6818 hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt; in lpfc_get_stats()
6823 hs->tx_words = (uint64_t) in lpfc_get_stats()
6824 ((uint64_t)pmb->un.varRdStatus.xmitByteCnt in lpfc_get_stats()
6826 hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt; in lpfc_get_stats()
6827 hs->rx_words = (uint64_t) in lpfc_get_stats()
6828 ((uint64_t)pmb->un.varRdStatus.rcvByteCnt in lpfc_get_stats()
6832 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_get_stats()
6833 pmb->mbxOwner = OWN_HOST; in lpfc_get_stats()
6834 pmboxq->ctx_buf = NULL; in lpfc_get_stats()
6835 pmboxq->vport = vport; in lpfc_get_stats()
6837 if (vport->fc_flag & FC_OFFLINE_MODE) { in lpfc_get_stats()
6840 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6844 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_get_stats()
6847 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6852 hs->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_get_stats()
6853 hs->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_get_stats()
6854 hs->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_get_stats()
6855 hs->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_get_stats()
6856 hs->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_get_stats()
6857 hs->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6858 hs->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_get_stats()
6860 hs->link_failure_count -= lso->link_failure_count; in lpfc_get_stats()
6861 hs->loss_of_sync_count -= lso->loss_of_sync_count; in lpfc_get_stats()
6862 hs->loss_of_signal_count -= lso->loss_of_signal_count; in lpfc_get_stats()
6863 hs->prim_seq_protocol_err_count -= lso->prim_seq_protocol_err_count; in lpfc_get_stats()
6864 hs->invalid_tx_word_count -= lso->invalid_tx_word_count; in lpfc_get_stats()
6865 hs->invalid_crc_count -= lso->invalid_crc_count; in lpfc_get_stats()
6866 hs->error_frames -= lso->error_frames; in lpfc_get_stats()
6868 if (phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_stats()
6869 hs->lip_count = -1; in lpfc_get_stats()
6870 hs->nos_count = (phba->link_events >> 1); in lpfc_get_stats()
6871 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6872 } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { in lpfc_get_stats()
6873 hs->lip_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6874 hs->lip_count -= lso->link_events; in lpfc_get_stats()
6875 hs->nos_count = -1; in lpfc_get_stats()
6877 hs->lip_count = -1; in lpfc_get_stats()
6878 hs->nos_count = (phba->fc_eventTag >> 1); in lpfc_get_stats()
6879 hs->nos_count -= lso->link_events; in lpfc_get_stats()
6882 hs->dumped_frames = -1; in lpfc_get_stats()
6884 hs->seconds_since_last_reset = ktime_get_seconds() - psli->stats_start; in lpfc_get_stats()
6886 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_get_stats()
6892 * lpfc_reset_stats - Copy the adapter link stats information
6898 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_reset_stats()
6899 struct lpfc_hba *phba = vport->phba; in lpfc_reset_stats()
6900 struct lpfc_sli *psli = &phba->sli; in lpfc_reset_stats()
6901 struct lpfc_lnk_stat *lso = &psli->lnk_stat_offsets; in lpfc_reset_stats()
6906 if (phba->sli.sli_flag & LPFC_BLOCK_MGMT_IO) in lpfc_reset_stats()
6909 pmboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); in lpfc_reset_stats()
6914 pmb = &pmboxq->u.mb; in lpfc_reset_stats()
6915 pmb->mbxCommand = MBX_READ_STATUS; in lpfc_reset_stats()
6916 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6917 pmb->un.varWords[0] = 0x1; /* reset request */ in lpfc_reset_stats()
6918 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6919 pmboxq->vport = vport; in lpfc_reset_stats()
6921 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6922 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) { in lpfc_reset_stats()
6925 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6929 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6932 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6938 pmb->mbxCommand = MBX_READ_LNK_STAT; in lpfc_reset_stats()
6939 pmb->mbxOwner = OWN_HOST; in lpfc_reset_stats()
6940 pmboxq->ctx_buf = NULL; in lpfc_reset_stats()
6941 pmboxq->vport = vport; in lpfc_reset_stats()
6943 if ((vport->fc_flag & FC_OFFLINE_MODE) || in lpfc_reset_stats()
6944 (!(psli->sli_flag & LPFC_SLI_ACTIVE))) { in lpfc_reset_stats()
6947 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6951 rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); in lpfc_reset_stats()
6954 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6959 lso->link_failure_count = pmb->un.varRdLnk.linkFailureCnt; in lpfc_reset_stats()
6960 lso->loss_of_sync_count = pmb->un.varRdLnk.lossSyncCnt; in lpfc_reset_stats()
6961 lso->loss_of_signal_count = pmb->un.varRdLnk.lossSignalCnt; in lpfc_reset_stats()
6962 lso->prim_seq_protocol_err_count = pmb->un.varRdLnk.primSeqErrCnt; in lpfc_reset_stats()
6963 lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; in lpfc_reset_stats()
6964 lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6965 lso->error_frames = pmb->un.varRdLnk.crcCnt; in lpfc_reset_stats()
6966 if (phba->hba_flag & HBA_FCOE_MODE) in lpfc_reset_stats()
6967 lso->link_events = (phba->link_events >> 1); in lpfc_reset_stats()
6969 lso->link_events = (phba->fc_eventTag >> 1); in lpfc_reset_stats()
6971 psli->stats_start = ktime_get_seconds(); in lpfc_reset_stats()
6973 mempool_free(pmboxq, phba->mbox_mem_pool); in lpfc_reset_stats()
6984 * lpfc_get_node_by_target - Return the nodelist for a target
6994 struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); in lpfc_get_node_by_target()
6995 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; in lpfc_get_node_by_target()
6998 spin_lock_irq(shost->host_lock); in lpfc_get_node_by_target()
7000 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_get_node_by_target()
7002 ndlp->nlp_state == NLP_STE_MAPPED_NODE && in lpfc_get_node_by_target()
7003 starget->id == ndlp->nlp_sid) { in lpfc_get_node_by_target()
7004 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
7008 spin_unlock_irq(shost->host_lock); in lpfc_get_node_by_target()
7013 * lpfc_get_starget_port_id - Set the target port id to the ndlp DID or -1
7021 fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1; in lpfc_get_starget_port_id()
7025 * lpfc_get_starget_node_name - Set the target node name
7036 ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0; in lpfc_get_starget_node_name()
7040 * lpfc_get_starget_port_name - Set the target port name
7051 ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0; in lpfc_get_starget_port_name()
7055 * lpfc_set_rport_loss_tmo - Set the rport dev loss tmo
7066 struct lpfc_rport_data *rdata = rport->dd_data; in lpfc_set_rport_loss_tmo()
7067 struct lpfc_nodelist *ndlp = rdata->pnode; in lpfc_set_rport_loss_tmo()
7073 rport->dev_loss_tmo = timeout; in lpfc_set_rport_loss_tmo()
7075 rport->dev_loss_tmo = 1; in lpfc_set_rport_loss_tmo()
7078 dev_info(&rport->dev, "Cannot find remote node to " in lpfc_set_rport_loss_tmo()
7080 rport->port_id); in lpfc_set_rport_loss_tmo()
7087 if (nrport && nrport->remoteport) in lpfc_set_rport_loss_tmo()
7088 nvme_fc_set_remoteport_devloss(nrport->remoteport, in lpfc_set_rport_loss_tmo()
7089 rport->dev_loss_tmo); in lpfc_set_rport_loss_tmo()
7094 * lpfc_rport_show_function - Return rport target information
7112 struct lpfc_rport_data *rdata = rport->hostdata; \
7114 (rdata->target) ? cast rdata->target->field : 0); \
7122 * lpfc_set_vport_symbolic_name - Set the vport's symbolic name
7127 * has been changed. This function re-registers the symbolic name with the
7133 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data; in lpfc_set_vport_symbolic_name()
7135 if (vport->port_state == LPFC_VPORT_READY) in lpfc_set_vport_symbolic_name()
7140 * lpfc_hba_log_verbose_init - Set hba's log verbose level
7151 phba->cfg_log_verbose = verbose; in lpfc_hba_log_verbose_init()
7287 * lpfc_get_hba_function_mode - Used to determine the HBA function in FCoE
7295 switch (phba->pcidev->device) { in lpfc_get_hba_function_mode()
7304 phba->hba_flag |= HBA_FCOE_MODE; in lpfc_get_hba_function_mode()
7308 phba->hba_flag &= ~HBA_FCOE_MODE; in lpfc_get_hba_function_mode()
7313 * lpfc_get_cfgparam - Used during probe_one to init the adapter structure
7351 if (phba->sli_rev != LPFC_SLI_REV4) in lpfc_get_cfgparam()
7352 phba->cfg_EnableXLane = 0; in lpfc_get_cfgparam()
7355 memset(phba->cfg_oas_tgt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7356 memset(phba->cfg_oas_vpt_wwpn, 0, (8 * sizeof(uint8_t))); in lpfc_get_cfgparam()
7357 phba->cfg_oas_lun_state = 0; in lpfc_get_cfgparam()
7358 phba->cfg_oas_lun_status = 0; in lpfc_get_cfgparam()
7359 phba->cfg_oas_flags = 0; in lpfc_get_cfgparam()
7360 phba->cfg_oas_priority = 0; in lpfc_get_cfgparam()
7364 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_get_cfgparam()
7365 phba->cfg_poll = 0; in lpfc_get_cfgparam()
7367 phba->cfg_poll = lpfc_poll; in lpfc_get_cfgparam()
7373 if (phba->cfg_enable_bg && phba->hba_flag & HBA_FCOE_MODE) { in lpfc_get_cfgparam()
7377 phba->cfg_enable_bg = 0; in lpfc_get_cfgparam()
7378 } else if (phba->cfg_enable_bg) { in lpfc_get_cfgparam()
7379 phba->sli3_options |= LPFC_SLI3_BG_ENABLED; in lpfc_get_cfgparam()
7397 if (phba->sli_rev != LPFC_SLI_REV4) { in lpfc_get_cfgparam()
7399 phba->nvmet_support = 0; in lpfc_get_cfgparam()
7400 phba->cfg_nvmet_mrq = 0; in lpfc_get_cfgparam()
7401 phba->cfg_enable_fc4_type = LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7402 phba->cfg_enable_bbcr = 0; in lpfc_get_cfgparam()
7403 phba->cfg_xri_rebalancing = 0; in lpfc_get_cfgparam()
7406 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) in lpfc_get_cfgparam()
7407 phba->cfg_enable_fc4_type |= LPFC_ENABLE_FCP; in lpfc_get_cfgparam()
7410 phba->cfg_auto_imax = (phba->cfg_fcp_imax) ? 0 : 1; in lpfc_get_cfgparam()
7412 phba->cfg_enable_pbde = 0; in lpfc_get_cfgparam()
7415 if (phba->cfg_hdw_queue == 0) in lpfc_get_cfgparam()
7416 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7417 if (phba->cfg_irq_chann == 0) in lpfc_get_cfgparam()
7418 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_get_cfgparam()
7419 if (phba->cfg_irq_chann > phba->cfg_hdw_queue) in lpfc_get_cfgparam()
7420 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_get_cfgparam()
7422 phba->cfg_soft_wwnn = 0L; in lpfc_get_cfgparam()
7423 phba->cfg_soft_wwpn = 0L; in lpfc_get_cfgparam()
7441 * lpfc_nvme_mod_param_dep - Adjust module parameter value based on
7450 if (phba->cfg_hdw_queue > phba->sli4_hba.num_present_cpu) { in lpfc_nvme_mod_param_dep()
7451 phba->cfg_hdw_queue = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7454 if (phba->cfg_irq_chann > phba->sli4_hba.num_present_cpu) { in lpfc_nvme_mod_param_dep()
7455 phba->cfg_irq_chann = phba->sli4_hba.num_present_cpu; in lpfc_nvme_mod_param_dep()
7458 if (phba->cfg_irq_chann > phba->cfg_hdw_queue) { in lpfc_nvme_mod_param_dep()
7459 phba->cfg_irq_chann = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7464 "2006 Reducing Queues - CPU limitation: " in lpfc_nvme_mod_param_dep()
7466 phba->cfg_irq_chann, in lpfc_nvme_mod_param_dep()
7467 phba->cfg_hdw_queue); in lpfc_nvme_mod_param_dep()
7469 if (phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME && in lpfc_nvme_mod_param_dep()
7470 phba->nvmet_support) { in lpfc_nvme_mod_param_dep()
7471 phba->cfg_enable_fc4_type &= ~LPFC_ENABLE_FCP; in lpfc_nvme_mod_param_dep()
7476 phba->cfg_nvme_enable_fb, in lpfc_nvme_mod_param_dep()
7477 phba->cfg_nvmet_fb_size, in lpfc_nvme_mod_param_dep()
7480 if (phba->cfg_nvme_enable_fb == 0) in lpfc_nvme_mod_param_dep()
7481 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7483 if (phba->cfg_nvmet_fb_size > LPFC_NVMET_FB_SZ_MAX) in lpfc_nvme_mod_param_dep()
7484 phba->cfg_nvmet_fb_size = LPFC_NVMET_FB_SZ_MAX; in lpfc_nvme_mod_param_dep()
7487 if (!phba->cfg_nvmet_mrq) in lpfc_nvme_mod_param_dep()
7488 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7491 if (phba->cfg_nvmet_mrq > phba->cfg_hdw_queue) { in lpfc_nvme_mod_param_dep()
7492 phba->cfg_nvmet_mrq = phba->cfg_hdw_queue; in lpfc_nvme_mod_param_dep()
7495 phba->cfg_nvmet_mrq); in lpfc_nvme_mod_param_dep()
7497 if (phba->cfg_nvmet_mrq > LPFC_NVMET_MRQ_MAX) in lpfc_nvme_mod_param_dep()
7498 phba->cfg_nvmet_mrq = LPFC_NVMET_MRQ_MAX; in lpfc_nvme_mod_param_dep()
7502 phba->nvmet_support = 0; in lpfc_nvme_mod_param_dep()
7503 phba->cfg_nvmet_mrq = 0; in lpfc_nvme_mod_param_dep()
7504 phba->cfg_nvmet_fb_size = 0; in lpfc_nvme_mod_param_dep()
7509 * lpfc_get_vport_cfgparam - Used during port create, init the vport structure