@@ -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;
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@huawei.com> --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)