From patchwork Wed Aug 1 06:13:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Madhani, Himanshu" X-Patchwork-Id: 10551745 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 CA8581708 for ; Wed, 1 Aug 2018 06:13:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B90992A5FC for ; Wed, 1 Aug 2018 06:13:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADE182A64D; Wed, 1 Aug 2018 06:13:49 +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 4D7C22A5FC for ; Wed, 1 Aug 2018 06:13:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733182AbeHAH5p (ORCPT ); Wed, 1 Aug 2018 03:57:45 -0400 Received: from mail-eopbgr690040.outbound.protection.outlook.com ([40.107.69.40]:15840 "EHLO NAM04-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1733157AbeHAH5o (ORCPT ); Wed, 1 Aug 2018 03:57:44 -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=ufhwIdujEqTxVBCYmKi3wAB5vp6pU2rQt9eN/ImOaf0=; b=O32g9Jlc8Zu9Aa29q/zk3+pEPhlT62zsQ07HhV0f03Ggfuljqnxgrn5z9Bu3nK32nhYz7xFcRUKIZx9f7W27hEMccLHwiYMBGLASYPZM1WdhkJw0CbaC2HeFNwUzQH+qXDhAgcN+A/6wESokjh5Pybz4iPvtZA3ovKNhv00vUD8= Received: from BYAPR07CA0027.namprd07.prod.outlook.com (2603:10b6:a02:bc::40) by CY1PR0701MB1386.namprd07.prod.outlook.com (2a01:111:e400:4c1b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.21; Wed, 1 Aug 2018 06:13:45 +0000 Received: from BY2NAM05FT043.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::202) by BYAPR07CA0027.outlook.office365.com (2603:10b6:a02:bc::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.995.17 via Frontend Transport; Wed, 1 Aug 2018 06:13:45 +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 BY2NAM05FT043.mail.protection.outlook.com (10.152.100.180) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.1038.3 via Frontend Transport; Wed, 1 Aug 2018 06:13:45 +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, 31 Jul 2018 23:13:36 -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 w716DbPM028773; Tue, 31 Jul 2018 23:13:37 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id w716DboD028772; Tue, 31 Jul 2018 23:13:37 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH v2 07/16] qla2xxx: Fix redundant fc_rport registration Date: Tue, 31 Jul 2018 23:13:26 -0700 Message-ID: <20180801061335.28709-8-himanshu.madhani@cavium.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180801061335.28709-1-himanshu.madhani@cavium.com> References: <20180801061335.28709-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)(136003)(39860400002)(396003)(346002)(376002)(2980300002)(438002)(189003)(199004)(87636003)(16586007)(51416003)(478600001)(52396003)(47776003)(106002)(69596002)(336012)(8676002)(14444005)(81166006)(446003)(4326008)(8936002)(186003)(86362001)(80596001)(26005)(50466002)(81156014)(76176011)(6666003)(48376002)(11346002)(356003)(316002)(54906003)(476003)(50226002)(110136005)(305945005)(72206003)(5660300001)(44832011)(486006)(126002)(1076002)(42186006)(2906002)(2616005)(106466001)(36756003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0701MB1386;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;BY2NAM05FT043;1:HRIzdtRx3p492f167alPyB05hUMFmFVUdU8fVm2yZoyt46u6/O9JMb2qp//qndl3iACf9bViHJEcPMKVWX+0tJ5qOsuN6B2+DnAcSSYkPwwKbI9H7TdAPQSdGVbsy4HW X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0939efb2-0ebd-4028-7104-08d5f775f004 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060);SRVR:CY1PR0701MB1386; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1386;3:zv8jYzV5xq66PZpBI93k/XiGmcX8q9PlIwNEw4j0UFazlpsV3GrTxREU984qh0Ad5sRaJYlQgdmra69J4h0c28OSgNqfin5AF65qjtPDJABxSYVaT1S6iEzrkk86UW1byyVfQX3SLfd034Rj6822dDXOk8pPr5GEd21Vim9Jgz+3SQsZ4z5FWhdO3MAMhnWhNznMk7cnVL/P0GSyLisx0V6NvCqH9OwdTVhZliHg8sWP9Nr1dw1DPhKtX+TFjfPtdsMWE4TgCHJaa0n646XJZw20CSO9Xx6QGsM2S/Gwns8dpIC5adqwdlfdyyPOgbwzS0EN3oe6xD11evHIBXw7+08wo0PawBZj0RPUmwEjmBc=;25:b1Jvu6Bgw7HEwGYDGYA5QNbi3QYBl9LMo68aaQf2K5db1QYbBSiN9bhEaqB+Tm/UzsJ6O+wYXz2VMUS+lUwlDnwuFt2BD15euQxeV7DLvfICdEzDcTA7nZ2RWPls+As8Ppsj83CJ3t0LwWUMz2RM+acTEqn5278/oYMV1/Z0no4cXUg1ESADBC1bp0iqkLHqtnCTrjBCsFcaEHTtDfJ8VncimKeLHsd4qwaXCPof8KI/nFmO0KyXjb8xuwRy+ZPZj9sIENDpWkOp5CywsSa5UhQ7wsS1X5furfcdNJNMQJENh07JAjsytGtexSAQmW4MkYZek6P346p9vqYvna3YHg== X-MS-TrafficTypeDiagnostic: CY1PR0701MB1386: X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1386;31:8ReF8d4cmF6EjDUoiXqrsri53x1kEvJiQmWZZkLRmsd6Zj4DM8iLEIhqTSUEklRM1LkqDsIB2rKu1kRWtZMvwDl82mRB9917dNyK8hx3e83Jc6ByS4SP7RvNQjViYYMOkRQegtN953skQYUD+R46+Ib7O7Fp0NRRk1Ur6acfCGP1jwI2bYVi7nf8JOFPxc/jY6M1xIOHCR0ZZwscq3Hj6yw9u4oldRjsalQOVRImPOk=;20:+KOUCZHXNciKgGlEiYyFGGa+a05AyO+hAUDXqwtTH7Pj1AAQCQ8m7H5hr4okZ0czf7lwQnVA7bvAkNjqQvct2h9pVRO4lnz/H7XBGd8QMj2YZledFKGr3cZB4kqj2fn8O5jQGwGPQNryQ3/w3XmJywNI+tGVAtR5s5IFtAAaSUF91Ac+joigEwKVhxj410xYjggVrAJeFP25DbFiHhxuf978v69xDtwBpe4CKFETG8ri8koaoYktl4VR6tHdHH0BJPbfsdkKGxi6oEKndapp5uOHOYOKaiQSDKS9NpEbzIB+FJ985dewJvrU18DX3Lg4+chlV+lD0hzJsZnOdztU3W0ODBKMEERdt+ONGoufOuUX8Zt8wuJpwh4ALLlYKIKvAZbjciuDn2wkeBm9tqhTgv7thdADKnc/3zHLFGD7rrL2fMSoZYg+Q34ObkwBlQTkHUfRrGE7ZGFd6s1BzLubnoaTvE82dwFOo3w2XGM3PhmF65NbekXnVXStp0DpJO6O 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)(5005006)(8121501046)(10201501046)(93006095)(93004095)(3231311)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016);SRVR:CY1PR0701MB1386;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0701MB1386; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1386;4:Hmpvb3t3e4eUDdrqsRbdM+F3gs7O6rDJDtm4AgQazqkm/6gHMCdUlnvs3bCpvaN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xC1JMAFPrbKl4f2qdQ2/lwVdWNFnGNfm82JL4q+HU5iJrzmFnO5gAvjmXBra/jrPT9E8l8TCEbxcgT6quN7lGZMCH7KaIMzX7iEsk2MLR0Da6Jc2DjDchB4h1AjG2IVNYhmyPtXkYF9e/s201nL+dFjWdvrIdrXoJO8bqoAtI5S2AukdLQXr8YJP5Hb+hHH3T7Jdapdd15VlTpb5VJiWWQYp9I6x4k5UIw4pGVPn1+nHkwCjQPTljWsSCAF+8lP3jIZCmy9obTriGNDNt4criBhOMxluTTzFfjcLCzp2xw7yssUABTNKtVIS/itwra12VVj/eFXxmHYYrU+03an4d5cmgj35ozcxKHeaWVhrB+jCfMpw== X-Microsoft-Antispam-Message-Info: 0qQolAhQWQwdRfASU7bXJJac7uL51sSUcbQDFI7lWnECsEp7QXBsHzinlesywsIT/pmhRE1/CgfLnLH5lJulkRIxJp9b2YkDNuxUuKqeNVS+wtDEOkOIbxpJNHBqmYnP+JL+CWC9CKNgLULVDc7L1Vkrr2l5wooHV1z+jHzczNvL7/MSW43lgBLZH+KTxYhKE0EoGVbOtWJZBux3P6OthET/BGabCvHlpNQauV37moWvVhoe4ossX1zTz2u0Z0ZhwwkoCGosorJXWD4hCvyiObdEdzGCdAw1N3EZSJCn7awm3nnjh6809oi/Ffy4MU+2XBvRm3tu0ycu5G0zEAxxTlwwyllnpq3shHCBGaLHWsM= X-Microsoft-Exchange-Diagnostics: 1;CY1PR0701MB1386;6:uavt4au3WTIkffMRkbJjxG+6Yny5FomgH33VA3bGPOYWaAb0oJ7uYT/419I4Upg8308QrwEB19+TodBhS0Tn133HTG5xh7U93w1mdF2G1We7kmBlqoDYxHjn1Aaws489/NWbT7Tfj8ky1ohyzcFEYHyR9bvhZp0fQNukA0qu0oKySj+eAPUmmmQToJLjNO4cOGBM29jv+Wgdd7FqhdVvyKB1lfv/E82dsDLbIeHO18FiZSSPbRFb494WjUNyEcyktQjVA8W2I65SvUbirvSilvPb1N6cJ3JmM1NKfqAL1S/yGl1nVzfRUywI7SZXRV+Vj1OYm4jh/jSr+dfyNMP9ID/Xj6kJfnsrOz7WThB0R/4+u2eTIdOKawVwe8z0A3QePCHMNOEQnqfMxr7bm/kNTopRyQwujJnMTYAlYj+3CGEoY/USkglh2O8TkRUyJtobM2UcsxYXZQWo9chfV/y6hA==;5:SbcYLB6z2nknr9A5Bjo8B3LWvgzlA1ZyL7JTa7iz4OIAUtjZ/voM2Q7aW+jtsAqfG+SQraKLZuofB6Wkn0ck754sCLSbJ05PL3FhFiLCI+nyqCI+8MGe8ukYP919twyHb++NaSVuM3w9Jmsoax/ShBzGtEk2tGg0AsyZN+4p3/U=;7:RZJ4LOBIa7xJHoG6ACRj4kCL9jJ62eHttPsp2di/lNAHL9VCyPASy/YpSeqLlppJDTz8L64GKHLz3XEodtmGDl4T/71NfEWwurERRiA9/H8Oxu22XOUvr53qcBshmmJ+N717jCk7UAo+DmGXy66PXYOYrI+kd2i2nc0jgGOIwweBJo3v7sXu/IPjy+bpGLSttN/WCSJR3z5J+GVSL8MzkUX7LO+64WMDBqbOV3jtgqtr7Lf+pXX4rWQvJEi+6UBb SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Aug 2018 06:13:45.0819 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0939efb2-0ebd-4028-7104-08d5f775f004 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: CY1PR0701MB1386 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 Prevent multiple registration with transport layer for the same remote port. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_init.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 79738294b069..4a89aa93c315 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -5001,6 +5001,9 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport) struct fc_rport *rport; unsigned long flags; + if (atomic_read(&fcport->state) == FCS_ONLINE) + return; + rport_ids.node_name = wwn_to_u64(fcport->node_name); rport_ids.port_name = wwn_to_u64(fcport->port_name); rport_ids.port_id = fcport->d_id.b.domain << 16 | @@ -5056,25 +5059,18 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) if (IS_SW_RESV_ADDR(fcport->d_id)) return; - ql_dbg(ql_dbg_disc, vha, 0x20ef, "%s %8phC\n", - __func__, fcport->port_name); - - if (IS_QLAFX00(vha->hw)) { - qla2x00_set_fcport_state(fcport, FCS_ONLINE); - } else { - fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); - fcport->disc_state = DSC_LOGIN_COMPLETE; - fcport->deleted = 0; - fcport->logout_on_delete = 1; - fcport->login_retry = vha->hw->login_retry_count; - qla2x00_set_fcport_state(fcport, FCS_ONLINE); - } + fcport->flags &= ~(FCF_LOGIN_NEEDED | FCF_ASYNC_SENT); + fcport->disc_state = DSC_LOGIN_COMPLETE; + fcport->deleted = 0; + fcport->logout_on_delete = 1; + fcport->login_retry = vha->hw->login_retry_count; - qla2x00_set_fcport_state(fcport, FCS_ONLINE); qla2x00_iidma_fcport(vha, fcport); if (fcport->fc4f_nvme) { qla_nvme_register_remote(vha, fcport); + fcport->disc_state = DSC_LOGIN_COMPLETE; + qla2x00_set_fcport_state(fcport, FCS_ONLINE); return; } @@ -5115,6 +5111,7 @@ qla2x00_update_fcport(scsi_qla_host_t *vha, fc_port_t *fcport) qla24xx_post_gpsc_work(vha, fcport); } } + qla2x00_set_fcport_state(fcport, FCS_ONLINE); } /*