From patchwork Wed Dec 27 04:34:39 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: 10133413 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 D5C1E6037D for ; Wed, 27 Dec 2017 04:35:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BBE552AB38 for ; Wed, 27 Dec 2017 04:35:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE2322AB4A; Wed, 27 Dec 2017 04:35:33 +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 36F272AB38 for ; Wed, 27 Dec 2017 04:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751864AbdL0Ef3 (ORCPT ); Tue, 26 Dec 2017 23:35:29 -0500 Received: from mail-cys01nam02on0064.outbound.protection.outlook.com ([104.47.37.64]:64326 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751822AbdL0EfQ (ORCPT ); Tue, 26 Dec 2017 23:35:16 -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=u3vdZkQMrmKkLt3kHta54tLbvtCmGOoeY1CpkqIoKi8=; b=nYNibrWA40/1gchylO8APu4UTHvzXRfMoHPRWrgWENecsjoQH00weGf75t3xAbu2rl4Fd17MqZ0KjYl7rSACjsvDebkXmcUyCfKgg/VG+HhRdC6bQpKvrL2zkxcmCz0VRxhFpYXQ8ztMhbKtvRscUlfGIJkB7YzG+4sE/CtnGY0= Received: from CY4PR02CA0006.namprd02.prod.outlook.com (10.169.188.16) by BLUPR02MB130.namprd02.prod.outlook.com (10.242.189.23) 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:13 +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:13 +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:53 +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:58 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" , Bart Van Assche Subject: [PATCH v2 18/30] scsi: aacraid: Merge func to get container information Date: Tue, 26 Dec 2017 20:34:39 -0800 Message-ID: <20171227043451.27813-19-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)(376002)(39380400002)(39850400004)(396003)(2980300002)(438002)(199004)(189003)(50226002)(77096006)(4326008)(81166006)(81156014)(8676002)(1076002)(106002)(76506005)(5660300001)(2950100002)(6666003)(36756003)(97736004)(69596002)(106466001)(53936002)(57986006)(8936002)(48376002)(50466002)(356003)(68736007)(2906002)(104016004)(305945005)(47776003)(86362001)(2201001)(478600001)(16586007)(51416003)(54906003)(110136005)(72206003)(76176011)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR02MB130; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD049; 1:6uMeeeg8+ENLZe3Yi2+98Cs8CiAY8eqSkjiaqPFcDHPu/k6HVpEVvL3ZNdwDaZNWefxjRrF4TUZjj8bRQykRFQgVqqiITUaGAkVnml9Hpx2EW4RRUgSxURUzBPmG//u+ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 245389e2-67c5-4bac-fde9-08d54ce32d18 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:BLUPR02MB130; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB130; 3:FlrKmjzxa6YfSg0KW1jexOls4OU/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Rjsk/nBHYeW41lV8W7PBrnUNJ+B6fDiwvw0CW0Jva0SRw7diMzE8c3Nz8jYuTk4BGUqNb3V1jeKiC7RVfvGM0/ZizEdnOIFqDdGLVrp8jh3HE7NeeJ8093TFgwVg6kU5o3mCDWz09M3El646lmtzmI4DsiWW4ttFHH4bo9OTek3FUTLLqGp6ts5iruYI1uWY3JffEjiddNDUGbpdlltWE1bzjNwemIW7HaIvjdyieKPwqqf+7hlwwz+OjdWQnBDogcQ+hYSHECY/Ud2N+bGODlrVUFK8A+GMRkodV7y0r0XQJrho3ZsjA4GO024H7/v6kJjuS7pogArkpIuuHifEg2k+hxswON5Fbs6XEETXIy+1R8ApJO5qaL+CWcITv96awvQxE78/mZt/5ioV/cZ//kY6y83sxzT9C7ZFYqVlA9oMRm9AhQxPnCk9EnlwtMLZ4HxECqALYfklrvaeFXQyLBN9XbABwRtTpU70C7RcrB2RdWpWhaPxuNfnN1cr5Vw0hHgLFMtXK9SBrw4HfabfSTYCSgGhuHmdJ1WU1LrTfGjo= 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)(93006095)(93004095)(3002001)(10201501046)(3231023)(944501075)(6055026)(6041268)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:BLUPR02MB130; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BLUPR02MB130; X-Microsoft-Exchange-Diagnostics: 1; BLUPR02MB130; 4:96/ouZObcLxaGgJbBpBV1k/t+Cqvgn+qbxCARdSuofc5xSU2NlAp+0V2ru/o/1MZLwLYOaV2wAB4Luhz1d8gD1XGuQ49tbz6H+q3pQVDLp/GDWUw42QUzvoc0UNvR0pWOF5K9Bggs3BqzPUscuXBkgUYs/y5dkQEO5Cew2NPZ/tWjAtvfbfYYf+p/FNxgC7x+Cm5bsy1fDYJ0u4P6i1XHWLoyLa+43N1Yy9X7vL9tn08Nb8B3l14EklobjCcCh6/x/i7ew474cmQSDXSlA5yHQm6wYiX0iayOYaF38Nj9efp2AT2+I215OgNlRedDayO X-Forefront-PRVS: 0534947130 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR02MB130; 23:4fUkuR+V0X1bXtQQNr2OWrzziWfNWSlF6brzdyf34O?= =?us-ascii?Q?k2WdAooX7sDu1xx5yB2pDCKbKXoOvoo6KVUbDqMnAvBowooHnKvDyQ8T2Jse?= =?us-ascii?Q?kcIzXyR4f7jP1Lv27xz7ubNJ5GgxzCOxOxv29BPrSvQCjb77F09M+HqKHmu7?= =?us-ascii?Q?REvKzxgDnmmrRqfNjD269hmltRcKZBYDBK5IX0JC1srlawJdCRdXsV0eoRcN?= =?us-ascii?Q?c95ImO1ZAOueBNWOcERD1uTjtCFrpLDgDFVnNvRESbew3VG3Ue7OKj+TPDHw?= =?us-ascii?Q?C/+UDRrXBSK5pG0Dp3oNL68M6SfqKiEDwwPh2gMjyGTwcdRYnuKpTzPFT8ad?= =?us-ascii?Q?eC30W2D8jOv7igpvpTFJHYwGBmD7B48OGsh5NYq51QK5ksmTOyKPN0fEkFvR?= =?us-ascii?Q?z0a5oR3nMyGtq0YgOAvAvgkkXbEH5hCOZyLozhs90cjfcF5061kGiNN1GXVm?= =?us-ascii?Q?ea0wo5JPkznWlNX9LBkYY+qFq/QABgF9zSrrN7Q1ewKL98ndvae0YtelQlpN?= =?us-ascii?Q?fvwEcKqj3loJlJ2pxcCckNI8iUDfZuWBFYkGP1ohN2AeFCLvK2ktfJgsdcSf?= =?us-ascii?Q?5s/eEIMqUIur9PG35lBojelRpZBEpmFPykBlJbu1gC3X2jJyLoD9oMe9feBW?= =?us-ascii?Q?JWslqSk7XNAsQ0yVjcpXGPIUuQ1iVvd9YQWVTi4M3/skCu13FXQzxnMgvLdX?= =?us-ascii?Q?eN1BHU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dIhuuh097FbDhj5g44rmQ/VLZMk5mGq7y6xjetyPTprZ0F4ABXLP/sqsFpdTnpgxkQZo=; 7:ETy6AazRoSWXqcY1pga/mrQ+ERMRqpmZ9bgdcdkNT4qcB5MrR6HRbD4MlQLkgxyraYcQ3JE1PxffIftq1Xk41m43et//uDVvgyuCzAZ3mOGn8iV6MYFrvT2CMulXH9Emijv2sJ0crZRkORw9v95TjIrsNQpZ4Fjh2Fri31XCw2a01/DiCA5ZZ+GciF7xxAgzEC8YVoJBE6Mqt5SoPOQp/jwJL5L8qp8IO2prmc/S34JdK8qWlSYAgUAOhTd4LrGa SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2017 04:34:53.7573 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 245389e2-67c5-4bac-fde9-08d54ce32d18 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: BLUPR02MB130 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 --- Changes in V2: None 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 67ca5af..c30f7da 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -2021,6 +2021,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;