From patchwork Wed Dec 27 04:34:37 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: 10133417 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 25D49605B4 for ; Wed, 27 Dec 2017 04:35:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EAB12AB38 for ; Wed, 27 Dec 2017 04:35:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03C732AB4A; Wed, 27 Dec 2017 04:35:35 +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 75BD42AB49 for ; Wed, 27 Dec 2017 04:35:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751849AbdL0Efd (ORCPT ); Tue, 26 Dec 2017 23:35:33 -0500 Received: from mail-sn1nam01on0059.outbound.protection.outlook.com ([104.47.32.59]:54080 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751495AbdL0EfP (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=kHfIJkii+x2zsPQYhPjMb9eJH3EeoafqzhzZALtl3pY=; b=PhT6Pqmwn1QTsmnWVgdaSTvOIQqqO9bgRB9c5mH+o2KAkmks55nFrr3HDPenQN36So0iMUPLXtAlU8hSkO29vNqbzptpqwax7R3Pb81wzlnKSOfFjiZeLpHoZwar7L08sdxPXaP/oJz92iEgULDAOqBksfia63Id+Jn4APQy+yY= Received: from CY4PR02CA0006.namprd02.prod.outlook.com (10.169.188.16) by CY1PR0201MB0746.namprd02.prod.outlook.com (10.160.141.149) 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:12 +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:12 +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:52 +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 16/30] scsi: aacraid: Save bmic phy information for each phy Date: Tue, 26 Dec 2017 20:34:37 -0800 Message-ID: <20171227043451.27813-17-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)(39860400002)(396003)(346002)(376002)(39380400002)(2980300002)(438002)(199004)(189003)(478600001)(57986006)(316002)(76506005)(68736007)(2201001)(106002)(16586007)(54906003)(356003)(51416003)(72206003)(50466002)(8936002)(110136005)(48376002)(4326008)(69596002)(36756003)(86362001)(8676002)(106466001)(104016004)(6666003)(47776003)(2950100002)(81166006)(2906002)(81156014)(305945005)(5660300001)(53936002)(77096006)(97736004)(50226002)(1076002)(76176011)(59450400001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0201MB0746; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD049; 1:3FcRcce0x8GWwf1K0iYffviW8sb6x3D59LImRyWZC6X0GeNdKWqVoJNxxWzgC1Ki/xl4a/+L53oD6uJ/Tghz+8l9YG3nzj3MBXPH4Pp+OBq49Lq4DidpOVTjQT5rLbJp X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4a153b17-52ae-4b81-0902-08d54ce32c83 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:CY1PR0201MB0746; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0746; 3:v0HO9I4GbuJNz4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2J9CzjC8bbVgAbH0NPlkRe4hlm3IV9/OniKw56h1DZ36z1OS+Yv23BIUrSmoZxPH+/ASiekoSZ+kxTW58tSmTqfgdBgcvXsBW8fuZ9+18cAbtEv8fHukHcYqaCrrtqMNZyCNfBU3/3OnCn2cwqGE+yvfkDzCW1S/5K7EsCJHfjLMwULJm6EFtqdbwEZT/YSg6qn+Ln164zLfwJibRWF3qkGv/g1MTmMmdLKWkI+lGSkU3ydU2OSBcZtr0Jupr5dL/2cLEOOb8125467X+XUoH1JTnT0M+cu4f3qIeYqL6AOIeG+L0G/AG7tzvZ2LBOTpNIhn0My6lrfmHNpNKDSGRyaICI1uBoEtEMMET6PGEl3NysB1tGNClbEhwt+X4jmnbLA4cgu1fedrpfbhRQ7vZxRIU2jaTHwEoXlwB/EWIg16RyTpYB3FO+C4+8A7mHNkg2YVNLDMrontHk4J+/WtkKTJR3qDCrYtjEZ2Od6H73kOOJWqtIjmn9U23/SkYJ9fbqGuPHeSMQulpeilGtg/g0onb0RXYbWORplf1y1Hm/dxTV1U= 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)(3231023)(944501075)(10201501046)(6055026)(6041268)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:CY1PR0201MB0746; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY1PR0201MB0746; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0201MB0746; 4:nD5dAQMwKu63iuOjidIjF6kpztq6rQHl+ga2ZmHFzjrXdxZG/4lirkJRFTEQ5Q9+1Rn16YBQ6iI2BhskEghRQHY0D8quS9/qrPrV8/BafzLgbq2zk9wbAzXSRkMVJRn5qGdwOkjCwL8HBqW3lFImqQcNi/xfkiSc+lXgKDfZV4E15a5B8YM2ytPpOeOjLrBnAmpzqjUId9diJLKME5OwtHTZ4LB9nniVARSmJGguVWHEd3CC6RT5xvaC6V/dyVR5/T79DWHvpJrOyimrcAHGYCt2lxLZAuTXJn/yvM7amgOpkMXDvXUdXRo1MfORVRny X-Forefront-PRVS: 0534947130 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0201MB0746; 23:/FDUBbXkKePYA+N77gKMFL2543zfkWSBv6ebY3U?= =?us-ascii?Q?qDMMTNsOk+5PMJhgBUXCpdc2w/jk5bz8+eCP/mQ+TYVfc186DjU2AqUe9hKY?= =?us-ascii?Q?Ag0CQSKsHVAJTVOXi0WZTT7Mk9fLStubsxB8bCySd2FlwMhYs2rE584K3wF8?= =?us-ascii?Q?jX7P6UX2iAXAD7pkfZzn9Cnj5nigVLoz3Mj0bwMGP0fWla6+75W4xKrRhWYH?= =?us-ascii?Q?bKAdZ2BnnUQZMjS27ho8KJJ4Vi5N3unFehZUYkLuPkH+FB2VMOLz5AdYQosY?= =?us-ascii?Q?DQtEFBZ4GWvch4/mhWL2Ym+u2cJX0pi3TH45rp1nCpe6x10n5Rd1sgwjNb+L?= =?us-ascii?Q?wAslLJaGB6tRQmKhVQ2jVVSxXN04EyCR0D8dhOw3jJmgI/E4oyiAAL8FQBpN?= =?us-ascii?Q?FGMVlEEiGzmvw93M+xQS3t0r1hrdodl3ljBH42j/5RH1o6+Or+r+46j845l2?= =?us-ascii?Q?GyPD/vnmfI8m0x5lAsaU+gsOgnXsjAp+u+iAhUnKaB0u9W8uHZkFmla/cqca?= =?us-ascii?Q?ZW2dOTh9eUOvXnvBHfDk8eCfCqLvDhfhuG9FrbA7JoFKqi3fj+4Nt0oiJpyP?= =?us-ascii?Q?+bru3pnOF6ITK1QWB2sCYAuzOyo5kEN7l7btTGQRTGR2pGhnbZuwpn+yC1EG?= =?us-ascii?Q?UUPYACU32Nuw6AdiLvGfVfiACv53HCVoVgvMihw2UIxNoUsft5smA2Htz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D4YJP9lBg7ODx+kAgZbS6343j0xvRKFSHvQhM37+aFI4g=; 24:i4jRIEp1B0hVLW1P5fy2/ppG/fOFhxAE8vAvCuS3c6TrOhj1tWHrddDGMd4NYtZwHiJfIg7gat3nu33shbytM+uh/EAgTEwGd5w4lSLCkzo=; 7:6fPY5mRfCxQCdqo174mA7s7Cd3TEsIsljlSBjnSvfFGTYOYcWF6DYNdxMuXG0rM57ZFFJ9E+udbnyC69lXMcgz14cOibL/andl7qlakg3TLJkkRln3woOwHoJ3/Zjzd99p3zYtidmYI6CqnyAC27dq15XVphDpMv4sPOrsMMk624c8ZK2B3xnbLuz/hQ/hgj5Gr3ZnXg+BeRw4Tsjm2UGe+3Q+kixpCt2/jzXrGkZPz8EMPbiJe+wm6j5MClaxUD SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Dec 2017 04:34:52.7745 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4a153b17-52ae-4b81-0902-08d54ce32c83 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: CY1PR0201MB0746 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 Save the bmic information for each phy, so that it can processed in target setup function. Signed-off-by: Raghava Aditya Renukunta --- Changes in V2: Removed unused phy_luns variable drivers/scsi/aacraid/aachba.c | 84 +++++++++++++++++++++++++++++++++++++++--- drivers/scsi/aacraid/aacraid.h | 1 + 2 files changed, 79 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index fa0132b..baa3de5 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1756,7 +1756,7 @@ static int aac_send_safw_bmic_cmd(struct aac_dev *dev, } static int aac_issue_safw_bmic_identify(struct aac_dev *dev, - u32 bus, u32 target) + struct aac_ciss_identify_pd **identify_resp, u32 bus, u32 target) { int rcode = -ENOMEM; int datasize; @@ -1779,7 +1779,7 @@ static int aac_issue_safw_bmic_identify(struct aac_dev *dev, rcode = aac_send_safw_bmic_cmd(dev, &srbu, identify_reply, datasize); if (unlikely(rcode < 0)) - goto out; + goto mem_free_all; if (identify_reply->current_queue_depth_limit <= 0 || identify_reply->current_queue_depth_limit > 32) @@ -1788,9 +1788,13 @@ static int aac_issue_safw_bmic_identify(struct aac_dev *dev, dev->hba_map[bus][target].qd_limit = identify_reply->current_queue_depth_limit; - kfree(identify_reply); + *identify_resp = identify_reply; + out: return rcode; +mem_free_all: + kfree(identify_reply); + goto out; } static inline void aac_free_safw_ciss_luns(struct aac_dev *dev) @@ -1883,6 +1887,71 @@ static inline u32 aac_get_safw_phys_device_type(struct aac_dev *dev, int lun) return dev->safw_phys_luns->lun[lun].node_ident[8]; } +static inline void aac_free_safw_identify_resp(struct aac_dev *dev, + int bus, int target) +{ + kfree(dev->hba_map[bus][target].safw_identify_resp); + dev->hba_map[bus][target].safw_identify_resp = NULL; +} + +static inline void aac_free_safw_all_identify_resp(struct aac_dev *dev, + int lun_count) +{ + int luns; + int i; + u32 bus; + u32 target; + + luns = aac_get_safw_phys_lun_count(dev); + + if (luns < lun_count) + lun_count = luns; + else if (lun_count < 0) + lun_count = luns; + + for (i = 0; i < lun_count; i++) { + bus = aac_get_safw_phys_bus(dev, i); + target = aac_get_safw_phys_target(dev, i); + + aac_free_safw_identify_resp(dev, bus, target); + } +} + +static int aac_get_safw_attr_all_targets(struct aac_dev *dev, int rescan) +{ + int i; + int rcode = 0; + u32 lun_count; + u32 bus; + u32 target; + struct aac_ciss_identify_pd *identify_resp = NULL; + + lun_count = aac_get_safw_phys_lun_count(dev); + + for (i = 0; i < lun_count; ++i) { + + bus = aac_get_safw_phys_bus(dev, i); + target = aac_get_safw_phys_target(dev, i); + + rcode = aac_issue_safw_bmic_identify(dev, + &identify_resp, bus, target); + + if (unlikely(rcode < 0)) { + dev->hba_map[bus][target].qd_limit = 32; + goto free_identify_resp; + } + + dev->hba_map[bus][target].safw_identify_resp = identify_resp; + } + +out: + return rcode; + +free_identify_resp: + aac_free_safw_all_identify_resp(dev, i); + goto out; +} + /** * aac_set_safw_attr_all_targets- update current hba map with data from FW * @dev: aac_dev structure @@ -1929,9 +1998,6 @@ static void aac_set_safw_attr_all_targets(struct aac_dev *dev, int rescan) if (devtype != AAC_DEVTYPE_NATIVE_RAW) goto update_devtype; - if (aac_issue_safw_bmic_identify(dev, bus, target) < 0) - dev->hba_map[bus][target].qd_limit = 32; - update_devtype: if (rescan == AAC_INIT) dev->hba_map[bus][target].devtype = devtype; @@ -1948,8 +2014,14 @@ static int aac_setup_safw_targets(struct aac_dev *dev, int rescan) if (unlikely(rcode < 0)) goto out; + rcode = aac_get_safw_attr_all_targets(dev, rescan); + if (unlikely(rcode < 0)) + goto free_ciss_luns; + aac_set_safw_attr_all_targets(dev, rescan); + aac_free_safw_all_identify_resp(dev, -1); +free_ciss_luns: aac_free_safw_ciss_luns(dev); out: return rcode; diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 19af4d9..b1a6045 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h @@ -1345,6 +1345,7 @@ struct aac_hba_map_info { /* after xth TM LUN reset */ u16 qd_limit; u8 expose; /*checks if to expose or not*/ + struct aac_ciss_identify_pd *safw_identify_resp; }; /*