Skip to content

Commit 3bea83b

Browse files
jsmart-ghmartinkpetersen
authored andcommitted
scsi: lpfc: SLI path split: Refactor the RSCN/SCR/RDF/EDC/FARPR paths
This patch refactors the SLI3/SLI4 RSCN/SCR/RDF/EDC/FARPR 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-7-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 cad93a0 commit 3bea83b

1 file changed

Lines changed: 81 additions & 34 deletions

File tree

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 81 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3177,19 +3177,29 @@ lpfc_cmpl_els_cmd(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
31773177
struct lpfc_vport *vport = cmdiocb->vport;
31783178
struct lpfc_nodelist *free_ndlp;
31793179
IOCB_t *irsp;
3180+
u32 ulp_status, ulp_word4, tmo, did, iotag;
31803181

3181-
irsp = &rspiocb->iocb;
3182+
ulp_status = get_job_ulpstatus(phba, rspiocb);
3183+
ulp_word4 = get_job_word4(phba, rspiocb);
3184+
did = get_job_els_rsp64_did(phba, cmdiocb);
3185+
3186+
if (phba->sli_rev == LPFC_SLI_REV4) {
3187+
tmo = get_wqe_tmo(cmdiocb);
3188+
iotag = get_wqe_reqtag(cmdiocb);
3189+
} else {
3190+
irsp = &rspiocb->iocb;
3191+
tmo = irsp->ulpTimeout;
3192+
iotag = irsp->ulpIoTag;
3193+
}
31823194

31833195
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD,
31843196
"ELS cmd cmpl: status:x%x/x%x did:x%x",
3185-
irsp->ulpStatus, irsp->un.ulpWord[4],
3186-
irsp->un.elsreq64.remoteID);
3197+
ulp_status, ulp_word4, did);
31873198

31883199
/* ELS cmd tag <ulpIoTag> completes */
31893200
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
31903201
"0106 ELS cmd tag x%x completes Data: x%x x%x x%x\n",
3191-
irsp->ulpIoTag, irsp->ulpStatus,
3192-
irsp->un.ulpWord[4], irsp->ulpTimeout);
3202+
iotag, ulp_status, ulp_word4, tmo);
31933203

31943204
/* Check to see if link went down during discovery */
31953205
lpfc_els_chk_latt(vport);
@@ -3311,20 +3321,29 @@ lpfc_cmpl_els_disc_cmd(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
33113321
u32 *pdata;
33123322
u32 cmd;
33133323
struct lpfc_nodelist *ndlp = cmdiocb->context1;
3324+
u32 ulp_status, ulp_word4, tmo, did, iotag;
33143325

3315-
irsp = &rspiocb->iocb;
3326+
ulp_status = get_job_ulpstatus(phba, rspiocb);
3327+
ulp_word4 = get_job_word4(phba, rspiocb);
3328+
did = get_job_els_rsp64_did(phba, cmdiocb);
3329+
3330+
if (phba->sli_rev == LPFC_SLI_REV4) {
3331+
tmo = get_wqe_tmo(cmdiocb);
3332+
iotag = get_wqe_reqtag(cmdiocb);
3333+
} else {
3334+
irsp = &rspiocb->iocb;
3335+
tmo = irsp->ulpTimeout;
3336+
iotag = irsp->ulpIoTag;
3337+
}
33163338

33173339
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD,
33183340
"ELS cmd cmpl: status:x%x/x%x did:x%x",
3319-
irsp->ulpStatus, irsp->un.ulpWord[4],
3320-
irsp->un.elsreq64.remoteID);
3341+
ulp_status, ulp_word4, did);
3342+
33213343
/* ELS cmd tag <ulpIoTag> completes */
33223344
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_CGN_MGMT,
3323-
"0217 ELS cmd tag x%x completes Data: x%x x%x x%x "
3324-
"x%x\n",
3325-
irsp->ulpIoTag, irsp->ulpStatus,
3326-
irsp->un.ulpWord[4], irsp->ulpTimeout,
3327-
cmdiocb->retry);
3345+
"0217 ELS cmd tag x%x completes Data: x%x x%x x%x x%x\n",
3346+
iotag, ulp_status, ulp_word4, tmo, cmdiocb->retry);
33283347

