From patchwork Fri Sep 1 09:41:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wenchao Hao X-Patchwork-Id: 719721 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29A9ECA0FE6 for ; Fri, 1 Sep 2023 09:42:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348993AbjIAJnA (ORCPT ); Fri, 1 Sep 2023 05:43:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348994AbjIAJmo (ORCPT ); Fri, 1 Sep 2023 05:42:44 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8BCE19BA; Fri, 1 Sep 2023 02:42:09 -0700 (PDT) Received: from kwepemm600012.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RcY0B0VHtzVkS3; Fri, 1 Sep 2023 17:39:38 +0800 (CST) Received: from build.huawei.com (10.175.101.6) by kwepemm600012.china.huawei.com (7.193.23.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 1 Sep 2023 17:42:00 +0800 From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , CC: Hannes Reinecke , , , , Wenchao Hao Subject: [RFC PATCH v2 14/19] scsi: mpt3sas: Add param to control LUN based error handle Date: Fri, 1 Sep 2023 17:41:22 +0800 Message-ID: <20230901094127.2010873-15-haowenchao2@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230901094127.2010873-1-haowenchao2@huawei.com> References: <20230901094127.2010873-1-haowenchao2@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600012.china.huawei.com (7.193.23.74) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add new module param lun_eh to control if enable LUN based error handler, since mpt3sas defined callback eh_host_reset and eh_target_reset, so make it fallback to further recover when LUN based recovery can not recover all error commands. Signed-off-by: Wenchao Hao --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index c3c1f466fe01..7a48e89c3e5d 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -174,6 +174,10 @@ module_param(host_tagset_enable, int, 0444); MODULE_PARM_DESC(host_tagset_enable, "Shared host tagset enable/disable Default: enable(1)"); +static bool lun_eh; +module_param(lun_eh, bool, 0444); +MODULE_PARM_DESC(lun_eh, "LUN based error handle (def=0)"); + /* raid transport support */ static struct raid_template *mpt3sas_raid_template; static struct raid_template *mpt2sas_raid_template; @@ -2044,6 +2048,13 @@ scsih_slave_alloc(struct scsi_device *sdev) struct _sas_device *sas_device; struct _pcie_device *pcie_device; unsigned long flags; + int ret = 0; + + if (lun_eh) { + ret = scsi_device_setup_eh(sdev, 1); + if (ret) + return ret; + } sas_device_priv_data = kzalloc(sizeof(*sas_device_priv_data), GFP_KERNEL); @@ -2122,6 +2133,9 @@ scsih_slave_destroy(struct scsi_device *sdev) struct _pcie_device *pcie_device; unsigned long flags; + if (lun_eh) + scsi_device_clear_eh(sdev); + if (!sdev->hostdata) return;