[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230901094127.2010873-16-haowenchao2@huawei.com>
Date: Fri, 1 Sep 2023 17:41:23 +0800
From: Wenchao Hao <haowenchao2@...wei.com>
To: "James E . J . Bottomley" <jejb@...ux.ibm.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
<linux-scsi@...r.kernel.org>
CC: Hannes Reinecke <hare@...e.de>, <linux-kernel@...r.kernel.org>,
<louhongxiang@...wei.com>, <lixiaokeng@...wei.com>,
Wenchao Hao <haowenchao2@...wei.com>
Subject: [RFC PATCH v2 15/19] scsi: mpt3sas: Add param to control target based error handle
Add new module param target_eh to control if enable target based
error handle, since mpt3sas defined callback eh_host_reset, so make
it fallback to further recover when target based recovery can not
recover all error commands.
Signed-off-by: Wenchao Hao <haowenchao2@...wei.com>
---
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 7a48e89c3e5d..6170d8a772d4 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -178,6 +178,10 @@ static bool lun_eh;
module_param(lun_eh, bool, 0444);
MODULE_PARM_DESC(lun_eh, "LUN based error handle (def=0)");
+static bool target_eh;
+module_param(target_eh, bool, 0444);
+MODULE_PARM_DESC(target_eh, "target based error handle (def=0)");
+
/* raid transport support */
static struct raid_template *mpt3sas_raid_template;
static struct raid_template *mpt2sas_raid_template;
@@ -1879,6 +1883,13 @@ scsih_target_alloc(struct scsi_target *starget)
struct _pcie_device *pcie_device;
unsigned long flags;
struct sas_rphy *rphy;
+ int ret = 0;
+
+ if (target_eh) {
+ ret = scsi_target_setup_eh(starget, 1);
+ if (ret)
+ return ret;
+ }
sas_target_priv_data = kzalloc(sizeof(*sas_target_priv_data),
GFP_KERNEL);
@@ -1969,6 +1980,9 @@ scsih_target_destroy(struct scsi_target *starget)
struct _pcie_device *pcie_device;
unsigned long flags;
+ if (target_eh)
+ scsi_target_clear_eh(starget);
+
sas_target_priv_data = starget->hostdata;
if (!sas_target_priv_data)
return;
--
2.35.3
Powered by blists - more mailing lists