From patchwork Fri Dec 7 22:28:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Brace X-Patchwork-Id: 10718961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0AFE4109C for ; Fri, 7 Dec 2018 22:29:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB9712D8A2 for ; Fri, 7 Dec 2018 22:29:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF4B12DA76; Fri, 7 Dec 2018 22:29:03 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 6CE342DA59 for ; Fri, 7 Dec 2018 22:29:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726090AbeLGW3D (ORCPT ); Fri, 7 Dec 2018 17:29:03 -0500 Received: from mail-eopbgr710083.outbound.protection.outlook.com ([40.107.71.83]:48192 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726041AbeLGW3C (ORCPT ); Fri, 7 Dec 2018 17:29:02 -0500 Received: from BL2PR19CA0021.namprd19.prod.outlook.com (2603:10b6:201:f::31) by BLUPR19MB0404.namprd19.prod.outlook.com (2a01:111:e400:c470::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.21; Fri, 7 Dec 2018 22:28:19 +0000 Received: from BY2FFO11FD014.protection.gbl (2a01:111:f400:7c0c::178) by BL2PR19CA0021.outlook.office365.com (2603:10b6:201:f::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1404.19 via Frontend Transport; Fri, 7 Dec 2018 22:28:19 +0000 Authentication-Results: spf=pass (sender IP is 208.19.99.221) 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.99.221 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.99.221; helo=AUSMBX1.microsemi.net; Received: from AUSMBX1.microsemi.net (208.19.99.221) by BY2FFO11FD014.mail.protection.outlook.com (10.1.14.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.1404.13 via Frontend Transport; Fri, 7 Dec 2018 22:28:18 +0000 Received: from AUSMBX2.microsemi.net (10.201.34.32) by AUSMBX1.microsemi.net (10.201.34.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3; Fri, 7 Dec 2018 16:28:17 -0600 Received: from [127.0.1.1] (10.238.32.34) by ausmbx2.microsemi.net (10.201.34.32) with Microsoft SMTP Server id 15.1.1531.3 via Frontend Transport; Fri, 7 Dec 2018 16:28:16 -0600 Subject: [PATCH 02/20] Add retries for device reset From: Don Brace To: , , , , , , , , , , , CC: Date: Fri, 7 Dec 2018 16:28:16 -0600 Message-ID: <154422169686.1218.16312393024655070834.stgit@brunhilda> In-Reply-To: <154422079293.1218.12539829857034151457.stgit@brunhilda> References: <154422079293.1218.12539829857034151457.stgit@brunhilda> User-Agent: StGit/0.19-dirty MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.99.221;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(7916004)(396003)(376002)(39850400004)(136003)(346002)(2980300002)(189003)(199004)(53936002)(8676002)(81156014)(81166006)(305945005)(8936002)(2201001)(9686003)(5660300001)(86362001)(106002)(110136005)(58126008)(316002)(103116003)(4326008)(230700001)(2906002)(478600001)(69596002)(33716001)(16576012)(97736004)(2486003)(23676004)(106466001)(47776003)(50466002)(336012)(14444005)(356004)(446003)(44832011)(476003)(26005)(77096007)(68736007)(76176011)(33896004)(486006)(11346002)(126002)(186003)(921003)(2101003)(1121003)(83996005);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR19MB0404;H:AUSMBX1.microsemi.net;FPR:;SPF:Pass;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD014;1:4jiLcAPM/WdNqLmgJCj1oML0VhvO8AQ4SXjcQAr0uAASHB/prcOgNML3KuIf0HzjY5BkWX013kI8aUSTD5LfAD1YJ64b5S5J1LZaUj/9LbjWM99lb0gv88r8i2CKO3KM X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7543f788-f143-49e3-8430-08d65c9349e0 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4608076)(2017052603328)(7153060);SRVR:BLUPR19MB0404; X-Microsoft-Exchange-Diagnostics: 1;BLUPR19MB0404;3:W90T3zDck+drfjnxirldITVk2fG/wr75vbY42nWhc1iOa3fbiLrUAPKJcDOBGOwK7WaQHJkfjVPbDXAGIXx3TGEwgwchSEUhNsS06m8VYRfLX5MdJundIHKMnG5IazPF/G5CU1pVSUlzAjl6NFv9/TiT2jaLyZwA73GkvwEcAwTp9tgbiBmdpmemDzqrS/SBJ9YTdmH7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c+FL3w0pV5bN4auiT5PkrZFTHLnbu8epJvRDEp719ScDddR4lT51ddaKf+akhEDQCo4Ka7yN1wQNKxaCb7oiVKJBGG5oJDkNsgZCvvOw5VuGKy9itCjXHzxklcg2zWYVuKPpIUAnINYTyLzKeSCpkvvA61msN3Sa2hBQ/uOx4j4oq4/3F55bXnz59Ypzk4YctIxDwNAShsSfCDEIjAL3QhuczeIMkCO5isZNjYJbB+IbBvfil3TAyZ5GsKiTLYQSx8VAuv2RktEqF7W0ouidmHY5F X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3231455)(999002)(944501520)(52105112)(93006095)(93004095)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123564045)(20161123560045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:BLUPR19MB0404;BCL:0;PCL:0;RULEID:;SRVR:BLUPR19MB0404; X-Microsoft-Exchange-Diagnostics: 1;BLUPR19MB0404;4:jzyYAXcIIpxb67f0Nw2qkm0q61FShCTu94QwfY2YZ137dGBymu2bKXwNPoeZBpSQVpXzgUJB92+P3rj1aWmhIvAo09F+fgnLeb/iC0VXsQScLoM9chH4BU4F4qHJd4qnNdRW3kFNtcz+4/DwyqPZ0juw2y1h2GHX1K4L629C/2KYkTNzlKQ5BKNVSkULxI+AG7tYvbou6TiqQPGxsrdqnWSVNydoTGazM1rS2mJU6oqOWesvmAeeTFxE8JUwvXi0VG7ZYO+YzmaW//G8FPkt1A== X-Forefront-PRVS: 0879599414 X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BBLUPR19MB0404=3B23=3Apw1LuGV?= =?utf-8?q?jbu5pMPVeS4HWgpnIa4bpDo6uOqf7+mkx/8H+v7CukSuDj9dyfzGD2dk5m7w0qbKh?= =?utf-8?q?c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vItMcl5yOjcNA6WK+ZYCsLtlA4AW9T8HnwGxpmhHt0tuIGg9/IDEw154FX+A9l1unZlSYaXcPzc4O+IFz1jj9zFS5MHcf5RQQklMBizxnZiFcLY66Ee/6EqosQgLGephQ==;5:lduQ9KMpic/A0ohKGKYyMKyHovzwnqkUWF9r8G8feaPmm68OYbCJoDrWLcbqyte0laVAABs/w67zxGlzQUIyykeveIuEZoxBMfagEOg1fgMytCL+iCv5lKgZJxue23ZkLX/apxh9Qm+nplpfN26jheTotGvonp7FmDYJZUEtXj4=;7:waTD87ArIV75Ofes44/MJ0yNkSHtLxC0ir06qCwCP1tDeSqmKGvew4r0GeLfHXhUP3x8ea7hie5+XP8CjBHWwW0Ht4TiRGCl65Quq/Y1dd/4gfoEkdhB26TrB6FO4S6Z1hUlhKJzDyNbZESuhIPHUA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Dec 2018 22:28:18.7339 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7543f788-f143-49e3-8430-08d65c9349e0 X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad;Ip=[208.19.99.221];Helo=[AUSMBX1.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR19MB0404 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 From: Mahesh Rajashekhara Reviewed-by: Ajish Koshy Reviewed-by: Murthy Bhat Reviewed-by: Justin Lindley Reviewed-by: Scott Benesh Reviewed-by: Dave Carroll Reviewed-by: Scott Teel Reviewed-by: Kevin Barnett Signed-off-by: Mahesh Rajashekhara Signed-off-by: Don Brace --- drivers/scsi/smartpqi/smartpqi.h | 1 + drivers/scsi/smartpqi/smartpqi_init.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/smartpqi/smartpqi.h b/drivers/scsi/smartpqi/smartpqi.h index bbf056ddd026..646982e45904 100644 --- a/drivers/scsi/smartpqi/smartpqi.h +++ b/drivers/scsi/smartpqi/smartpqi.h @@ -587,6 +587,7 @@ typedef u32 pqi_index_t; #define SOP_TASK_ATTRIBUTE_ACA 4 #define SOP_TMF_COMPLETE 0x0 +#define SOP_TMF_REJECTED 0x4 #define SOP_TMF_FUNCTION_SUCCEEDED 0x8 /* additional CDB bytes usage field codes */ diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index 72e635cc594c..db95b1cb6889 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -2665,6 +2665,9 @@ static int pqi_interpret_task_management_response( case SOP_TMF_FUNCTION_SUCCEEDED: rc = 0; break; + case SOP_TMF_REJECTED: + rc = -EAGAIN; + break; default: rc = -EIO; break; @@ -5218,14 +5221,23 @@ static int pqi_lun_reset(struct pqi_ctrl_info *ctrl_info, return rc; } +#define PQI_LUN_RESET_RETRIES 3 +#define PQI_LUN_RESET_RETRY_INTERVAL_MSECS 10000 /* Performs a reset at the LUN level. */ static int pqi_device_reset(struct pqi_ctrl_info *ctrl_info, struct pqi_scsi_dev *device) { int rc; + unsigned int retries; - rc = pqi_lun_reset(ctrl_info, device); + for (retries = 0;;) { + rc = pqi_lun_reset(ctrl_info, device); + if (rc != -EAGAIN || + ++retries > PQI_LUN_RESET_RETRIES) + break; + msleep(PQI_LUN_RESET_RETRY_INTERVAL_MSECS); + } if (rc == 0) rc = pqi_device_wait_for_pending_io(ctrl_info, device);