[PATCH v3 3/3] scsi: hisi_sas: Implement lldd_device_task_abort()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Implement lldd_device_task_abort() to abort active io for device.

Signed-off-by: Xingui Yang <yangxingui@xxxxxxxxxx>
---
 drivers/scsi/hisi_sas/hisi_sas_main.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index 41ba22f6c7f0..647479e54b62 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -1839,6 +1839,24 @@ static int hisi_sas_clear_nexus_ha(struct sas_ha_struct *sas_ha)
 	return TMF_RESP_FUNC_COMPLETE;
 }
 
+static int hisi_sas_device_task_abort(struct domain_device *dev)
+{
+	struct hisi_sas_device *sas_dev = dev->lldd_dev;
+	struct hisi_sas_slot *slot, *slot2;
+	struct sas_task *task;
+
+	spin_lock(&sas_dev->lock);
+	list_for_each_entry_safe(slot, slot2, &sas_dev->list, entry) {
+		task = slot->task;
+		if (unlikely(!task || !task->lldd_task || !task->dev))
+			continue;
+		sas_task_abort(task);
+	}
+	spin_unlock(&sas_dev->lock);
+
+	return 0;
+}
+
 static int hisi_sas_query_task(struct sas_task *task)
 {
 	int rc = TMF_RESP_FUNC_FAILED;
@@ -2029,6 +2047,7 @@ static struct sas_domain_function_template hisi_sas_transport_ops = {
 	.lldd_abort_task_set	= hisi_sas_abort_task_set,
 	.lldd_I_T_nexus_reset	= hisi_sas_I_T_nexus_reset,
 	.lldd_lu_reset		= hisi_sas_lu_reset,
+	.lldd_device_task_abort = hisi_sas_device_task_abort,
 	.lldd_query_task	= hisi_sas_query_task,
 	.lldd_clear_nexus_ha	= hisi_sas_clear_nexus_ha,
 	.lldd_port_formed	= hisi_sas_port_formed,
-- 
2.17.1




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux