diff mbox series

[v3,1/3] scsi: libsas: Add sas_device_task_abort()

Message ID 20221221092514.4091-2-yangxingui@huawei.com (mailing list archive)
State Deferred
Headers show
Series Directly kick-off EH when device removed with active IO | expand

Commit Message

yangxingui Dec. 21, 2022, 9:25 a.m. UTC
Add support for abort all active IOs for device, and define a LLDD
interface lldd_device_task_abort for LLDD to implement.

Signed-off-by: Xingui Yang <yangxingui@huawei.com>
---
 drivers/scsi/libsas/sas_scsi_host.c | 9 +++++++++
 include/scsi/libsas.h               | 2 ++
 2 files changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index a36fa1c128a8..4ac7cffcbada 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -1230,6 +1230,15 @@  void sas_task_abort(struct sas_task *task)
 }
 EXPORT_SYMBOL_GPL(sas_task_abort);
 
+void sas_device_task_abort(struct domain_device *dev)
+{
+	struct sas_internal *i =
+		to_sas_internal(dev->port->ha->core.shost->transportt);
+	if (i->dft->lldd_device_task_abort)
+		i->dft->lldd_device_task_abort(dev);
+}
+EXPORT_SYMBOL_GPL(sas_device_task_abort);
+
 int sas_slave_alloc(struct scsi_device *sdev)
 {
 	if (dev_is_sata(sdev_to_domain_dev(sdev)) && sdev->lun)
diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
index 1aee3d0ebbb2..1bf1cfb13912 100644
--- a/include/scsi/libsas.h
+++ b/include/scsi/libsas.h
@@ -678,6 +678,7 @@  struct sas_domain_function_template {
 	int (*lldd_abort_task_set)(struct domain_device *, u8 *lun);
 	int (*lldd_clear_task_set)(struct domain_device *, u8 *lun);
 	int (*lldd_I_T_nexus_reset)(struct domain_device *);
+	int (*lldd_device_task_abort)(struct domain_device *dev);
 	int (*lldd_ata_check_ready)(struct domain_device *);
 	void (*lldd_ata_set_dmamode)(struct domain_device *);
 	int (*lldd_lu_reset)(struct domain_device *, u8 *lun);
@@ -743,6 +744,7 @@  void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *);
 void sas_init_dev(struct domain_device *);
 
 void sas_task_abort(struct sas_task *);
+void sas_device_task_abort(struct domain_device *dev);
 int sas_eh_abort_handler(struct scsi_cmnd *cmd);
 int sas_eh_device_reset_handler(struct scsi_cmnd *cmd);
 int sas_eh_target_reset_handler(struct scsi_cmnd *cmd);