linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Smart <jsmart2021@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: James Smart <jsmart2021@gmail.com>,
	Dick Kennedy <dick.kennedy@broadcom.com>,
	James Smart <james.smart@broadcom.com>
Subject: [PATCH 06/11] Fix SLI3 drivers attempting NVME ELS commands.
Date: Thu, 15 Jun 2017 22:56:46 -0700	[thread overview]
Message-ID: <20170616055651.9674-7-jsmart2021@gmail.com> (raw)
In-Reply-To: <20170616055651.9674-1-jsmart2021@gmail.com>

In a server with an 8G adapter and a 32G adapter, running NVME
and FCP, the server would crash with the following stack.

RIP: 0010: ... lpfc_nvme_register_port+0x38/0x420 [lpfc]
 lpfc_nlp_state_cleanup+0x154/0x4f0 [lpfc]
 lpfc_nlp_set_state+0x9d/0x1a0 [lpfc]
 lpfc_cmpl_prli_prli_issue+0x35f/0x440 [lpfc]
 lpfc_disc_state_machine+0x78/0x1c0 [lpfc]
 lpfc_cmpl_els_prli+0x17c/0x1f0 [lpfc]
 lpfc_sli_sp_handle_rspiocb+0x39b/0x6b0 [lpfc]
 lpfc_sli_handle_slow_ring_event_s3+0x134/0x2d0 [lpfc]
 lpfc_work_done+0x8ac/0x13b0 [lpfc]
 lpfc_do_work+0xf1/0x1b0 [lpfc]

Crash, on the 8G adapter, is due to a vport which does not have
a nvme local port structure. It's not supposed to have one. NVME is
not supported on the 8G adapter, so the NVME PRLI, which started
this flow shouldn't have been sent in the first place.

Correct discovery engine to recognize when on an SLI3 rport, which
doesn't support SLI3, if the rport supports only NVME, don't send
a NVME PRLI. Instead, as no FC4 will be used, a LOGO is sent.
If rport is FCP and NVME, only execute the SCSI PRLI.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
---
 drivers/scsi/lpfc/lpfc_els.c     | 16 +++++++++++++++-
 drivers/scsi/lpfc/lpfc_hbadisc.c |  3 ++-
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index a140318d6159..54de984d695f 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -2168,6 +2168,19 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 				 ndlp->nlp_fc4_type, ndlp->nlp_DID);
 		return 1;
 	}
+
+	/* SLI3 ports don't support NVME.  If this rport is a strict NVME
+	 * FC4 type, implicitly LOGO.
+	 */
+	if (phba->sli_rev == LPFC_SLI_REV3 &&
+	    ndlp->nlp_fc4_type == NLP_FC4_NVME) {
+		lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+				 "3088 Rport fc4 type 0x%x not supported by SLI3 adapter\n",
+				 ndlp->nlp_type);
+		lpfc_disc_state_machine(vport, ndlp, NULL, NLP_EVT_DEVICE_RM);
+		return 1;
+	}
+
 	elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
 				     ndlp->nlp_DID, elscmd);
 	if (!elsiocb)
@@ -2268,7 +2281,8 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 	/* The driver supports 2 FC4 types.  Make sure
 	 * a PRLI is issued for all types before exiting.
 	 */
-	if (local_nlp_type & (NLP_FC4_FCP | NLP_FC4_NVME))
+	if (phba->sli_rev == LPFC_SLI_REV4 &&
+	    local_nlp_type & (NLP_FC4_FCP | NLP_FC4_NVME))
 		goto send_next_prli;
 
 	return 0;
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index db2d0e692ddf..aa5e5ff56dfb 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -4194,7 +4194,8 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 			lpfc_register_remote_port(vport, ndlp);
 		}
 		/* Notify the NVME transport of this new rport. */
-		if (ndlp->nlp_fc4_type & NLP_FC4_NVME) {
+		if (vport->phba->sli_rev >= LPFC_SLI_REV4 &&
+		    ndlp->nlp_fc4_type & NLP_FC4_NVME) {
 			if (vport->phba->nvmet_support == 0) {
 				/* Register this rport with the transport.
 				 * Initiators take the NDLP ref count in
-- 
2.11.0

  parent reply	other threads:[~2017-06-16  5:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-16  5:56 [PATCH 00/11] lpfc updates for 11.4.0.1 James Smart
2017-06-16  5:56 ` [PATCH 01/11] Fix system panic when express lane enabled James Smart
2017-06-16  7:50   ` Hannes Reinecke
2017-06-16  5:56 ` [PATCH 02/11] Fix nvme_info sysfs output to be consistent James Smart
2017-06-16  7:51   ` Hannes Reinecke
2017-06-16  5:56 ` [PATCH 03/11] Vport creation is failing with "Link Down" error James Smart
2017-06-16  7:51   ` Hannes Reinecke
2017-06-16  5:56 ` [PATCH 04/11] Reduce time spent in IRQ for received NVME commands James Smart
2017-06-16  7:52   ` Hannes Reinecke
2017-06-16  5:56 ` [PATCH 05/11] Break up IO ctx list into a separate get and put list James Smart
2017-06-16  7:59   ` Hannes Reinecke
2017-06-16  5:56 ` James Smart [this message]
2017-06-16  8:00   ` [PATCH 06/11] Fix SLI3 drivers attempting NVME ELS commands Hannes Reinecke
2017-06-16  5:56 ` [PATCH 07/11] Fix crash after firmware flash when IO is running James Smart
2017-06-16  8:01   ` Hannes Reinecke
2017-06-16  5:56 ` [PATCH 08/11] Fix crash doing IO with resets James Smart
2017-06-16  8:02   ` Hannes Reinecke
2017-06-16  5:56 ` [PATCH 09/11] Fix crash in lpfc_sli_ringtxcmpl_put when nvmet gets an abort request James Smart
2017-06-16  8:02   ` Hannes Reinecke
2017-06-16  5:56 ` [PATCH 10/11] Driver responds LS_RJT to Beacon Off ELS - Linux James Smart
2017-06-16  8:03   ` Hannes Reinecke
2017-06-16  5:56 ` [PATCH 11/11] lpfc: update to revision to 11.4.0.1 James Smart
2017-06-16  8:03   ` Hannes Reinecke
2017-06-20  1:42 ` [PATCH 00/11] lpfc updates for 11.4.0.1 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=20170616055651.9674-7-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.com \
    --cc=dick.kennedy@broadcom.com \
    --cc=james.smart@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).