From patchwork Wed Dec 27 04:34:35 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: 10133407 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 784D36037D for ; Wed, 27 Dec 2017 04:35:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60FB82D864 for ; Wed, 27 Dec 2017 04:35:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 560CA2DA5E; Wed, 27 Dec 2017 04:35:26 +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 D5D242D864 for ; Wed, 27 Dec 2017 04:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751815AbdL0EfY (ORCPT ); Tue, 26 Dec 2017 23:35:24 -0500 Received: from mail-cys01nam02on0084.outbound.protection.outlook.com ([104.47.37.84]:55353 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751457AbdL0EfP (ORCPT ); Tue, 26 Dec 2017 23:35:15 -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=ml8JJeLsMhZLLnylTSE5rztKiO+5TvSCN/ZOC+oJ1+k=; b=ADN+R9GRs7ct/N1RKBiBSmUgVwFolzhOPQJ9qYT5BKqB9AsqJB6kiHqx+n6EJk3JBnrlgJ42E6XF/IayFxx9nGxwYSNiNSLzN1MZaG2b5HYWbgdojgxpnFirhLH5JowNKOeMigrvlKYnGOhxvheYJ4Oa9UUBBI/zNst1heKecag= Received: from CY4PR02CA0006.namprd02.prod.outlook.com (2603:10b6:903:18::16) by CO1PR02MB144.namprd02.prod.outlook.com (2a01:111:e400:101e::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.366.8; Wed, 27 Dec 2017 04:35:11 +0000 Received: from BL2FFO11FD049.protection.gbl (2a01:111:f400:7c09::140) by CY4PR02CA0006.outlook.office365.com (2603:10b6:903:18::16) 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 BL2FFO11FD049.mail.protection.outlook.com (10.173.161.211) 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:51 +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:57 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" , Bart Van Assche Subject: [PATCH v2 14/30] scsi: aacraid: Move function around to match existing code Date: Tue, 26 Dec 2017 20:34:35 -0800 Message-ID: <20171227043451.27813-15-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)(39860400002)(376002)(2980300002)(438002)(189003)(199004)(8936002)(77096006)(76176011)(59450400001)(81156014)(8676002)(50226002)(51416003)(305945005)(356003)(69596002)(68736007)(2201001)(81166006)(2950100002)(104016004)(1076002)(5660300001)(6666003)(106002)(478600001)(72206003)(54906003)(106466001)(36756003)(110136005)(53936002)(2906002)(86362001)(4326008)(97736004)(16586007)(47776003)(316002)(57986006)(50466002)(76506005)(48376002); DIR:OUT; SFP:1101; SCL:1; SRVR:CO1PR02MB144; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD049; 1:ZbpKSyrNpOxb11UyrGCY1WZpiNpPl145SG7pK0B6gf1mJVNoED/ocMMZn/ABkngUJGg4ZlgNegftKXCe0Xwf+As6iakaJpLT0mTbs0uz44N4N18zbqkke0nQbIQwr0Yz X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 30d7ca2b-0d08-4f46-3111-08d54ce32baf X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:CO1PR02MB144; X-Microsoft-Exchange-Diagnostics: 1; CO1PR02MB144; 3:J7N8hxFx/yMN/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rodBV8JYYVMiDNZAX22acg+qtjTLWUzhAqKCH/p/nymL15N4ONO9N+4d9lMRon+dUO5VbP/Py1XB518fjxSM4DXmRjdS5CLrxrZrpw0UBr5FduFlmFX+PgCcfFjY4Hmjpq2CojH31duS47G3GuKTF+y1qPfViHLFkGWPqAVCxhGUlexcTFQtAUyHTPizg7epF9jBSAd41AG+0JraDWHBUiM87OskSwcy33H9QgqbykVTKIoork6qlBGQqR53tz8Q2gXA1fYCWXTe6tXRIUm5vtOvzMJ/7fT1nXEoEtaMLM4RTanLzspmsOelbimRcKTwha+G3h/YgzgdBC38X2feeG/6+9CTlfWBCWo/hp7Z4mjCwCeKN3mTMJMM9Ic7/2LAm1q2/gr+MenAkazhAZs1wXAYA4B1xdwKq0gjrTvxEMqbM6IMP/ZvHNPzEpICAqAKOalopLJhnt6KVxQjNzqjwBIhPtw6TaLEQTRLZ3oNDzwSjTpLMerTwPhl784+zIdRyVSysYox47S55n7HO57MSjVi+R+5RkQlEUY0k= 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)(93006095)(93004095)(3002001)(10201501046)(3231023)(944501075)(6055026)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(6072148)(201708071742011); SRVR:CO1PR02MB144; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CO1PR02MB144; X-Microsoft-Exchange-Diagnostics: 1; CO1PR02MB144; 4:x/cHb3ZFN+iOAvT1aQQsMebT4vWvtKO0bZQefamqde0NFaOQPrN7Vg8ovMamtMiYTu6DbY++dH6gsFoUByBlDzJ2IFUexyeDa1tO6dXKd++MiCH0X5yCvz1Cazw/CwD4rKKdddhuYRif7+elV2L/lEjDEJ4bQrkLilTdvYXPBq2B+oaYydr93n6MYe5JsLaNE4B8lJ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7/Lc+Enzne5OL4pwfIPRd4xT6YCQ5iPABRaVleHX+Udl+0cQ1CUec1Hl/vrLbACP702B7qos/ByqAmM9Dbgn3A4=; 24:wGiiyxpk7zF2sygzKl2WF9J6jSbMeSR7xvq4SM6IAAwsanKJo1Arxn/+5ADqvmG7Ggpp6qLVLe+bAfT9ncSzyUG1J0GcGzjp6FTGT+kUBKk=; 7:h8UPk7gGAaNskE0lcmQN9PD61256vABsHAwwtnLl1Tk3Np/GLCjA2d6npAsUdVZ0oP6jntZ5BuP6qTTtW6ETLRkfqvGf6YMJPKnic24ufWoyuHtz4jdolhLoxII60GeamzrpwSlVoFEAhNZlVNbCEtJfGgNDZrYhJ9eYpP6lPphM4pG1d+AiNf/kksJdyUEolAyWcViqbtGRuVYDFgazx/Tlzl2zcV9S13cdcXxkwed6NLmyhz2JHof6DGNIlyMl SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2017 04:34:51.3706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 30d7ca2b-0d08-4f46-3111-08d54ce32baf 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: CO1PR02MB144 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 --- Changes in V2: None 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 629a04d..43a3c11 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1791,6 +1791,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 @@ -1854,62 +1910,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;