Commit 1b64aa9e authored by James Smart's avatar James Smart Committed by Martin K. Petersen
Browse files

scsi: lpfc: SLI path split: Refactor fast and slow paths to native SLI4

Convert the SLI4 fast and slow paths to use native SLI4 wqe constructs
instead of iocb SLI3-isms.

Includes the following:

 - Create simple get_xxx and set_xxx routines to wrapper access to common
   elements in both SLI3 and SLI4 commands - allowing calling routines to
   avoid sli-rev-specific structures to access the elements.

 - using the wqe in the job structure as the primary element

 - use defines from SLI-4, not SLI-3

 - Removal of iocb to wqe conversion from fast and slow path

 - Add below routines to handle fast path
	lpfc_prep_embed_io - prepares the wqe for fast path
	lpfc_wqe_bpl2sgl   - manages bpl to sgl conversion
	lpfc_sli_wqe2iocb  - converts a WQE to IOCB for SLI-3 path

 - Add lpfc_sli3_iocb2wcqecmpl in completion path to convert an SLI-3
   iocb completion to wcqe completion

 - Refactor some of the code that works on both revs for clarity

Link: https://lore.kernel.org/r/20220225022308.16486-3-jsmart2021@gmail.com


Co-developed-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent a680a929
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -1797,3 +1797,39 @@ static inline int lpfc_is_vmid_enabled(struct lpfc_hba *phba)
{
	return phba->cfg_vmid_app_header || phba->cfg_vmid_priority_tagging;
}

static inline
u8 get_job_ulpstatus(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{
	if (phba->sli_rev == LPFC_SLI_REV4)
		return bf_get(lpfc_wcqe_c_status, &iocbq->wcqe_cmpl);
	else
		return iocbq->iocb.ulpStatus;
}

static inline
u32 get_job_word4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{
	if (phba->sli_rev == LPFC_SLI_REV4)
		return iocbq->wcqe_cmpl.parameter;
	else
		return iocbq->iocb.un.ulpWord[4];
}

static inline
u8 get_job_cmnd(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{
	if (phba->sli_rev == LPFC_SLI_REV4)
		return bf_get(wqe_cmnd, &iocbq->wqe.generic.wqe_com);
	else
		return iocbq->iocb.ulpCommand;
}

static inline
u16 get_job_ulpcontext(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{
	if (phba->sli_rev == LPFC_SLI_REV4)
		return bf_get(wqe_ctxt_tag, &iocbq->wqe.generic.wqe_com);
	else
		return iocbq->iocb.ulpContext;
}
+1 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ void lpfc_disc_list_loopmap(struct lpfc_vport *);
void lpfc_disc_start(struct lpfc_vport *);
void lpfc_cleanup_discovery_resources(struct lpfc_vport *);
void lpfc_cleanup(struct lpfc_vport *);
void lpfc_prep_embed_io(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_ncmd);
void lpfc_disc_timeout(struct timer_list *);

int lpfc_unregister_fcf_prep(struct lpfc_hba *);
+7 −0
Original line number Diff line number Diff line
@@ -60,6 +60,13 @@
	((ptr)->name##_WORD = ((((value) & name##_MASK) << name##_SHIFT) | \
		 ((ptr)->name##_WORD & ~(name##_MASK << name##_SHIFT))))

#define get_wqe_reqtag(x)	(((x)->wqe.words[9] >>  0) & 0xFFFF)

#define get_job_ulpword(x, y)	((x)->iocb.un.ulpWord[y])

#define set_job_ulpstatus(x, y)	bf_set(lpfc_wcqe_c_status, &(x)->wcqe_cmpl, y)
#define set_job_ulpword4(x, y)	((&(x)->wcqe_cmpl)->parameter = y)

struct dma_address {
	uint32_t addr_lo;
	uint32_t addr_hi;
+211 −302

File changed.

Preview size limit exceeded, changes collapsed.

+2 −0
Original line number Diff line number Diff line
@@ -76,6 +76,8 @@ struct lpfc_iocbq {
	struct lpfc_wcqe_complete wcqe_cmpl;	/* WQE cmpl */

	uint8_t num_bdes;
	uint8_t abort_bls;	/* ABTS by initiator or responder */

	uint8_t priority;	/* OAS priority */
	uint8_t retry;		/* retry counter for IOCB cmd - if needed */
	u32 cmd_flag;