From patchwork Thu Dec 21 17:34:09 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: 10128121 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 323C960318 for ; Thu, 21 Dec 2017 17:35:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2051729CE3 for ; Thu, 21 Dec 2017 17:35:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 14B8E29D38; Thu, 21 Dec 2017 17: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 9776229CE3 for ; Thu, 21 Dec 2017 17:35:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754100AbdLURfT (ORCPT ); Thu, 21 Dec 2017 12:35:19 -0500 Received: from mail-co1nam03on0073.outbound.protection.outlook.com ([104.47.40.73]:50048 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754187AbdLURer (ORCPT ); Thu, 21 Dec 2017 12:34:47 -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=sWR26IGVbmnOP9hCADSwjI1L656fT1FTJfyj3txvWDQ=; b=HZc9UvUYsyFAUC/VTRAnhV3TOQVHBoxiNvihqLbIWOS6MNZEKhHoifxm/IrQVHtrAlwqyOCcvxOfuQsYN87h/k+kqGWXA3jHwBNPQwQmymyXizpO/7Sy7Kkgno6NZwMiQez40PZdiDcfRiaYRdkQrYcCyAHRw7vL2USM9VIterk= Received: from MWHPR02CA0045.namprd02.prod.outlook.com (10.164.133.34) by BY2PR0201MB1829.namprd02.prod.outlook.com (10.163.75.19) 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:46 +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:45 +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:31 +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:26 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" Subject: [PATCH 18/29] scsi: aacraid: Merge func to get container information Date: Thu, 21 Dec 2017 09:34:09 -0800 Message-ID: <20171221173420.8213-19-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)(39860400002)(376002)(39380400002)(2980300002)(438002)(199004)(189003)(36756003)(76506005)(305945005)(68736007)(1076002)(4326008)(106002)(356003)(5660300001)(53936002)(69596002)(8676002)(57986006)(97736004)(81166006)(104016004)(81156014)(2201001)(77096006)(316002)(16586007)(47776003)(110136005)(54906003)(478600001)(72206003)(86362001)(50226002)(2906002)(106466001)(6666003)(8936002)(50466002)(2950100002)(76176011)(48376002)(51416003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0201MB1829; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD036; 1:G/FPRpUtOP+fVwYiTDgAdG8jIuGJ28Sqx5HUVPMmeUTvfvZLTl7lVbFmohV9xkmA0kMaZoaTnvV+g3bmlC1p162P8VoxeemUlsozdTCmKz0UNKDmTZaHcU2n5hYBRPNX X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9f7f9db0-e788-43bd-290a-08d548991827 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4608076)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307)(7153060); SRVR:BY2PR0201MB1829; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1829; 3:P6UmyGC/YpquaSa6Au9Q4X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pXnLXER7IvYHns+TMlpkwpcxKJOwnum465e9WAjfV5GH7dXX3bA+Jx01pETB3Xgq4dwjEB9pDqEd4pv45DgBqxwGNH4VJLF0D7Kd5ZVpC9IRMNBNKTAATED/NlYSsX8A+MPQ5vyjF+zNHnIpMfi2D5ypr2N19RG6swrmzE65JTi4ckrroEhBPFTJmwa84D2nDYG7sVWuLZm8llL0/jyGwuQo2OIAg5RBCEWPYbJNezKtIUWPJsJ3DuSpfdpM9F4+flWjK9A8l98/O6qeoHjfFaYS5mK6Fr8AYV04cUuXDII1mwL6zjNr4j4JvkCIvlzBwXmsy26NIrPAHWnZvBlOaAXbjqgmd9mb7YB/9mJsDCRRD+CPGbky5T4EG2n4Jk5LHmVtjKEHVUJRlYyqYTSLB7owBseDxt+WfwR04L2NHH9axMoAtmzu5NQT5H/6R125FJ9BH4OeiIdrF5piU3eWEEba7/q6F6Rcvv6DeJExaijopNLksU7Wh02xWt903Ewm9aZCnJFKMq5xd9p3dzq5HJO3c= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(72170198267865); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(3231023)(93006095)(93004095)(10201501046)(6055026)(6041268)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:BY2PR0201MB1829; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BY2PR0201MB1829; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0201MB1829; 4:aG4Zkle43jpYBodYTfom+oWu/+aqF+Hiw3y4FovPrNJwh9nzse7ewgmwEkDDCOJtzofGs8PAcuPeEeukoId5TseRtHgeXNCYGiLQDo54xvG05glBvCu99yHqN6JS0Cs8XWNOvayGRATf81G3riS5NzuBxRQIIT4dFXWn4KqstlemEPec77lVVetxqMxhk/yNE1cbTWrkYSKDkY29cDpShq321rBUgwQnGEPTY702zxid7TlJit9MxhhO5W4XwcxH9HWdOad+e+pIff6Ufn0oJnHDRwoB2/vhhs6B02ah9XjMQQr+icjZ6Fq/onZ5U2j+ X-Forefront-PRVS: 0528942FD8 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0201MB1829; 23:pFPNI5rpHO5wtYfD1NhPD8QSWQvtTJMKd+rTJTR?= =?us-ascii?Q?hCQ3T360bQASlMnm6vYeIe0m6mqvtV79o+YkInDO71WvMiQ/VOzCFd9n/THh?= =?us-ascii?Q?7bjx0uSvDGciLXcirgFwAeu7jM2Mg/TMDFcIshBvf7B+CIABc8yO8+m2HVgQ?= =?us-ascii?Q?Ux/qEoonifg2yJIDwHWJJMOC49h2M+cBE06TUN3WOBlqmgSYgDLqbivsTlIc?= =?us-ascii?Q?5e1T3xcd49AdhhyVAK0TxCHr0KdHGlFZ/PHuVjcKbhePZNFrjIu4zD2Um38v?= =?us-ascii?Q?/jDg1zcENDG66UC+QOVR4vzeA2f2Di/4aYXupsOAbOAnY4A0o4y6vBt7JRp4?= =?us-ascii?Q?UFiaqwybUu0FJZZc7vSuvXPBgnYzgNhq3bxeQ8DIgSLQ7CNOCuagT/QJ67fq?= =?us-ascii?Q?P/4tkjMGiBRLeRXR9cdhPM8wE9+g9uYjO24VGzz5lvxGWxivbBc/atDqjCxI?= =?us-ascii?Q?BSnjMX/aBxgjOx9rnHWmRLhW65ujIwO+SI3rIt5nguS1jaPGapKjd+c7xXtG?= =?us-ascii?Q?gsReX6VfBc/uPz/UhFT0vaeP9vFmoIAR94i42H9/kgsYm1/W9CUpk+wjGKYZ?= =?us-ascii?Q?Cfyi5mJYGXzIPuz21dwEZXhulc1pB31eVEFBlwf2obOqKYdQP/8kjQjg1juu?= =?us-ascii?Q?fGhB6hNTZG79iACiUtzAXf8OeofQX0f+Un+/rKgHsLoLFvGOaGgNEWmfq0KN?= =?us-ascii?Q?1lZKsbTo77NNdRZUzJtF5wf+EOnWCKVLk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IzZD2cv+VZRUtH1iTJ4osrjXH6BQkhKbNmM1Yor62Rg90fn2CSVCViGAtsE=; 7:SwcpgLpXrgKWl9r9nbeoi87nnOuCiVFfaBv9nm4Ww9LFHtM21cemmIaUTH6WLsdaExQpWKY8CHiabL8t9mdPxdq7ZaUtCZ4FE6lqYFKywIxKAzcvd9WlRuUVyRFEgGGf2VS8nbSUOZWd2cGp1FIrFPbHLIlXR0Uh6xaJVDBhQigdVAeEY7Z8BXJoI8i7X1eFttVf2su4c2mZMH+lT+WOhA3jM0ESbawvfkcspm2zWB60JV2y7LpuvNUAUceMSUtX SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2017 17:34:31.1776 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f7f9db0-e788-43bd-290a-08d548991827 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: BY2PR0201MB1829 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 Merge aac_get_containers to setup target function, so that information about all the present devices can be retrieved in one shot. Signed-off-by: Raghava Aditya Renukunta --- drivers/scsi/aacraid/aachba.c | 4 ++++ drivers/scsi/aacraid/commsup.c | 34 +++++++++++++++------------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 01cb825..7f6036c 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -2032,6 +2032,10 @@ static int aac_setup_safw_targets(struct aac_dev *dev, int rescan) { int rcode = 0; + rcode = aac_get_containers(dev); + if (unlikely(rcode < 0)) + goto out; + rcode = aac_get_safw_ciss_luns(dev, rescan); if (unlikely(rcode < 0)) goto out; diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index f3077b3..9625eb0 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -1949,26 +1949,22 @@ static void aac_handle_sa_aif(struct aac_dev *dev, struct fib *fibptr) aac_resolve_luns(dev); - if (events == SA_AIF_LDEV_CHANGE || - events == SA_AIF_BPCFG_CHANGE) { - aac_get_containers(dev); - for (container = 0; container < + for (container = 0; container < dev->maximum_num_containers; ++container) { - sdev = scsi_device_lookup(dev->scsi_host_ptr, - CONTAINER_CHANNEL, - container, 0); - if (dev->fsa_dev[container].valid && !sdev) { - scsi_add_device(dev->scsi_host_ptr, - CONTAINER_CHANNEL, - container, 0); - } else if (!dev->fsa_dev[container].valid && - sdev) { - scsi_remove_device(sdev); - scsi_device_put(sdev); - } else if (sdev) { - scsi_rescan_device(&sdev->sdev_gendev); - scsi_device_put(sdev); - } + sdev = scsi_device_lookup(dev->scsi_host_ptr, + CONTAINER_CHANNEL, + container, 0); + if (dev->fsa_dev[container].valid && !sdev) { + scsi_add_device(dev->scsi_host_ptr, + CONTAINER_CHANNEL, + container, 0); + } else if (!dev->fsa_dev[container].valid && + sdev) { + scsi_remove_device(sdev); + scsi_device_put(sdev); + } else if (sdev) { + scsi_rescan_device(&sdev->sdev_gendev); + scsi_device_put(sdev); } } break;