All of lore.kernel.org
 help / color / mirror / Atom feed
From: Himanshu Madhani <hmadhani@marvell.com>
To: <James.Bottomley@HansenPartnership.com>, <martin.petersen@oracle.com>
Cc: <hmadhani@marvell.com>, <linux-scsi@vger.kernel.org>
Subject: [PATCH 17/18] qla2xxx: Set Nport ID for N2N
Date: Wed, 26 Feb 2020 14:40:21 -0800	[thread overview]
Message-ID: <20200226224022.24518-18-hmadhani@marvell.com> (raw)
In-Reply-To: <20200226224022.24518-1-hmadhani@marvell.com>

From: Quinn Tran <qutran@marvell.com>

When transitioning from loop to N2N, stale NPort ID
is not re-assigned. Stale ID can collide with remote device.
This patch will re-assign NPort ID on N2N is detected.

Signed-off-by: Quinn Tran <qutran@marvell.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
---
 drivers/scsi/qla2xxx/qla_mbx.c | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index bd13b0d3cfea..a6f0bec65377 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -3925,11 +3925,29 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
 				fcport->scan_state = QLA_FCPORT_SCAN;
 				fcport->n2n_flag = 0;
 			}
+			id.b24 = 0;
+			if (wwn_to_u64(vha->port_name) >
+			    wwn_to_u64(rptid_entry->u.f1.port_name)) {
+				vha->d_id.b24 = 0;
+				vha->d_id.b.al_pa = 1;
+				ha->flags.n2n_bigger = 1;
+
+				id.b.al_pa = 2;
+				ql_dbg(ql_dbg_async, vha, 0x5075,
+				    "Format 1: assign local id %x remote id %x\n",
+				    vha->d_id.b24, id.b24);
+			} else {
+				ql_dbg(ql_dbg_async, vha, 0x5075,
+				    "Format 1: Remote login - Waiting for WWPN %8phC.\n",
+				    rptid_entry->u.f1.port_name);
+				ha->flags.n2n_bigger = 0;
+			}
 
 			fcport = qla2x00_find_fcport_by_wwpn(vha,
 			    rptid_entry->u.f1.port_name, 1);
 			spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
 
+
 			if (fcport) {
 				fcport->plogi_nack_done_deadline = jiffies + HZ;
 				fcport->dm_login_expire = jiffies + 2*HZ;
@@ -3940,6 +3958,11 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
 				if (vha->flags.nvme_enabled)
 					fcport->fc4_type |= FS_FC4TYPE_NVME;
 
+				if (wwn_to_u64(vha->port_name) >
+				    wwn_to_u64(fcport->port_name)) {
+					fcport->d_id = id;
+				}
+
 				switch (fcport->disc_state) {
 				case DSC_DELETED:
 					set_bit(RELOGIN_NEEDED,
@@ -3952,25 +3975,6 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
 					break;
 				}
 			} else {
-				id.b24 = 0;
-				if (wwn_to_u64(vha->port_name) >
-				    wwn_to_u64(rptid_entry->u.f1.port_name)) {
-					vha->d_id.b24 = 0;
-					vha->d_id.b.al_pa = 1;
-					ha->flags.n2n_bigger = 1;
-					ha->flags.n2n_ae = 0;
-
-					id.b.al_pa = 2;
-					ql_dbg(ql_dbg_async, vha, 0x5075,
-					    "Format 1: assign local id %x remote id %x\n",
-					    vha->d_id.b24, id.b24);
-				} else {
-					ql_dbg(ql_dbg_async, vha, 0x5075,
-					    "Format 1: Remote login - Waiting for WWPN %8phC.\n",
-					    rptid_entry->u.f1.port_name);
-					ha->flags.n2n_bigger = 0;
-					ha->flags.n2n_ae = 1;
-				}
 				qla24xx_post_newsess_work(vha, &id,
 				    rptid_entry->u.f1.port_name,
 				    rptid_entry->u.f1.node_name,
-- 
2.12.0


  parent reply	other threads:[~2020-02-26 22:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-26 22:40 [PATCH 00/18] qla2xxx: fixes for the driver Himanshu Madhani
2020-02-26 22:40 ` [PATCH 01/18] qla2xxX: Add 16.0GT for PCI String Himanshu Madhani
2020-02-26 22:40 ` [PATCH 02/18] qla2xxx: Avoid setting firmware options twice in 24xx_update_fw_options Himanshu Madhani
2020-02-26 22:40 ` [PATCH 03/18] qla2xxx: Use FC generic update firmware options routine for ISP27xx Himanshu Madhani
2020-02-26 22:40 ` [PATCH 04/18] qla2xxx: Fix FCP-SCSI FC4 flag passing error Himanshu Madhani
2020-02-26 22:40 ` [PATCH 05/18] qla2xxx: Improved secure flash support messages Himanshu Madhani
2020-02-26 22:40 ` [PATCH 06/18] qla2xxx: Return appropriate failure through BSG Interface Himanshu Madhani
2020-02-26 22:40 ` [PATCH 07/18] qla2xxx: Use a dedicated interrupt handler for 'handshake-required' ISPs Himanshu Madhani
2020-02-26 22:40 ` [PATCH 08/18] qla2xxx: fix FW resource count values Himanshu Madhani
2020-02-26 22:40 ` [PATCH 09/18] qla2xxx: Update BPM enablement semantics Himanshu Madhani
2020-02-26 22:40 ` [PATCH 10/18] qla2xxx: add more FW debug information Himanshu Madhani
2020-02-26 22:40 ` [PATCH 11/18] qla2xxx: Force semaphore on flash validation failure Himanshu Madhani
2020-02-26 22:40 ` [PATCH 12/18] qla2xxx: Fix RDP respond data format Himanshu Madhani
2020-02-26 22:40 ` [PATCH 13/18] qla2xxx: Fix NPIV instantiation after FW dump Himanshu Madhani
2020-02-26 22:40 ` [PATCH 14/18] qla2xxx: Serialize fc_port alloc in N2N Himanshu Madhani
2020-02-26 22:40 ` [PATCH 15/18] qla2xxx: Remove restriction of FC T10-PI and FC-NVMe Himanshu Madhani
2020-02-26 22:40 ` [PATCH 16/18] qla2xxx: Handle NVME status iocb correctly Himanshu Madhani
2020-02-26 22:40 ` Himanshu Madhani [this message]
2020-02-26 22:40 ` [PATCH 18/18] qla2xxx: Update driver version to 10.01.00.25-k Himanshu Madhani
2020-02-29  1:33 ` [PATCH 00/18] qla2xxx: fixes for the driver 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=20200226224022.24518-18-hmadhani@marvell.com \
    --to=hmadhani@marvell.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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.