From patchwork Fri Nov 10 01:08:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 10052239 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 5B9B66032D for ; Fri, 10 Nov 2017 01:09:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E6F62B20E for ; Fri, 10 Nov 2017 01:09:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4354C2B227; Fri, 10 Nov 2017 01:09:18 +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 C637C2B20E for ; Fri, 10 Nov 2017 01:09:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755553AbdKJBJQ (ORCPT ); Thu, 9 Nov 2017 20:09:16 -0500 Received: from mail-qk0-f193.google.com ([209.85.220.193]:51535 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755472AbdKJBIz (ORCPT ); Thu, 9 Nov 2017 20:08:55 -0500 Received: by mail-qk0-f193.google.com with SMTP id n66so10106171qki.8 for ; Thu, 09 Nov 2017 17:08:55 -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=t9QDaX4UN9SwCyYZqQ+au5hpF27CfvDgNvQv8n0acjo=; b=UMYYg+8REP8ImuIWwllH14YWbv76306yue0wlNVkS3GWQCXQSSPz3V/+0gd5KuZE9R Tzz5ZuGl0vi/jS3pjCgHqNuz48DhDPK3+wPbzmqMN9r9HYdSq2WMe0/kYy4FLgeNBS0a B7NUspjvnPpEObar3LYRKxIm/8eQMdhoHQIfYGZPRSFZWMh3O6sblKj7AIEKSZ8tFqld IgQTKd5yCpfDnZmeSShouSJ26urcmTfMLALgWt3c8MPmRjGz/QhWRYnEondpraNFU0yV 9nPwu9324UUV7UztETasbBOMedXbtsaIOB3wh0gBLRUdStTGp+wUFfo5BcLKOdQUnKua Dy/g== 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=WVro0p6lnyclfilRhePAEQirttX4TOBhyfgdYtmgC7zVlT0nz+Gqr1thkDqe4DFLuq XAOr6g4zAKIaOVwMwDdj0rbiYCA8eeBc/f1T6013KUxlVPC1jiMFNDoN2VLOM9p7F0g+ 61AdF0A42j17y17hxXA2qi57O5ngLF2cRgDS0UGPMx20zy5pspoLWLfxRqLErnmhYS0X glAMLS3KjK5+gNWp4QS8ov4xPx87hrwAqXWCdV58jjevCA8Kcj31hdJwr+B1Q9vNFt3g oOp5edj+O8yKcSOAEszuP2YSBBkqQxL16oPp5RQXb2ni8iA1lzzhUaqgM2TBkpCcmHEp TBuA== X-Gm-Message-State: AJaThX6OeiAbutkEJ4K2i738wG13sxtU+8SbrRMXppfw/3svHEdFnS+h Js5WoyHYkRV8kIMigNvn6HO1QQ6r X-Google-Smtp-Source: ABhQp+QK+XF2KdnIG/l3b5f1Wj5QxNwC6u20Q23dGmAHSP5eSfRc1+zvFagxBN9YRL3dtmpLilvUDA== X-Received: by 10.55.217.18 with SMTP id u18mr3921749qki.153.1510276134538; Thu, 09 Nov 2017 17:08:54 -0800 (PST) Received: from pallmd1.broadcom.com ([192.19.255.250]) by smtp.gmail.com with ESMTPSA id j48sm5661969qta.96.2017.11.09.17.08.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Nov 2017 17:08:54 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Dick Kennedy , James Smart Subject: [PATCH v2 12/17] lpfc: correct port registrations with nvme_fc Date: Thu, 9 Nov 2017 17:08:29 -0800 Message-Id: <20171110010834.4542-13-jsmart2021@gmail.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20171110010834.4542-1-jsmart2021@gmail.com> References: <20171110010834.4542-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 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.