33293348
pcmd = (struct lpfc_dmabuf *)cmdiocb->context2;
33303349
if (!pcmd)
@@ -3336,8 +3355,8 @@ lpfc_cmpl_els_disc_cmd(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
33363355
cmd = *pdata;
33373356

33383357
/* Only 1 retry for ELS Timeout only */
3339-
if (irsp->ulpStatus == IOSTAT_LOCAL_REJECT &&
3340-
((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) ==
3358+
if (ulp_status == IOSTAT_LOCAL_REJECT &&
3359+
((ulp_word4 & IOERR_PARAM_MASK) ==
33413360
IOERR_SEQUENCE_TIMEOUT)) {
33423361
cmdiocb->retry++;
33433362
if (cmdiocb->retry <= 1) {
@@ -3362,11 +3381,11 @@ lpfc_cmpl_els_disc_cmd(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
33623381
lpfc_cmpl_els_edc(phba, cmdiocb, rspiocb);
33633382
return;
33643383
}
3365-
if (irsp->ulpStatus) {
3384+
if (ulp_status) {
33663385
/* ELS discovery cmd completes with error */
3367-
lpfc_printf_vlog(vport, KERN_WARNING, LOG_ELS,
3386+
lpfc_printf_vlog(vport, KERN_WARNING, LOG_ELS | LOG_CGN_MGMT,
33683387
"4203 ELS cmd x%x error: x%x x%X\n", cmd,
3369-
irsp->ulpStatus, irsp->un.ulpWord[4]);
3388+
ulp_status, ulp_word4);
33703389
goto out;
33713390
}
33723391

@@ -3391,7 +3410,7 @@ lpfc_cmpl_els_disc_cmd(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
33913410
"4677 Fabric RDF Notification Grant "
33923411
"Data: 0x%08x Reg: %x %x\n",
33933412
be32_to_cpu(
3394-
prdf->reg_d1.desc_tags[i]),
3413+
prdf->reg_d1.desc_tags[i]),
33953414
phba->cgn_reg_signal,
33963415
phba->cgn_reg_fpin);
33973416
}
@@ -3636,7 +3655,7 @@ lpfc_issue_els_farpr(struct lpfc_vport *vport, uint32_t nportid, uint8_t retry)
36363655
}
36373656

36383657
elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
3639-
ndlp->nlp_DID, ELS_CMD_RNID);
3658+
ndlp->nlp_DID, ELS_CMD_FARPR);
36403659
if (!elsiocb)
36413660
return 1;
36423661

@@ -3938,7 +3957,7 @@ static void
39383957
lpfc_cmpl_els_edc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
39393958
struct lpfc_iocbq *rspiocb)
39403959
{
3941-
IOCB_t *irsp;
3960+
IOCB_t *irsp_iocb;
39423961
struct fc_els_edc_resp *edc_rsp;
39433962
struct fc_tlv_desc *tlv;
39443963
struct fc_diag_cg_sig_desc *pcgd;
@@ -3949,20 +3968,31 @@ lpfc_cmpl_els_edc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
39493968
int desc_cnt = 0, bytes_remain;
39503969
bool rcv_cap_desc = false;
39513970
struct lpfc_nodelist *ndlp;
3971+
u32 ulp_status, ulp_word4, tmo, did, iotag;
39523972

3953-
irsp = &rspiocb->iocb;
39543973
ndlp = cmdiocb->context1;
39553974

3975+
ulp_status = get_job_ulpstatus(phba, rspiocb);
3976+
ulp_word4 = get_job_word4(phba, rspiocb);
3977+
did = get_job_els_rsp64_did(phba, rspiocb);
3978+
3979+
if (phba->sli_rev == LPFC_SLI_REV4) {
3980+
tmo = get_wqe_tmo(rspiocb);
3981+
iotag = get_wqe_reqtag(rspiocb);
3982+
} else {
3983+
irsp_iocb = &rspiocb->iocb;
3984+
tmo = irsp_iocb->ulpTimeout;
3985+
iotag = irsp_iocb->ulpIoTag;
3986+
}
3987+
39563988
lpfc_debugfs_disc_trc(phba->pport, LPFC_DISC_TRC_ELS_CMD,
39573989
"EDC cmpl: status:x%x/x%x did:x%x",
3958-
irsp->ulpStatus, irsp->un.ulpWord[4],
3959-
irsp->un.elsreq64.remoteID);
3990+
ulp_status, ulp_word4, did);
39603991

