From patchwork Tue Sep 11 17:18:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10596007 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 8090114E5 for ; Tue, 11 Sep 2018 17:18:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 626A029B1F for ; Tue, 11 Sep 2018 17:18:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 56B9B29B23; Tue, 11 Sep 2018 17:18:51 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 DB9B129B1F for ; Tue, 11 Sep 2018 17:18:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728136AbeIKWTH (ORCPT ); Tue, 11 Sep 2018 18:19:07 -0400 Received: from mail-eopbgr730048.outbound.protection.outlook.com ([40.107.73.48]:8288 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728078AbeIKWTH (ORCPT ); Tue, 11 Sep 2018 18:19:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ph7mc10vha75FVmXwQqfZh2b5CwCRJqh/w4vReAxLl4=; b=jBevYxHVdMCPiS9ym5C7BYfDQuwqTYgHjk38Jzsu76qbfMkjRHcjmrTMmKd81nJVYBrunSCZKwgRpgZZrFfGYUn7lUMsqAABQOfHQJ33d3kTSvSI/VJxdpa/Mdf0Gb/qZNUdysgh4z+iKEiPhtAAqt+pQ1tq1epcKG6SavUcvjc= Received: from DM6PR07CA0011.namprd07.prod.outlook.com (2603:10b6:5:94::24) by SN6PR07MB4672.namprd07.prod.outlook.com (2603:10b6:805:3b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1122.18; Tue, 11 Sep 2018 17:18:47 +0000 Received: from CO1NAM05FT061.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e50::202) by DM6PR07CA0011.outlook.office365.com (2603:10b6:5:94::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1122.15 via Frontend Transport; Tue, 11 Sep 2018 17:18:46 +0000 Authentication-Results: spf=pass (sender IP is 50.232.66.26) smtp.mailfrom=cavium.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=cavium.com; Received-SPF: Pass (protection.outlook.com: domain of cavium.com designates 50.232.66.26 as permitted sender) receiver=protection.outlook.com; client-ip=50.232.66.26; helo=CAEXCH02.caveonetworks.com; Received: from CAEXCH02.caveonetworks.com (50.232.66.26) by CO1NAM05FT061.mail.protection.outlook.com (10.152.96.179) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.1164.5 via Frontend Transport; Tue, 11 Sep 2018 17:18:46 +0000 Received: from dut1171.mv.qlogic.com (172.29.51.171) by CAEXCH02.caveonetworks.com (10.17.4.29) with Microsoft SMTP Server id 14.2.347.0; Tue, 11 Sep 2018 10:18:31 -0700 Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id w8BHIUms029107; Tue, 11 Sep 2018 10:18:30 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w8BHIUrA029106; Tue, 11 Sep 2018 10:18:30 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 14/16] qla2xxx: Fix duplicate switch's Nport ID entries Date: Tue, 11 Sep 2018 10:18:25 -0700 Message-ID: <20180911171827.29016-15-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180911171827.29016-1-himanshu.madhani@cavium.com> References: <20180911171827.29016-1-himanshu.madhani@cavium.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:50.232.66.26;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(346002)(136003)(396003)(39860400002)(376002)(2980300002)(438002)(189003)(199004)(446003)(14444005)(336012)(2906002)(80596001)(356003)(305945005)(69596002)(36756003)(86362001)(1076002)(5660300001)(47776003)(8936002)(81166006)(478600001)(87636003)(6666003)(76176011)(16586007)(54906003)(110136005)(72206003)(50226002)(106002)(106466001)(81156014)(42186006)(8676002)(4326008)(476003)(126002)(44832011)(486006)(2616005)(11346002)(186003)(51416003)(50466002)(316002)(26005)(48376002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN6PR07MB4672;H:CAEXCH02.caveonetworks.com;FPR:;SPF:Pass;LANG:en;PTR:50-232-66-26-static.hfc.comcastbusiness.net;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;CO1NAM05FT061;1:whxCaHb9xK+cfDUBEX702S/XhBeOEIPLguxoPBBvyx4W69Q/IJ/HLzoPwhPnJ3gPbNQz1jD6lVeEfXTW4JCUKZAlOdroiFDa+mhMQ3NjuBv5dBJKARJSB+4uFXEOc64w X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e787f257-4f1c-4cb5-7d35-08d6180aa216 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:SN6PR07MB4672; X-Microsoft-Exchange-Diagnostics: 1;SN6PR07MB4672;3:oz8B33nx4Fu19xo+YFp+nlkhecggCNLDwPo7zU7OCREv39lXvn7vExFlZMNnbv3Cm4PHiO+0nKyV6Rr/1FY1vlU/GQS5w4vPSc7PTXDc5FekAzu5O6qori3RkVNWEqTDFZqhjpOwtTTGvk+t1vCtFQBF9vxXQeVvKxhZeS0AuapbpKeLPyfBTg83a33B+GetSOeqhNU1uKbubbOBMnOljFT0eJ6qALgJQHJ00xXRVg0pggj7xro912zY6DMoYEN7nPbA3FGrJxJ0g5THZoKDxYjDXw0zG5OOWZdwdU2NfHqNoO9jb5QAw+0nt2anX6KoJM2TOt8JiTanlNIhhsvBP7PKqpSo7MQtX0fJDAg93M0=;25:yGStIwQu5aNOHsJvXxkvL5a2Ol9A4pDQhUNq/7MpXDc+BiPJOzE4Eu3wP/RPPZQolsXkXHR/n3+3gQBoisB7+YW6rzd6fBVXiddN0ZRfolgL+kHfpTjlt2y2SvD34lRytnWS0ndmay1n6cdiCrkjn0G3f5Vw/bGy4mhAhKietEB13yH4EZX28Zs3ubNWxeP4IvWvd+pEzejqY4yfVjjUSyttizrXyjltzI8b+mv3bfCcrrRYuzef8iC2GOmDhewCfzolMdJVJKmY2UbSoPX78PYReDxmoyBXxBlE+S2qfhVlOXGmpXmEnhTvSdIQ2ihW6Wz9hwqTM6Kp184yEmM2qw== X-MS-TrafficTypeDiagnostic: SN6PR07MB4672: X-Microsoft-Exchange-Diagnostics: 1;SN6PR07MB4672;31:dyL+4bSB1zLBBNJwCgZnUoWOClkIF+W2z5EIspKKoUMiqurVA4u6aUMh/B9h0SBYbXGMWrAcXcQBqkQkzC7GhJpBjAzNWKVEa7/GlzF5dxLHbhHR2Gpfakgx4WIS1AayRbX8093CAl824zVAeYQ18PPruh7Ui6KiC9vOMB+FNsfM5JyRFv2x/CClUnXCSMZhR3zrZvwnF4rWqpMJv1isowON59XFf7Lj9x5a3w43ZZw=;20:a7AjuTrUTIa/+9k93jMNRDxswADG02LSDDG3XCfusqTshRnPpU7s/p5FUHRmqdVTvbFQJw8tOSBcuPzuQIpZ10mOxc6Jw3TiEslwng+Q+wENI+7DtN4Mdwu9rVzMho1RIio/377b3b5u1rMS20xhfqrHXeVEPH7JH1BkffYkjbxdy7hGpSPrZpTW+GMNEaUE0o3cx8s3XF+zBEOPStnBb7/zmaQpKSJm8IP++kYVmjkjGxs7ffwYq+Oiz3m1Rw8984TToZZxTji9Wy7TiKIpVTDr/+lsswqmsenHB/GK8q74mxQJz/cgx1sQZw24FiP35rHTnHREQIGnFOvQnKMvVb3ljJxPQxYR5h6ECUGoMaFZyAxGJm7xsyj1RjK4NDg3didGSplzw1JMl+AXPg4XnY56XsSALJ1cVoaHDLBAYT38aPeU7z4YNs3WXKq497tSZO94qg3H1VNfFA3jdGk+C0WThXP9O0RZdC6/O0CEYrdmOk3rYVR4gGXaGCQXWYDT X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93004095)(3231311)(944501410)(52105095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(201708071742011)(7699050);SRVR:SN6PR07MB4672;BCL:0;PCL:0;RULEID:;SRVR:SN6PR07MB4672; X-Microsoft-Exchange-Diagnostics: 1;SN6PR07MB4672;4:aEUzACYUz4rRF8Qgvrva7Pu4WBNH44kQ71f7GHXCeC+mi1Ifk7eLYpXyZSC3HG/mVoog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rndF46WXC41HpyTnaT45PMOdxj7+A4hEJ+aVLtSJWNbieYpypNWEcpvNiO4FB8Whh4Eq1OCYv3Yg6AgF4qrlQqOx8H8wI6LWQwaXISQJnQRb3LfgDyDU58cGOOhM+JXBPYd8WA+5xPpjEtmfwJH1QzRyxTvZBCD07NH85Gu8+cw==;5:FtEYMnHmoLstHqT8zpNwsMxSwObbnjaAhVSeV8HkEwH2KDhl2HGD7cWbJpEqPeSlRcw6ocBdXs5JkiCAGMjXQQBISL4cqrf2ycQ45dWIzZ4LXLd0QLQZZpKh9upEdVB7UeBOKGIttpahKT/T4etpQLHcl2w1M04fYrmR82NyFm8=;7:KCWBQZNySmsM95pt0JUVV1PDCFkdOAbmlG/dx4THOdNXsXz4BOge9zVNy8MSFRqnDzckoIpkzPyFjjTLUH2Ls/iHMevGG0QSxWzG+koVFZ3uvxalOCX/EUuYt5FtqkXONZqpMR+yMLiiINhhUEkgvFF5f3UIKuUjhkzLiPdfhRTDuUjZnPudFuWaD1CE69d5GQy+wd9v8Tui17UFJZumdbhCZ1Zra9uSJA4aRLb+TGww8t0r9s8+7Zb5HoJP2C+7 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Sep 2018 17:18:46.5126 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e787f257-4f1c-4cb5-7d35-08d6180aa216 X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=711e4ccf-2e9b-4bcf-a551-4094005b6194;Ip=[50.232.66.26];Helo=[CAEXCH02.caveonetworks.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR07MB4672 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 From: Quinn Tran Current code relies on switch to provide a unique combination of WWPN + NPORTID to tract an FC port. This patch tries to detect a case where switch data base can get corrupted where multiple WWPNs can have the same Nport ID. The 1st Nport ID on the list will be kept while the duplicate Nport ID will be discard. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_gs.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index 56a80c6e50e3..84e234c1f302 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3619,9 +3619,10 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) fc_port_t *fcport; u32 i, rc; bool found; - struct fab_scan_rp *rp; + struct fab_scan_rp *rp, *trp; unsigned long flags; u8 recheck = 0; + u16 dup = 0, dup_cnt = 0; ql_dbg(ql_dbg_disc, vha, 0xffff, "%s enter\n", __func__); @@ -3652,6 +3653,7 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) for (i = 0; i < vha->hw->max_fibre_devices; i++) { u64 wwn; + int k; rp = &vha->scan.l[i]; found = false; @@ -3660,6 +3662,20 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) if (wwn == 0) continue; + /* Remove duplicate NPORT ID entries from switch data base */ + for (k = i + 1; k < vha->hw->max_fibre_devices; k++) { + trp = &vha->scan.l[k]; + if (rp->id.b24 == trp->id.b24) { + dup = 1; + dup_cnt++; + ql_dbg(ql_dbg_disc + ql_dbg_verbose, + vha, 0xffff, + "Detected duplicate NPORT ID from switch data base: ID %06x WWN %8phN WWN %8phN\n", + rp->id.b24, rp->port_name, trp->port_name); + memset(trp, 0, sizeof(*trp)); + } + } + if (!memcmp(rp->port_name, vha->port_name, WWN_SIZE)) continue; @@ -3699,6 +3715,12 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t *sp) } } + if (dup) { + ql_log(ql_log_warn, vha, 0xffff, + "Detected %d duplicate NPORT ID(s) from switch data base\n", + dup_cnt); + } + /* * Logout all previous fabric dev marked lost, except FCP2 devices. */