Lines Matching +full:attr +full:- +full:cnt +full:- +full:name

4  * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term *
6 * Copyright (C) 2004-2016 Emulex. All rights reserved. *
16 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
24 * Fibre Channel SCSI LAN Device Driver CT support: FC Generic Services FC-GS
53 /* FDMI Port Speed definitions - FC-GS-7 */
121 ndlp = cmdiocb->ndlp; in lpfc_ct_unsol_cmpl()
125 mp = cmdiocb->rsp_dmabuf; in lpfc_ct_unsol_cmpl()
126 bmp = cmdiocb->bpl_dmabuf; in lpfc_ct_unsol_cmpl()
128 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_ct_unsol_cmpl()
130 cmdiocb->rsp_dmabuf = NULL; in lpfc_ct_unsol_cmpl()
134 lpfc_mbuf_free(phba, bmp->virt, bmp->phys); in lpfc_ct_unsol_cmpl()
136 cmdiocb->bpl_dmabuf = NULL; in lpfc_ct_unsol_cmpl()
143 * lpfc_ct_reject_event - Issue reject for unhandled CT MIB commands
144 * @ndlp: pointer to a node-list data structure.
157 struct lpfc_vport *vport = ndlp->vport; in lpfc_ct_reject_event()
158 struct lpfc_hba *phba = vport->phba; in lpfc_ct_reject_event()
174 mp->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &mp->phys); in lpfc_ct_reject_event()
175 if (!mp->virt) { in lpfc_ct_reject_event()
187 bmp->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &bmp->phys); in lpfc_ct_reject_event()
188 if (!bmp->virt) { in lpfc_ct_reject_event()
193 INIT_LIST_HEAD(&mp->list); in lpfc_ct_reject_event()
194 INIT_LIST_HEAD(&bmp->list); in lpfc_ct_reject_event()
196 bpl = (struct ulp_bde64 *)bmp->virt; in lpfc_ct_reject_event()
198 bpl->addrHigh = le32_to_cpu(putPaddrHigh(mp->phys)); in lpfc_ct_reject_event()
199 bpl->addrLow = le32_to_cpu(putPaddrLow(mp->phys)); in lpfc_ct_reject_event()
200 bpl->tus.f.bdeFlags = BUFF_TYPE_BDE_64; in lpfc_ct_reject_event()
201 bpl->tus.f.bdeSize = (LPFC_CT_PREAMBLE - 4); in lpfc_ct_reject_event()
202 bpl->tus.w = le32_to_cpu(bpl->tus.w); in lpfc_ct_reject_event()
204 ct_rsp = (struct lpfc_sli_ct_request *)mp->virt; in lpfc_ct_reject_event()
207 ct_rsp->RevisionId.bits.Revision = SLI_CT_REVISION; in lpfc_ct_reject_event()
208 ct_rsp->RevisionId.bits.InId = 0; in lpfc_ct_reject_event()
209 ct_rsp->FsType = ct_req->FsType; in lpfc_ct_reject_event()
210 ct_rsp->FsSubType = ct_req->FsSubType; in lpfc_ct_reject_event()
211 ct_rsp->CommandResponse.bits.Size = 0; in lpfc_ct_reject_event()
212 ct_rsp->CommandResponse.bits.CmdRsp = in lpfc_ct_reject_event()
214 ct_rsp->ReasonCode = SLI_CT_REQ_NOT_SUPPORTED; in lpfc_ct_reject_event()
215 ct_rsp->Explanation = SLI_CT_NO_ADDITIONAL_EXPL; in lpfc_ct_reject_event()
223 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_ct_reject_event()
225 phba->sli4_hba.rpi_ids[ndlp->nlp_rpi], in lpfc_ct_reject_event()
235 cmdiocbq->rsp_dmabuf = mp; in lpfc_ct_reject_event()
236 cmdiocbq->bpl_dmabuf = bmp; in lpfc_ct_reject_event()
237 cmdiocbq->cmd_cmpl = lpfc_ct_unsol_cmpl; in lpfc_ct_reject_event()
238 tmo = (3 * phba->fc_ratov); in lpfc_ct_reject_event()
240 cmdiocbq->retry = 0; in lpfc_ct_reject_event()
241 cmdiocbq->vport = vport; in lpfc_ct_reject_event()
242 cmdiocbq->drvrTimeout = tmo + LPFC_DRVR_TIMEOUT; in lpfc_ct_reject_event()
244 cmdiocbq->ndlp = lpfc_nlp_get(ndlp); in lpfc_ct_reject_event()
245 if (!cmdiocbq->ndlp) in lpfc_ct_reject_event()
259 lpfc_mbuf_free(phba, bmp->virt, bmp->phys); in lpfc_ct_reject_event()
263 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_ct_reject_event()
269 rc, vport->fc_flag); in lpfc_ct_reject_event()
273 * lpfc_ct_handle_mibreq - Process an unsolicited CT MIB request data buffer
286 struct lpfc_vport *vport = ctiocbq->vport; in lpfc_ct_handle_mibreq()
292 did = bf_get(els_rsp64_sid, &ctiocbq->wqe.xmit_els_rsp); in lpfc_ct_handle_mibreq()
301 if (test_bit(FC_UNLOADING, &vport->load_flag)) in lpfc_ct_handle_mibreq()
312 ct_req = (struct lpfc_sli_ct_request *)ctiocbq->cmd_dmabuf->virt; in lpfc_ct_handle_mibreq()
314 mi_cmd = be16_to_cpu(ct_req->CommandResponse.bits.CmdRsp); in lpfc_ct_handle_mibreq()
319 &ctiocbq->wqe.xmit_els_rsp.wqe_com), in lpfc_ct_handle_mibreq()
321 &ctiocbq->wqe.xmit_els_rsp.wqe_com)); in lpfc_ct_handle_mibreq()
325 * lpfc_ct_unsol_event - Process an unsolicited event from a ct sli ring
341 IOCB_t *icmd = &ctiocbq->iocb; in lpfc_ct_unsol_event()
349 struct lpfc_dmabuf *bdeBuf1 = ctiocbq->cmd_dmabuf; in lpfc_ct_unsol_event()
350 struct lpfc_dmabuf *bdeBuf2 = ctiocbq->bpl_dmabuf; in lpfc_ct_unsol_event()
354 ctiocbq->cmd_dmabuf = NULL; in lpfc_ct_unsol_event()
355 ctiocbq->rsp_dmabuf = NULL; in lpfc_ct_unsol_event()
356 ctiocbq->bpl_dmabuf = NULL; in lpfc_ct_unsol_event()
358 wcqe_cmpl = &ctiocbq->wcqe_cmpl; in lpfc_ct_unsol_event()
361 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_ct_unsol_event()
362 bde_count = wcqe_cmpl->word3; in lpfc_ct_unsol_event()
364 bde_count = icmd->ulpBdeCount; in lpfc_ct_unsol_event()
372 phba->fc_stat.NoRcvBuf++; in lpfc_ct_unsol_event()
373 if (!(phba->sli3_options & LPFC_SLI3_HBQ_ENABLED)) in lpfc_ct_unsol_event()
384 ctiocbq->cmd_dmabuf = bdeBuf1; in lpfc_ct_unsol_event()
386 ctiocbq->bpl_dmabuf = bdeBuf2; in lpfc_ct_unsol_event()
388 ct_req = (struct lpfc_sli_ct_request *)ctiocbq->cmd_dmabuf->virt; in lpfc_ct_unsol_event()
390 if (ct_req->FsType == SLI_CT_MANAGEMENT_SERVICE && in lpfc_ct_unsol_event()
391 ct_req->FsSubType == SLI_CT_MIB_Subtypes) { in lpfc_ct_unsol_event()
398 if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) { in lpfc_ct_unsol_event()
400 list_add_tail(&head, &ctiocbq->list); in lpfc_ct_unsol_event()
402 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_ct_unsol_event()
403 bde_count = iocb->wcqe_cmpl.word3; in lpfc_ct_unsol_event()
405 bde_count = iocb->iocb.ulpBdeCount; in lpfc_ct_unsol_event()
409 bdeBuf1 = iocb->cmd_dmabuf; in lpfc_ct_unsol_event()
410 iocb->cmd_dmabuf = NULL; in lpfc_ct_unsol_event()
411 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_ct_unsol_event()
412 size = iocb->wqe.gen_req.bde.tus.f.bdeSize; in lpfc_ct_unsol_event()
414 size = iocb->iocb.un.cont64[0].tus.f.bdeSize; in lpfc_ct_unsol_event()
418 bdeBuf2 = iocb->bpl_dmabuf; in lpfc_ct_unsol_event()
419 iocb->bpl_dmabuf = NULL; in lpfc_ct_unsol_event()
420 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_ct_unsol_event()
421 size = iocb->unsol_rcv_len; in lpfc_ct_unsol_event()
423 size = iocb->iocb.unsli3.rcvsli3.bde2.tus.f.bdeSize; in lpfc_ct_unsol_event()
432 list_add_tail(&head, &ctiocbq->list); in lpfc_ct_unsol_event()
434 icmd = &iocbq->iocb; in lpfc_ct_unsol_event()
435 if (icmd->ulpBdeCount == 0) in lpfc_ct_unsol_event()
437 for (i = 0; i < icmd->ulpBdeCount; i++) { in lpfc_ct_unsol_event()
438 dma_addr = getPaddr(icmd->un.cont64[i].addrHigh, in lpfc_ct_unsol_event()
439 icmd->un.cont64[i].addrLow); in lpfc_ct_unsol_event()
442 size = icmd->un.cont64[i].tus.f.bdeSize; in lpfc_ct_unsol_event()
453 * lpfc_ct_handle_unsol_abort - ct upper level protocol abort handler
478 list_for_each_entry_safe(mlast, next_mlast, &mlist->list, list) { in lpfc_free_ct_rsp()
479 list_del(&mlast->list); in lpfc_free_ct_rsp()
480 lpfc_mbuf_free(phba, mlast->virt, mlast->phys); in lpfc_free_ct_rsp()
483 lpfc_mbuf_free(phba, mlist->virt, mlist->phys); in lpfc_free_ct_rsp()
494 int cnt, i = 0; in lpfc_alloc_ct_rsp() local
497 cnt = size > FCELSSIZE ? FCELSSIZE: size; in lpfc_alloc_ct_rsp()
508 INIT_LIST_HEAD(&mp->list); in lpfc_alloc_ct_rsp()
512 mp->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &(mp->phys)); in lpfc_alloc_ct_rsp()
514 mp->virt = lpfc_mbuf_alloc(phba, 0, &(mp->phys)); in lpfc_alloc_ct_rsp()
516 if (!mp->virt) { in lpfc_alloc_ct_rsp()
527 list_add_tail(&mp->list, &mlist->list); in lpfc_alloc_ct_rsp()
529 bpl->tus.f.bdeFlags = BUFF_TYPE_BDE_64I; in lpfc_alloc_ct_rsp()
531 bpl->addrLow = le32_to_cpu(putPaddrLow(mp->phys) ); in lpfc_alloc_ct_rsp()
532 bpl->addrHigh = le32_to_cpu(putPaddrHigh(mp->phys) ); in lpfc_alloc_ct_rsp()
533 bpl->tus.f.bdeSize = (uint16_t) cnt; in lpfc_alloc_ct_rsp()
534 bpl->tus.w = le32_to_cpu(bpl->tus.w); in lpfc_alloc_ct_rsp()
538 size -= cnt; in lpfc_alloc_ct_rsp()
553 if (ctiocb->cmd_dmabuf) { in lpfc_ct_free_iocb()
554 buf_ptr = ctiocb->cmd_dmabuf; in lpfc_ct_free_iocb()
555 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_ct_free_iocb()
557 ctiocb->cmd_dmabuf = NULL; in lpfc_ct_free_iocb()
559 if (ctiocb->rsp_dmabuf) { in lpfc_ct_free_iocb()
560 lpfc_free_ct_rsp(phba, ctiocb->rsp_dmabuf); in lpfc_ct_free_iocb()
561 ctiocb->rsp_dmabuf = NULL; in lpfc_ct_free_iocb()
564 if (ctiocb->bpl_dmabuf) { in lpfc_ct_free_iocb()
565 buf_ptr = ctiocb->bpl_dmabuf; in lpfc_ct_free_iocb()
566 lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys); in lpfc_ct_free_iocb()
568 ctiocb->bpl_dmabuf = NULL; in lpfc_ct_free_iocb()
575 * lpfc_gen_req - Build and issue a GEN_REQUEST command to the SLI Layer
593 struct lpfc_hba *phba = vport->phba; in lpfc_gen_req()
605 geniocb->num_bdes = num_entry; in lpfc_gen_req()
607 geniocb->bpl_dmabuf = bmp; in lpfc_gen_req()
610 geniocb->cmd_dmabuf = inp; in lpfc_gen_req()
611 geniocb->rsp_dmabuf = outp; in lpfc_gen_req()
613 geniocb->event_tag = event_tag; in lpfc_gen_req()
617 tmo = (3 * phba->fc_ratov); in lpfc_gen_req()
620 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_gen_req()
621 ulp_context = phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]; in lpfc_gen_req()
623 ulp_context = ndlp->nlp_rpi; in lpfc_gen_req()
631 ndlp->nlp_DID, geniocb->iotag, in lpfc_gen_req()
632 vport->port_state); in lpfc_gen_req()
633 geniocb->cmd_cmpl = cmpl; in lpfc_gen_req()
634 geniocb->drvrTimeout = tmo + LPFC_DRVR_TIMEOUT; in lpfc_gen_req()
635 geniocb->vport = vport; in lpfc_gen_req()
636 geniocb->retry = retry; in lpfc_gen_req()
637 geniocb->ndlp = lpfc_nlp_get(ndlp); in lpfc_gen_req()
638 if (!geniocb->ndlp) in lpfc_gen_req()
654 * lpfc_ct_cmd - Build and issue a CT command
670 struct lpfc_hba *phba = vport->phba; in lpfc_ct_cmd()
671 struct ulp_bde64 *bpl = (struct ulp_bde64 *) bmp->virt; in lpfc_ct_cmd()
673 int cnt = 0, status; in lpfc_ct_cmd() local
674 __be16 cmdcode = ((struct lpfc_sli_ct_request *)inmp->virt)-> in lpfc_ct_cmd()
680 outmp = lpfc_alloc_ct_rsp(phba, cmdcode, bpl, rsp_size, &cnt); in lpfc_ct_cmd()
682 return -ENOMEM; in lpfc_ct_cmd()
688 cnt += 1; in lpfc_ct_cmd()
690 phba->fc_eventTag, cnt, 0, retry); in lpfc_ct_cmd()
693 return -ENOMEM; in lpfc_ct_cmd()
703 spin_lock_irqsave(&phba->port_list_lock, flags); in lpfc_find_vport_by_did()
704 list_for_each_entry(vport_curr, &phba->port_list, listentry) { in lpfc_find_vport_by_did()
705 if ((vport_curr->fc_myDID) && (vport_curr->fc_myDID == did)) { in lpfc_find_vport_by_did()
706 spin_unlock_irqrestore(&phba->port_list_lock, flags); in lpfc_find_vport_by_did()
710 spin_unlock_irqrestore(&phba->port_list_lock, flags); in lpfc_find_vport_by_did()
719 if ((vport->port_type != LPFC_NPIV_PORT) || in lpfc_prep_node_fc4type()
720 !(vport->ct_flags & FC_CT_RFF_ID) || !vport->cfg_restrict_login) { in lpfc_prep_node_fc4type()
727 Did, ndlp->nlp_flag, vport->fc_flag); in lpfc_prep_node_fc4type()
731 ndlp->nlp_fc4_type |= NLP_FC4_FCP; in lpfc_prep_node_fc4type()
734 ndlp->nlp_fc4_type |= NLP_FC4_NVME; in lpfc_prep_node_fc4type()
739 ndlp->nlp_flag, ndlp->nlp_fc4_type, in lpfc_prep_node_fc4type()
740 ndlp->nlp_state, vport->fc_flag, in lpfc_prep_node_fc4type()
741 vport->fc_rscn_id_cnt); in lpfc_prep_node_fc4type()
747 if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag) && in lpfc_prep_node_fc4type()
748 ndlp->nlp_state == NLP_STE_UNUSED_NODE) { in lpfc_prep_node_fc4type()
754 "Skip1 GID_FTrsp: did:x%x flg:x%lx cnt:%d", in lpfc_prep_node_fc4type()
755 Did, vport->fc_flag, vport->fc_rscn_id_cnt); in lpfc_prep_node_fc4type()
760 Did, vport->fc_flag, in lpfc_prep_node_fc4type()
761 vport->fc_rscn_id_cnt, ndlp); in lpfc_prep_node_fc4type()
764 if (!test_bit(FC_RSCN_MODE, &vport->fc_flag) || in lpfc_prep_node_fc4type()
767 "Query GID_FTrsp: did:x%x flg:x%lx cnt:%d", in lpfc_prep_node_fc4type()
768 Did, vport->fc_flag, vport->fc_rscn_id_cnt); in lpfc_prep_node_fc4type()
776 (ndlp->nlp_type & in lpfc_prep_node_fc4type()
779 ndlp->nlp_fc4_type |= NLP_FC4_FCP; in lpfc_prep_node_fc4type()
781 ndlp->nlp_fc4_type |= NLP_FC4_NVME; in lpfc_prep_node_fc4type()
785 vport->num_disc_nodes++; in lpfc_prep_node_fc4type()
790 "Skip2 GID_FTrsp: did:x%x flg:x%lx cnt:%d", in lpfc_prep_node_fc4type()
791 Did, vport->fc_flag, vport->fc_rscn_id_cnt); in lpfc_prep_node_fc4type()
796 vport->fc_flag, in lpfc_prep_node_fc4type()
797 vport->fc_rscn_id_cnt); in lpfc_prep_node_fc4type()
805 struct lpfc_hba *phba = vport->phba; in lpfc_ns_rsp_audit_did()
809 if (phba->cfg_ns_query == LPFC_NS_QUERY_GID_FT) in lpfc_ns_rsp_audit_did()
822 if (Did != vport->fc_myDID && in lpfc_ns_rsp_audit_did()
824 vport->cfg_peer_port_login)) { in lpfc_ns_rsp_audit_did()
825 if (!phba->nvmet_support) { in lpfc_ns_rsp_audit_did()
831 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_ns_rsp_audit_did()
832 if (ndlp->nlp_type != NLP_NVME_INITIATOR || in lpfc_ns_rsp_audit_did()
833 ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) in lpfc_ns_rsp_audit_did()
835 if (ndlp->nlp_DID == Did) in lpfc_ns_rsp_audit_did()
836 clear_bit(NLP_NVMET_RECOV, &ndlp->nlp_flag); in lpfc_ns_rsp_audit_did()
838 set_bit(NLP_NVMET_RECOV, &ndlp->nlp_flag); in lpfc_ns_rsp_audit_did()
848 (struct lpfc_sli_ct_request *) mp->virt; in lpfc_ns_rsp()
850 uint32_t *ctptr = (uint32_t *) & Response->un.gid.PortType; in lpfc_ns_rsp()
852 int Cnt; in lpfc_ns_rsp() local
857 vport->num_disc_nodes = 0; in lpfc_ns_rsp()
858 vport->fc_ns_retry = 0; in lpfc_ns_rsp()
861 list_add_tail(&head, &mp->list); in lpfc_ns_rsp()
865 Cnt = Size > FCELSSIZE ? FCELSSIZE : Size; in lpfc_ns_rsp()
867 Size -= Cnt; in lpfc_ns_rsp()
870 ctptr = (uint32_t *) mlast->virt; in lpfc_ns_rsp()
872 Cnt -= 16; /* subtract length of CT header */ in lpfc_ns_rsp()
875 while (Cnt >= sizeof(uint32_t)) { in lpfc_ns_rsp()
883 Cnt -= sizeof(uint32_t); in lpfc_ns_rsp()
893 if (vport->phba->nvmet_support) { in lpfc_ns_rsp()
894 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_ns_rsp()
895 if (!test_bit(NLP_NVMET_RECOV, &ndlp->nlp_flag)) in lpfc_ns_rsp()
899 clear_bit(NLP_NVMET_RECOV, &ndlp->nlp_flag); in lpfc_ns_rsp()
912 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct_cmd_gid_ft()
923 ndlp = cmdiocb->ndlp; in lpfc_cmpl_ct_cmd_gid_ft()
926 cmdiocb->rsp_iocb = rspiocb; in lpfc_cmpl_ct_cmd_gid_ft()
927 inp = cmdiocb->cmd_dmabuf; in lpfc_cmpl_ct_cmd_gid_ft()
928 outp = cmdiocb->rsp_dmabuf; in lpfc_cmpl_ct_cmd_gid_ft()
932 ulp_status, ulp_word4, vport->fc_ns_retry); in lpfc_cmpl_ct_cmd_gid_ft()
935 if (cmdiocb->event_tag != phba->fc_eventTag) { in lpfc_cmpl_ct_cmd_gid_ft()
942 if (vport == phba->pport && test_bit(FC_UNLOADING, &vport->load_flag)) { in lpfc_cmpl_ct_cmd_gid_ft()
943 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) in lpfc_cmpl_ct_cmd_gid_ft()
951 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) in lpfc_cmpl_ct_cmd_gid_ft()
961 ulp_status, ulp_word4, vport->fc_flag, in lpfc_cmpl_ct_cmd_gid_ft()
962 vport->port_state, vport->gidft_inp); in lpfc_cmpl_ct_cmd_gid_ft()
963 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) in lpfc_cmpl_ct_cmd_gid_ft()
965 if (vport->gidft_inp) in lpfc_cmpl_ct_cmd_gid_ft()
966 vport->gidft_inp--; in lpfc_cmpl_ct_cmd_gid_ft()
970 if (test_and_clear_bit(FC_RSCN_DEFERRED, &vport->fc_flag)) { in lpfc_cmpl_ct_cmd_gid_ft()
974 if (vport->gidft_inp) in lpfc_cmpl_ct_cmd_gid_ft()
975 vport->gidft_inp--; in lpfc_cmpl_ct_cmd_gid_ft()
979 * Re-issue the NS cmd in lpfc_cmpl_ct_cmd_gid_ft()
983 vport->fc_flag, vport->fc_rscn_id_cnt); in lpfc_cmpl_ct_cmd_gid_ft()
991 if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) { in lpfc_cmpl_ct_cmd_gid_ft()
995 vport->fc_ns_retry++; in lpfc_cmpl_ct_cmd_gid_ft()
1003 vport->fc_ns_retry, type); in lpfc_cmpl_ct_cmd_gid_ft()
1007 if (vport->gidft_inp) in lpfc_cmpl_ct_cmd_gid_ft()
1008 vport->gidft_inp--; in lpfc_cmpl_ct_cmd_gid_ft()
1011 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) in lpfc_cmpl_ct_cmd_gid_ft()
1016 ulp_status, vport->fc_ns_retry); in lpfc_cmpl_ct_cmd_gid_ft()
1019 CTreq = (struct lpfc_sli_ct_request *) inp->virt; in lpfc_cmpl_ct_cmd_gid_ft()
1020 CTrsp = (struct lpfc_sli_ct_request *) outp->virt; in lpfc_cmpl_ct_cmd_gid_ft()
1021 if (CTrsp->CommandResponse.bits.CmdRsp == in lpfc_cmpl_ct_cmd_gid_ft()
1026 vport->fc_flag, in lpfc_cmpl_ct_cmd_gid_ft()
1027 CTreq->un.gid.Fc4Type, in lpfc_cmpl_ct_cmd_gid_ft()
1028 vport->num_disc_nodes, in lpfc_cmpl_ct_cmd_gid_ft()
1029 vport->gidft_inp, in lpfc_cmpl_ct_cmd_gid_ft()
1034 CTreq->un.gid.Fc4Type, in lpfc_cmpl_ct_cmd_gid_ft()
1036 } else if (be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp) == in lpfc_cmpl_ct_cmd_gid_ft()
1039 if ((CTrsp->ReasonCode == SLI_CT_UNABLE_TO_PERFORM_REQ) in lpfc_cmpl_ct_cmd_gid_ft()
1040 && (CTrsp->Explanation == SLI_CT_NO_FC4_TYPES)) { in lpfc_cmpl_ct_cmd_gid_ft()
1045 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct_cmd_gid_ft()
1046 (uint32_t) CTrsp->ReasonCode, in lpfc_cmpl_ct_cmd_gid_ft()
1047 (uint32_t) CTrsp->Explanation, in lpfc_cmpl_ct_cmd_gid_ft()
1048 vport->fc_flag); in lpfc_cmpl_ct_cmd_gid_ft()
1052 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct_cmd_gid_ft()
1053 (uint32_t) CTrsp->ReasonCode, in lpfc_cmpl_ct_cmd_gid_ft()
1054 (uint32_t) CTrsp->Explanation); in lpfc_cmpl_ct_cmd_gid_ft()
1060 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct_cmd_gid_ft()
1061 (uint32_t) CTrsp->ReasonCode, in lpfc_cmpl_ct_cmd_gid_ft()
1062 (uint32_t) CTrsp->Explanation, in lpfc_cmpl_ct_cmd_gid_ft()
1063 vport->fc_flag); in lpfc_cmpl_ct_cmd_gid_ft()
1067 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct_cmd_gid_ft()
1068 (uint32_t) CTrsp->ReasonCode, in lpfc_cmpl_ct_cmd_gid_ft()
1069 (uint32_t) CTrsp->Explanation); in lpfc_cmpl_ct_cmd_gid_ft()
1078 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct_cmd_gid_ft()
1079 (uint32_t) CTrsp->ReasonCode, in lpfc_cmpl_ct_cmd_gid_ft()
1080 (uint32_t) CTrsp->Explanation, in lpfc_cmpl_ct_cmd_gid_ft()
1081 vport->fc_flag); in lpfc_cmpl_ct_cmd_gid_ft()
1085 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct_cmd_gid_ft()
1086 (uint32_t) CTrsp->ReasonCode, in lpfc_cmpl_ct_cmd_gid_ft()
1087 (uint32_t) CTrsp->Explanation); in lpfc_cmpl_ct_cmd_gid_ft()
1089 if (vport->gidft_inp) in lpfc_cmpl_ct_cmd_gid_ft()
1090 vport->gidft_inp--; in lpfc_cmpl_ct_cmd_gid_ft()
1095 vport->gidft_inp, vport->num_disc_nodes); in lpfc_cmpl_ct_cmd_gid_ft()
1098 if ((vport->num_disc_nodes == 0) && in lpfc_cmpl_ct_cmd_gid_ft()
1099 (vport->gidft_inp == 0)) { in lpfc_cmpl_ct_cmd_gid_ft()
1105 if (vport->port_state >= LPFC_DISC_AUTH) { in lpfc_cmpl_ct_cmd_gid_ft()
1106 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) { in lpfc_cmpl_ct_cmd_gid_ft()
1109 set_bit(FC_RSCN_MODE, &vport->fc_flag); in lpfc_cmpl_ct_cmd_gid_ft()
1127 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct_cmd_gid_pt()
1138 ndlp = cmdiocb->ndlp; in lpfc_cmpl_ct_cmd_gid_pt()
1141 cmdiocb->rsp_iocb = rspiocb; in lpfc_cmpl_ct_cmd_gid_pt()
1142 inp = cmdiocb->cmd_dmabuf; in lpfc_cmpl_ct_cmd_gid_pt()
1143 outp = cmdiocb->rsp_dmabuf; in lpfc_cmpl_ct_cmd_gid_pt()
1148 vport->fc_ns_retry); in lpfc_cmpl_ct_cmd_gid_pt()
1151 if (cmdiocb->event_tag != phba->fc_eventTag) { in lpfc_cmpl_ct_cmd_gid_pt()
1158 if (vport == phba->pport && test_bit(FC_UNLOADING, &vport->load_flag)) { in lpfc_cmpl_ct_cmd_gid_pt()
1159 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) in lpfc_cmpl_ct_cmd_gid_pt()
1167 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) in lpfc_cmpl_ct_cmd_gid_pt()
1177 ulp_status, ulp_word4, vport->fc_flag, in lpfc_cmpl_ct_cmd_gid_pt()
1178 vport->port_state, vport->gidft_inp); in lpfc_cmpl_ct_cmd_gid_pt()
1179 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) in lpfc_cmpl_ct_cmd_gid_pt()
1181 if (vport->gidft_inp) in lpfc_cmpl_ct_cmd_gid_pt()
1182 vport->gidft_inp--; in lpfc_cmpl_ct_cmd_gid_pt()
1186 if (test_and_clear_bit(FC_RSCN_DEFERRED, &vport->fc_flag)) { in lpfc_cmpl_ct_cmd_gid_pt()
1190 if (vport->gidft_inp) in lpfc_cmpl_ct_cmd_gid_pt()
1191 vport->gidft_inp--; in lpfc_cmpl_ct_cmd_gid_pt()
1195 * Re-issue the NS cmd in lpfc_cmpl_ct_cmd_gid_pt()
1199 vport->fc_flag, vport->fc_rscn_id_cnt); in lpfc_cmpl_ct_cmd_gid_pt()
1207 if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) { in lpfc_cmpl_ct_cmd_gid_pt()
1211 vport->fc_ns_retry++; in lpfc_cmpl_ct_cmd_gid_pt()
1215 vport->fc_ns_retry, GID_PT_N_PORT); in lpfc_cmpl_ct_cmd_gid_pt()
1219 if (vport->gidft_inp) in lpfc_cmpl_ct_cmd_gid_pt()
1220 vport->gidft_inp--; in lpfc_cmpl_ct_cmd_gid_pt()
1223 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) in lpfc_cmpl_ct_cmd_gid_pt()
1228 ulp_status, vport->fc_ns_retry); in lpfc_cmpl_ct_cmd_gid_pt()
1231 CTreq = (struct lpfc_sli_ct_request *)inp->virt; in lpfc_cmpl_ct_cmd_gid_pt()
1232 CTrsp = (struct lpfc_sli_ct_request *)outp->virt; in lpfc_cmpl_ct_cmd_gid_pt()
1233 if (be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp) == in lpfc_cmpl_ct_cmd_gid_pt()
1238 vport->fc_flag, in lpfc_cmpl_ct_cmd_gid_pt()
1239 CTreq->un.gid.Fc4Type, in lpfc_cmpl_ct_cmd_gid_pt()
1240 vport->num_disc_nodes, in lpfc_cmpl_ct_cmd_gid_pt()
1241 vport->gidft_inp, in lpfc_cmpl_ct_cmd_gid_pt()
1246 CTreq->un.gid.Fc4Type, in lpfc_cmpl_ct_cmd_gid_pt()
1248 } else if (be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp) == in lpfc_cmpl_ct_cmd_gid_pt()
1251 if ((CTrsp->ReasonCode == SLI_CT_UNABLE_TO_PERFORM_REQ) in lpfc_cmpl_ct_cmd_gid_pt()
1252 && (CTrsp->Explanation == SLI_CT_NO_FC4_TYPES)) { in lpfc_cmpl_ct_cmd_gid_pt()
1257 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct_cmd_gid_pt()
1258 (uint32_t)CTrsp->ReasonCode, in lpfc_cmpl_ct_cmd_gid_pt()
1259 (uint32_t)CTrsp->Explanation, in lpfc_cmpl_ct_cmd_gid_pt()
1260 vport->fc_flag); in lpfc_cmpl_ct_cmd_gid_pt()
1265 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct_cmd_gid_pt()
1266 (uint32_t)CTrsp->ReasonCode, in lpfc_cmpl_ct_cmd_gid_pt()
1267 (uint32_t)CTrsp->Explanation); in lpfc_cmpl_ct_cmd_gid_pt()
1273 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct_cmd_gid_pt()
1274 (uint32_t)CTrsp->ReasonCode, in lpfc_cmpl_ct_cmd_gid_pt()
1275 (uint32_t)CTrsp->Explanation, in lpfc_cmpl_ct_cmd_gid_pt()
1276 vport->fc_flag); in lpfc_cmpl_ct_cmd_gid_pt()
1281 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct_cmd_gid_pt()
1282 (uint32_t)CTrsp->ReasonCode, in lpfc_cmpl_ct_cmd_gid_pt()
1283 (uint32_t)CTrsp->Explanation); in lpfc_cmpl_ct_cmd_gid_pt()
1290 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct_cmd_gid_pt()
1291 (uint32_t)CTrsp->ReasonCode, in lpfc_cmpl_ct_cmd_gid_pt()
1292 (uint32_t)CTrsp->Explanation, in lpfc_cmpl_ct_cmd_gid_pt()
1293 vport->fc_flag); in lpfc_cmpl_ct_cmd_gid_pt()
1298 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct_cmd_gid_pt()
1299 (uint32_t)CTrsp->ReasonCode, in lpfc_cmpl_ct_cmd_gid_pt()
1300 (uint32_t)CTrsp->Explanation); in lpfc_cmpl_ct_cmd_gid_pt()
1302 if (vport->gidft_inp) in lpfc_cmpl_ct_cmd_gid_pt()
1303 vport->gidft_inp--; in lpfc_cmpl_ct_cmd_gid_pt()
1308 vport->gidft_inp, vport->num_disc_nodes); in lpfc_cmpl_ct_cmd_gid_pt()
1311 if ((vport->num_disc_nodes == 0) && in lpfc_cmpl_ct_cmd_gid_pt()
1312 (vport->gidft_inp == 0)) { in lpfc_cmpl_ct_cmd_gid_pt()
1318 if (vport->port_state >= LPFC_DISC_AUTH) { in lpfc_cmpl_ct_cmd_gid_pt()
1319 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) { in lpfc_cmpl_ct_cmd_gid_pt()
1322 set_bit(FC_RSCN_MODE, &vport->fc_flag); in lpfc_cmpl_ct_cmd_gid_pt()
1339 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct_cmd_gff_id()
1340 struct lpfc_dmabuf *inp = cmdiocb->cmd_dmabuf; in lpfc_cmpl_ct_cmd_gff_id()
1341 struct lpfc_dmabuf *outp = cmdiocb->rsp_dmabuf; in lpfc_cmpl_ct_cmd_gff_id()
1349 did = ((struct lpfc_sli_ct_request *) inp->virt)->un.gff.PortId; in lpfc_cmpl_ct_cmd_gff_id()
1357 if (cmdiocb->event_tag != phba->fc_eventTag) { in lpfc_cmpl_ct_cmd_gff_id()
1365 CTrsp = (struct lpfc_sli_ct_request *) outp->virt; in lpfc_cmpl_ct_cmd_gff_id()
1366 fbits = CTrsp->un.gff_acc.fbits[FCP_TYPE_FEATURE_OFFSET]; in lpfc_cmpl_ct_cmd_gff_id()
1375 if (be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp) == in lpfc_cmpl_ct_cmd_gff_id()
1384 vport->fc_rscn_id_cnt); in lpfc_cmpl_ct_cmd_gff_id()
1391 if (cmdiocb->retry < LPFC_MAX_NS_RETRY) { in lpfc_cmpl_ct_cmd_gff_id()
1408 cmdiocb->retry++; in lpfc_cmpl_ct_cmd_gff_id()
1412 cmdiocb->retry++; in lpfc_cmpl_ct_cmd_gff_id()
1417 cmdiocb->retry, did); in lpfc_cmpl_ct_cmd_gff_id()
1420 free_ndlp = cmdiocb->ndlp; in lpfc_cmpl_ct_cmd_gff_id()
1431 vport->fc_flag, vport->fc_rscn_id_cnt); in lpfc_cmpl_ct_cmd_gff_id()
1440 did, ndlp->nlp_flag, vport->fc_flag, in lpfc_cmpl_ct_cmd_gff_id()
1441 vport->fc_rscn_id_cnt); in lpfc_cmpl_ct_cmd_gff_id()
1446 vport->fc_flag, vport->fc_rscn_id_cnt); in lpfc_cmpl_ct_cmd_gff_id()
1450 if (vport->num_disc_nodes) in lpfc_cmpl_ct_cmd_gff_id()
1451 vport->num_disc_nodes--; in lpfc_cmpl_ct_cmd_gff_id()
1455 vport->gidft_inp, vport->num_disc_nodes); in lpfc_cmpl_ct_cmd_gff_id()
1457 if (vport->num_disc_nodes == 0) { in lpfc_cmpl_ct_cmd_gff_id()
1463 if (vport->port_state >= LPFC_DISC_AUTH) { in lpfc_cmpl_ct_cmd_gff_id()
1464 if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) { in lpfc_cmpl_ct_cmd_gff_id()
1467 set_bit(FC_RSCN_MODE, &vport->fc_flag); in lpfc_cmpl_ct_cmd_gff_id()
1476 free_ndlp = cmdiocb->ndlp; in lpfc_cmpl_ct_cmd_gff_id()
1486 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct_cmd_gft_id()
1487 struct lpfc_dmabuf *inp = cmdiocb->cmd_dmabuf; in lpfc_cmpl_ct_cmd_gft_id()
1488 struct lpfc_dmabuf *outp = cmdiocb->rsp_dmabuf; in lpfc_cmpl_ct_cmd_gft_id()
1492 struct lpfc_nodelist *ns_ndlp = cmdiocb->ndlp; in lpfc_cmpl_ct_cmd_gft_id()
1497 did = ((struct lpfc_sli_ct_request *)inp->virt)->un.gft.PortId; in lpfc_cmpl_ct_cmd_gft_id()
1505 if ((uint32_t)cmdiocb->event_tag != phba->fc_eventTag) { in lpfc_cmpl_ct_cmd_gft_id()
1513 CTrsp = (struct lpfc_sli_ct_request *)outp->virt; in lpfc_cmpl_ct_cmd_gft_id()
1514 fc4_data_0 = be32_to_cpu(CTrsp->un.gft_acc.fc4_types[0]); in lpfc_cmpl_ct_cmd_gft_id()
1515 fc4_data_1 = be32_to_cpu(CTrsp->un.gft_acc.fc4_types[1]); in lpfc_cmpl_ct_cmd_gft_id()
1537 ndlp->nlp_fc4_type |= NLP_FC4_FCP; in lpfc_cmpl_ct_cmd_gft_id()
1539 ndlp->nlp_fc4_type |= NLP_FC4_NVME; in lpfc_cmpl_ct_cmd_gft_id()
1545 ndlp, did, ndlp->nlp_fc4_type, in lpfc_cmpl_ct_cmd_gft_id()
1547 ndlp->nlp_state); in lpfc_cmpl_ct_cmd_gft_id()
1549 if (ndlp->nlp_state == NLP_STE_REG_LOGIN_ISSUE && in lpfc_cmpl_ct_cmd_gft_id()
1550 ndlp->nlp_fc4_type) { in lpfc_cmpl_ct_cmd_gft_id()
1551 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; in lpfc_cmpl_ct_cmd_gft_id()
1555 } else if (!ndlp->nlp_fc4_type) { in lpfc_cmpl_ct_cmd_gft_id()
1562 ndlp, did, ndlp->nlp_fc4_type, in lpfc_cmpl_ct_cmd_gft_id()
1563 ndlp->nlp_state); in lpfc_cmpl_ct_cmd_gft_id()
1565 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; in lpfc_cmpl_ct_cmd_gft_id()
1583 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct()
1595 ndlp = cmdiocb->ndlp; in lpfc_cmpl_ct()
1598 cmdiocb->rsp_iocb = rspiocb; in lpfc_cmpl_ct()
1600 inp = cmdiocb->cmd_dmabuf; in lpfc_cmpl_ct()
1601 outp = cmdiocb->rsp_dmabuf; in lpfc_cmpl_ct()
1603 cmdcode = be16_to_cpu(((struct lpfc_sli_ct_request *) inp->virt)-> in lpfc_cmpl_ct()
1605 CTrsp = (struct lpfc_sli_ct_request *) outp->virt; in lpfc_cmpl_ct()
1614 be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp), in lpfc_cmpl_ct()
1615 get_job_ulpcontext(phba, cmdiocb), cmdiocb->iotag); in lpfc_cmpl_ct()
1633 retry = cmdiocb->retry; in lpfc_cmpl_ct()
1649 if (test_bit(NLP_WAIT_FOR_DA_ID, &ndlp->save_flags)) { in lpfc_cmpl_ct()
1650 if (ndlp->da_id_waitq) in lpfc_cmpl_ct()
1651 wake_up(ndlp->da_id_waitq); in lpfc_cmpl_ct()
1654 clear_bit(NLP_WAIT_FOR_DA_ID, &ndlp->save_flags); in lpfc_cmpl_ct()
1665 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct_cmd_rft_id()
1672 outp = cmdiocb->rsp_dmabuf; in lpfc_cmpl_ct_cmd_rft_id()
1673 CTrsp = (struct lpfc_sli_ct_request *)outp->virt; in lpfc_cmpl_ct_cmd_rft_id()
1674 if (be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp) == in lpfc_cmpl_ct_cmd_rft_id()
1676 vport->ct_flags |= FC_CT_RFT_ID; in lpfc_cmpl_ct_cmd_rft_id()
1686 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct_cmd_rnn_id()
1693 outp = cmdiocb->rsp_dmabuf; in lpfc_cmpl_ct_cmd_rnn_id()
1694 CTrsp = (struct lpfc_sli_ct_request *) outp->virt; in lpfc_cmpl_ct_cmd_rnn_id()
1695 if (be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp) == in lpfc_cmpl_ct_cmd_rnn_id()
1697 vport->ct_flags |= FC_CT_RNN_ID; in lpfc_cmpl_ct_cmd_rnn_id()
1707 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct_cmd_rspn_id()
1714 outp = cmdiocb->rsp_dmabuf; in lpfc_cmpl_ct_cmd_rspn_id()
1715 CTrsp = (struct lpfc_sli_ct_request *)outp->virt; in lpfc_cmpl_ct_cmd_rspn_id()
1716 if (be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp) == in lpfc_cmpl_ct_cmd_rspn_id()
1718 vport->ct_flags |= FC_CT_RSPN_ID; in lpfc_cmpl_ct_cmd_rspn_id()
1728 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct_cmd_rsnn_nn()
1735 outp = cmdiocb->rsp_dmabuf; in lpfc_cmpl_ct_cmd_rsnn_nn()
1736 CTrsp = (struct lpfc_sli_ct_request *) outp->virt; in lpfc_cmpl_ct_cmd_rsnn_nn()
1737 if (be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp) == in lpfc_cmpl_ct_cmd_rsnn_nn()
1739 vport->ct_flags |= FC_CT_RSNN_NN; in lpfc_cmpl_ct_cmd_rsnn_nn()
1749 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct_cmd_da_id()
1752 vport->ct_flags = 0; in lpfc_cmpl_ct_cmd_da_id()
1761 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct_cmd_rff_id()
1768 outp = cmdiocb->rsp_dmabuf; in lpfc_cmpl_ct_cmd_rff_id()
1769 CTrsp = (struct lpfc_sli_ct_request *)outp->virt; in lpfc_cmpl_ct_cmd_rff_id()
1770 if (be16_to_cpu(CTrsp->CommandResponse.bits.CmdRsp) == in lpfc_cmpl_ct_cmd_rff_id()
1772 vport->ct_flags |= FC_CT_RFF_ID; in lpfc_cmpl_ct_cmd_rff_id()
1779 * Although the symbolic port name is thought to be an integer
1791 * Name object. NPIV is not in play so this integer in lpfc_vport_symbolic_port_name()
1792 * value is sufficient and unique per FC-ID. in lpfc_vport_symbolic_port_name()
1794 n = scnprintf(symbol, size, "%d", vport->phba->brd_no); in lpfc_vport_symbolic_port_name()
1808 scnprintf(tmp, sizeof(tmp), "Emulex %s", vport->phba->ModelName); in lpfc_vport_symbolic_node_name()
1812 lpfc_decode_firmware_rev(vport->phba, fwrev, 0); in lpfc_vport_symbolic_node_name()
1821 scnprintf(tmp, sizeof(tmp), " HN:%s", vport->phba->os_host_name); in lpfc_vport_symbolic_node_name()
1825 /* Note :- OS name is "Linux" */ in lpfc_vport_symbolic_node_name()
1826 scnprintf(tmp, sizeof(tmp), " OS:%s", init_utsname()->sysname); in lpfc_vport_symbolic_node_name()
1839 uint32_t cnt = 0; in lpfc_find_map_node() local
1841 spin_lock_irqsave(&vport->fc_nodes_list_lock, iflags); in lpfc_find_map_node()
1842 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { in lpfc_find_map_node()
1843 if (ndlp->nlp_type & NLP_FABRIC) in lpfc_find_map_node()
1845 if ((ndlp->nlp_state == NLP_STE_MAPPED_NODE) || in lpfc_find_map_node()
1846 (ndlp->nlp_state == NLP_STE_UNMAPPED_NODE)) in lpfc_find_map_node()
1847 cnt++; in lpfc_find_map_node()
1849 spin_unlock_irqrestore(&vport->fc_nodes_list_lock, iflags); in lpfc_find_map_node()
1850 return cnt; in lpfc_find_map_node()
1864 mp = cmdiocb->cmd_dmabuf; in lpfc_get_gidft_type()
1867 CtReq = (struct lpfc_sli_ct_request *)mp->virt; in lpfc_get_gidft_type()
1868 type = (uint32_t)CtReq->un.gid.Fc4Type; in lpfc_get_gidft_type()
1886 struct lpfc_hba *phba = vport->phba; in lpfc_ns_cmd()
1898 if (!ndlp || ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) { in lpfc_ns_cmd()
1911 INIT_LIST_HEAD(&mp->list); in lpfc_ns_cmd()
1912 mp->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &(mp->phys)); in lpfc_ns_cmd()
1913 if (!mp->virt) { in lpfc_ns_cmd()
1925 INIT_LIST_HEAD(&bmp->list); in lpfc_ns_cmd()
1926 bmp->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &(bmp->phys)); in lpfc_ns_cmd()
1927 if (!bmp->virt) { in lpfc_ns_cmd()
1935 cmdcode, vport->fc_flag, vport->fc_rscn_id_cnt, in lpfc_ns_cmd()
1938 bpl = (struct ulp_bde64 *) bmp->virt; in lpfc_ns_cmd()
1940 bpl->addrHigh = le32_to_cpu(putPaddrHigh(mp->phys) ); in lpfc_ns_cmd()
1941 bpl->addrLow = le32_to_cpu(putPaddrLow(mp->phys) ); in lpfc_ns_cmd()
1942 bpl->tus.f.bdeFlags = 0; in lpfc_ns_cmd()
1944 bpl->tus.f.bdeSize = GID_REQUEST_SZ; in lpfc_ns_cmd()
1946 bpl->tus.f.bdeSize = GID_REQUEST_SZ; in lpfc_ns_cmd()
1948 bpl->tus.f.bdeSize = GFF_REQUEST_SZ; in lpfc_ns_cmd()
1950 bpl->tus.f.bdeSize = GFT_REQUEST_SZ; in lpfc_ns_cmd()
1952 bpl->tus.f.bdeSize = RFT_REQUEST_SZ; in lpfc_ns_cmd()
1954 bpl->tus.f.bdeSize = RNN_REQUEST_SZ; in lpfc_ns_cmd()
1956 bpl->tus.f.bdeSize = RSPN_REQUEST_SZ; in lpfc_ns_cmd()
1958 bpl->tus.f.bdeSize = RSNN_REQUEST_SZ; in lpfc_ns_cmd()
1960 bpl->tus.f.bdeSize = DA_ID_REQUEST_SZ; in lpfc_ns_cmd()
1962 bpl->tus.f.bdeSize = RFF_REQUEST_SZ; in lpfc_ns_cmd()
1964 bpl->tus.f.bdeSize = 0; in lpfc_ns_cmd()
1965 bpl->tus.w = le32_to_cpu(bpl->tus.w); in lpfc_ns_cmd()
1967 CtReq = (struct lpfc_sli_ct_request *) mp->virt; in lpfc_ns_cmd()
1969 CtReq->RevisionId.bits.Revision = SLI_CT_REVISION; in lpfc_ns_cmd()
1970 CtReq->RevisionId.bits.InId = 0; in lpfc_ns_cmd()
1971 CtReq->FsType = SLI_CT_DIRECTORY_SERVICE; in lpfc_ns_cmd()
1972 CtReq->FsSubType = SLI_CT_DIRECTORY_NAME_SERVER; in lpfc_ns_cmd()
1973 CtReq->CommandResponse.bits.Size = 0; in lpfc_ns_cmd()
1976 CtReq->CommandResponse.bits.CmdRsp = in lpfc_ns_cmd()
1978 CtReq->un.gid.Fc4Type = context; in lpfc_ns_cmd()
1980 if (vport->port_state < LPFC_NS_QRY) in lpfc_ns_cmd()
1981 vport->port_state = LPFC_NS_QRY; in lpfc_ns_cmd()
1988 CtReq->CommandResponse.bits.CmdRsp = in lpfc_ns_cmd()
1990 CtReq->un.gid.PortType = context; in lpfc_ns_cmd()
1992 if (vport->port_state < LPFC_NS_QRY) in lpfc_ns_cmd()
1993 vport->port_state = LPFC_NS_QRY; in lpfc_ns_cmd()
2000 CtReq->CommandResponse.bits.CmdRsp = in lpfc_ns_cmd()
2002 CtReq->un.gff.PortId = cpu_to_be32(context); in lpfc_ns_cmd()
2007 CtReq->CommandResponse.bits.CmdRsp = in lpfc_ns_cmd()
2009 CtReq->un.gft.PortId = cpu_to_be32(context); in lpfc_ns_cmd()
2014 vport->ct_flags &= ~FC_CT_RFT_ID; in lpfc_ns_cmd()
2015 CtReq->CommandResponse.bits.CmdRsp = in lpfc_ns_cmd()
2017 CtReq->un.rft.port_id = cpu_to_be32(vport->fc_myDID); in lpfc_ns_cmd()
2020 if (phba->cfg_vmid_app_header) in lpfc_ns_cmd()
2021 CtReq->un.rft.app_serv_reg = in lpfc_ns_cmd()
2025 if (vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH || in lpfc_ns_cmd()
2026 vport->cfg_enable_fc4_type == LPFC_ENABLE_FCP) in lpfc_ns_cmd()
2027 CtReq->un.rft.fcp_reg = cpu_to_be32(RFT_FCP_REG); in lpfc_ns_cmd()
2030 if (vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH || in lpfc_ns_cmd()
2031 vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME) in lpfc_ns_cmd()
2032 CtReq->un.rft.nvme_reg = cpu_to_be32(RFT_NVME_REG); in lpfc_ns_cmd()
2038 CtReq->un.rft.fcp_reg ? "FCP" : " ", in lpfc_ns_cmd()
2039 CtReq->un.rft.nvme_reg ? "NVME" : " ", in lpfc_ns_cmd()
2040 CtReq->un.rft.app_serv_reg ? "APPS" : " ", in lpfc_ns_cmd()
2048 vport->ct_flags &= ~FC_CT_RNN_ID; in lpfc_ns_cmd()
2049 CtReq->CommandResponse.bits.CmdRsp = in lpfc_ns_cmd()
2051 CtReq->un.rnn.PortId = cpu_to_be32(vport->fc_myDID); in lpfc_ns_cmd()
2052 memcpy(CtReq->un.rnn.wwnn, &vport->fc_nodename, in lpfc_ns_cmd()
2058 vport->ct_flags &= ~FC_CT_RSPN_ID; in lpfc_ns_cmd()
2059 CtReq->CommandResponse.bits.CmdRsp = in lpfc_ns_cmd()
2061 CtReq->un.rspn.PortId = cpu_to_be32(vport->fc_myDID); in lpfc_ns_cmd()
2062 size = sizeof(CtReq->un.rspn.symbname); in lpfc_ns_cmd()
2063 CtReq->un.rspn.len = in lpfc_ns_cmd()
2065 CtReq->un.rspn.symbname, size); in lpfc_ns_cmd()
2069 vport->ct_flags &= ~FC_CT_RSNN_NN; in lpfc_ns_cmd()
2070 CtReq->CommandResponse.bits.CmdRsp = in lpfc_ns_cmd()
2072 memcpy(CtReq->un.rsnn.wwnn, &vport->fc_nodename, in lpfc_ns_cmd()
2074 size = sizeof(CtReq->un.rsnn.symbname); in lpfc_ns_cmd()
2075 CtReq->un.rsnn.len = in lpfc_ns_cmd()
2077 CtReq->un.rsnn.symbname, size); in lpfc_ns_cmd()
2082 CtReq->CommandResponse.bits.CmdRsp = in lpfc_ns_cmd()
2084 CtReq->un.da_id.port_id = cpu_to_be32(vport->fc_myDID); in lpfc_ns_cmd()
2088 vport->ct_flags &= ~FC_CT_RFF_ID; in lpfc_ns_cmd()
2089 CtReq->CommandResponse.bits.CmdRsp = in lpfc_ns_cmd()
2091 CtReq->un.rff.PortId = cpu_to_be32(vport->fc_myDID); in lpfc_ns_cmd()
2092 CtReq->un.rff.fbits = FC4_FEATURE_INIT; in lpfc_ns_cmd()
2098 if (((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || in lpfc_ns_cmd()
2099 (vport->cfg_enable_fc4_type == LPFC_ENABLE_NVME)) && in lpfc_ns_cmd()
2101 if ((vport == phba->pport) && phba->nvmet_support) { in lpfc_ns_cmd()
2102 CtReq->un.rff.fbits = (FC4_FEATURE_TARGET | in lpfc_ns_cmd()
2108 CtReq->un.rff.type_code = context; in lpfc_ns_cmd()
2110 } else if (((vport->cfg_enable_fc4_type == LPFC_ENABLE_BOTH) || in lpfc_ns_cmd()
2111 (vport->cfg_enable_fc4_type == LPFC_ENABLE_FCP)) && in lpfc_ns_cmd()
2113 CtReq->un.rff.type_code = context; in lpfc_ns_cmd()
2136 cmdcode, ndlp->nlp_DID, 0); in lpfc_ns_cmd()
2142 lpfc_mbuf_free(phba, bmp->virt, bmp->phys); in lpfc_ns_cmd()
2146 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_ns_cmd()
2153 cmdcode, rc, vport->fc_flag, vport->fc_rscn_id_cnt); in lpfc_ns_cmd()
2158 * lpfc_fdmi_rprt_defer - Check for any deferred FDMI RPRT commands
2174 set_bit(HBA_RHBA_CMPL, &phba->hba_flag); in lpfc_fdmi_rprt_defer()
2177 for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { in lpfc_fdmi_rprt_defer()
2179 ndlp = lpfc_findnode_did(phba->pport, FDMI_DID); in lpfc_fdmi_rprt_defer()
2182 if (vport->ct_flags & FC_CT_RPRT_DEFER) { in lpfc_fdmi_rprt_defer()
2183 vport->ct_flags &= ~FC_CT_RPRT_DEFER; in lpfc_fdmi_rprt_defer()
2184 vport->fdmi_port_mask = mask; in lpfc_fdmi_rprt_defer()
2193 * lpfc_cmpl_ct_disc_fdmi - Handle a discovery FDMI completion
2205 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct_disc_fdmi()
2206 struct lpfc_dmabuf *inp = cmdiocb->cmd_dmabuf; in lpfc_cmpl_ct_disc_fdmi()
2207 struct lpfc_dmabuf *outp = cmdiocb->rsp_dmabuf; in lpfc_cmpl_ct_disc_fdmi()
2208 struct lpfc_sli_ct_request *CTcmd = inp->virt; in lpfc_cmpl_ct_disc_fdmi()
2209 struct lpfc_sli_ct_request *CTrsp = outp->virt; in lpfc_cmpl_ct_disc_fdmi()
2210 __be16 fdmi_cmd = CTcmd->CommandResponse.bits.CmdRsp; in lpfc_cmpl_ct_disc_fdmi()
2211 __be16 fdmi_rsp = CTrsp->CommandResponse.bits.CmdRsp; in lpfc_cmpl_ct_disc_fdmi()
2227 ulp_word4, phba->sli.sli_flag); in lpfc_cmpl_ct_disc_fdmi()
2237 cmdiocb->retry++; in lpfc_cmpl_ct_disc_fdmi()
2238 if (cmdiocb->retry >= LPFC_FDMI_MAX_RETRY) in lpfc_cmpl_ct_disc_fdmi()
2253 free_ndlp = cmdiocb->ndlp; in lpfc_cmpl_ct_disc_fdmi()
2271 /* Should we fallback to FDMI-2 / FDMI-1 ? */ in lpfc_cmpl_ct_disc_fdmi()
2274 if (vport->fdmi_hba_mask == LPFC_FDMI2_HBA_ATTR) { in lpfc_cmpl_ct_disc_fdmi()
2275 /* Fallback to FDMI-1 for HBA attributes */ in lpfc_cmpl_ct_disc_fdmi()
2276 vport->fdmi_hba_mask = LPFC_FDMI1_HBA_ATTR; in lpfc_cmpl_ct_disc_fdmi()
2281 vport->fdmi_port_mask = LPFC_FDMI1_PORT_ATTR; in lpfc_cmpl_ct_disc_fdmi()
2288 if (vport->port_type != LPFC_PHYSICAL_PORT) { in lpfc_cmpl_ct_disc_fdmi()
2289 ndlp = lpfc_findnode_did(phba->pport, FDMI_DID); in lpfc_cmpl_ct_disc_fdmi()
2293 if (vport->fdmi_port_mask == LPFC_FDMI2_PORT_ATTR) { in lpfc_cmpl_ct_disc_fdmi()
2294 /* Fallback to FDMI-1 */ in lpfc_cmpl_ct_disc_fdmi()
2295 vport->fdmi_port_mask = LPFC_FDMI1_PORT_ATTR; in lpfc_cmpl_ct_disc_fdmi()
2300 if (vport->fdmi_port_mask == LPFC_FDMI2_SMART_ATTR) { in lpfc_cmpl_ct_disc_fdmi()
2301 vport->fdmi_port_mask = LPFC_FDMI2_PORT_ATTR; in lpfc_cmpl_ct_disc_fdmi()
2309 if (phba->link_flag & LS_CT_VEN_RPA) { in lpfc_cmpl_ct_disc_fdmi()
2310 phba->link_flag &= ~LS_CT_VEN_RPA; in lpfc_cmpl_ct_disc_fdmi()
2311 if (phba->cmf_active_mode == LPFC_CFG_OFF) in lpfc_cmpl_ct_disc_fdmi()
2318 if (vport->fdmi_port_mask == LPFC_FDMI2_PORT_ATTR) { in lpfc_cmpl_ct_disc_fdmi()
2319 /* Fallback to FDMI-1 */ in lpfc_cmpl_ct_disc_fdmi()
2320 vport->fdmi_hba_mask = LPFC_FDMI1_HBA_ATTR; in lpfc_cmpl_ct_disc_fdmi()
2321 vport->fdmi_port_mask = LPFC_FDMI1_PORT_ATTR; in lpfc_cmpl_ct_disc_fdmi()
2326 if (vport->fdmi_port_mask == LPFC_FDMI2_SMART_ATTR) { in lpfc_cmpl_ct_disc_fdmi()
2327 vport->fdmi_port_mask = LPFC_FDMI2_PORT_ATTR; in lpfc_cmpl_ct_disc_fdmi()
2337 * DHBA -> DPRT -> RHBA -> RPA (physical port) in lpfc_cmpl_ct_disc_fdmi()
2338 * DPRT -> RPRT (vports) in lpfc_cmpl_ct_disc_fdmi()
2343 lpfc_fdmi_rprt_defer(phba, vport->fdmi_port_mask); in lpfc_cmpl_ct_disc_fdmi()
2353 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_cmpl_ct_disc_fdmi()
2356 ndlp = lpfc_findnode_did(phba->pport, FDMI_DID); in lpfc_cmpl_ct_disc_fdmi()
2364 if (test_bit(HBA_RHBA_CMPL, &phba->hba_flag)) { in lpfc_cmpl_ct_disc_fdmi()
2370 vport->ct_flags |= FC_CT_RPRT_DEFER; in lpfc_cmpl_ct_disc_fdmi()
2375 if (vport->port_type == LPFC_PHYSICAL_PORT && in lpfc_cmpl_ct_disc_fdmi()
2376 phba->sli4_hba.pc_sli4_params.mi_ver) { in lpfc_cmpl_ct_disc_fdmi()
2378 if (phba->link_flag & LS_CT_VEN_RPA) { in lpfc_cmpl_ct_disc_fdmi()
2383 phba->link_flag &= ~LS_CT_VEN_RPA; in lpfc_cmpl_ct_disc_fdmi()
2390 phba->sli4_hba.pc_sli4_params.mi_ver); in lpfc_cmpl_ct_disc_fdmi()
2395 phba->link_flag |= LS_CT_VEN_RPA; in lpfc_cmpl_ct_disc_fdmi()
2399 phba->sli4_hba.pc_sli4_params.mi_ver, in lpfc_cmpl_ct_disc_fdmi()
2400 phba->link_flag); in lpfc_cmpl_ct_disc_fdmi()
2404 "6459 No FDMI VEN MI support - " in lpfc_cmpl_ct_disc_fdmi()
2414 * lpfc_fdmi_change_check - Check for changed FDMI parameters
2420 * changed. If so, re-register those Attributes.
2425 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_change_check()
2427 uint16_t cnt; in lpfc_fdmi_change_check() local
2433 if (!test_bit(FC_FABRIC, &vport->fc_flag)) in lpfc_fdmi_change_check()
2441 if (strcmp(phba->os_host_name, init_utsname()->nodename)) { in lpfc_fdmi_change_check()
2442 memset(phba->os_host_name, 0, sizeof(phba->os_host_name)); in lpfc_fdmi_change_check()
2443 scnprintf(phba->os_host_name, sizeof(phba->os_host_name), "%s", in lpfc_fdmi_change_check()
2444 init_utsname()->nodename); in lpfc_fdmi_change_check()
2448 * de-register and go thru the whole FDMI registration cycle. in lpfc_fdmi_change_check()
2449 * DHBA -> DPRT -> RHBA -> RPA (physical port) in lpfc_fdmi_change_check()
2450 * DPRT -> RPRT (vports) in lpfc_fdmi_change_check()
2452 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_fdmi_change_check()
2454 phba->link_flag &= ~LS_CT_VEN_RPA; in lpfc_fdmi_change_check()
2457 ndlp = lpfc_findnode_did(phba->pport, FDMI_DID); in lpfc_fdmi_change_check()
2469 if (!(vport->fdmi_port_mask & LPFC_FDMI_PORT_ATTR_num_disc)) in lpfc_fdmi_change_check()
2473 cnt = lpfc_find_map_node(vport); in lpfc_fdmi_change_check()
2474 if (cnt == vport->fdmi_num_disc) in lpfc_fdmi_change_check()
2477 if (vport->port_type == LPFC_PHYSICAL_PORT) { in lpfc_fdmi_change_check()
2481 ndlp = lpfc_findnode_did(phba->pport, FDMI_DID); in lpfc_fdmi_change_check()
2490 lpfc_fdmi_set_attr_u32(void *attr, uint16_t attrtype, uint32_t attrval) in lpfc_fdmi_set_attr_u32() argument
2492 struct lpfc_fdmi_attr_u32 *ae = attr; in lpfc_fdmi_set_attr_u32()
2495 ae->type = cpu_to_be16(attrtype); in lpfc_fdmi_set_attr_u32()
2496 ae->len = cpu_to_be16(size); in lpfc_fdmi_set_attr_u32()
2497 ae->value_u32 = cpu_to_be32(attrval); in lpfc_fdmi_set_attr_u32()
2503 lpfc_fdmi_set_attr_wwn(void *attr, uint16_t attrtype, struct lpfc_name *wwn) in lpfc_fdmi_set_attr_wwn() argument
2505 struct lpfc_fdmi_attr_wwn *ae = attr; in lpfc_fdmi_set_attr_wwn()
2508 ae->type = cpu_to_be16(attrtype); in lpfc_fdmi_set_attr_wwn()
2509 ae->len = cpu_to_be16(size); in lpfc_fdmi_set_attr_wwn()
2510 /* WWN's assumed to be bytestreams - Big Endian presentation */ in lpfc_fdmi_set_attr_wwn()
2511 memcpy(ae->name, wwn, in lpfc_fdmi_set_attr_wwn()
2518 lpfc_fdmi_set_attr_fullwwn(void *attr, uint16_t attrtype, in lpfc_fdmi_set_attr_fullwwn() argument
2521 struct lpfc_fdmi_attr_fullwwn *ae = attr; in lpfc_fdmi_set_attr_fullwwn()
2522 u8 *nname = ae->nname; in lpfc_fdmi_set_attr_fullwwn()
2523 u8 *pname = ae->pname; in lpfc_fdmi_set_attr_fullwwn()
2526 ae->type = cpu_to_be16(attrtype); in lpfc_fdmi_set_attr_fullwwn()
2527 ae->len = cpu_to_be16(size); in lpfc_fdmi_set_attr_fullwwn()
2528 /* WWN's assumed to be bytestreams - Big Endian presentation */ in lpfc_fdmi_set_attr_fullwwn()
2538 lpfc_fdmi_set_attr_string(void *attr, uint16_t attrtype, char *attrstring) in lpfc_fdmi_set_attr_string() argument
2540 struct lpfc_fdmi_attr_string *ae = attr; in lpfc_fdmi_set_attr_string()
2549 strscpy(ae->value_string, attrstring, sizeof(ae->value_string)); in lpfc_fdmi_set_attr_string()
2550 len = strnlen(ae->value_string, sizeof(ae->value_string)); in lpfc_fdmi_set_attr_string()
2552 len += (len & 3) ? (4 - (len & 3)) : 4; in lpfc_fdmi_set_attr_string()
2556 ae->type = cpu_to_be16(attrtype); in lpfc_fdmi_set_attr_string()
2557 ae->len = cpu_to_be16(size); in lpfc_fdmi_set_attr_string()
2568 lpfc_fdmi_set_attr_fc4types(void *attr, uint16_t attrtype, uint32_t typemask) in lpfc_fdmi_set_attr_fc4types() argument
2570 struct lpfc_fdmi_attr_fc4types *ae = attr; in lpfc_fdmi_set_attr_fc4types()
2573 ae->type = cpu_to_be16(attrtype); in lpfc_fdmi_set_attr_fc4types()
2574 ae->len = cpu_to_be16(size); in lpfc_fdmi_set_attr_fc4types()
2577 ae->value_types[2] = 0x01; /* Type 0x8 - FCP */ in lpfc_fdmi_set_attr_fc4types()
2580 ae->value_types[7] = 0x01; /* Type 0x20 - CT */ in lpfc_fdmi_set_attr_fc4types()
2583 ae->value_types[6] = 0x01; /* Type 0x28 - NVME */ in lpfc_fdmi_set_attr_fc4types()
2590 lpfc_fdmi_hba_attr_wwnn(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_wwnn() argument
2592 return lpfc_fdmi_set_attr_wwn(attr, RHBA_NODENAME, in lpfc_fdmi_hba_attr_wwnn()
2593 &vport->fc_sparam.nodeName); in lpfc_fdmi_hba_attr_wwnn()
2597 lpfc_fdmi_hba_attr_manufacturer(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_manufacturer() argument
2602 return lpfc_fdmi_set_attr_string(attr, RHBA_MANUFACTURER, in lpfc_fdmi_hba_attr_manufacturer()
2607 lpfc_fdmi_hba_attr_sn(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_sn() argument
2609 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_hba_attr_sn()
2611 return lpfc_fdmi_set_attr_string(attr, RHBA_SERIAL_NUMBER, in lpfc_fdmi_hba_attr_sn()
2612 phba->SerialNumber); in lpfc_fdmi_hba_attr_sn()
2616 lpfc_fdmi_hba_attr_model(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_model() argument
2618 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_hba_attr_model()
2620 return lpfc_fdmi_set_attr_string(attr, RHBA_MODEL, in lpfc_fdmi_hba_attr_model()
2621 phba->ModelName); in lpfc_fdmi_hba_attr_model()
2625 lpfc_fdmi_hba_attr_description(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_description() argument
2627 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_hba_attr_description()
2629 return lpfc_fdmi_set_attr_string(attr, RHBA_MODEL_DESCRIPTION, in lpfc_fdmi_hba_attr_description()
2630 phba->ModelDesc); in lpfc_fdmi_hba_attr_description()
2634 lpfc_fdmi_hba_attr_hdw_ver(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_hdw_ver() argument
2636 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_hba_attr_hdw_ver()
2637 lpfc_vpd_t *vp = &phba->vpd; in lpfc_fdmi_hba_attr_hdw_ver()
2640 snprintf(buf, sizeof(buf), "%08x", vp->rev.biuRev); in lpfc_fdmi_hba_attr_hdw_ver()
2642 return lpfc_fdmi_set_attr_string(attr, RHBA_HARDWARE_VERSION, buf); in lpfc_fdmi_hba_attr_hdw_ver()
2646 lpfc_fdmi_hba_attr_drvr_ver(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_drvr_ver() argument
2648 return lpfc_fdmi_set_attr_string(attr, RHBA_DRIVER_VERSION, in lpfc_fdmi_hba_attr_drvr_ver()
2653 lpfc_fdmi_hba_attr_rom_ver(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_rom_ver() argument
2655 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_hba_attr_rom_ver()
2658 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_fdmi_hba_attr_rom_ver()
2661 return lpfc_fdmi_set_attr_string(attr, RHBA_OPTION_ROM_VERSION, in lpfc_fdmi_hba_attr_rom_ver()
2665 return lpfc_fdmi_set_attr_string(attr, RHBA_OPTION_ROM_VERSION, in lpfc_fdmi_hba_attr_rom_ver()
2666 phba->OptionROMVersion); in lpfc_fdmi_hba_attr_rom_ver()
2670 lpfc_fdmi_hba_attr_fmw_ver(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_fmw_ver() argument
2672 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_hba_attr_fmw_ver()
2677 return lpfc_fdmi_set_attr_string(attr, RHBA_FIRMWARE_VERSION, buf); in lpfc_fdmi_hba_attr_fmw_ver()
2681 lpfc_fdmi_hba_attr_os_ver(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_os_ver() argument
2686 init_utsname()->sysname, in lpfc_fdmi_hba_attr_os_ver()
2687 init_utsname()->release, in lpfc_fdmi_hba_attr_os_ver()
2688 init_utsname()->version); in lpfc_fdmi_hba_attr_os_ver()
2690 return lpfc_fdmi_set_attr_string(attr, RHBA_OS_NAME_VERSION, buf); in lpfc_fdmi_hba_attr_os_ver()
2694 lpfc_fdmi_hba_attr_ct_len(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_ct_len() argument
2696 return lpfc_fdmi_set_attr_u32(attr, RHBA_MAX_CT_PAYLOAD_LEN, in lpfc_fdmi_hba_attr_ct_len()
2701 lpfc_fdmi_hba_attr_symbolic_name(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_symbolic_name() argument
2707 return lpfc_fdmi_set_attr_string(attr, RHBA_SYM_NODENAME, buf); in lpfc_fdmi_hba_attr_symbolic_name()
2711 lpfc_fdmi_hba_attr_vendor_info(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_vendor_info() argument
2713 return lpfc_fdmi_set_attr_u32(attr, RHBA_VENDOR_INFO, 0); in lpfc_fdmi_hba_attr_vendor_info()
2717 lpfc_fdmi_hba_attr_num_ports(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_num_ports() argument
2720 return lpfc_fdmi_set_attr_u32(attr, RHBA_NUM_PORTS, 1); in lpfc_fdmi_hba_attr_num_ports()
2724 lpfc_fdmi_hba_attr_fabric_wwnn(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_fabric_wwnn() argument
2726 return lpfc_fdmi_set_attr_wwn(attr, RHBA_FABRIC_WWNN, in lpfc_fdmi_hba_attr_fabric_wwnn()
2727 &vport->fabric_nodename); in lpfc_fdmi_hba_attr_fabric_wwnn()
2731 lpfc_fdmi_hba_attr_bios_ver(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_bios_ver() argument
2733 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_hba_attr_bios_ver()
2735 return lpfc_fdmi_set_attr_string(attr, RHBA_BIOS_VERSION, in lpfc_fdmi_hba_attr_bios_ver()
2736 phba->BIOSVersion); in lpfc_fdmi_hba_attr_bios_ver()
2740 lpfc_fdmi_hba_attr_bios_state(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_bios_state() argument
2743 return lpfc_fdmi_set_attr_u32(attr, RHBA_BIOS_STATE, 0); in lpfc_fdmi_hba_attr_bios_state()
2747 lpfc_fdmi_hba_attr_vendor_id(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_hba_attr_vendor_id() argument
2749 return lpfc_fdmi_set_attr_string(attr, RHBA_VENDOR_ID, "EMULEX"); in lpfc_fdmi_hba_attr_vendor_id()
2757 lpfc_fdmi_port_attr_fc4type(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_fc4type() argument
2759 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_port_attr_fc4type()
2765 if ((phba->sli_rev == LPFC_SLI_REV4) && (vport == phba->pport) && in lpfc_fdmi_port_attr_fc4type()
2766 phba->sli4_hba.pc_sli4_params.nvme) in lpfc_fdmi_port_attr_fc4type()
2769 return lpfc_fdmi_set_attr_fc4types(attr, RPRT_SUPPORTED_FC4_TYPES, in lpfc_fdmi_port_attr_fc4type()
2774 lpfc_fdmi_port_attr_support_speed(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_support_speed() argument
2776 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_port_attr_support_speed()
2779 u8 i, cnt; in lpfc_fdmi_port_attr_support_speed() local
2781 if (!test_bit(HBA_FCOE_MODE, &phba->hba_flag)) { in lpfc_fdmi_port_attr_support_speed()
2782 cnt = 0; in lpfc_fdmi_port_attr_support_speed()
2783 if (phba->sli_rev == LPFC_SLI_REV4) { in lpfc_fdmi_port_attr_support_speed()
2784 tcfg = phba->sli4_hba.conf_trunk; in lpfc_fdmi_port_attr_support_speed()
2787 cnt++; in lpfc_fdmi_port_attr_support_speed()
2790 if (cnt > 2) { /* 4 lane trunk group */ in lpfc_fdmi_port_attr_support_speed()
2791 if (phba->lmt & LMT_64Gb) in lpfc_fdmi_port_attr_support_speed()
2793 if (phba->lmt & LMT_32Gb) in lpfc_fdmi_port_attr_support_speed()
2795 if (phba->lmt & LMT_16Gb) in lpfc_fdmi_port_attr_support_speed()
2797 } else if (cnt) { /* 2 lane trunk group */ in lpfc_fdmi_port_attr_support_speed()
2798 if (phba->lmt & LMT_128Gb) in lpfc_fdmi_port_attr_support_speed()
2800 if (phba->lmt & LMT_64Gb) in lpfc_fdmi_port_attr_support_speed()
2802 if (phba->lmt & LMT_32Gb) in lpfc_fdmi_port_attr_support_speed()
2804 if (phba->lmt & LMT_16Gb) in lpfc_fdmi_port_attr_support_speed()
2807 if (phba->lmt & LMT_256Gb) in lpfc_fdmi_port_attr_support_speed()
2809 if (phba->lmt & LMT_128Gb) in lpfc_fdmi_port_attr_support_speed()
2811 if (phba->lmt & LMT_64Gb) in lpfc_fdmi_port_attr_support_speed()
2813 if (phba->lmt & LMT_32Gb) in lpfc_fdmi_port_attr_support_speed()
2815 if (phba->lmt & LMT_16Gb) in lpfc_fdmi_port_attr_support_speed()
2817 if (phba->lmt & LMT_10Gb) in lpfc_fdmi_port_attr_support_speed()
2819 if (phba->lmt & LMT_8Gb) in lpfc_fdmi_port_attr_support_speed()
2821 if (phba->lmt & LMT_4Gb) in lpfc_fdmi_port_attr_support_speed()
2823 if (phba->lmt & LMT_2Gb) in lpfc_fdmi_port_attr_support_speed()
2825 if (phba->lmt & LMT_1Gb) in lpfc_fdmi_port_attr_support_speed()
2830 switch (phba->fc_linkspeed) { in lpfc_fdmi_port_attr_support_speed()
2846 return lpfc_fdmi_set_attr_u32(attr, RPRT_SUPPORTED_SPEED, speeds); in lpfc_fdmi_port_attr_support_speed()
2850 lpfc_fdmi_port_attr_speed(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_speed() argument
2852 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_port_attr_speed()
2855 if (!test_bit(HBA_FCOE_MODE, &phba->hba_flag)) { in lpfc_fdmi_port_attr_speed()
2856 switch (phba->fc_linkspeed) { in lpfc_fdmi_port_attr_speed()
2892 switch (phba->fc_linkspeed) { in lpfc_fdmi_port_attr_speed()
2911 return lpfc_fdmi_set_attr_u32(attr, RPRT_PORT_SPEED, speeds); in lpfc_fdmi_port_attr_speed()
2915 lpfc_fdmi_port_attr_max_frame(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_max_frame() argument
2917 struct serv_parm *hsp = (struct serv_parm *)&vport->fc_sparam; in lpfc_fdmi_port_attr_max_frame()
2919 return lpfc_fdmi_set_attr_u32(attr, RPRT_MAX_FRAME_SIZE, in lpfc_fdmi_port_attr_max_frame()
2920 (((uint32_t)hsp->cmn.bbRcvSizeMsb & 0x0F) << 8) | in lpfc_fdmi_port_attr_max_frame()
2921 (uint32_t)hsp->cmn.bbRcvSizeLsb); in lpfc_fdmi_port_attr_max_frame()
2925 lpfc_fdmi_port_attr_os_devname(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_os_devname() argument
2931 shost->host_no); in lpfc_fdmi_port_attr_os_devname()
2933 return lpfc_fdmi_set_attr_string(attr, RPRT_OS_DEVICE_NAME, buf); in lpfc_fdmi_port_attr_os_devname()
2937 lpfc_fdmi_port_attr_host_name(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_host_name() argument
2941 scnprintf(buf, sizeof(buf), "%s", vport->phba->os_host_name); in lpfc_fdmi_port_attr_host_name()
2943 return lpfc_fdmi_set_attr_string(attr, RPRT_HOST_NAME, buf); in lpfc_fdmi_port_attr_host_name()
2947 lpfc_fdmi_port_attr_wwnn(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_wwnn() argument
2949 return lpfc_fdmi_set_attr_wwn(attr, RPRT_NODENAME, in lpfc_fdmi_port_attr_wwnn()
2950 &vport->fc_sparam.nodeName); in lpfc_fdmi_port_attr_wwnn()
2954 lpfc_fdmi_port_attr_wwpn(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_wwpn() argument
2956 return lpfc_fdmi_set_attr_wwn(attr, RPRT_PORTNAME, in lpfc_fdmi_port_attr_wwpn()
2957 &vport->fc_sparam.portName); in lpfc_fdmi_port_attr_wwpn()
2961 lpfc_fdmi_port_attr_symbolic_name(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_symbolic_name() argument
2967 return lpfc_fdmi_set_attr_string(attr, RPRT_SYM_PORTNAME, buf); in lpfc_fdmi_port_attr_symbolic_name()
2971 lpfc_fdmi_port_attr_port_type(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_port_type() argument
2973 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_port_attr_port_type()
2975 return lpfc_fdmi_set_attr_u32(attr, RPRT_PORT_TYPE, in lpfc_fdmi_port_attr_port_type()
2976 (phba->fc_topology == LPFC_TOPOLOGY_LOOP) ? in lpfc_fdmi_port_attr_port_type()
2982 lpfc_fdmi_port_attr_class(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_class() argument
2984 return lpfc_fdmi_set_attr_u32(attr, RPRT_SUPPORTED_CLASS, in lpfc_fdmi_port_attr_class()
2989 lpfc_fdmi_port_attr_fabric_wwpn(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_fabric_wwpn() argument
2991 return lpfc_fdmi_set_attr_wwn(attr, RPRT_FABRICNAME, in lpfc_fdmi_port_attr_fabric_wwpn()
2992 &vport->fabric_portname); in lpfc_fdmi_port_attr_fabric_wwpn()
2996 lpfc_fdmi_port_attr_active_fc4type(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_active_fc4type() argument
2998 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_port_attr_active_fc4type()
3004 if (vport == phba->pport && in lpfc_fdmi_port_attr_active_fc4type()
3005 phba->cfg_enable_fc4_type & LPFC_ENABLE_NVME) in lpfc_fdmi_port_attr_active_fc4type()
3008 return lpfc_fdmi_set_attr_fc4types(attr, RPRT_ACTIVE_FC4_TYPES, in lpfc_fdmi_port_attr_active_fc4type()
3013 lpfc_fdmi_port_attr_port_state(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_port_state() argument
3015 return lpfc_fdmi_set_attr_u32(attr, RPRT_PORT_STATE, in lpfc_fdmi_port_attr_port_state()
3020 lpfc_fdmi_port_attr_num_disc(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_num_disc() argument
3022 vport->fdmi_num_disc = lpfc_find_map_node(vport); in lpfc_fdmi_port_attr_num_disc()
3024 return lpfc_fdmi_set_attr_u32(attr, RPRT_DISC_PORT, in lpfc_fdmi_port_attr_num_disc()
3025 vport->fdmi_num_disc); in lpfc_fdmi_port_attr_num_disc()
3029 lpfc_fdmi_port_attr_nportid(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_port_attr_nportid() argument
3031 return lpfc_fdmi_set_attr_u32(attr, RPRT_PORT_ID, vport->fc_myDID); in lpfc_fdmi_port_attr_nportid()
3035 lpfc_fdmi_smart_attr_service(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_smart_attr_service() argument
3037 return lpfc_fdmi_set_attr_string(attr, RPRT_SMART_SERVICE, in lpfc_fdmi_smart_attr_service()
3042 lpfc_fdmi_smart_attr_guid(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_smart_attr_guid() argument
3044 return lpfc_fdmi_set_attr_fullwwn(attr, RPRT_SMART_GUID, in lpfc_fdmi_smart_attr_guid()
3045 &vport->fc_sparam.nodeName, in lpfc_fdmi_smart_attr_guid()
3046 &vport->fc_sparam.portName); in lpfc_fdmi_smart_attr_guid()
3050 lpfc_fdmi_smart_attr_version(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_smart_attr_version() argument
3052 return lpfc_fdmi_set_attr_string(attr, RPRT_SMART_VERSION, in lpfc_fdmi_smart_attr_version()
3057 lpfc_fdmi_smart_attr_model(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_smart_attr_model() argument
3059 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_smart_attr_model()
3061 return lpfc_fdmi_set_attr_string(attr, RPRT_SMART_MODEL, in lpfc_fdmi_smart_attr_model()
3062 phba->ModelName); in lpfc_fdmi_smart_attr_model()
3066 lpfc_fdmi_smart_attr_port_info(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_smart_attr_port_info() argument
3070 return lpfc_fdmi_set_attr_u32(attr, RPRT_SMART_PORT_INFO, in lpfc_fdmi_smart_attr_port_info()
3071 (vport->vpi) ? 2 /* NPIV */ : 1 /* Physical */); in lpfc_fdmi_smart_attr_port_info()
3075 lpfc_fdmi_smart_attr_qos(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_smart_attr_qos() argument
3077 return lpfc_fdmi_set_attr_u32(attr, RPRT_SMART_QOS, 0); in lpfc_fdmi_smart_attr_qos()
3081 lpfc_fdmi_smart_attr_security(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_smart_attr_security() argument
3083 return lpfc_fdmi_set_attr_u32(attr, RPRT_SMART_SECURITY, 1); in lpfc_fdmi_smart_attr_security()
3087 lpfc_fdmi_vendor_attr_mi(struct lpfc_vport *vport, void *attr) in lpfc_fdmi_vendor_attr_mi() argument
3089 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_vendor_attr_mi()
3092 sprintf(buf, "ELXE2EM:%04d", phba->sli4_hba.pc_sli4_params.mi_ver); in lpfc_fdmi_vendor_attr_mi()
3094 return lpfc_fdmi_set_attr_string(attr, RPRT_VENDOR_MI, buf); in lpfc_fdmi_vendor_attr_mi()
3152 * lpfc_fdmi_cmd - Build and send a FDMI cmd to the specified NPort
3164 struct lpfc_hba *phba = vport->phba; in lpfc_fdmi_cmd()
3191 rq->virt = lpfc_mbuf_alloc(phba, 0, &rq->phys); in lpfc_fdmi_cmd()
3192 if (!rq->virt) in lpfc_fdmi_cmd()
3200 rsp->virt = lpfc_mbuf_alloc(phba, 0, &rsp->phys); in lpfc_fdmi_cmd()
3201 if (!rsp->virt) in lpfc_fdmi_cmd()
3204 INIT_LIST_HEAD(&rq->list); in lpfc_fdmi_cmd()
3205 INIT_LIST_HEAD(&rsp->list); in lpfc_fdmi_cmd()
3207 /* mbuf buffers are 1K in length - aka LPFC_BPL_SIZE */ in lpfc_fdmi_cmd()
3208 memset(rq->virt, 0, LPFC_BPL_SIZE); in lpfc_fdmi_cmd()
3214 cmdcode, new_mask, vport->fdmi_port_mask, in lpfc_fdmi_cmd()
3215 vport->fc_flag, vport->port_state); in lpfc_fdmi_cmd()
3217 CtReq = (struct lpfc_sli_ct_request *)rq->virt; in lpfc_fdmi_cmd()
3220 CtReq->RevisionId.bits.Revision = SLI_CT_REVISION; in lpfc_fdmi_cmd()
3221 CtReq->RevisionId.bits.InId = 0; in lpfc_fdmi_cmd()
3223 CtReq->FsType = SLI_CT_MANAGEMENT_SERVICE; in lpfc_fdmi_cmd()
3224 CtReq->FsSubType = SLI_CT_FDMI_Subtypes; in lpfc_fdmi_cmd()
3226 CtReq->CommandResponse.bits.CmdRsp = cpu_to_be16(cmdcode); in lpfc_fdmi_cmd()
3234 rh = (struct lpfc_fdmi_reg_hba *)&CtReq->un; in lpfc_fdmi_cmd()
3236 memcpy(&rh->hi.PortName, &phba->pport->fc_sparam.portName, in lpfc_fdmi_cmd()
3243 rh->rpl.EntryCnt = cpu_to_be32(1); in lpfc_fdmi_cmd()
3244 memcpy(&rh->rpl.pe.PortName, in lpfc_fdmi_cmd()
3245 &phba->pport->fc_sparam.portName, in lpfc_fdmi_cmd()
3251 ab->EntryCnt = 0; in lpfc_fdmi_cmd()
3258 mask = vport->fdmi_hba_mask; in lpfc_fdmi_cmd()
3266 ab->EntryCnt++; in lpfc_fdmi_cmd()
3271 (LPFC_BPL_SIZE - LPFC_CT_PREAMBLE)) in lpfc_fdmi_cmd()
3278 ab->EntryCnt = cpu_to_be32(ab->EntryCnt); in lpfc_fdmi_cmd()
3280 size += GID_REQUEST_SZ - 4; in lpfc_fdmi_cmd()
3284 if (vport->port_type != LPFC_PHYSICAL_PORT) { in lpfc_fdmi_cmd()
3285 ndlp = lpfc_findnode_did(phba->pport, FDMI_DID); in lpfc_fdmi_cmd()
3292 base = (struct lpfc_fdmi_reg_portattr *)&CtReq->un; in lpfc_fdmi_cmd()
3297 memcpy(&rh->hi.PortName, in lpfc_fdmi_cmd()
3298 &phba->pport->fc_sparam.portName, in lpfc_fdmi_cmd()
3307 memcpy((uint8_t *)&pab->PortName, in lpfc_fdmi_cmd()
3308 (uint8_t *)&vport->fc_sparam.portName, in lpfc_fdmi_cmd()
3310 pab->ab.EntryCnt = 0; in lpfc_fdmi_cmd()
3311 /* add length of name and EntryCnt field */ in lpfc_fdmi_cmd()
3318 mask = vport->fdmi_port_mask; in lpfc_fdmi_cmd()
3326 pab->ab.EntryCnt++; in lpfc_fdmi_cmd()
3331 (LPFC_BPL_SIZE - LPFC_CT_PREAMBLE)) in lpfc_fdmi_cmd()
3338 pab->ab.EntryCnt = cpu_to_be32(pab->ab.EntryCnt); in lpfc_fdmi_cmd()
3339 size += GID_REQUEST_SZ - 4; in lpfc_fdmi_cmd()
3348 pe = (struct lpfc_fdmi_port_entry *)&CtReq->un; in lpfc_fdmi_cmd()
3349 memcpy((uint8_t *)&pe->PortName, in lpfc_fdmi_cmd()
3350 (uint8_t *)&vport->fc_sparam.portName, in lpfc_fdmi_cmd()
3352 size = GID_REQUEST_SZ - 4 + sizeof(struct lpfc_name); in lpfc_fdmi_cmd()
3360 if (vport->port_type != LPFC_PHYSICAL_PORT) { in lpfc_fdmi_cmd()
3361 ndlp = lpfc_findnode_did(phba->pport, FDMI_DID); in lpfc_fdmi_cmd()
3367 pe = (struct lpfc_fdmi_port_entry *)&CtReq->un; in lpfc_fdmi_cmd()
3368 memcpy((uint8_t *)&pe->PortName, in lpfc_fdmi_cmd()
3369 (uint8_t *)&vport->fc_sparam.portName, in lpfc_fdmi_cmd()
3371 size = GID_REQUEST_SZ - 4 + sizeof(struct lpfc_name); in lpfc_fdmi_cmd()
3374 size = GID_REQUEST_SZ - 4; in lpfc_fdmi_cmd()
3382 CtReq->CommandResponse.bits.Size = cpu_to_be16(rsp_size); in lpfc_fdmi_cmd()
3384 bde = (struct ulp_bde64_le *)rsp->virt; in lpfc_fdmi_cmd()
3385 bde->addr_high = cpu_to_le32(putPaddrHigh(rq->phys)); in lpfc_fdmi_cmd()
3386 bde->addr_low = cpu_to_le32(putPaddrLow(rq->phys)); in lpfc_fdmi_cmd()
3387 bde->type_size = cpu_to_le32(ULP_BDE64_TYPE_BDE_64 << in lpfc_fdmi_cmd()
3389 bde->type_size |= cpu_to_le32(size); in lpfc_fdmi_cmd()
3399 lpfc_mbuf_free(phba, rsp->virt, rsp->phys); in lpfc_fdmi_cmd()
3403 lpfc_mbuf_free(phba, rq->virt, rq->phys); in lpfc_fdmi_cmd()
3415 * lpfc_delayed_disc_tmo - Timeout handler for delayed discovery timer.
3426 struct lpfc_hba *phba = vport->phba; in lpfc_delayed_disc_tmo()
3430 spin_lock_irqsave(&vport->work_port_lock, iflag); in lpfc_delayed_disc_tmo()
3431 tmo_posted = vport->work_port_events & WORKER_DELAYED_DISC_TMO; in lpfc_delayed_disc_tmo()
3433 vport->work_port_events |= WORKER_DELAYED_DISC_TMO; in lpfc_delayed_disc_tmo()
3434 spin_unlock_irqrestore(&vport->work_port_lock, iflag); in lpfc_delayed_disc_tmo()
3442 * lpfc_delayed_disc_timeout_handler - Function called by worker thread to
3451 if (!test_and_clear_bit(FC_DISC_DELAYED, &vport->fc_flag)) in lpfc_delayed_disc_timeout_handler()
3454 lpfc_do_scr_ns_plogi(vport->phba, vport); in lpfc_delayed_disc_timeout_handler()
3460 struct lpfc_sli *psli = &phba->sli; in lpfc_decode_firmware_rev()
3461 lpfc_vpd_t *vp = &phba->vpd; in lpfc_decode_firmware_rev()
3467 if (phba->sli_rev == LPFC_SLI_REV4) in lpfc_decode_firmware_rev()
3468 snprintf(fwrevision, FW_REV_STR_SIZE, "%s", vp->rev.opFwName); in lpfc_decode_firmware_rev()
3469 else if (vp->rev.rBit) { in lpfc_decode_firmware_rev()
3470 if (psli->sli_flag & LPFC_SLI_ACTIVE) in lpfc_decode_firmware_rev()
3471 rev = vp->rev.sli2FwRev; in lpfc_decode_firmware_rev()
3473 rev = vp->rev.sli1FwRev; in lpfc_decode_firmware_rev()
3499 if (psli->sli_flag & LPFC_SLI_ACTIVE) in lpfc_decode_firmware_rev()
3500 fwname = vp->rev.sli2FwName; in lpfc_decode_firmware_rev()
3502 fwname = vp->rev.sli1FwName; in lpfc_decode_firmware_rev()
3530 rev = vp->rev.smFwRev; in lpfc_decode_firmware_rev()
3547 struct lpfc_vport *vport = cmdiocb->vport; in lpfc_cmpl_ct_cmd_vmid()
3548 struct lpfc_dmabuf *inp = cmdiocb->cmd_dmabuf; in lpfc_cmpl_ct_cmd_vmid()
3549 struct lpfc_dmabuf *outp = cmdiocb->rsp_dmabuf; in lpfc_cmpl_ct_cmd_vmid()
3550 struct lpfc_sli_ct_request *ctcmd = inp->virt; in lpfc_cmpl_ct_cmd_vmid()
3551 struct lpfc_sli_ct_request *ctrsp = outp->virt; in lpfc_cmpl_ct_cmd_vmid()
3552 __be16 rsp = ctrsp->CommandResponse.bits.CmdRsp; in lpfc_cmpl_ct_cmd_vmid()
3554 struct lpfc_nodelist *ndlp = cmdiocb->ndlp; in lpfc_cmpl_ct_cmd_vmid()
3557 u8 *data = outp->virt; in lpfc_cmpl_ct_cmd_vmid()
3560 cmd = be16_to_cpu(ctcmd->CommandResponse.bits.CmdRsp); in lpfc_cmpl_ct_cmd_vmid()
3573 cmd, ctrsp->ReasonCode, in lpfc_cmpl_ct_cmd_vmid()
3574 ctrsp->Explanation); in lpfc_cmpl_ct_cmd_vmid()
3576 (ctrsp->ReasonCode != SLI_CT_UNABLE_TO_PERFORM_REQ) || in lpfc_cmpl_ct_cmd_vmid()
3577 (ctrsp->Explanation != SLI_CT_APP_ID_NOT_AVAILABLE)) { in lpfc_cmpl_ct_cmd_vmid()
3581 &vport->load_flag); in lpfc_cmpl_ct_cmd_vmid()
3591 "len %d\n", be32_to_cpu(app->app_id), in lpfc_cmpl_ct_cmd_vmid()
3592 be32_to_cpu(app->port_id), in lpfc_cmpl_ct_cmd_vmid()
3593 app->obj.entity_id_len); in lpfc_cmpl_ct_cmd_vmid()
3595 if (app->obj.entity_id_len == 0 || app->port_id == 0) in lpfc_cmpl_ct_cmd_vmid()
3598 hash = lpfc_vmid_hash_fn(app->obj.entity_id, in lpfc_cmpl_ct_cmd_vmid()
3599 app->obj.entity_id_len); in lpfc_cmpl_ct_cmd_vmid()
3601 app->obj.entity_id); in lpfc_cmpl_ct_cmd_vmid()
3603 write_lock(&vport->vmid_lock); in lpfc_cmpl_ct_cmd_vmid()
3604 vmp->un.app_id = be32_to_cpu(app->app_id); in lpfc_cmpl_ct_cmd_vmid()
3605 vmp->flag |= LPFC_VMID_REGISTERED; in lpfc_cmpl_ct_cmd_vmid()
3606 vmp->flag &= ~LPFC_VMID_REQ_REGISTER; in lpfc_cmpl_ct_cmd_vmid()
3607 write_unlock(&vport->vmid_lock); in lpfc_cmpl_ct_cmd_vmid()
3609 vport->vmid_flag |= LPFC_VMID_IN_USE; in lpfc_cmpl_ct_cmd_vmid()
3613 app->obj.entity_id, hash); in lpfc_cmpl_ct_cmd_vmid()
3620 be32_to_cpu(app->app_id), in lpfc_cmpl_ct_cmd_vmid()
3621 be32_to_cpu(app->port_id)); in lpfc_cmpl_ct_cmd_vmid()
3626 read_lock(&vport->vmid_lock); in lpfc_cmpl_ct_cmd_vmid()
3627 for (i = 0; i < phba->cfg_max_vmid; i++) { in lpfc_cmpl_ct_cmd_vmid()
3628 vmp = &vport->vmid[i]; in lpfc_cmpl_ct_cmd_vmid()
3629 if (vmp->flag != LPFC_VMID_SLOT_FREE) in lpfc_cmpl_ct_cmd_vmid()
3632 read_unlock(&vport->vmid_lock); in lpfc_cmpl_ct_cmd_vmid()
3634 if (!hash_empty(vport->hash_table)) in lpfc_cmpl_ct_cmd_vmid()
3635 hash_for_each(vport->hash_table, bucket, cur, hnode) in lpfc_cmpl_ct_cmd_vmid()
3636 hash_del(&cur->hnode); in lpfc_cmpl_ct_cmd_vmid()
3637 set_bit(FC_ALLOW_VMID, &vport->load_flag); in lpfc_cmpl_ct_cmd_vmid()
3649 * lpfc_vmid_cmd - Build and send a FDMI cmd to the specified NPort
3660 struct lpfc_hba *phba = vport->phba; in lpfc_vmid_cmd()
3676 if (!ndlp || ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) in lpfc_vmid_cmd()
3687 mp->virt = lpfc_mbuf_alloc(phba, 0, &mp->phys); in lpfc_vmid_cmd()
3688 if (!mp->virt) in lpfc_vmid_cmd()
3696 bmp->virt = lpfc_mbuf_alloc(phba, 0, &bmp->phys); in lpfc_vmid_cmd()
3697 if (!bmp->virt) in lpfc_vmid_cmd()
3700 INIT_LIST_HEAD(&mp->list); in lpfc_vmid_cmd()
3701 INIT_LIST_HEAD(&bmp->list); in lpfc_vmid_cmd()
3705 vport->fc_flag, vport->port_state, cmdcode); in lpfc_vmid_cmd()
3706 ctreq = (struct lpfc_sli_ct_request *)mp->virt; in lpfc_vmid_cmd()
3707 data = mp->virt; in lpfc_vmid_cmd()
3710 ctreq->RevisionId.bits.Revision = SLI_CT_REVISION; in lpfc_vmid_cmd()
3711 ctreq->RevisionId.bits.InId = 0; in lpfc_vmid_cmd()
3713 ctreq->FsType = SLI_CT_MANAGEMENT_SERVICE; in lpfc_vmid_cmd()
3714 ctreq->FsSubType = SLI_CT_APP_SEV_Subtypes; in lpfc_vmid_cmd()
3716 ctreq->CommandResponse.bits.CmdRsp = cpu_to_be16(cmdcode); in lpfc_vmid_cmd()
3723 "1329 RAPP_IDENT for %s\n", vmid->host_vmid); in lpfc_vmid_cmd()
3724 ctreq->un.PortID = cpu_to_be32(vport->fc_myDID); in lpfc_vmid_cmd()
3727 rap->no_of_objects = cpu_to_be32(1); in lpfc_vmid_cmd()
3728 rap->obj[0].entity_id_len = vmid->vmid_len; in lpfc_vmid_cmd()
3729 memcpy(rap->obj[0].entity_id, vmid->host_vmid, vmid->vmid_len); in lpfc_vmid_cmd()
3731 struct_size(rap, obj, be32_to_cpu(rap->no_of_objects)); in lpfc_vmid_cmd()
3736 ctreq->un.PortID = cpu_to_be32(vport->fc_myDID); in lpfc_vmid_cmd()
3742 "1469 DAPP_IDENT for %s\n", vmid->host_vmid); in lpfc_vmid_cmd()
3743 ctreq->un.PortID = cpu_to_be32(vport->fc_myDID); in lpfc_vmid_cmd()
3746 dap->no_of_objects = cpu_to_be32(1); in lpfc_vmid_cmd()
3747 dap->obj[0].entity_id_len = vmid->vmid_len; in lpfc_vmid_cmd()
3748 memcpy(dap->obj[0].entity_id, vmid->host_vmid, vmid->vmid_len); in lpfc_vmid_cmd()
3750 struct_size(dap, obj, be32_to_cpu(dap->no_of_objects)); in lpfc_vmid_cmd()
3751 write_lock(&vport->vmid_lock); in lpfc_vmid_cmd()
3752 vmid->flag &= ~LPFC_VMID_REGISTERED; in lpfc_vmid_cmd()
3753 write_unlock(&vport->vmid_lock); in lpfc_vmid_cmd()
3758 ctreq->un.PortID = cpu_to_be32(vport->fc_myDID); in lpfc_vmid_cmd()
3769 ctreq->CommandResponse.bits.Size = cpu_to_be16(rsp_size); in lpfc_vmid_cmd()
3771 bpl = (struct ulp_bde64 *)bmp->virt; in lpfc_vmid_cmd()
3772 bpl->addrHigh = putPaddrHigh(mp->phys); in lpfc_vmid_cmd()
3773 bpl->addrLow = putPaddrLow(mp->phys); in lpfc_vmid_cmd()
3774 bpl->tus.f.bdeFlags = 0; in lpfc_vmid_cmd()
3775 bpl->tus.f.bdeSize = size; in lpfc_vmid_cmd()
3784 lpfc_mbuf_free(phba, bmp->virt, bmp->phys); in lpfc_vmid_cmd()
3788 lpfc_mbuf_free(phba, mp->virt, mp->phys); in lpfc_vmid_cmd()
3796 return -EIO; in lpfc_vmid_cmd()