From patchwork Tue Nov 21 00:00:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 10067503 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 590C86056A for ; Tue, 21 Nov 2017 00:01:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B43729194 for ; Tue, 21 Nov 2017 00:01:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40300291AB; Tue, 21 Nov 2017 00:01:13 +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 DF04329196 for ; Tue, 21 Nov 2017 00:01:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751714AbdKUABJ (ORCPT ); Mon, 20 Nov 2017 19:01:09 -0500 Received: from mail-qk0-f194.google.com ([209.85.220.194]:32961 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751975AbdKUABH (ORCPT ); Mon, 20 Nov 2017 19:01:07 -0500 Received: by mail-qk0-f194.google.com with SMTP id 78so9761321qkz.0 for ; Mon, 20 Nov 2017 16:01:07 -0800 (PST) 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=cu+q0JNI4PqMrOUkqRCSx5szXSm0TRC19oIm23AHb/w=; b=sCWUS4k9yQdYoCWZS09sWcJm7MoQ6IXQmSTu6jcjux4A4oc/cuo/9hzRoMyFg0SUym sLKPZXxY5cxMXv9O0nUICVsrbn13OfTg+FQW3uAjikvA+JqC3hu7S47jguAEzp1IwuSv 7qaq0JnZbOoQHqumU1JhtUNbRdLVHMmH7g2mfYF8ICHRrUtxwt4bxmi6Gq5hmEep4c6i 7UMBq1S8QjFv31BVDlNPaW13/sXFOZTb5PAjJXsmG7lIzYn68v7y+p4lKt2sfZIEQtYA L3Z2HpcCXrCWZHB1ENhmXLqs/Egds+gb5GGImxl3FB+JROoVNrqonIl8cJIRuiRb62Ay ++wg== 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=cu+q0JNI4PqMrOUkqRCSx5szXSm0TRC19oIm23AHb/w=; b=UJQ19WvbziYzKUfmeMr/q7a1Z3GKbrf1TaZZGc/4sfwurL9Ie+N1l5U8wil7z01QRd jNvvnPp2AZD/a4ZcBSZKIeecm6isqFSt7coU6DIVz9P7nekNX01cBmxBe0vpv+g++eui YhqQbPuExXu1PN+Z16I498cSZnQGNlxOhHUHJeu260wkPGePzcB/JCbmCjtU9CXXSV82 O41aeOv5FFav0vc/jkr4GhVGmZ9FIXM5fyz20Oz+MByKYx8gaMXVYcg9CVOmCRv6wyCu 4GYXDZwgslNltnlbedCJJybMo6aY1xh6ShtU7SWlTFH+rRkVP5xKXLQZvNZQGkD3JSiU +f/w== X-Gm-Message-State: AJaThX6MG/n7GoZX33HwuCTDqEkhbRFIv51kZd8O8Bej4KHv5gpydZRR a4JbH1c9UDABOxuhYwAi6QWkBuav X-Google-Smtp-Source: AGs4zMZ/LfGRurprtrTj0z6y2q25S68g+nz6k1Uf3/oH26L9qBp6I2e5MM3/FaXQTe8NteZkQgRVKQ== X-Received: by 10.55.15.90 with SMTP id z87mr21454190qkg.141.1511222466794; Mon, 20 Nov 2017 16:01:06 -0800 (PST) Received: from pallmd1.broadcom.com ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id w143sm1612821qka.84.2017.11.20.16.01.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Nov 2017 16:01:06 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Dick Kennedy , James Smart Subject: [PATCH v3 12/17] lpfc: correct port registrations with nvme_fc Date: Mon, 20 Nov 2017 16:00:39 -0800 Message-Id: <20171121000044.27702-13-jsmart2021@gmail.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20171121000044.27702-1-jsmart2021@gmail.com> References: <20171121000044.27702-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 The driver currently registers any remote port that has NVME support. It should only be registering target ports. Register only target ports. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Hannes Reinecke --- drivers/scsi/lpfc/lpfc_hbadisc.c | 20 ++++++++++++-------- drivers/scsi/lpfc/lpfc_nvme.c | 3 ++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 31773e481264..9f4936911c4b 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -4176,12 +4176,14 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, if (ndlp->nlp_fc4_type & NLP_FC4_NVME) { vport->phba->nport_event_cnt++; - if (vport->phba->nvmet_support == 0) - /* Start devloss */ - lpfc_nvme_unregister_port(vport, ndlp); - else + if (vport->phba->nvmet_support == 0) { + /* Start devloss if target. */ + if (ndlp->nlp_type & NLP_NVME_TARGET) + lpfc_nvme_unregister_port(vport, ndlp); + } else { /* NVMET has no upcall. */ lpfc_nlp_put(ndlp); + } } } @@ -4205,11 +4207,13 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, 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 - * the register. + * Only NVME Target Rports are registered with + * the transport. */ - vport->phba->nport_event_cnt++; - lpfc_nvme_register_port(vport, ndlp); + if (ndlp->nlp_type & NLP_NVME_TARGET) { + vport->phba->nport_event_cnt++; + lpfc_nvme_register_port(vport, ndlp); + } } else { /* Just take an NDLP ref count since the * target does not register rports. diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index db1ed426f7e6..d3ada630b427 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -2473,7 +2473,8 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) /* Sanity check ndlp type. Only call for NVME ports. Don't * clear any rport state until the transport calls back. */ - if (ndlp->nlp_type & (NLP_NVME_TARGET | NLP_NVME_INITIATOR)) { + + if (ndlp->nlp_type & NLP_NVME_TARGET) { init_completion(&rport->rport_unreg_done); /* No concern about the role change on the nvme remoteport.