From patchwork Fri Oct 20 21:51:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 10021031 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 BF56860234 for ; Fri, 20 Oct 2017 21:52:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFDDB28F67 for ; Fri, 20 Oct 2017 21:52:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A40A328F6A; Fri, 20 Oct 2017 21:52:34 +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 C044128F6D for ; Fri, 20 Oct 2017 21:52:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753529AbdJTVwc (ORCPT ); Fri, 20 Oct 2017 17:52:32 -0400 Received: from mail-bn3nam01on0040.outbound.protection.outlook.com ([104.47.33.40]:35214 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752845AbdJTVwZ (ORCPT ); Fri, 20 Oct 2017 17:52:25 -0400 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=BPHbrJygWlBo/FQ63KJzK5b/qqWHPfkppURvujpqi20=; b=masyU9/68X4VgwUqWSETEhnXBMfi6Uz0iNYhi8+Lv1n7rQPnbWk4CKTawVFTpPPmqjeVpNDjuuktn5IEUr5HtEEhEshUs5i/AE4C5iYkzXVUgkiOTR0Y27pSw/utM/hZCL9w2gSE5OJaX50ZY3+WGJ7x7igKa4D74fWte0rmFcA= Received: from MWHPR02CA0022.namprd02.prod.outlook.com (2603:10b6:300:4b::32) by BN1PR0201MB0739.namprd02.prod.outlook.com (2a01:111:e400:56::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Fri, 20 Oct 2017 21:52:23 +0000 Received: from BY2FFO11FD048.protection.gbl (2a01:111:f400:7c0c::190) by MWHPR02CA0022.outlook.office365.com (2603:10b6:300:4b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7 via Frontend Transport; Fri, 20 Oct 2017 21:52:22 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.21) smtp.mailfrom=microsemi.com; suse.com; dkim=none (message not signed) header.d=none;suse.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 BY2FFO11FD048.mail.protection.outlook.com (10.1.15.176) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.77.10 via Frontend Transport; Fri, 20 Oct 2017 21:52:22 +0000 Received: from [127.0.1.1] (10.238.32.34) by avsrvexchhts1.microsemi.net (10.100.34.105) with Microsoft SMTP Server id 14.3.361.1; Fri, 20 Oct 2017 14:51:46 -0700 Subject: [PATCH 07/12] hpsa: correct smart path enabled From: Don Brace To: , , , , , , , , , , CC: Date: Fri, 20 Oct 2017 16:51:45 -0500 Message-ID: <150853630493.28275.14651999856539186327.stgit@brunhilda> In-Reply-To: <150853443786.28275.17878578984391668998.stgit@brunhilda> References: <150853443786.28275.17878578984391668998.stgit@brunhilda> User-Agent: StGit/0.17.1-dirty 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)(6009001)(7916004)(376002)(39860400002)(346002)(2980300002)(438002)(199003)(189002)(478600001)(58126008)(77096006)(53936002)(81166006)(68736007)(9686003)(50986999)(356003)(81156014)(316002)(305945005)(76176999)(2201001)(54356999)(5660300001)(8676002)(106002)(110136005)(2950100002)(16576012)(189998001)(47776003)(69596002)(8936002)(104016004)(97736004)(106466001)(23676002)(50466002)(4326008)(230700001)(103116003)(2906002)(86362001)(33646002)(83506002)(33716001)(921003)(2101003)(83996005)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0201MB0739; H:avsrvexchhts1.microsemi.net; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD048; 1:cfZ28SLEAlEHCbkzXMQl2ZDvkgtaKLyoYMKyqF3OO0xLBBl8LTux3v8lnA61M701Ru92poSwQ69E2PayOQyNOPvFQbuumVZgBB3YVZNvDGY9m0H9lwDHQbtmLBGFnhEQ X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f9f74ab8-a71f-44fe-05f2-08d51804d807 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(4534020)(4602075)(4627075)(201703031133081)(201702281549075)(2017052603199); SRVR:BN1PR0201MB0739; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0739; 3:A/Od6vB0XXTNc12T7kBEN+7d9+MvzUGvtci4IgmhM63/ajOFhiW/90hCt+f/qyQ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ftEzEz4r9u2kyIVGTVd1Z9u40pv5G4qqZLVkveTEbstQ8dgG47xZfyjIcnpTiJseRai67eygcNd4go/9ztvNkyYzVn+/UZtq/RnWlQWgOfLdfSTFRxPydR1hdy34WvZnfcNeLLT+UGFcswg8Hv6goktveoMXgLQiD/xUaTV6YsnjstD5lDqpW1HDDQObeBJf/GYRsnD+wDZ1TPN0uAojhVOtffHu4qZNO0KO0ePZzY0Yc/vTa2TM23qF+0kvMqJWr+FAIZHMymXxaNTPMKRE5kLrxKb9xaXsuqPuGKF71j7v4qCYZuGb53jhPSLp2mohRI3XYauk/cjSD/6M8qFJ0aU9zH15Cp8cR30r7YV5vnOoEQly/I5z6uASv8Gxh2zFfWvc+DwASpaWwBkCJAO X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(72170198267865); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(93006095)(93004095)(10201501046)(3231020)(100000703101)(100105400095)(3002001)(6055026)(6041248)(20161123558100)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123555025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN1PR0201MB0739; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN1PR0201MB0739; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0739; 4:c9xQOcQLGlxE2UukSw2+RhG9jThRUrx/IR/ZNunKe4SZJAdpkJeO4xaMT4oSfVrQoRiW1b5zX0u4hS0lFGtXa6T4iMSMYcfXSsMtdcKKfEXjtrl7KoaeKVywjs9XOp0t39aKsnpv4GvXRFksQuNDQVh9LJ4LVvDBiP4bs969rKsr2xYLJL4iXZ5BGTQOgU2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TFMc2JtQUFjeTF1V2ludW04Mjh3REVS?= =?utf-8?Q?Y=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0739; 6:pwiYghBSXB0AAuKyTIifqKP3Gy9at/unDExPUawF7QhCJI9YSQ/a2sDA1qZN69duTnytnNbBM82DiEM3u/MhYWdViZxi6mp1wX4l01sqSeMxPGszMl1f0pizzuNWNxQthNCjH+QDvecf9f1hnW3SvO9uyeiySIjOI/G/Jl1C4Ab4xmQaVGdG9rtLlb9uMkQ4BjwLZV+KbhCbxZgfpy7o+c3gXfFYSWOe6FinDiA+z4K93AMaeJVqkMs/NQXsXAmhmXso3xuyNvMkv45Nex+u9v3F02c0adM7qEGcJ7Q7GAuKWihLh9Nf2pe87mAmR7p/Gx0b7caVQRJmZ9SomwQ2sQ==; 5:zP8ZTuS0xWRKUWSgIH6xWBCvTFQ8x1kYxj4MV64gDRHPnCrAs3Py1B7tFr5w7ZV0nl4OHxWIZbRvcTmqwMdfb6QVg2hW5i0A++h1qqm5IRVoBzYxKgs/yJHfQmNOnWdPFOLHZyHpolhDRFikQH8gNw==; 24:aRra3EOku6uQ3xDPCRKhydICeMnD30sV4Gm3NdlBMTpGBvDgp49EkupGt5u8ssuJNGmNFMXJYCR90jf1VZIumpBVmFHFbLzXG6NvxcrSoGU=; 7:C7A6XcipaokLkOYfCbSk6lJaVJo1DoBITWDvwFnc0WxC8xYdAffA/q/Qo1+HKqURqQFo5ZkSbSXHxQd6JPMfX5ytt4jkFhO/coWI6Fh+ws3oIjGe3lgfK2rLXnCPn/wTrZUHJF9MpMRdXj0yTtqL0ry5BHcCmhchQPDbOIAsECk9Bt9tLg56hP7p4HQe5Akxw4TYFq2P0l2EfC0Qv30vNZ4Y+LMVeq88VpIlp44ypkc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2017 21:52:22.3727 (UTC) 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: BN1PR0201MB0739 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 - correct re-enabling ioaccel after: 1) RAID transformations and 2) multi-path fail-overs. Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Reviewed-by: Kevin Barnett Signed-off-by: Don Brace --- drivers/scsi/hpsa.c | 189 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 151 insertions(+), 38 deletions(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 4ab53df..6a998b0 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -787,7 +787,12 @@ static ssize_t host_show_hp_ssd_smart_path_enabled(struct device *dev, } offload_enabled = hdev->offload_enabled; spin_unlock_irqrestore(&h->lock, flags); - return snprintf(buf, 20, "%d\n", offload_enabled); + + if (hdev->devtype == TYPE_DISK || hdev->devtype == TYPE_ZBC) + return snprintf(buf, 20, "%d\n", offload_enabled); + else + return snprintf(buf, 40, "%s\n", + "Not applicable for a controller"); } #define MAX_PATHS 8 @@ -1270,7 +1275,7 @@ static void hpsa_show_dev_msg(const char *level, struct ctlr_info *h, dev->model, label, dev->offload_config ? '+' : '-', - dev->offload_enabled ? '+' : '-', + dev->offload_to_be_enabled ? '+' : '-', dev->expose_device); } @@ -1345,36 +1350,42 @@ static int hpsa_scsi_add_entry(struct ctlr_info *h, (*nadded)++; hpsa_show_dev_msg(KERN_INFO, h, device, device->expose_device ? "added" : "masked"); - device->offload_to_be_enabled = device->offload_enabled; - device->offload_enabled = 0; return 0; } -/* Update an entry in h->dev[] array. */ +/* + * Called during a scan operation. + * + * Update an entry in h->dev[] array. + */ static void hpsa_scsi_update_entry(struct ctlr_info *h, int entry, struct hpsa_scsi_dev_t *new_entry) { - int offload_enabled; /* assumes h->devlock is held */ BUG_ON(entry < 0 || entry >= HPSA_MAX_DEVICES); /* Raid level changed. */ h->dev[entry]->raid_level = new_entry->raid_level; + /* + * ioacccel_handle may have changed for a dual domain disk + */ + h->dev[entry]->ioaccel_handle = new_entry->ioaccel_handle; + /* Raid offload parameters changed. Careful about the ordering. */ - if (new_entry->offload_config && new_entry->offload_enabled) { + if (new_entry->offload_config && new_entry->offload_to_be_enabled) { /* * if drive is newly offload_enabled, we want to copy the * raid map data first. If previously offload_enabled and * offload_config were set, raid map data had better be - * the same as it was before. if raid map data is changed + * the same as it was before. If raid map data has changed * then it had better be the case that * h->dev[entry]->offload_enabled is currently 0. */ h->dev[entry]->raid_map = new_entry->raid_map; h->dev[entry]->ioaccel_handle = new_entry->ioaccel_handle; } - if (new_entry->hba_ioaccel_enabled) { + if (new_entry->offload_to_be_enabled) { h->dev[entry]->ioaccel_handle = new_entry->ioaccel_handle; wmb(); /* set ioaccel_handle *before* hba_ioaccel_enabled */ } @@ -1385,17 +1396,18 @@ static void hpsa_scsi_update_entry(struct ctlr_info *h, /* * We can turn off ioaccel offload now, but need to delay turning - * it on until we can update h->dev[entry]->phys_disk[], but we + * ioaccel on until we can update h->dev[entry]->phys_disk[], but we * can't do that until all the devices are updated. */ - h->dev[entry]->offload_to_be_enabled = new_entry->offload_enabled; - if (!new_entry->offload_enabled) + h->dev[entry]->offload_to_be_enabled = new_entry->offload_to_be_enabled; + + /* + * turn ioaccel off immediately if told to do so. + */ + if (!new_entry->offload_to_be_enabled) h->dev[entry]->offload_enabled = 0; - offload_enabled = h->dev[entry]->offload_enabled; - h->dev[entry]->offload_enabled = h->dev[entry]->offload_to_be_enabled; hpsa_show_dev_msg(KERN_INFO, h, h->dev[entry], "updated"); - h->dev[entry]->offload_enabled = offload_enabled; } /* Replace an entry from h->dev[] array. */ @@ -1421,9 +1433,8 @@ static void hpsa_scsi_replace_entry(struct ctlr_info *h, h->dev[entry] = new_entry; added[*nadded] = new_entry; (*nadded)++; + hpsa_show_dev_msg(KERN_INFO, h, new_entry, "replaced"); - new_entry->offload_to_be_enabled = new_entry->offload_enabled; - new_entry->offload_enabled = 0; } /* Remove an entry from h->dev[] array. */ @@ -1513,11 +1524,22 @@ static inline int device_updated(struct hpsa_scsi_dev_t *dev1, return 1; if (dev1->offload_config != dev2->offload_config) return 1; - if (dev1->offload_enabled != dev2->offload_enabled) + if (dev1->offload_to_be_enabled != dev2->offload_to_be_enabled) return 1; if (!is_logical_dev_addr_mode(dev1->scsi3addr)) if (dev1->queue_depth != dev2->queue_depth) return 1; + /* + * This can happen for dual domain devices. An active + * path change causes the ioaccel handle to change + * + * for example note the handle differences between p0 and p1 + * Device WWN ,WWN hash,Handle + * D016 p0|0x3 [02]P2E:01:01,0x5000C5005FC4DACA,0x9B5616,0x01030003 + * p1 0x5000C5005FC4DAC9,0x6798C0,0x00040004 + */ + if (dev1->ioaccel_handle != dev2->ioaccel_handle) + return 1; return 0; } @@ -1727,6 +1749,11 @@ static void hpsa_figure_phys_disk_ptrs(struct ctlr_info *h, * be 0, but we'll turn it off here just in case */ if (!logical_drive->phys_disk[i]) { + dev_warn(&h->pdev->dev, + "%s: [%d:%d:%d:%d] A phys disk component of LV is missing, turning off offload_enabled for LV.\n", + __func__, + h->scsi_host->host_no, logical_drive->bus, + logical_drive->target, logical_drive->lun); logical_drive->offload_enabled = 0; logical_drive->offload_to_be_enabled = 0; logical_drive->queue_depth = 8; @@ -1759,13 +1786,24 @@ static void hpsa_update_log_drive_phys_drive_ptrs(struct ctlr_info *h, /* * If offload is currently enabled, the RAID map and * phys_disk[] assignment *better* not be changing - * and since it isn't changing, we do not need to - * update it. + * because we would be changing ioaccel phsy_disk[] pointers + * on a ioaccel volume processing I/O requests. + * + * If an ioaccel volume status changed, initially because it was + * re-configured and thus underwent a transformation, or + * a drive failed, we would have received a state change + * request and ioaccel should have been turned off. When the + * transformation completes, we get another state change + * request to turn ioaccel back on. In this case, we need + * to update the ioaccel information. + * + * Thus: If it is not currently enabled, but will be after + * the scan completes, make sure the ioaccel pointers + * are up to date. */ - if (dev[i]->offload_enabled) - continue; - hpsa_figure_phys_disk_ptrs(h, dev, ndevices, dev[i]); + if (!dev[i]->offload_enabled && dev[i]->offload_to_be_enabled) + hpsa_figure_phys_disk_ptrs(h, dev, ndevices, dev[i]); } } @@ -1965,8 +2003,13 @@ static void adjust_hpsa_scsi_table(struct ctlr_info *h, } hpsa_update_log_drive_phys_drive_ptrs(h, h->dev, h->ndevices); - /* Now that h->dev[]->phys_disk[] is coherent, we can enable + /* + * Now that h->dev[]->phys_disk[] is coherent, we can enable * any logical drives that need it enabled. + * + * The raid map should be current by now. + * + * We are updating the device list used for I/O requests. */ for (i = 0; i < h->ndevices; i++) { if (h->dev[i] == NULL) @@ -2441,7 +2484,7 @@ static void process_ioaccel2_completion(struct ctlr_info *h, /* * Any RAID offload error results in retry which will use - * the normal I/O path so the controller can handle whatever's + * the normal I/O path so the controller can handle whatever is * wrong. */ if (is_logical_device(dev) && @@ -3540,6 +3583,13 @@ static bool hpsa_vpd_page_supported(struct ctlr_info *h, return true; } +/* + * Called during a scan operation. + * Sets ioaccel status on the new device list, not the existing device list + * + * The device list used during I/O will be updated later in + * adjust_hpsa_scsi_table. + */ static void hpsa_get_ioaccel_status(struct ctlr_info *h, unsigned char *scsi3addr, struct hpsa_scsi_dev_t *this_device) { @@ -3568,12 +3618,12 @@ static void hpsa_get_ioaccel_status(struct ctlr_info *h, this_device->offload_config = !!(ioaccel_status & OFFLOAD_CONFIGURED_BIT); if (this_device->offload_config) { - this_device->offload_enabled = + this_device->offload_to_be_enabled = !!(ioaccel_status & OFFLOAD_ENABLED_BIT); if (hpsa_get_raid_map(h, scsi3addr, this_device)) - this_device->offload_enabled = 0; + this_device->offload_to_be_enabled = 0; } - this_device->offload_to_be_enabled = this_device->offload_enabled; + out: kfree(buf); return; @@ -4307,7 +4357,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h) continue; } - /* Get device type, vendor, model, device id */ + /* Get device type, vendor, model, device id, raid_map */ rc = hpsa_update_device_info(h, lunaddrbytes, tmpdevice, &is_OBDR); if (rc == -ENOMEM) { @@ -8067,9 +8117,79 @@ static int detect_controller_lockup(struct ctlr_info *h) return false; } -static void hpsa_ack_ctlr_events(struct ctlr_info *h) +/* + * Set ioaccel status for all ioaccel volumes. + * + * Called from monitor controller worker (hpsa_event_monitor_worker) + * + * A Volume (or Volumes that comprise an Array set may be undergoing a + * transformation, so we will be turning off ioaccel for all volumes that + * make up the Array. + */ +static void hpsa_set_ioaccel_status(struct ctlr_info *h) { + int rc; int i; + u8 ioaccel_status; + unsigned char *buf; + struct hpsa_scsi_dev_t *device; + + if (!h) + return; + + buf = kmalloc(64, GFP_KERNEL); + if (!buf) + return; + + /* + * Run through current device list used during I/O requests. + */ + for (i = 0; i < h->ndevices; i++) { + device = h->dev[i]; + + if (!device) + continue; + if (!device->scsi3addr) + continue; + if (!hpsa_vpd_page_supported(h, device->scsi3addr, + HPSA_VPD_LV_IOACCEL_STATUS)) + continue; + + memset(buf, 0, 64); + + rc = hpsa_scsi_do_inquiry(h, device->scsi3addr, + VPD_PAGE | HPSA_VPD_LV_IOACCEL_STATUS, + buf, 64); + if (rc != 0) + continue; + + ioaccel_status = buf[IOACCEL_STATUS_BYTE]; + device->offload_config = + !!(ioaccel_status & OFFLOAD_CONFIGURED_BIT); + if (device->offload_config) + device->offload_to_be_enabled = + !!(ioaccel_status & OFFLOAD_ENABLED_BIT); + + /* + * Immediately turn off ioaccel for any volume the + * controller tells us to. Some of the reasons could be: + * transformation - change to the LVs of an Array. + * degraded volume - component failure + * + * If ioaccel is to be re-enabled, re-enable later during the + * scan operation so the driver can get a fresh raidmap + * before turning ioaccel back on. + * + */ + if (!device->offload_to_be_enabled) + device->offload_enabled = 0; + } + + kfree(buf); +} + +static void hpsa_ack_ctlr_events(struct ctlr_info *h) +{ char *event_type; if (!(h->fw_support & MISC_FW_EVENT_NOTIFY)) @@ -8087,10 +8207,7 @@ static void hpsa_ack_ctlr_events(struct ctlr_info *h) event_type = "configuration change"; /* Stop sending new RAID offload reqs via the IO accelerator */ scsi_block_requests(h->scsi_host); - for (i = 0; i < h->ndevices; i++) { - h->dev[i]->offload_enabled = 0; - h->dev[i]->offload_to_be_enabled = 0; - } + hpsa_set_ioaccel_status(h); hpsa_drain_accel_commands(h); /* Set 'accelerator path config change' bit */ dev_warn(&h->pdev->dev, @@ -8107,10 +8224,6 @@ static void hpsa_ack_ctlr_events(struct ctlr_info *h) writel(h->events, &(h->cfgtable->clear_event_notify)); writel(DOORBELL_CLEAR_EVENTS, h->vaddr + SA5_DOORBELL); hpsa_wait_for_clear_event_notify_ack(h); -#if 0 - writel(CFGTBL_ChangeReq, h->vaddr + SA5_DOORBELL); - hpsa_wait_for_mode_change_ack(h); -#endif } return; }