From patchwork Wed Dec 27 04:34:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Raghava Aditya Renukunta X-Patchwork-Id: 10133403 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 51DAF6037D for ; Wed, 27 Dec 2017 04:35:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AAC62D864 for ; Wed, 27 Dec 2017 04:35:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E1A62DA5E; Wed, 27 Dec 2017 04:35:23 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 B11752D864 for ; Wed, 27 Dec 2017 04:35:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751851AbdL0EfV (ORCPT ); Tue, 26 Dec 2017 23:35:21 -0500 Received: from mail-cys01nam02on0089.outbound.protection.outlook.com ([104.47.37.89]:47232 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751798AbdL0EfM (ORCPT ); Tue, 26 Dec 2017 23:35:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mscc365.onmicrosoft.com; s=selector1-microsemi-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=U8JIr2gW/nzTTHAOK62qtApPr3Ul1cYZQaqPZtSQUw8=; b=G17C5CrETvI293i2XZJ9x9uqD1QVG0XPpeoQp9Gc5mjj3aZhZbhSGaxKnfT5mVsM30/Rl5hDBUqmouSMQG8hD+qCjGcvPS2djVs339rV7YO4BfzOHJUvsZVGe83bQQXASE/ZVigC/kWkes437BtDuxUCS1ov7N8e09SdDFHx3yk= Received: from MWHPR0201CA0047.namprd02.prod.outlook.com (2603:10b6:301:73::24) by BN1PR0201MB0737.namprd02.prod.outlook.com (2a01:111:e400:56::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Wed, 27 Dec 2017 04:35:10 +0000 Received: from BL2FFO11FD050.protection.gbl (2a01:111:f400:7c09::115) by MWHPR0201CA0047.outlook.office365.com (2603:10b6:301:73::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.366.8 via Frontend Transport; Wed, 27 Dec 2017 04:35:10 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=bestguesspass action=none header.from=microsemi.com; Received-SPF: Pass (protection.outlook.com: domain of microsemi.com designates 208.19.100.21 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.100.21; helo=avsrvexchhts1.microsemi.net; Received: from avsrvexchhts1.microsemi.net (208.19.100.21) by BL2FFO11FD050.mail.protection.outlook.com (10.173.161.212) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.345.12 via Frontend Transport; Wed, 27 Dec 2017 04:34:50 +0000 Received: from localhost (10.181.72.13) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server (TLS) id 14.3.361.1; Tue, 26 Dec 2017 20:34:56 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" , Bart Van Assche Subject: [PATCH v2 13/30] scsi: aacraid: Untangle targets setup from report phy luns Date: Tue, 26 Dec 2017 20:34:34 -0800 Message-ID: <20171227043451.27813-14-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171227043451.27813-1-RaghavaAditya.Renukunta@microsemi.com> References: <20171227043451.27813-1-RaghavaAditya.Renukunta@microsemi.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.100.21; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(39380400002)(396003)(376002)(39860400002)(2980300002)(438002)(199004)(189003)(4326008)(81156014)(305945005)(5660300001)(48376002)(50466002)(8676002)(36756003)(1076002)(106002)(2950100002)(53936002)(76176011)(6666003)(2201001)(69596002)(59450400001)(97736004)(86362001)(72206003)(51416003)(16586007)(54906003)(478600001)(50226002)(104016004)(106466001)(2906002)(8936002)(81166006)(110136005)(316002)(77096006)(57986006)(68736007)(47776003)(356003)(76506005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0201MB0737; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD050; 1:fkepO3BpimZvgvJ8zHpZ8nD05oYcnOJw8nqlKVBPAqQfL1DmjsGH+O0DuAZdYS6swU7YNLWgJhQOYu9o0aXpGutLcnp6rhd+mqibxnLavkTMhb2PH8Riyh/s34W2T82s X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 566de306-fbb0-47da-efc4-08d54ce32b36 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:BN1PR0201MB0737; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0737; 3:aY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YOniGVXCQotEfNIrgZXt4N23jzI4nEGLonWMLKtdbLpBZCuotdt3R1ytNX6EXFclya3cvGjpA7IHSLJtlYSFNAPx4v4gNtQAvIOMIg7UHsoDEXDh1Ral0Zwl5KMjwNNS8PIlNHnB8R6rdx8hTBnE1l1VA2KbtjQkt/PArZBrCGiTAhxPfnqBwx50/lybxfPowZbqjb2Ve8WXF3Tn/6upR21spnL9Fvr3b/d6CGlpnucQ2GnNso4vG93xinsCijrLEXv7c6undrlutVv/vwbUhtpmVzZRxAhfeG3A41Mx4gpSdJ92BMdeku9jF/nLP+C9A2zE/vKAqjz1CQ+Wf670FPMdXnoy79V9UhRVh+da0Ahv6tnbeU5h5Dhs7gbKgsTrb3Mz5qGtQAd90ef1d4wdMqjewWkMMLWO1OcpAWVyR7GpqnG0QxChEyHqAP/U6Vgh+JFVq157yFvL+XYeO19FyeB6707qPXmQJ7XEYHf4GzQuUIlEMhkRClz3AtzIcvgSneOgEhV/EZL9l0fyaKSiRxNtP2fRZhnXgjIBberBtrqqmXlpgWtt2mgU2FaNC3K8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865)(211171220733660); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93004095)(3231023)(944501075)(6055026)(6041268)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011); SRVR:BN1PR0201MB0737; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BN1PR0201MB0737; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0737; 4:6NOSBjyBXfdHCb6J6dvMQmnK5HyghlRRAIQN2lJWe5QcWCSjl2pggEfm+21/WEvvWbbcNZzGhNdqY/z/ldquKfpBtHRsS2Sz3Bmt7q6UoHV9i3qZx7q5Da1TsLYIX8H+8fB+rHNucAQHQbMov1YzyGCFBi2TW07nouBDpGGgXCP7DgZ2+jK+V0FaRWEw9i8OQriNyyCrPSyd/h6W0iCF/NttizuAbilmZ0nEVbmvLcABWSb+XKNOnT+5Hda5Y3uaDeNkd8+jPgyAYk3ueZLml6PKEDqCyRnKvocie/HITvMG88h3NCDO54oy7bKY19RtQKYt6nEMW3HntmjZU9YSHcfDavxls+5gTcUnHklTClw= X-Forefront-PRVS: 0534947130 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN1PR0201MB0737; 23:vb9BGEgHckggl9U+1+Bl6ackgSn21StY9D6LihP?= =?us-ascii?Q?jMl5UBIec+QHl5ihUYr1UmOwvkJX0BgrSXCTYFKkEsBn/qLwY6LXskAU3yTF?= =?us-ascii?Q?s21zkSyioBNAWM57J46oVCCLNrKvMRxdiD9rW31xJUydRVCbNfAq9J9Rx5wv?= =?us-ascii?Q?Ek1TogSCn9V74Vq7nCHDWyQnC5vYgCz//S0IQrjCcD0VAVMkTNbGxkwJUSlT?= =?us-ascii?Q?gwgEX1kbUkw2CdCBy6LdTPlFhtODzIaq0p3nOItGhqVDRwxtKH02xhU8G3R0?= =?us-ascii?Q?pbEjPGvzXcnnueSDe2PpXIewC9GbdP8y5QEPl+Au5mcOktSHuCyyJESigEM7?= =?us-ascii?Q?h1T5Sitj4Un55XaWuixSNrJCUg5mB/PxD3MjZAfvK/6/Td31EsXe/qPA8+9O?= =?us-ascii?Q?83UENeXPtPvvdTzNsDXhymnzoVRZRwSP9MB23Lnh7dPSDEWf8lfCjuckuqaE?= =?us-ascii?Q?2/ek+1SNTPz0pL0KID/42mycpTMWo/GP//rD/qpb/0+oUVIOTYkJ2uWINTnF?= =?us-ascii?Q?Ldl8AxZv5WaOOYAnB3+UQDqQ4cQq9o7hvxg/+c+SwDkhBltq3rTFlFt5d6a4?= =?us-ascii?Q?GEaV6EFtzm2wGDxSDGwixanvOx1WytaIh60OXgc3t8euyPZTpJw/r2RSfrEH?= =?us-ascii?Q?hb2oIP1KBQ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ld4BH50/dOGihEQvWsskTil4+420dXqkJGGrv9Vt0jx9Bf1Ha0nlPbDaxxE5WoBoCprVro4+Xr2jOIIetI5GfSRJ5eAHT3RYpoY=; 24:2xxsD5E2uKK++wEbu/KsAY46gPvS/p4DgGYvzwdmmP0Hm/8DB2XYKjBYCLI+VnoKQl2VH4sSYvJYYYPdqR02/UTzLC4spTFe3m0whd4uHVM=; 7:rmNAQr2gWJvmHsbAUmWjKloEe9G7e+8LFDb7M8QvC/Z9SmtNKHTQfSLeUeFaZmwwnsloCean6zhZ2d0dwxHwhnqtCcWSgO0WWhj0E/mNEBuoxMbRE3sowSJIQY8wnXKWH8gg4Rh9N0Ugu/u1YPwgxA6ajQvgEOyCRAeIpbiSxgu9vWOEILwFVHL4z1PcK92iiH+hsVGAupk/ZKg2TMKTsvl8Bd5jTz0KlFPwgB6hTZE5I0+GpHptHNFFToGjp8Yf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2017 04:34:50.5981 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 566de306-fbb0-47da-efc4-08d54ce32b36 X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad; Ip=[208.19.100.21]; Helo=[avsrvexchhts1.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0201MB0737 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 Remove function call to process targets from the report phy luns function and make it a function in its own right. This will help understand the flow of the code. Signed-off-by: Raghava Aditya Renukunta --- Changes in V2: None drivers/scsi/aacraid/aachba.c | 44 +++++++++++++++++++++++++++++++----------- drivers/scsi/aacraid/aacraid.h | 1 + 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 5a95883..629a04d 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1799,14 +1799,16 @@ static int aac_issue_safw_bmic_identify(struct aac_dev *dev, * * Update our hba map with the information gathered from the FW */ -static void aac_set_safw_attr_all_targets(struct aac_dev *dev, - struct aac_ciss_phys_luns_resp *phys_luns, int rescan) +static void aac_set_safw_attr_all_targets(struct aac_dev *dev, int rescan) { /* ok and extended reporting */ u32 lun_count, nexus; u32 i, bus, target; u8 expose_flag, attribs; u8 devtype; + struct aac_ciss_phys_luns_resp *phys_luns; + + phys_luns = dev->safw_phys_luns; lun_count = ((phys_luns->list_length[0] << 24) + (phys_luns->list_length[1] << 16) @@ -1852,6 +1854,12 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev, } } +static inline void aac_free_safw_ciss_luns(struct aac_dev *dev) +{ + kfree(dev->safw_phys_luns); + dev->safw_phys_luns = NULL; +} + /** * aac_get_safw_ciss_luns() Process topology change * @dev: aac_dev structure @@ -1872,7 +1880,7 @@ static int aac_get_safw_ciss_luns(struct aac_dev *dev, int rescan) (AAC_MAX_TARGETS - 1) * sizeof(struct _ciss_lun); phys_luns = kmalloc(datasize, GFP_KERNEL); if (phys_luns == NULL) - goto err_out; + goto out; memset(&srbu, 0, sizeof(struct aac_srb_unit)); @@ -1885,22 +1893,36 @@ static int aac_get_safw_ciss_luns(struct aac_dev *dev, int rescan) rcode = aac_send_safw_bmic_cmd(dev, &srbu, phys_luns, datasize); if (unlikely(rcode < 0)) - goto err_out; + goto mem_free_all; - /* analyse data */ - if (rcode >= 0 && phys_luns->resp_flag == 2) { - /* ok and extended reporting */ - aac_set_safw_attr_all_targets(dev, phys_luns, rescan); + if (phys_luns->resp_flag != 2) { + rcode = -ENOMSG; + goto mem_free_all; } - kfree(phys_luns); -err_out: + dev->safw_phys_luns = phys_luns; + +out: return rcode; +mem_free_all: + kfree(phys_luns); + goto out; + } static int aac_setup_safw_targets(struct aac_dev *dev, int rescan) { - return aac_get_safw_ciss_luns(dev, rescan); + int rcode = 0; + + rcode = aac_get_safw_ciss_luns(dev, rescan); + if (unlikely(rcode < 0)) + goto out; + + aac_set_safw_attr_all_targets(dev, rescan); + + aac_free_safw_ciss_luns(dev); +out: + return rcode; } int aac_setup_safw_adapter(struct aac_dev *dev, int rescan) diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 5690767..19af4d9 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -1671,6 +1671,7 @@ struct aac_dev struct msix_entry msixentry[AAC_MAX_MSIX]; struct aac_msix_ctx aac_msix[AAC_MAX_MSIX]; /* context */ struct aac_hba_map_info hba_map[AAC_MAX_BUSES][AAC_MAX_TARGETS]; + struct aac_ciss_phys_luns_resp *safw_phys_luns; u8 adapter_shutdown; u32 handle_pci_error; };