From patchwork Thu Dec 21 17:34:04 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: 10128117 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 14A3160318 for ; Thu, 21 Dec 2017 17:35:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02D4929CE3 for ; Thu, 21 Dec 2017 17:35:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBCCC29D1B; Thu, 21 Dec 2017 17:35:17 +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 5303229CE3 for ; Thu, 21 Dec 2017 17:35:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754388AbdLURfQ (ORCPT ); Thu, 21 Dec 2017 12:35:16 -0500 Received: from mail-bn3nam01on0064.outbound.protection.outlook.com ([104.47.33.64]:1286 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754007AbdLURem (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=2S3naAf9m0LBUC2HA18JSFiCN7XN0QG0cWo612ibnjM=; b=jWvgi7dpTQDnpeWVLgMgAZmd1LMb9rthf3IPgCpJOxrJ1bE27g5AavupNe7rKQxkbbLeDXoYMwRCQOjuoIdUYKV2ujtL45UXrmDE8khk6+27lSJWo7+egBnXQ/0aCzo0Bf3EeR2gpc6/WZphlwY+F83a+Xii9/eHnN/AudBU99g= Received: from MWHPR0201CA0044.namprd02.prod.outlook.com (2603:10b6:301:73::21) by DM2PR0201MB0752.namprd02.prod.outlook.com (2a01:111:e400:3c06::28) 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 BN1BFFO11FD012.protection.gbl (2a01:111:f400:7c10::1:128) by MWHPR0201CA0044.outlook.office365.com (2603:10b6:301:73::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.345.14 via Frontend Transport; Thu, 21 Dec 2017 17:34:40 +0000 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 BN1BFFO11FD012.mail.protection.outlook.com (10.58.144.75) 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 13/29] scsi: aacraid: Untangle targets setup from report phy luns Date: Thu, 21 Dec 2017 09:34:04 -0800 Message-ID: <20171221173420.8213-14-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)(396003)(346002)(376002)(39860400002)(39380400002)(2980300002)(438002)(199004)(189003)(2906002)(86362001)(57986006)(104016004)(8676002)(97736004)(36756003)(316002)(59450400001)(53936002)(1076002)(106466001)(2201001)(16586007)(4326008)(76506005)(51416003)(72206003)(54906003)(50466002)(356003)(76176011)(305945005)(48376002)(110136005)(106002)(81156014)(68736007)(77096006)(5660300001)(6666003)(2950100002)(47776003)(8936002)(69596002)(50226002)(81166006)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0201MB0752; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD012; 1:eLhsSPrcDDSWGzI9GXSdoY2HjNRlXP+TtJFblXJgD+CHmbrNraTbfAcXYLY3u0x+cph/QqK/MM/XbyOvg2nlx/eM/Uw7tqgf1h8DZzEMrNUepZbU3h6lSVuIR49oFlYL X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0eedd682-8ebc-4e94-89e3-08d5489914e2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4608076)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307)(7153060); SRVR:DM2PR0201MB0752; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0752; 3:Y5rbBGsxRO4zN7Fbl/QK2Sr8bJme8lbEkIt6Bip3M9mre2FzgD34DkoViETBHmxdeGkYKtdrEAwPWJLWU7salfO9yEb87alC7JtsexIw1AKZK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u/JzTmq5OgfZsuH3noCfSf484KWCxmdJoDnrP4z7/3CprP/dZoqBbpmuJignI607NypWh+0X2P2gow2JmcelmU2nbnHQYa4Y811HakiLk4nSjusf2V6mUaKluEumS8ne3I1U+WtMQf6nz8mjBeIqphgYXCVAFeIUCxFqqz2vT/PANaD553KMc0kTM2brWoeeFtd/T/4AUjZyjxXH4qaA9HzCCi0E+aujOAh+ncBIuj6E6Cxjevu6puasbXQz/KxQ1dVtTTsTPkp12/idh2WF4FIGAGZ0Jk/2+jp/lxYCBgmrhnYjIZX45vnHhfUi8v4ecYgEP5mG3deoXf+VAntnzS5yetm34b6oJGJMS76u8e3eU8aOCyK9+j6AUEggDOB/IgL0CxhCjgRFHYUQEbej06jTq2W0IZsDSMTEY5qKTSB+DkPbtsuqfLj34alvV1z3MAWLzpeOPNrqgH8KcGR4QhwXhiUg3KlOk= 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)(10201501046)(3231023)(944501029)(3002001)(6055026)(6041268)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:DM2PR0201MB0752; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:DM2PR0201MB0752; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0201MB0752; 4:HRmhf/3uH5WaDrwUWUBvhmtg4P6aaJg65q73VzP9bo7v0BkUKifkmF6od+MmxpCWwruiic5w69rLvPMDledbZFisXCB+EP1ILMFrMj9dhNIuC4bDEVDw6/BGHey69K9bTf6UfcX38i9z7c2zGBTsTdg6PWJmgCWk6D2p+noasENCaFJ4Hoj7V0I7Fg61cQ9VORn1gW5E6lZg6iyQacf8xep5JPRFYS8TknjlgdZwdk/AjOBVER8C2ozJRJKHFN2FzJhAK9m/q53psVZBsgdNske/Fe1+fwheykWorG40JhSevuuRgHnvlNpYjYKr3Kv1KkrXWRJbG8+RztRVRYGU1OnQDCpn3hP1CKH1vE65SO4= X-Forefront-PRVS: 0528942FD8 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0201MB0752; 23:fe+pZxAT0GyLK8RO3GZe3Y9Wzqg+wxniF+Mu6zT?= =?us-ascii?Q?Fewnxr+Hzjqas5Iv+J9DvJpSgskxFJW9YiSX7b9yktK2t+nR38mSdsevyrZ5?= =?us-ascii?Q?exQta5pNbo8NgAwwie0wjPW2ZuO/ahZEXm+7Thu0frVL2a6oOH5Frfr5JMvN?= =?us-ascii?Q?jWQDAqyfF+n1cPjRZUP2kuqgi4xnCxafPFttt7hbMnnA56bT28YLs9zQ34N3?= =?us-ascii?Q?kc0rMm7JECcPF/3kIoEcdIF8YjsJVxE1Rv0yoHXzfiMmu8d0322zBSGEDlKN?= =?us-ascii?Q?Pptk44siEIpvTAVXXqjgHUR7wazxJWOUF44QEFihn0nTD2QRZp0aXwE3JRnc?= =?us-ascii?Q?Kzs43dlZ5rDL9Iu9YCcTUa+cniAD7Gxw+DSyDYJMyp+0uY0nz24gsTXDm3BH?= =?us-ascii?Q?UyMIheA8gHN7w/4Pr+XZJCSeuMGJnWX8Ss1P0U/X1Thjp9YT3hg7ElP5wRbj?= =?us-ascii?Q?zGDKzBNObqM+A+mwCh3xwT/Wq6ZHi4AcIYTTtdiW5Jt4YM0IBgbrz2l5A5sw?= =?us-ascii?Q?0pQdKtpnm7k73scATcREE/surDu9k0SNrLXTdGi8xWtOPyupwx4bMhpyJN4g?= =?us-ascii?Q?GTFEirsKff+p5GDgAFEKQzO78Qy3TWkrWAXRXqtVs7HpknExtjmYnwlX3tQz?= =?us-ascii?Q?NvXceu/JtZczvpEbLQhvipxrmHyxZLoeM0CrYMRZ09L8YyWafQWS+e5DVuat?= =?us-ascii?Q?/vxbm6NpfKUIYZTPJmMkNXUKe/puYzD7jmM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 24:z1waVkUjf+JVg434bfYUgcNAZbcd9Qr70t7hFVFOiAVVCL19eqL1ytzW100v2++AmxJ9XqCexy83JfxsBdvKS4O89XWMRhHyduz0OyJy/B8=; 7:mlVhzh3EzPZvTwa8ZXRk8Xb28L1qZbKKJtteemxapxw9VAuQYDvlcUwELV80t8FyGQojrpBtnG3Igljojdf9qcHjWaAbX0AVEigz3evyMNhxGRddBW38RCgQKKmYEJV/wbRvSl7b+3CmFuzbQDBj8xWKvuhQ23UQbIonbUz87FfGCCIT/B/Bf5VpHdTXbN/20URLz7e1nI/Scj4PLytMbxJNj+OrxYJJLu88HPT0371Zlhpc0cN29FsSnejo+gQp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2017 17:34:25.6948 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0eedd682-8ebc-4e94-89e3-08d5489914e2 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: DM2PR0201MB0752 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 --- 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 90377b1..cf02910 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1802,14 +1802,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) @@ -1855,6 +1857,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 @@ -1875,7 +1883,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)); @@ -1888,22 +1896,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; };