Skip to content

Commit 9d41f08

Browse files
jsmart-ghmartinkpetersen
authored andcommitted
scsi: lpfc: SLI path split: Refactor FDISC paths
This patch refactors the FDISC paths to use SLI-4 as the primary interface: - Conversion away from using SLI-3 iocb structures to set/access fields in common routines. Use the new generic get/set routines that were added. This move changes code from indirect structure references to using local variables with the generic routines. - Refactor routines when setting non-generic fields, to have both SLI3 and SLI4 specific sections. This replaces the set-as-SLI3 then translate to SLI4 behavior of the past. Link: https://lore.kernel.org/r/20220225022308.16486-10-jsmart2021@gmail.com Co-developed-by: Justin Tee <justin.tee@broadcom.com> Signed-off-by: Justin Tee <justin.tee@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent e0367df commit 9d41f08

File tree

1 file changed

+29
-18
lines changed

1 file changed

+29
-18
lines changed

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11153,6 +11153,7 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1115311153
{
1115411154
struct lpfc_hba *phba = vport->phba;
1115511155
IOCB_t *icmd;
11156+
union lpfc_wqe128 *wqe = NULL;
1115611157
struct lpfc_iocbq *elsiocb;
1115711158
struct serv_parm *sp;
1115811159
uint8_t *pcmd;
@@ -11172,15 +11173,14 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1117211173
return 1;
1117311174
}
1117411175

11175-
icmd = &elsiocb->iocb;
11176-
icmd->un.elsreq64.myID = 0;
11177-
icmd->un.elsreq64.fl = 1;
11178-
11179-
/*
11180-
* SLI3 ports require a different context type value than SLI4.
11181-
* Catch SLI3 ports here and override the prep.
11182-
*/
11183-
if (phba->sli_rev == LPFC_SLI_REV3) {
11176+
if (phba->sli_rev == LPFC_SLI_REV4) {
11177+
wqe = &elsiocb->wqe;
11178+
bf_set(els_req64_sid, &wqe->els_req, 0);
11179+
bf_set(els_req64_sp, &wqe->els_req, 1);
11180+
} else {
11181+
icmd = &elsiocb->iocb;
11182+
icmd->un.elsreq64.myID = 0;
11183+
icmd->un.elsreq64.fl = 1;
1118411184
icmd->ulpCt_h = 1;
1118511185
icmd->ulpCt_l = 0;
1118611186
}
@@ -11218,14 +11218,11 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1121811218
did, 0, 0);
1121911219

1122011220
elsiocb->context1 = lpfc_nlp_get(ndlp);
11221-
if (!elsiocb->context1) {
11222-
lpfc_els_free_iocb(phba, elsiocb);
11221+
if (!elsiocb->context1)
1122311222
goto err_out;
11224-
}
1122511223

1122611224
rc = lpfc_issue_fabric_iocb(phba, elsiocb);
1122711225
if (rc == IOCB_ERROR) {
11228-
lpfc_els_free_iocb(phba, elsiocb);
1122911226
lpfc_nlp_put(ndlp);
1123011227
goto err_out;
1123111228
}
@@ -11234,6 +11231,7 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1123411231
return 0;
1123511232

1123611233
err_out:
11234+
lpfc_els_free_iocb(phba, elsiocb);
1123711235
lpfc_vport_set_state(vport, FC_VPORT_FAILED);
1123811236
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
1123911237
"0256 Issue FDISC: Cannot send IOCB\n");
@@ -11262,23 +11260,36 @@ lpfc_cmpl_els_npiv_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
1126211260
IOCB_t *irsp;
1126311261
struct lpfc_nodelist *ndlp;
1126411262
struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
11263+
u32 ulp_status, ulp_word4, did, tmo;
1126511264

1126611265
ndlp = (struct lpfc_nodelist *)cmdiocb->context1;
11267-
irsp = &rspiocb->iocb;
11266+
11267+
ulp_status = get_job_ulpstatus(phba, rspiocb);
11268+
ulp_word4 = get_job_word4(phba, rspiocb);
11269+
11270+
if (phba->sli_rev == LPFC_SLI_REV4) {
11271+
did = get_job_els_rsp64_did(phba, cmdiocb);
11272+
tmo = get_wqe_tmo(cmdiocb);
11273+
} else {
11274+
irsp = &rspiocb->iocb;
11275+
did = get_job_els_rsp64_did(phba, rspiocb);
11276+
tmo = irsp->ulpTimeout;
11277+
}
11278+
1126811279
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD,
1126911280
"LOGO npiv cmpl: status:x%x/x%x did:x%x",
11270-
irsp->ulpStatus, irsp->un.ulpWord[4], irsp->un.rcvels.remoteID);
11281+
ulp_status, ulp_word4, did);
1127111282

1127211283
/* NPIV LOGO completes to NPort <nlp_DID> */
1127311284
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
1127411285
"2928 NPIV LOGO completes to NPort x%x "
1127511286
"Data: x%x x%x x%x x%x x%x x%x x%x\n",
11276-
ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
11277-
irsp->ulpTimeout, vport->num_disc_nodes,
11287+
ndlp->nlp_DID, ulp_status, ulp_word4,
11288+
tmo, vport->num_disc_nodes,
1127811289
kref_read(&ndlp->kref), ndlp->nlp_flag,
1127911290
ndlp->fc4_xpt_flags);
1128011291

11281-
if (irsp->ulpStatus == IOSTAT_SUCCESS) {
11292+
if (ulp_status == IOSTAT_SUCCESS) {
1128211293
spin_lock_irq(shost->host_lock);
1128311294
vport->fc_flag &= ~FC_NDISC_ACTIVE;
1128411295
vport->fc_flag &= ~FC_FABRIC;

0 commit comments

Comments
 (0)