From patchwork Fri Jun 16 05:56:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 9790585 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0C0D760231 for ; Fri, 16 Jun 2017 05:57:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF4022861F for ; Fri, 16 Jun 2017 05:57:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E427728641; Fri, 16 Jun 2017 05:57:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 840852861F for ; Fri, 16 Jun 2017 05:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752096AbdFPF5P (ORCPT ); Fri, 16 Jun 2017 01:57:15 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:33056 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751641AbdFPF5N (ORCPT ); Fri, 16 Jun 2017 01:57:13 -0400 Received: by mail-qt0-f196.google.com with SMTP id w1so7899442qtg.0 for ; Thu, 15 Jun 2017 22:57:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kkIOTBLvVLSxa55lYwFTggHplX/+aRZtBW/sXhsjnGA=; b=qieG04aiWrCDwVVJQMbYS5rcit2PAbt1ouHedCRkupFvdtPpmcz0rOOesVGRLVlm5s tGiOpv3MqtX73ExGRjyi6eFhuiSKAJfnEOpKlhr8HAb6vmX3UcMQ+J+U1xqVw46ksO4s CNI92yG1DW1lBZFZ2ehmHX1SSw0cXNn4VRFH89/CULnqkO1znKenMl9K7POStx64LXi1 IDediYmzbiEoCimcWpvyBCvVMwtGD3xk8dx2cvBkM8bjdr5iF9MvWcfoNNVCTdvZVskZ t5tE8CMz1seOImmr0AA2YszvsDMWZljwWWMByaKhasAD6ArrxkY7ldZZv/b91PACL6mU 5y8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kkIOTBLvVLSxa55lYwFTggHplX/+aRZtBW/sXhsjnGA=; b=T/O8BEMUKlk0LbyMKQS8zfGJnxr3Fdv2mb1cx43utq4+lsj1kYR4KRuCq1uJzrcDOK YkzGROhiEsLsWLKqpkR7vv/kaFiW1thcNAx07V/6/VsJK+bEmscq3mt4wbR6UOFRTMTd bXUQBhrkpdc8zefsGJNiLeJteBdxoP9tK5t56PNna8GiwtO9HYmGfAkX+iN6t6TmKZ4v lmnFSMWRNEcaNmMyvgfopM/zle1aZF6QRau3qZAWls/9RaA7KDxy/FKklFaY11jX0Vir RyrkGU9RwTD/qhrNikmkeRbsKvIenq//VZNx4zB87qKr2ziF0irJnN7dKejLkF/L/1h9 0ngw== X-Gm-Message-State: AKS2vOxPGEYK0SDL6VP8b7DVFogekfP25TcNCtLPnzL/jQrii3IIutCQ L7i0xSTHoNuBt1sE X-Received: by 10.55.90.196 with SMTP id o187mr10515810qkb.113.1497592632290; Thu, 15 Jun 2017 22:57:12 -0700 (PDT) Received: from localhost.localdomain ([192.19.218.250]) by smtp.gmail.com with ESMTPSA id d16sm925428qke.5.2017.06.15.22.57.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Jun 2017 22:57:11 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Dick Kennedy , James Smart Subject: [PATCH 06/11] Fix SLI3 drivers attempting NVME ELS commands. Date: Thu, 15 Jun 2017 22:56:46 -0700 Message-Id: <20170616055651.9674-7-jsmart2021@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170616055651.9674-1-jsmart2021@gmail.com> References: <20170616055651.9674-1-jsmart2021@gmail.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: James Smart Reviewed-by: Hannes Reinecke --- 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