From patchwork Fri Nov 3 22:56:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 10041315 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 4BD1B60384 for ; Fri, 3 Nov 2017 22:57:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E915299CE for ; Fri, 3 Nov 2017 22:57:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33ACA299E1; Fri, 3 Nov 2017 22:57:14 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 B7C52299CE for ; Fri, 3 Nov 2017 22:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932152AbdKCW5K (ORCPT ); Fri, 3 Nov 2017 18:57:10 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:48087 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756073AbdKCW4t (ORCPT ); Fri, 3 Nov 2017 18:56:49 -0400 Received: by mail-qt0-f196.google.com with SMTP id z50so5066778qtj.4 for ; Fri, 03 Nov 2017 15:56:49 -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=t9QDaX4UN9SwCyYZqQ+au5hpF27CfvDgNvQv8n0acjo=; b=l0OHrIzWGg5W2bjavWD/P8uFi1mbXgcDduJ0wM5owunYHuwHBhf4QixeOlf+qxNXxo Fv+ezaAas3EiV8a9nimghC5jFBZtBKoHb3Y5YjmBPjk0QwJ+KOlPh7FK1nj82R79bZ4p Vm2r3O6hjSRvVrIslhJdG691gOg9S15Nb9FhSf3cHthEh/Ew0qTCCKkNKiC0TxK8luSh tj7EWeXuGZ3jlU+dsSra9wh9GBqwdBz3Qg4W3EGl1bh7IgxzZ/amdhvu1sugCWp1cTVp da9mDcBCNKVZ7DJPZ506q1HRNa7SkNG/TYkYWgiZivzsUU/Y8FJZsZT9KBaALrizdtva +O2Q== 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=t9QDaX4UN9SwCyYZqQ+au5hpF27CfvDgNvQv8n0acjo=; b=uRYPdnZb+RbYz/+r8xNOl/AUDSQI62JTaq8WbBQoMdly7AfA+445o77ZSp0Gk/bTtU jT8FRBW7hYIMyujO8mwjenYHI27Qnr1i/QZvxnZM6yr2R1oApa2cJ240u7gO54aUy0YG bbg9DUXV0cl7sXusqM18s2mMgkbgHR/I27ONhxtjrtvzJ6lAWIwYbRY0eIqLEg+TDfSL nT++YVvC2pJ6FrcVEatLHcgmy2LdoKFBk8mBsPMmdaPUKDcZ8ZMosbiXovQ0hpwhunQ7 VoGcXLtfwGud1b7YppbWcbUxNXNH3NV6jst3ljza8V8felx3tbgKdKDia8BJ0v63abzM jA+w== X-Gm-Message-State: AMCzsaXsJgUsktFElUM6wtht5JEjdlyecziFPPNFOhqVrMf5FB7WtXT2 fDq1920vu7wJ5Qfnn3bfaOZZ28Ep X-Google-Smtp-Source: ABhQp+TBG4ilmXilC3SFs8HlqsWG/WVq17d9oxn0u7sIkoMdP/miRJFkzO0sEDHEQq+fgCFhuXIiKA== X-Received: by 10.200.20.13 with SMTP id k13mr12094225qtj.261.1509749808706; Fri, 03 Nov 2017 15:56:48 -0700 (PDT) Received: from pallmd1.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id v21sm4765626qtv.21.2017.11.03.15.56.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Nov 2017 15:56:48 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Dick Kennedy , James Smart Subject: [PATCH 12/17] lpfc: correct port registrations with nvme_fc Date: Fri, 3 Nov 2017 15:56:23 -0700 Message-Id: <20171103225628.24716-13-jsmart2021@gmail.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20171103225628.24716-1-jsmart2021@gmail.com> References: <20171103225628.24716-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 --- 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 4577330313c0..ffceebf420f4 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.