From patchwork Thu Dec 21 17:34:05 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: 10128113 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 E72D660318 for ; Thu, 21 Dec 2017 17:35:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4F2429CE3 for ; Thu, 21 Dec 2017 17:35:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9A6729D1B; Thu, 21 Dec 2017 17:35:12 +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 5A13B29CE3 for ; Thu, 21 Dec 2017 17:35:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754823AbdLURfK (ORCPT ); Thu, 21 Dec 2017 12:35:10 -0500 Received: from mail-co1nam03on0044.outbound.protection.outlook.com ([104.47.40.44]:24992 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753849AbdLURem (ORCPT ); Thu, 21 Dec 2017 12:34:42 -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=JLFXhYhr0ZXievfnS0B99datJAPZHDc29ksna8MwodU=; b=OX/gOEZu7mAa2/dOrbgMXjhPs/BpX3gwVgyhowWWws4u11CxWLOIC255yZ2U5UESL63rX8ZQatfj3NOUldtTU0HCYelHCqGA5qIgmbrmXrh5qNyvIdri55RFocTLN9q7ClInibpyOIzitTLvw8YPJDCfbHd/HZEVhyj3A1FjR+4= Received: from MWHPR02CA0045.namprd02.prod.outlook.com (10.164.133.34) by BY2PR0201MB0744.namprd02.prod.outlook.com (10.160.124.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Thu, 21 Dec 2017 17:34:40 +0000 Received: from BN1BFFO11FD036.protection.gbl (2a01:111:f400:7c10::1:195) by MWHPR02CA0045.outlook.office365.com (2603:10b6:301:60::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.323.15 via Frontend Transport; Thu, 21 Dec 2017 17:34:40 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; linux.vnet.ibm.com; dkim=none (message not signed) header.d=none; linux.vnet.ibm.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 BN1BFFO11FD036.mail.protection.outlook.com (10.58.144.99) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.302.6 via Frontend Transport; Thu, 21 Dec 2017 17:34:25 +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; Thu, 21 Dec 2017 09:34:24 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" Subject: [PATCH 14/29] scsi: aacraid: Move function around to match existing code Date: Thu, 21 Dec 2017 09:34:05 -0800 Message-ID: <20171221173420.8213-15-RaghavaAditya.Renukunta@microsemi.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171221173420.8213-1-RaghavaAditya.Renukunta@microsemi.com> References: <20171221173420.8213-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)(39860400002)(376002)(39380400002)(396003)(346002)(2980300002)(438002)(199004)(189003)(76176011)(59450400001)(4326008)(72206003)(106466001)(48376002)(97736004)(50466002)(104016004)(53936002)(1076002)(68736007)(69596002)(51416003)(2906002)(5660300001)(2201001)(16586007)(54906003)(50226002)(316002)(478600001)(76506005)(6666003)(2950100002)(356003)(106002)(8936002)(110136005)(305945005)(36756003)(81156014)(8676002)(81166006)(47776003)(77096006)(57986006)(86362001); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0201MB0744; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD036; 1:jCX7v672cfdAuGZiK976L0XQUy++cHTDuyokzL9113CWdaWtFamVBeX2+cDy5FTdq+S9tho0aWS3Uf3tuqyH8xSlRiTGEaYr0K1HWuxzlVbPjZuhjY7p+SYSyLEnxSto X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 288198e3-b763-4d68-d741-08d5489914cb X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4608076)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307)(7153060); SRVR:BY2PR0201MB0744; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB0744; 3:QYXgGimXqta9r6FYsrwPLokh0r+KR2Dc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vRmEflu23fzMtenwdanxHB2OiKo5LTnUFf/V30gcOb/Ragv9k61ulhtvs6Yw4BukoW/MgVwnc4RY5Me0tMbZBbnDR6fknB6R3MuIXbWAn1AHS6SmlEOoTy0c7seZyzO7sa3DOnSU12Lp8m1BIeQNDmHGxC1sNKVKgLATm/qPiaRiDoZvCWDsQSHo4WcBp+h0AjfsD0xKdqBrl6C2899ceFpLKtDvq10FQMOfNicHiwjilXAw48Q8Vprv1eVePaoSHGsyTQsnjAywnVqqwOuBLe/uQU5qe2zUAN0kICh2O92b+dt1JUO0OvGjaDEfoGinah83a8UukDmRR+L1nk7zg8zcGp15N5GQeorEs0IISjuwY49PXRhYcxKsFR9vBGha3ywtQl962UahQl72QuZEu4u/2d5yfElWqsBYgGTbsRYXXj/fJynDCtH0YZM4WEPOlU7IYvyzZbf9dnejX2ygr0Fj7M4XvTw8emKrlReToxPCyaiFmRivZmhz/IaAMKHyJkT1Lpvmnp3uZch9R0ps4de/RqtEJQ= 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)(8121501046)(5005006)(10201501046)(93006095)(93004095)(3231023)(3002001)(6055026)(6041268)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:BY2PR0201MB0744; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BY2PR0201MB0744; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB0744; 4:oGCZXsgNWCpNSSy/xZzSfiUJv+IJfr3nZP72v+k8nLBiPD5fSIAhg3P9CIzeEAKYhpSy+CKf/oI/ln7Po5Te5SLtnd58swwM3U9Nv68JHmQMTORV8CRtFE8bAVpA2vJhAw0u+XAcTBQjHLr6zIk5pHNjcO0m3hfuc6OBNls6JZT0MpnXWSy8rwHL7TIsxZGkqXsHozlTyBWpA380O4zOvq+HcKmZgGHRbBVnM45H722CoUb16KazGbN87Kz5Wu1DcpPEn3Ay7MeZpIwhRIKWpErJ0ZNjp6mWS9oY10jUr4iQ1TfwpxFJDPb9OvLszkdAEQFWCsr8d1nRRBmognVW1cWLGClwkC0tArgHJna9NJ8= X-Forefront-PRVS: 0528942FD8 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0201MB0744; 23:qB2oLqZ8X/1P+nxw0qBvQASq8Quh95saF/15uff?= =?us-ascii?Q?CrNzc3288i9zE08suKXEAmmbCXv5kceev5hqokw3E6vRZirUwA37thuLxKBG?= =?us-ascii?Q?W8PwUNPniyVaRajCjyd59Y3Uc3zJsn4Wg/USOw1XnQ1ybO0R4pOJWc7CJl6t?= =?us-ascii?Q?Fw5buRA8MB7As5ViIBOhSG/hqnxIz9TtYYQMyhvPC/P4xlcSg82h0APcXdlY?= =?us-ascii?Q?6v83nqTL5hbixRWxFJq5JmSSWFJK28E4caM219ENR20xoQiTF/hQ3heWRPZe?= =?us-ascii?Q?GBB4Vwd0j3ineK7AIq7C/6Co72flWh9Yz7zsyx7PdN+tq23pCiiHVR5rApeJ?= =?us-ascii?Q?LsDM4fLkQCQIZN1/718UKVfIiJj+uKjhhwD8xNn9aFcgdDSK6KXtGqnxQTcI?= =?us-ascii?Q?TICvjRpJMYDwuo6bf7tIQwcOFV/0KlKaEmW7C2BWb7kBDLKeMCtHvVU+Wz5z?= =?us-ascii?Q?PYhVHq4/3XaSx033IuY1nUTuMGDh5/nCtaiCLkJxR0Kbctf3DlXZ+1XGvInj?= =?us-ascii?Q?ldTTtJ41XU4Ikk78g4f67wA2Lkz4wXSwLNyDjmBVhT9mO7InY0SKxW8Os0fg?= =?us-ascii?Q?b5F+z6+fX8jbV0Ww8jHfqAy0Qfd8OvGvltbsEFgOFLIjbIVn8pTFHtTT0VG0?= =?us-ascii?Q?uOcK+wca3h85RymLHD7v2zdYZUiVJGvdLh/xyMN2UhNjmLl2V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TyaBdsN4VX503oiVuSPDGb1RuiptNvBib84ClukMJ2I9wIrWIELpZnEjDg=; 24:rG/pIsMB35fMPZ/bUcf+HNzP5/q47W5yMOcEnueuQxC5ppKN2har7xB/VMSAFPZb51an4HgFSU2NMMGLU9eoDqJQiw5Tu7P/v1eZnvd0NDE=; 7:xiavyqg36PZZrZ/NSKQSl0pcQD5G4gZdX4Kn6hQ+CetyGCqUZp2LwvjdZaWrcCYx3rg5z2PqPK5lCyy3J2b680+LUs9FPxrK1vxTlRqE+hiqj6q4/eBvT7UNETqcak5X6Ny5+4X8VuP69g9yqUCGPCBTI6dm82SCp4m6IuvcpQ0lrIywYCiigqxs9JHEg8vQ1PXwmGJned6IkC1xa4RG9Cyo0R2t496Kbd0MztJL1V2jMyQGdtXeEoMENDKDRodG SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2017 17:34:25.5460 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 288198e3-b763-4d68-d741-08d5489914cb 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: BY2PR0201MB0744 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 Move the function to get phy luns information to the top of function to set target information Signed-off-by: Raghava Aditya Renukunta --- drivers/scsi/aacraid/aachba.c | 112 +++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index cf02910..affa2f1 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1794,6 +1794,62 @@ static int aac_issue_safw_bmic_identify(struct aac_dev *dev, return rcode; } +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 + * @rescan Indicates rescan + * + * Execute a CISS REPORT PHYS LUNS and process the results into + * the current hba_map. + */ +static int aac_get_safw_ciss_luns(struct aac_dev *dev, int rescan) +{ + int rcode = -ENOMEM; + int datasize; + struct aac_srb *srbcmd; + struct aac_srb_unit srbu; + struct aac_ciss_phys_luns_resp *phys_luns; + + datasize = sizeof(struct aac_ciss_phys_luns_resp) + + (AAC_MAX_TARGETS - 1) * sizeof(struct _ciss_lun); + phys_luns = kmalloc(datasize, GFP_KERNEL); + if (phys_luns == NULL) + goto out; + + memset(&srbu, 0, sizeof(struct aac_srb_unit)); + + srbcmd = &srbu.srb; + srbcmd->flags = cpu_to_le32(SRB_DataIn); + srbcmd->cdb[0] = CISS_REPORT_PHYSICAL_LUNS; + srbcmd->cdb[1] = 2; /* extended reporting */ + srbcmd->cdb[8] = (u8)(datasize >> 8); + srbcmd->cdb[9] = (u8)(datasize); + + rcode = aac_send_safw_bmic_cmd(dev, &srbu, phys_luns, datasize); + if (unlikely(rcode < 0)) + goto mem_free_all; + + if (phys_luns->resp_flag != 2) { + rcode = -ENOMSG; + goto mem_free_all; + } + + dev->safw_phys_luns = phys_luns; + +out: + return rcode; +mem_free_all: + kfree(phys_luns); + goto out; + +} + /** * aac_set_safw_attr_all_targets- update current hba map with data from FW * @dev: aac_dev structure @@ -1857,62 +1913,6 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev, int rescan) } } -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 - * @rescan Indicates rescan - * - * Execute a CISS REPORT PHYS LUNS and process the results into - * the current hba_map. - */ -static int aac_get_safw_ciss_luns(struct aac_dev *dev, int rescan) -{ - int rcode = -ENOMEM; - int datasize; - struct aac_srb *srbcmd; - struct aac_srb_unit srbu; - struct aac_ciss_phys_luns_resp *phys_luns; - - datasize = sizeof(struct aac_ciss_phys_luns_resp) + - (AAC_MAX_TARGETS - 1) * sizeof(struct _ciss_lun); - phys_luns = kmalloc(datasize, GFP_KERNEL); - if (phys_luns == NULL) - goto out; - - memset(&srbu, 0, sizeof(struct aac_srb_unit)); - - srbcmd = &srbu.srb; - srbcmd->flags = cpu_to_le32(SRB_DataIn); - srbcmd->cdb[0] = CISS_REPORT_PHYSICAL_LUNS; - srbcmd->cdb[1] = 2; /* extended reporting */ - srbcmd->cdb[8] = (u8)(datasize >> 8); - srbcmd->cdb[9] = (u8)(datasize); - - rcode = aac_send_safw_bmic_cmd(dev, &srbu, phys_luns, datasize); - if (unlikely(rcode < 0)) - goto mem_free_all; - - if (phys_luns->resp_flag != 2) { - rcode = -ENOMSG; - goto mem_free_all; - } - - 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) { int rcode = 0;