From patchwork Tue Oct 23 20:41:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 10653649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 831D914BB for ; Tue, 23 Oct 2018 20:41:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E9E52A468 for ; Tue, 23 Oct 2018 20:41:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60C782A491; Tue, 23 Oct 2018 20:41:52 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,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 E94EA2A468 for ; Tue, 23 Oct 2018 20:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727685AbeJXFGw (ORCPT ); Wed, 24 Oct 2018 01:06:52 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34692 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725761AbeJXFGw (ORCPT ); Wed, 24 Oct 2018 01:06:52 -0400 Received: by mail-pf1-f193.google.com with SMTP id f78-v6so1272345pfe.1 for ; Tue, 23 Oct 2018 13:41:50 -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=mTFYJnt9s3iSJ1GTLm6kjNqT6UWQerPpHNOEU5eVEH0=; b=d0QaGROh4guERQplqIKXq+tTus8vBhVYodK4aWE83EKEUBvoK5L0cO4Ax10EZh+UjJ yCNmOgtKaU5y6NXlrHZJA+DZlyV4h8jYw7W5v4jFWVV63bNRBqT/IQOBZGgxKCgt6CID KyA6Tx4EJJmV0iadAi2l5kdbANFPZ8rAQBc8YzsuMqKQJ7e2MrJm9fsq4PdQv9TKGNYb dmtM2HkwAYNW+bY5PxmBCYwPsFslHRqzKM7GDfPSNA7ByuAB6vf5ztKYEc2CUCe5zDDf ue6grXpe6QBoP2dZrWbh6uAOOUP7npDe3RB30IaOP3QbvP+pyV3+qIxM940gHTnjfTjy /JBQ== 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=mTFYJnt9s3iSJ1GTLm6kjNqT6UWQerPpHNOEU5eVEH0=; b=SncQAvvenOFykpqxefQ3Z4divSeKdKOBKunCJNE0v3bpfDvVYcnWak2P8GAxi5I5EH l+qu6jMAEqq7ee8N0WLMBDDIduSAL+v08ELW2qIruA2dedMAO3k9fDnKtGbqrQwajE5C a6ezU61dht54XUpSC1vkFTqTmrqgXP9x4BEhdASPlTEVvGb2aOHDxigmyKGxkURyP0Ch tVnFInI0KkoNVIR45i5zTBdzxtIVZY+pZ0XqOeDTUKdtVUUH2a0znitKCfChXwOXiKpz /0MB+ySyxKR6jYrBkSnnj5zWZkvs38drJNC5ere/X1G0qVCbf3DoU++S8yDSmnRU5kIP yBxA== X-Gm-Message-State: ABuFfoh9g5F1g85C0RsegvrUMU7tVMr/A6frsRId+k37SsADFiCQ3Gft IzcyH/+mJTIlM7MHP3bb4534Kg2+ X-Google-Smtp-Source: ACcGV62Me5kFsDbDPqkCqeHav0AvvLfxUiBN3N7IzPWpzqEixLsxizubwQsHuFqv8PcswfWRAjA0ow== X-Received: by 2002:a63:5308:: with SMTP id h8-v6mr46972742pgb.358.1540327310373; Tue, 23 Oct 2018 13:41:50 -0700 (PDT) Received: from pallmd1.broadcom.com ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id m11-v6sm4348752pgn.39.2018.10.23.13.41.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Oct 2018 13:41:49 -0700 (PDT) From: James Smart To: linux-scsi@vger.kernel.org Cc: James Smart , Dick Kennedy Subject: [PATCH 09/12] lpfc: Correct loss of fc4 type on remote port address change Date: Tue, 23 Oct 2018 13:41:09 -0700 Message-Id: <20181023204112.18213-10-jsmart2021@gmail.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20181023204112.18213-1-jsmart2021@gmail.com> References: <20181023204112.18213-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 An address change for a remote port cause PRLI for the wrong protocol to be sent. The node copy done in the discovery code skipped copying the fc4 protocols supported as well. Fix the copy logic for the address change. Beefed up log messages in this area as well. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Hannes Reinecke --- drivers/scsi/lpfc/lpfc_els.c | 27 +++++++++++++++++++++++---- drivers/scsi/lpfc/lpfc_nportdisc.c | 5 +++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index a200cdaf34a6..ebd6c7251ad8 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -1556,8 +1556,10 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, */ new_ndlp = lpfc_findnode_wwpn(vport, &sp->portName); + /* return immediately if the WWPN matches ndlp */ if (new_ndlp == ndlp && NLP_CHK_NODE_ACT(new_ndlp)) return ndlp; + if (phba->sli_rev == LPFC_SLI_REV4) { active_rrqs_xri_bitmap = mempool_alloc(phba->active_rrq_pool, GFP_KERNEL); @@ -1566,9 +1568,13 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, phba->cfg_rrq_xri_bitmap_sz); } - lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, - "3178 PLOGI confirm: ndlp %p x%x: new_ndlp %p\n", - ndlp, ndlp->nlp_DID, new_ndlp); + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_NODE, + "3178 PLOGI confirm: ndlp x%x x%x x%x: " + "new_ndlp x%x x%x x%x\n", + ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_fc4_type, + (new_ndlp ? new_ndlp->nlp_DID : 0), + (new_ndlp ? new_ndlp->nlp_flag : 0), + (new_ndlp ? new_ndlp->nlp_fc4_type : 0)); if (!new_ndlp) { rc = memcmp(&ndlp->nlp_portname, name, @@ -1617,6 +1623,14 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, phba->cfg_rrq_xri_bitmap_sz); } + /* At this point in this routine, we know new_ndlp will be + * returned. however, any previous GID_FTs that were done + * would have updated nlp_fc4_type in ndlp, so we must ensure + * new_ndlp has the right value. + */ + if (vport->fc_flag & FC_FABRIC) + new_ndlp->nlp_fc4_type = ndlp->nlp_fc4_type; + lpfc_unreg_rpi(vport, new_ndlp); new_ndlp->nlp_DID = ndlp->nlp_DID; new_ndlp->nlp_prev_state = ndlp->nlp_prev_state; @@ -1666,7 +1680,6 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, if (ndlp->nrport) { ndlp->nrport = NULL; lpfc_nlp_put(ndlp); - new_ndlp->nlp_fc4_type = ndlp->nlp_fc4_type; } /* We shall actually free the ndlp with both nlp_DID and @@ -1740,6 +1753,12 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, active_rrqs_xri_bitmap) mempool_free(active_rrqs_xri_bitmap, phba->active_rrq_pool); + + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_NODE, + "3173 PLOGI confirm exit: new_ndlp x%x x%x x%x\n", + new_ndlp->nlp_DID, new_ndlp->nlp_flag, + new_ndlp->nlp_fc4_type); + return new_ndlp; } diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 394ffbe9cb6d..6827ffef3261 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -2868,8 +2868,9 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, /* DSM in event on NPort in state */ lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, "0211 DSM in event x%x on NPort x%x in " - "state %d Data: x%x\n", - evt, ndlp->nlp_DID, cur_state, ndlp->nlp_flag); + "state %d Data: x%x x%x\n", + evt, ndlp->nlp_DID, cur_state, + ndlp->nlp_flag, ndlp->nlp_fc4_type); lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, "DSM in: evt:%d ste:%d did:x%x",