Commit 6831ce12 authored by James Smart's avatar James Smart Committed by Martin K. Petersen
Browse files

scsi: lpfc: SLI path split: Refactor base ELS paths and the FLOGI path

The patch refactors the general ELS handling paths to migrate to SLI-4
structures or common element abstractions. The fabric login paths are
revised as part of this patch:

 - New generic lpfc_sli_prep_els_req_rsp jump table routine

 - Introduce ls_rjt_error_be and ulp_bde64_le unions to correct legacy
   endianness assignments

 - 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.

 - Clean up poor indentation on some of the ELS paths

Link: https://lore.kernel.org/r/20220225022308.16486-5-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 56134142
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -961,7 +961,13 @@ struct lpfc_hba {

	int (*lpfc_bg_scsi_prep_dma_buf)
		(struct lpfc_hba *, struct lpfc_io_buf *);
	/* Add new entries here */

	/* Prep SLI WQE/IOCB jump table entries */
	void (*__lpfc_sli_prep_els_req_rsp)(struct lpfc_iocbq *cmdiocbq,
					    struct lpfc_vport *vport,
					    struct lpfc_dmabuf *bmp,
					    u16 cmd_size, u32 did, u32 elscmd,
					    u8 tmo, u8 expect_rsp);

	/* expedite pool */
	struct lpfc_epd_pool epd_pool;
@@ -1833,3 +1839,12 @@ u16 get_job_ulpcontext(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
	else
		return iocbq->iocb.ulpContext;
}

static inline
u32 get_job_els_rsp64_did(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
{
	if (phba->sli_rev == LPFC_SLI_REV4)
		return bf_get(wqe_els_did, &iocbq->wqe.els_req.wqe_dest);
	else
		return iocbq->iocb.un.elsreq64.remoteID;
}
+5 −0
Original line number Diff line number Diff line
@@ -353,6 +353,11 @@ int lpfc_sli4_issue_wqe(struct lpfc_hba *phba, struct lpfc_sli4_hdw_queue *qp,
			struct lpfc_iocbq *pwqe);
int lpfc_sli4_issue_abort_iotag(struct lpfc_hba *phba,
			struct lpfc_iocbq *cmdiocb, void *cmpl);
void lpfc_sli_prep_els_req_rsp(struct lpfc_hba *phba,
			       struct lpfc_iocbq *cmdiocbq,
			       struct lpfc_vport *vport,
			       struct lpfc_dmabuf *bmp, u16 cmd_size, u32 did,
			       u32 elscmd, u8 tmo, u8 expect_rsp);
struct lpfc_sglq *__lpfc_clear_active_sglq(struct lpfc_hba *phba, uint16_t xri);
struct lpfc_sglq *__lpfc_sli_get_nvmet_sglq(struct lpfc_hba *phba,
					    struct lpfc_iocbq *piocbq);
+2 −2
Original line number Diff line number Diff line
@@ -982,7 +982,7 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
		lpfc_vport_set_state(vport, FC_VPORT_FAILED);
		goto out;
	}
	if (lpfc_error_lost_link(irsp)) {
	if (lpfc_error_lost_link(irsp->ulpStatus, irsp->un.ulpWord[4])) {
		lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
				 "0226 NS query failed due to link event\n");
		if (vport->fc_flag & FC_RSCN_MODE)
@@ -1199,7 +1199,7 @@ lpfc_cmpl_ct_cmd_gid_pt(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
		lpfc_vport_set_state(vport, FC_VPORT_FAILED);
		goto out;
	}
	if (lpfc_error_lost_link(irsp)) {
	if (lpfc_error_lost_link(irsp->ulpStatus, irsp->un.ulpWord[4])) {
		lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
				 "4166 NS query failed due to link event\n");
		if (vport->fc_flag & FC_RSCN_MODE)
+233 −207

File changed.

Preview size limit exceeded, changes collapsed.

+7 −7
Original line number Diff line number Diff line
@@ -664,6 +664,7 @@ struct fc_vft_header {

struct ls_rjt {	/* Structure is in Big Endian format */
	union {
		__be32 ls_rjt_error_be;
		uint32_t lsRjtError;
		struct {
			uint8_t lsRjtRsvd0;	/* FC Word 0, bit 24:31 */
@@ -4376,16 +4377,15 @@ lpfc_is_LC_HBA(unsigned short device)
}

/*
 * Determine if an IOCB failed because of a link event or firmware reset.
 * Determine if failed because of a link event or firmware reset.
 */

static inline int
lpfc_error_lost_link(IOCB_t *iocbp)
lpfc_error_lost_link(u32 ulp_status, u32 ulp_word4)
{
	return (iocbp->ulpStatus == IOSTAT_LOCAL_REJECT &&
		(iocbp->un.ulpWord[4] == IOERR_SLI_ABORTED ||
		 iocbp->un.ulpWord[4] == IOERR_LINK_DOWN ||
		 iocbp->un.ulpWord[4] == IOERR_SLI_DOWN));
	return (ulp_status == IOSTAT_LOCAL_REJECT &&
		(ulp_word4 == IOERR_SLI_ABORTED ||
		 ulp_word4 == IOERR_LINK_DOWN ||
		 ulp_word4 == IOERR_SLI_DOWN));
}

#define MENLO_TRANSPORT_TYPE 0xfe
Loading