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 08/12] lpfc: Change VMID registration to be based on fabric parameters
Date: Thu,  5 May 2022 20:55:15 -0700	[thread overview]
Message-ID: <20220506035519.50908-9-jsmart2021@gmail.com> (raw)
In-Reply-To: <20220506035519.50908-1-jsmart2021@gmail.com>

Currently, VMID registration is configured via module parameters.  This
could lead to VMID compatibility issues if two ports are connected to
different brands of switches, as the two brands implement VMID
differently.

Make logical changes so that VMID registration is based on common service
parameters from FLOGI_ACC with fabric rather than module parameters.

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.h      |  1 +
 drivers/scsi/lpfc/lpfc_els.c  |  3 ++-
 drivers/scsi/lpfc/lpfc_scsi.c | 17 +++++++++--------
 drivers/scsi/lpfc/lpfc_sli.c  |  4 ++--
 4 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 405c8a8dd795..f8f5b4a2d523 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -714,6 +714,7 @@ struct lpfc_vport {
 #define LPFC_VMID_QFPA_CMPL		0x4
 #define LPFC_VMID_QOS_ENABLED		0x8
 #define LPFC_VMID_TIMER_ENBLD		0x10
+#define LPFC_VMID_TYPE_PRIO		0x20
 	struct fc_qfpa_res *qfpa_res;
 
 	struct fc_vport *fc_vport;
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 3671e0f8e041..33fac4401e8f 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -1105,7 +1105,8 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 			 sp->cmn.priority_tagging, kref_read(&ndlp->kref));
 
 	if (sp->cmn.priority_tagging)
-		vport->vmid_flag |= LPFC_VMID_ISSUE_QFPA;
+		vport->phba->pport->vmid_flag |= (LPFC_VMID_ISSUE_QFPA |
+						  LPFC_VMID_TYPE_PRIO);
 
 	if (vport->port_state == LPFC_FLOGI) {
 		/*
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 1959c58d22f8..1d134a01ff3e 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -5344,9 +5344,9 @@ static void lpfc_vmid_update_entry(struct lpfc_vport *vport, struct scsi_cmnd
 {
 	u64 *lta;
 
-	if (vport->vmid_priority_tagging)
+	if (vport->phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO)
 		tag->cs_ctl_vmid = vmp->un.cs_ctl_vmid;
-	else
+	else if (vport->phba->cfg_vmid_app_header)
 		tag->app_id = vmp->un.app_id;
 
 	if (cmd->sc_data_direction == DMA_TO_DEVICE)
@@ -5391,11 +5391,12 @@ static int lpfc_vmid_get_appid(struct lpfc_vport *vport, char *uuid, struct
 			       scsi_cmnd * cmd, union lpfc_vmid_io_tag *tag)
 {
 	struct lpfc_vmid *vmp = NULL;
-	int hash, len, rc, i;
+	int hash, len, rc = -EPERM, i;
 
 	/* check if QFPA is complete */
-	if (lpfc_vmid_is_type_priority_tag(vport) && !(vport->vmid_flag &
-	      LPFC_VMID_QFPA_CMPL)) {
+	if (lpfc_vmid_is_type_priority_tag(vport) &&
+	    !(vport->vmid_flag & LPFC_VMID_QFPA_CMPL) &&
+	    (vport->vmid_flag & LPFC_VMID_ISSUE_QFPA)) {
 		vport->work_port_events |= WORKER_CHECK_VMID_ISSUE_QFPA;
 		return -EAGAIN;
 	}
@@ -5469,7 +5470,7 @@ static int lpfc_vmid_get_appid(struct lpfc_vport *vport, char *uuid, struct
 			vport->vmid_inactivity_timeout ? 1 : 0;
 
 		/* if type priority tag, get next available VMID */
-		if (lpfc_vmid_is_type_priority_tag(vport))
+		if (vport->phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO)
 			lpfc_vmid_assign_cs_ctl(vport, vmp);
 
 		/* allocate the per cpu variable for holding */
@@ -5488,9 +5489,9 @@ static int lpfc_vmid_get_appid(struct lpfc_vport *vport, char *uuid, struct
 		write_unlock(&vport->vmid_lock);
 
 		/* complete transaction with switch */
-		if (lpfc_vmid_is_type_priority_tag(vport))
+		if (vport->phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO)
 			rc = lpfc_vmid_uvem(vport, vmp, true);
-		else
+		else if (vport->phba->cfg_vmid_app_header)
 			rc = lpfc_vmid_cmd(vport, SLI_CTAS_RAPP_IDENT, vmp);
 		if (!rc) {
 			write_lock(&vport->vmid_lock);
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 573526f08baf..79d2ef5f0f05 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -10377,11 +10377,11 @@ lpfc_prep_embed_io(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)
 
 	/* add the VMID tags as per switch response */
 	if (unlikely(piocb->cmd_flag & LPFC_IO_VMID)) {
-		if (phba->pport->vmid_priority_tagging) {
+		if (phba->pport->vmid_flag & LPFC_VMID_TYPE_PRIO) {
 			bf_set(wqe_ccpe, &wqe->fcp_iwrite.wqe_com, 1);
 			bf_set(wqe_ccp, &wqe->fcp_iwrite.wqe_com,
 					(piocb->vmid_tag.cs_ctl_vmid));
-		} else {
+		} else if (phba->cfg_vmid_app_header) {
 			bf_set(wqe_appid, &wqe->fcp_iwrite.wqe_com, 1);
 			bf_set(wqe_wqes, &wqe->fcp_iwrite.wqe_com, 1);
 			wqe->words[31] = piocb->vmid_tag.app_id;
-- 
2.26.2


  parent reply	other threads:[~2022-05-06  3:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06  3:55 [PATCH 00/12] lpfc: Update lpfc to revision 14.2.0.3 James Smart
2022-05-06  3:55 ` [PATCH 01/12] lpfc: Fix element offset in __lpfc_sli_release_iocbq_s4() James Smart
2022-05-06  3:55 ` [PATCH 02/12] lpfc: Fill in missing ndlp kref puts in error paths James Smart
2022-05-06  3:55 ` [PATCH 03/12] lpfc: Fix ndlp put following a LOGO completion James Smart
2022-05-06  3:55 ` [PATCH 04/12] lpfc: Inhibit aborts if external loopback plug is inserted James Smart
2022-05-06  3:55 ` [PATCH 05/12] lpfc: Fix dmabuf ptr assignment in lpfc_ct_reject_event James Smart
2022-05-06  3:55 ` [PATCH 06/12] lpfc: Use list_for_each_entry_safe on fc_nodes list in rscn_recovery_check James Smart
2022-05-06  3:55 ` [PATCH 07/12] lpfc: Decrement outstanding gidft_inp counter if lpfc_err_lost_link James Smart
2022-05-06  3:55 ` James Smart [this message]
2022-05-06  3:55 ` [PATCH 09/12] lpfc: Rework FDMI initialization after link up James Smart
2022-05-06  3:55 ` [PATCH 10/12] lpfc: Alter FPIN stat accounting logic James Smart
2022-05-06  3:55 ` [PATCH 11/12] lpfc: Use sg_dma_address and sg_dma_len macros for NVMe I/O James Smart
2022-05-06 16:41   ` Jerry Snitselaar
2022-05-06  3:55 ` [PATCH 12/12] lpfc: Update lpfc version to 14.2.0.3 James Smart
2022-05-11  2:11 ` [PATCH 00/12] lpfc: Update lpfc to revision 14.2.0.3 Martin K. Petersen
2022-05-17  2:16 ` Martin K. Petersen

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=20220506035519.50908-9-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.