From patchwork Thu Dec 21 17:34:07 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: 10128125 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 499A360318 for ; Thu, 21 Dec 2017 17:35:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 377FF29CE3 for ; Thu, 21 Dec 2017 17:35:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BDAC29D38; Thu, 21 Dec 2017 17:35:29 +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 7B43729CE3 for ; Thu, 21 Dec 2017 17:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752351AbdLURfZ (ORCPT ); Thu, 21 Dec 2017 12:35:25 -0500 Received: from mail-by2nam03on0059.outbound.protection.outlook.com ([104.47.42.59]:39895 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752629AbdLURep (ORCPT ); Thu, 21 Dec 2017 12:34:45 -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=uIGJTm9WouBws92XWwMjaobWQQvVLufEvb/KgTD3X58=; b=LnIQLSoyYnHla7j8CywGJc50JWEwsyrGSu/Qca8KRCB3YH9C6cSgCMgfNmlJPT+uJ5WPHgH0JoeL7g2uSZv3A/eDRlzf1BoCI5fyl7vsJ35Fgbk0QJ7vLjeQplprMebQFG8ONT70ufnXdsNY/JRrp+/ap/e7RoQ/CFR4RMDxToE= Received: from MWHPR02CA0042.namprd02.prod.outlook.com (10.164.133.31) by BY2PR02MB140.namprd02.prod.outlook.com (10.242.45.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Thu, 21 Dec 2017 17:34:43 +0000 Received: from BN1BFFO11FD036.protection.gbl (2a01:111:f400:7c10::1:177) by MWHPR02CA0042.outlook.office365.com (2603:10b6:301:60::31) 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:43 +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:28 +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:25 -0800 From: Raghava Aditya Renukunta To: , , CC: , , , "Guilherme G . Piccoli" Subject: [PATCH 16/29] scsi: aacraid: Save bmic phy information for each phy Date: Thu, 21 Dec 2017 09:34:07 -0800 Message-ID: <20171221173420.8213-17-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)(346002)(376002)(39380400002)(39860400002)(396003)(2980300002)(438002)(189003)(199004)(5660300001)(81166006)(77096006)(110136005)(4326008)(54906003)(8936002)(76506005)(81156014)(305945005)(57986006)(2950100002)(50466002)(104016004)(48376002)(47776003)(1076002)(6666003)(2201001)(53936002)(106002)(86362001)(50226002)(106466001)(76176011)(59450400001)(97736004)(68736007)(316002)(16586007)(2906002)(8676002)(478600001)(36756003)(51416003)(356003)(72206003)(69596002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR02MB140; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD036; 1:gKVIdx2ELbz9O4zMbYkqvSox0lqIdcTlkg7OVD+CksJkoqd8HkX4b00D8noKLGByACKYdi18R/KR428Q0aBHRCRQLSnJOUFYqgyRLAviqdvKprpNYjI3YiRD/aXPI/E/ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 09065d65-6a11-412f-5a7d-08d54899168b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4608076)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603307)(7153060); SRVR:BY2PR02MB140; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB140; 3:De+aJz1HXjPyqmnw/fj4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vZkpcPP5C1gkfZ8wj3gru19aTnLHosdpiz1Wrx/w+ItMagpmHG2aCamA97v+b2FTdqmWLiSwGaAYemMNRj80RfwIJ6KOW/bCTs9HlZ/qSXc4w2baB/3/KUZp8omau94Mh7EDmtHCrxJJRlmQcpEdlLtIzssNlOIDnpNyay+0EhgOkofs/DelSjrO7mCOg+bgn2Zl8lTP3XHbtE3cFaf2QGPjwjgkzeUK+Z2cUHhDyh6S1OFcbZQmSXCWgvzZGyYD3g5ayeu5KIWtvcEPbzZAYryfg1CzuP+SmJIQ6er2uycNMOjhguskvqSzHWE5efMHR1h4b4qpIBRJG5pNAO0bOeSjyuqAsL3QSQ3+UKKCrOLJ4J9VuW6oQy0HokcUw9f+8xnHsvFDM7mC6hD4i7KP+FwOCBiGvV4oums/4PzDUu76GGSmHQQCii4knILmTd9REROfhPyJ9Vq+0ZbAOJ8yKRd8Mj6c+397klbgb6sTonA1zBAxpwyXG0YRa2mbxZ64pN4/kUH1VGVnX1ORAl33ZcdU04S7OwbTz7+CNTn53gpWPC87GDFLY= 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)(3231023)(93006095)(93004095)(10201501046)(3002001)(6055026)(6041268)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:BY2PR02MB140; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BY2PR02MB140; X-Microsoft-Exchange-Diagnostics: 1; BY2PR02MB140; 4:zS0kLSDKdNyh7hEYthA4b/U+eJBL2T7hJ5BEEkg0fePwuYVIhy6dS479v0Gx+9v2qk/E2wLqTPLOtn3DBWw9mlSFdeWggtBmT5mjZaQCzJbqmLVFWTXAJ71NKOvhNKlPrMzRHqWx0dN4vEolJqIrOPDyBuqGTofHX/A3vXCoPBIo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SZyi3Z3pcBeHBnw6GPqJCKl3t0UAR4N9AU=; 24:f8sFWCfnb3wFGV72oMmWg7wBE72FR7ZoquL+ufv4gO1siuwSPGJYFV6r86m/JCX4Yt4IxqSeY2zE9Vk+fQSHdvGU/20L0L1Mv32tXRAu7sM=; 7:ZlAakrJoDkNcnNxQjmu/EuU59KVUjnR8upjgYdGhIV9XXufLJrcRzi1gswoo0cBz/5S9r6l3pc1Jqx20chUD2RAf2x9Aphe1IF2yqTmr2QvCC2zMV1KBJeNtXx+JcrS73uWk8jV0ZyMyIj2WS5EsySsKG7xZ1VWaLbZNax0+Hiyg6zUfRpKaKaIHxaV1BCy12LUiRTSWIJtZAqBao6FPiBRqG04d8s7QLytnKxnyvrL7jN2rQc8IDWCss3q0MTV3 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2017 17:34:28.4632 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 09065d65-6a11-412f-5a7d-08d54899168b 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: BY2PR02MB140 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 --- drivers/scsi/aacraid/aachba.c | 87 +++++++++++++++++++++++++++++++++++++++--- drivers/scsi/aacraid/aacraid.h | 1 + 2 files changed, 82 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 83d2576..a29c8fb 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c @@ -1757,7 +1757,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; @@ -1780,7 +1780,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) @@ -1789,9 +1789,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) @@ -1891,6 +1895,74 @@ 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_phys_luns_resp *phys_luns; + struct aac_ciss_identify_pd *identify_resp = NULL; + + phys_luns = dev->safw_phys_luns; + + 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 @@ -1937,9 +2009,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; @@ -1956,8 +2025,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; }; /*