All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Smart <jsmart2021@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: James Smart <jsmart2021@gmail.com>, Justin Tee <justin.tee@broadcom.com>
Subject: [PATCH 24/26] lpfc: Expand setting ELS_ID field in ELS_REQUEST64_WQE
Date: Tue, 12 Apr 2022 15:20:06 -0700	[thread overview]
Message-ID: <20220412222008.126521-25-jsmart2021@gmail.com> (raw)
In-Reply-To: <20220412222008.126521-1-jsmart2021@gmail.com>

ELS_ID field for ELS_REQUEST64_WQE is not filled out when FIP is not
supported by the HBA.

Move setting ELS_ID logic into __lpfc_sli_prep_els_req_rsp_s4, and
remove ELS_ID FIP dependency logic from lpfc_sli_prep_wqe.

Introduce PLOGI ELS_ID and as a result update wqe_els_id_MASK because
PLOGI ELS_ID = 0x4 occupies up to 3 bits.

While in __lpfc_sli_prep_els_req_rsp_s4 routine, remove SLI3-isms.

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>
---
 drivers/scsi/lpfc/lpfc_hw4.h | 14 ++++++++-----
 drivers/scsi/lpfc/lpfc_sli.c | 38 ++++++++++++++++++++++++++----------
 2 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 6d20c97762e9..8511369d2cf8 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -4476,12 +4476,8 @@ struct wqe_common {
 #define wqe_cmd_type_MASK     0x0000000f
 #define wqe_cmd_type_WORD     word11
 #define wqe_els_id_SHIFT      4
-#define wqe_els_id_MASK       0x00000003
+#define wqe_els_id_MASK       0x00000007
 #define wqe_els_id_WORD       word11
-#define LPFC_ELS_ID_FLOGI	3
-#define LPFC_ELS_ID_FDISC	2
-#define LPFC_ELS_ID_LOGO	1
-#define LPFC_ELS_ID_DEFAULT	0
 #define wqe_irsp_SHIFT        4
 #define wqe_irsp_MASK         0x00000001
 #define wqe_irsp_WORD         word11
@@ -4528,6 +4524,14 @@ struct lpfc_wqe_generic{
 	uint32_t payload[4];
 };
 
+enum els_request64_wqe_word11 {
+	LPFC_ELS_ID_DEFAULT,
+	LPFC_ELS_ID_LOGO,
+	LPFC_ELS_ID_FDISC,
+	LPFC_ELS_ID_FLOGI,
+	LPFC_ELS_ID_PLOGI,
+};
+
 struct els_request64_wqe {
 	struct ulp_bde64 bde;
 	uint32_t payload_len;
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 22fe7de63fb6..8bf62697317a 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -10583,6 +10583,7 @@ __lpfc_sli_prep_els_req_rsp_s4(struct lpfc_iocbq *cmdiocbq,
 	struct lpfc_hba  *phba = vport->phba;
 	union lpfc_wqe128 *wqe;
 	struct ulp_bde64_le *bde;
+	u8 els_id;
 
 	wqe = &cmdiocbq->wqe;
 	memset(wqe, 0, sizeof(*wqe));
@@ -10595,7 +10596,7 @@ __lpfc_sli_prep_els_req_rsp_s4(struct lpfc_iocbq *cmdiocbq,
 	bde->type_size |= cpu_to_le32(ULP_BDE64_TYPE_BDE_64);
 
 	if (expect_rsp) {
-		bf_set(wqe_cmnd, &wqe->els_req.wqe_com, CMD_ELS_REQUEST64_CR);
+		bf_set(wqe_cmnd, &wqe->els_req.wqe_com, CMD_ELS_REQUEST64_WQE);
 
 		/* Transfer length */
 		wqe->els_req.payload_len = cmd_size;
@@ -10603,6 +10604,30 @@ __lpfc_sli_prep_els_req_rsp_s4(struct lpfc_iocbq *cmdiocbq,
 
 		/* DID */
 		bf_set(wqe_els_did, &wqe->els_req.wqe_dest, did);
+
+		/* Word 11 - ELS_ID */
+		switch (elscmd) {
+		case ELS_CMD_PLOGI:
+			els_id = LPFC_ELS_ID_PLOGI;
+			break;
+		case ELS_CMD_FLOGI:
+			els_id = LPFC_ELS_ID_FLOGI;
+			break;
+		case ELS_CMD_LOGO:
+			els_id = LPFC_ELS_ID_LOGO;
+			break;
+		case ELS_CMD_FDISC:
+			if (!vport->fc_myDID) {
+				els_id = LPFC_ELS_ID_FDISC;
+				break;
+			}
+			fallthrough;
+		default:
+			els_id = LPFC_ELS_ID_DEFAULT;
+			break;
+		}
+
+		bf_set(wqe_els_id, &wqe->els_req.wqe_com, els_id);
 	} else {
 		/* DID */
 		bf_set(wqe_els_did, &wqe->xmit_els_rsp.wqe_dest, did);
@@ -10611,7 +10636,7 @@ __lpfc_sli_prep_els_req_rsp_s4(struct lpfc_iocbq *cmdiocbq,
 		wqe->xmit_els_rsp.response_payload_len = cmd_size;
 
 		bf_set(wqe_cmnd, &wqe->xmit_els_rsp.wqe_com,
-		       CMD_XMIT_ELS_RSP64_CX);
+		       CMD_XMIT_ELS_RSP64_WQE);
 	}
 
 	bf_set(wqe_tmo, &wqe->generic.wqe_com, tmo);
@@ -10627,7 +10652,7 @@ __lpfc_sli_prep_els_req_rsp_s4(struct lpfc_iocbq *cmdiocbq,
 		if (expect_rsp) {
 			bf_set(els_req64_sid, &wqe->els_req, vport->fc_myDID);
 
-			/* For ELS_REQUEST64_CR, use the VPI by default */
+			/* For ELS_REQUEST64_WQE, use the VPI by default */
 			bf_set(wqe_ctxt_tag, &wqe->els_req.wqe_com,
 			       phba->vpi_ids[vport->vpi]);
 		}
@@ -22215,7 +22240,6 @@ lpfc_sli_prep_wqe(struct lpfc_hba *phba, struct lpfc_iocbq *job)
 	u32 fip, abort_tag;
 	struct lpfc_nodelist *ndlp = NULL;
 	union lpfc_wqe128 *wqe = &job->wqe;
-	u32 els_id = LPFC_ELS_ID_DEFAULT;
 	u8 command_type = ELS_COMMAND_NON_FIP;
 
 	fip = phba->hba_flag & HBA_FIP_SUPPORT;
@@ -22234,11 +22258,6 @@ lpfc_sli_prep_wqe(struct lpfc_hba *phba, struct lpfc_iocbq *job)
 	case CMD_ELS_REQUEST64_WQE:
 		ndlp = job->ndlp;
 
-		/* CCP CCPE PV PRI in word10 were set in the memcpy */
-		if (command_type == ELS_COMMAND_FIP)
-			els_id = ((job->cmd_flag & LPFC_FIP_ELS_ID_MASK)
-				  >> LPFC_FIP_ELS_ID_SHIFT);
-
 		if_type = bf_get(lpfc_sli_intf_if_type,
 				 &phba->sli4_hba.sli_intf);
 		if (if_type >= LPFC_SLI_INTF_IF_TYPE_2) {
@@ -22275,7 +22294,6 @@ lpfc_sli_prep_wqe(struct lpfc_hba *phba, struct lpfc_iocbq *job)
 		bf_set(wqe_temp_rpi, &wqe->els_req.wqe_com,
 		       phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]);
 
-		bf_set(wqe_els_id, &wqe->els_req.wqe_com, els_id);
 		bf_set(wqe_dbde, &wqe->els_req.wqe_com, 1);
 		bf_set(wqe_iod, &wqe->els_req.wqe_com, LPFC_WQE_IOD_READ);
 		bf_set(wqe_qosd, &wqe->els_req.wqe_com, 1);
-- 
2.26.2


  parent reply	other threads:[~2022-04-12 23:34 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 22:19 [PATCH 00/26] lpfc: Update lpfc to revision 14.2.0.2 James Smart
2022-04-12 22:19 ` [PATCH 01/26] lpfc: Tweak message log categories for ELS/FDMI/NVME Rescan James Smart
2022-04-12 22:19 ` [PATCH 02/26] lpfc: Move cfg_log_verbose check before calling lpfc_dmp_dbg James Smart
2022-04-12 22:19 ` [PATCH 03/26] lpfc: Fix diagnostic fw logging after a function reset James Smart
2022-04-12 22:19 ` [PATCH 04/26] lpfc: Zero SLI4 fcp_cmnd buffer's fcpCntl0 field James Smart
2022-04-12 22:19 ` [PATCH 05/26] lpfc: Requeue SCSI I/O to upper layer when fw reports link down James Smart
2022-04-12 22:19 ` [PATCH 06/26] lpfc: Fix SCSI I/O completion and abort handler deadlock James Smart
2022-04-12 22:19 ` [PATCH 07/26] lpfc: Clear fabric topology flag before initiating a new FLOGI James Smart
2022-04-12 22:19 ` [PATCH 08/26] lpfc: Fix null pointer dereference after failing to issue FLOGI and PLOGI James Smart
2022-04-12 22:19 ` [PATCH 09/26] lpfc: Protect memory leak for NPIV ports sending PLOGI_RJT James Smart
2022-04-12 22:19 ` [PATCH 10/26] lpfc: Update fc_prli_sent outstanding only after guaranteed IOCB submit James Smart
2022-04-12 22:19 ` [PATCH 11/26] lpfc: Transition to NPR state upon LOGO cmpl if link down or aborted James Smart
2022-04-12 22:19 ` [PATCH 12/26] lpfc: Remove unnecessary NULL pointer assignment for ELS_RDF path James Smart
2022-04-12 22:19 ` [PATCH 13/26] lpfc: Move MI module parameter check to handle dynamic disable James Smart
2022-04-12 22:19 ` [PATCH 14/26] lpfc: Correct CRC32 calculation for congestion stats James Smart
2022-04-12 22:19 ` [PATCH 15/26] lpfc: Fix call trace observed during I/O with CMF enabled James Smart
2022-04-12 22:19 ` [PATCH 16/26] lpfc: Revise FDMI reporting of supported port speed for trunk groups James Smart
2022-04-12 22:19 ` [PATCH 17/26] lpfc: Remove false FDMI NVME FC-4 support for NPIV ports James Smart
2022-04-12 22:20 ` [PATCH 18/26] lpfc: Register for Application Services FC-4 type in Fabric topology James Smart
2022-04-12 22:20 ` [PATCH 19/26] lpfc: Introduce FC_RSCN_MEMENTO flag for tracking post RSCN completion James Smart
2022-04-12 22:20 ` [PATCH 20/26] lpfc: Fix field overload in lpfc_iocbq data structure James Smart
2022-04-13 16:25   ` kernel test robot
2022-04-12 22:20 ` [PATCH 21/26] lpfc: Refactor cleanup of mailbox commands James Smart
2022-04-12 22:20 ` [PATCH 22/26] lpfc: Change FA-PWWN detection methodology James Smart
2022-04-12 22:20 ` [PATCH 23/26] lpfc: Update stat accounting for READ_STATUS mbox command James Smart
2022-04-12 22:20 ` James Smart [this message]
2022-04-12 22:20 ` [PATCH 25/26] lpfc: Update lpfc version to 14.2.0.2 James Smart
2022-04-12 22:20 ` [PATCH 26/26] lpfc: Copyright updates for 14.2.0.2 patches James Smart
2022-04-19  2:50 ` [PATCH 00/26] lpfc: Update lpfc to revision 14.2.0.2 Martin K. Petersen
2022-04-26  4:00 ` Martin K. Petersen
2022-04-18 18:53 [PATCH 20/26] lpfc: Fix field overload in lpfc_iocbq data structure kernel test robot
2022-04-22 14:51 ` Dan Carpenter
2022-04-22 14:51 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220412222008.126521-25-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.com \
    --cc=justin.tee@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.