From patchwork Sun Nov 15 19:26:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 324989 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F658C6379F for ; Sun, 15 Nov 2020 19:27:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DEABF223C7 for ; Sun, 15 Nov 2020 19:27:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="C+bZxa65" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727877AbgKOT1I (ORCPT ); Sun, 15 Nov 2020 14:27:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727861AbgKOT1F (ORCPT ); Sun, 15 Nov 2020 14:27:05 -0500 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D382BC0613CF for ; Sun, 15 Nov 2020 11:27:05 -0800 (PST) Received: by mail-pf1-x442.google.com with SMTP id a18so11348036pfl.3 for ; Sun, 15 Nov 2020 11:27:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version; bh=gqZlVEbVNSBZRqbcxyKX9YCI1715XhxSCPftVUufgy4=; b=C+bZxa65r48qLYLcRcMG2YP0vUEqbf3CysIz3WtLrGnrWGG65dGLBnwKeibOpbKVpR oAcnBTek6G/d6VJ0D1DnBFZrNTzKCAjd+Q84bJVPtMS0kSCaQeR+3xBPPepurY34pXbk xk2F8dI/zF4NiG/GX4hAauRgd22s6ksOHEjwQ= 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:mime-version; bh=gqZlVEbVNSBZRqbcxyKX9YCI1715XhxSCPftVUufgy4=; b=P44lxKub57fBFY7eESUN/jiL2kwlhZaLqdxKYtn4L0UGyG6Kqx0Nq8DrIyE4sydoo0 g48gDQiERZKAyEGdJdfGcgP7dev990h6ER60SiTMO2iePzyjg7c3Zu4Kw4dEDNe7Bmxr EhHHae9iMIimvYIoR8LSyhrauYaqL0INujoeq201hY6TObFDkY9V53kwNtCmwT/zaB2j h4YrAJtNz08+302NZN8QRjktzwDYX5vAw8sTiDHgIOzVjGax3Mo/kEWtmApfP+WhfcEn pLklSaKeGZLr7vQMADL65lz05/kwJiPvagF5A3TLmfr5vRQbpntXNonT5l3GMr5J1L3b xfJg== X-Gm-Message-State: AOAM5305giLa0ijHfy3y1TMO5rnS9nKMTJG2x4eCj39rlBVEQ9Lbm0FF 5UiAhDvGB41Ci8SpOYAk5LGU9bGTjOZu4NWh3Ku6uYGxSCgtOj8opVvjUC9K95ulsPAY+Sr2vqu N73qRqgMuBNRs4ldbdA9lwTBsfX6ZqYI2tosiEJIJ8KBXSLWUicuDesGDLzPQhVvp86958G8t6+ +p5mc= X-Google-Smtp-Source: ABdhPJzFtA6jffGRPydsxBdPk1kZsh/rDOHQt61wXzoE8+CJP8E6pAPHccCXgTUKunjCXTQgL1QOTA== X-Received: by 2002:a62:17c8:0:b029:18b:5a97:a8d1 with SMTP id 191-20020a6217c80000b029018b5a97a8d1mr10887092pfx.15.1605468424825; Sun, 15 Nov 2020 11:27:04 -0800 (PST) Received: from localhost.localdomain ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id v126sm15864604pfb.137.2020.11.15.11.27.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 11:27:03 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Dick Kennedy Subject: [PATCH 08/17] lpfc: Fix NPIV discovery and Fabric Node detection Date: Sun, 15 Nov 2020 11:26:37 -0800 Message-Id: <20201115192646.12977-9-james.smart@broadcom.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201115192646.12977-1-james.smart@broadcom.com> References: <20201115192646.12977-1-james.smart@broadcom.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org While testing NPIV and link bounces, the vport would not show a fabric node for the F_Port, would not transition into NPR state during a link fault, or leave the FDMI node untouched during error injection. Cause for this was determined to be an inconsistent manner in which F_Port, Nameserver, and FDMI controller nodes were created and linked. In some cases, the nodes would never be unregistered from the transport, leaving references active. In other cases, the fabric nodes may register with the transport multiple times while still registered. The following changes were made: - Fix the FDISC issue routine, which starts vport (re)creation, to mark the F_Port as a fabric node (NLP_FABRIC) and allow the F_Port node to fully be created and show up in the node list. - When remote ports are cleaned up on vport termination, cleanup the nameserver and FDMI controller nodes on the vport so they unregister from the transport. - On link bounces, don't exclude the NPIV Fabric remote ports from transitioning to the NPR state, allowing them to avoid re-registration if already registered. Co-developed-by: Dick Kennedy Signed-off-by: Dick Kennedy Signed-off-by: James Smart --- drivers/scsi/lpfc/lpfc_els.c | 4 ++++ drivers/scsi/lpfc/lpfc_hbadisc.c | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 45a8ebbf60bc..6fc42c978730 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -1508,6 +1508,10 @@ lpfc_initial_fdisc(struct lpfc_vport *vport) ndlp = lpfc_nlp_init(vport, Fabric_DID); if (!ndlp) return 0; + + /* NPIV is only supported in Fabrics. */ + ndlp->nlp_type |= NLP_FABRIC; + /* Put ndlp onto node list */ lpfc_enqueue_node(vport, ndlp); } diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index ac05d188f816..f3cf988733c2 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -818,12 +818,13 @@ lpfc_cleanup_rpis(struct lpfc_vport *vport, int remove) struct lpfc_nodelist *ndlp, *next_ndlp; list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { - if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) continue; + if ((phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) || - ((vport->port_type == LPFC_NPIV_PORT) && - (ndlp->nlp_DID == NameServer_DID))) + ((vport->port_type == LPFC_NPIV_PORT) && + ((ndlp->nlp_DID == NameServer_DID) || + (ndlp->nlp_DID == FDMI_DID)))) lpfc_unreg_rpi(vport, ndlp); /* Leave Fabric nodes alone on link down */ @@ -1037,9 +1038,7 @@ lpfc_linkup_port(struct lpfc_vport *vport) vport->fc_ns_retry = 0; spin_unlock_irq(shost->host_lock); - if (vport->fc_flag & FC_LBIT) - lpfc_linkup_cleanup_nodes(vport); - + lpfc_linkup_cleanup_nodes(vport); } static int