39613992
/* ELS cmd tag <ulpIoTag> completes */
39623993
lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_CGN_MGMT,
39633994
"4201 EDC cmd tag x%x completes Data: x%x x%x x%x\n",
3964-
irsp->ulpIoTag, irsp->ulpStatus,
3965-
irsp->un.ulpWord[4], irsp->ulpTimeout);
3995+
iotag, ulp_status, ulp_word4, tmo);
39663996

39673997
pcmd = (struct lpfc_dmabuf *)cmdiocb->context2;
39683998
if (!pcmd)
@@ -3973,7 +4003,7 @@ lpfc_cmpl_els_edc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
39734003
goto out;
39744004

39754005
/* Need to clear signal values, send features MB and RDF with FPIN. */
3976-
if (irsp->ulpStatus)
4006+
if (ulp_status)
39774007
goto out;
39784008

39794009
prsp = list_get_first(&pcmd->list, struct lpfc_dmabuf, list);
@@ -6268,12 +6298,18 @@ lpfc_els_rsp_echo_acc(struct lpfc_vport *vport, uint8_t *data,
62686298
struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp)
62696299
{
62706300
struct lpfc_hba *phba = vport->phba;
6301+
IOCB_t *icmd, *oldcmd;
6302+
union lpfc_wqe128 *wqe;
62716303
struct lpfc_iocbq *elsiocb;
62726304
uint8_t *pcmd;
62736305
uint16_t cmdsize;
62746306
int rc;
6307+
u32 ulp_context;
62756308

6276-
cmdsize = oldiocb->iocb.unsli3.rcvsli3.acc_len;
6309+
if (phba->sli_rev == LPFC_SLI_REV4)
6310+
cmdsize = oldiocb->wcqe_cmpl.total_data_placed;
6311+
else
6312+
cmdsize = oldiocb->iocb.unsli3.rcvsli3.acc_len;
62776313

62786314
/* The accumulated length can exceed the BPL_SIZE. For
62796315
* now, use this as the limit
@@ -6285,13 +6321,26 @@ lpfc_els_rsp_echo_acc(struct lpfc_vport *vport, uint8_t *data,
62856321
if (!elsiocb)
62866322
return 1;
62876323

6288-
elsiocb->iocb.ulpContext = oldiocb->iocb.ulpContext; /* Xri / rx_id */
6289-
elsiocb->iocb.unsli3.rcvsli3.ox_id = oldiocb->iocb.unsli3.rcvsli3.ox_id;
6324+
if (phba->sli_rev == LPFC_SLI_REV4) {
6325+
wqe = &elsiocb->wqe;
6326+
bf_set(wqe_ctxt_tag, &wqe->generic.wqe_com,
6327+
get_job_ulpcontext(phba, oldiocb)); /* Xri / rx_id */
6328+
ulp_context = get_job_ulpcontext(phba, elsiocb);
6329+
bf_set(wqe_rcvoxid, &wqe->xmit_els_rsp.wqe_com,
6330+
get_job_rcvoxid(phba, oldiocb));
6331+
} else {
6332+
icmd = &elsiocb->iocb;
6333+
oldcmd = &oldiocb->iocb;
6334+
icmd->ulpContext = oldcmd->ulpContext; /* Xri / rx_id */
6335+
ulp_context = elsiocb->iocb.ulpContext;
6336+
icmd->unsli3.rcvsli3.ox_id =
6337+
oldcmd->unsli3.rcvsli3.ox_id;
6338+
}
62906339

62916340
/* Xmit ECHO ACC response tag <ulpIoTag> */
62926341
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
62936342
"2876 Xmit ECHO ACC response tag x%x xri x%x\n",
6294-
elsiocb->iotag, elsiocb->iocb.ulpContext);
6343+
elsiocb->iotag, ulp_context);
62956344
pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt);
62966345
*((uint32_t *) (pcmd)) = ELS_CMD_ACC;
62976346
pcmd += sizeof(uint32_t);
@@ -8850,11 +8899,9 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
88508899
{
88518900
struct lpfc_dmabuf *pcmd;
88528901
uint32_t *lp;
8853-
IOCB_t *icmd;
88548902
uint32_t did;
88558903

8856-
icmd = &cmdiocb->iocb;
8857-
did = icmd->un.elsreq64.remoteID;
8904+
did = get_job_els_rsp64_did(vport->phba, cmdiocb);
88588905
pcmd = (struct lpfc_dmabuf *) cmdiocb->context2;
88598906
lp = (uint32_t *) pcmd->virt;
88608907

0 commit comments

Comments
 (0)