Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1335308
| From | John Garry <john.garry@huawei.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/6] hisi_sas: add hisi_sas_slot_abort() |
| Date | 2016-02-16 13:10 +0100 |
| Message-ID | <r2MC6-7Er-13@gated-at.bofh.it> (permalink) |
| References | <r2MC6-7Er-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Add a function to abort a slot (task) in the device
(if it is in the task set) and then cleanup and
complete the task.
The function is called from work queue context as
it cannot be called from the context where it is
triggered (interrupt).
Signed-off-by: John Garry <john.garry@huawei.com>
---
drivers/scsi/hisi_sas/hisi_sas.h | 1 +
drivers/scsi/hisi_sas/hisi_sas_main.c | 43 +++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h
index 02da7e4..a05ce71 100644
--- a/drivers/scsi/hisi_sas/hisi_sas.h
+++ b/drivers/scsi/hisi_sas/hisi_sas.h
@@ -120,6 +120,7 @@ struct hisi_sas_slot {
dma_addr_t command_table_dma;
struct hisi_sas_sge_page *sge_page;
dma_addr_t sge_page_dma;
+ struct work_struct abort_slot;
};
struct hisi_sas_tmf_task {
diff --git a/drivers/scsi/hisi_sas/hisi_sas_main.c b/drivers/scsi/hisi_sas/hisi_sas_main.c
index c600f5e..65509eb 100644
--- a/drivers/scsi/hisi_sas/hisi_sas_main.c
+++ b/drivers/scsi/hisi_sas/hisi_sas_main.c
@@ -15,6 +15,9 @@
#define DEV_IS_GONE(dev) \
((!dev) || (dev->dev_type == SAS_PHY_UNUSED))
+static int hisi_sas_debug_issue_ssp_tmf(struct domain_device *device,
+ u8 *lun, struct hisi_sas_tmf_task *tmf);
+
static struct hisi_hba *dev_to_hisi_hba(struct domain_device *device)
{
return device->port->ha->lldd_ha;
@@ -113,6 +116,45 @@ static int hisi_sas_task_prep_ata(struct hisi_hba *hisi_hba,
return hisi_hba->hw->prep_stp(hisi_hba, slot);
}
+/*
+ * This function will issue an abort TMF if a task is still in
+ * the target. Then it will do the task complete cleanup and
+ * callbacks.
+ */
+static void hisi_sas_slot_abort(struct work_struct *work)
+{
+ struct hisi_sas_slot *abort_slot =
+ container_of(work, struct hisi_sas_slot, abort_slot);
+ struct sas_task *task = abort_slot->task;
+ struct hisi_hba *hisi_hba = dev_to_hisi_hba(task->dev);
+ struct scsi_cmnd *cmnd = task->uldd_task;
+ struct hisi_sas_tmf_task tmf_task;
+ struct domain_device *device = task->dev;
+ struct hisi_sas_device *sas_dev = device->lldd_dev;
+ struct scsi_lun lun;
+ int tag = abort_slot->idx, rc;
+
+ int_to_scsilun(cmnd->device->lun, &lun);
+ tmf_task.tmf = TMF_QUERY_TASK;
+ tmf_task.tag_of_task_to_be_managed = cpu_to_le16(tag);
+
+ rc = hisi_sas_debug_issue_ssp_tmf(task->dev, lun.scsi_lun, &tmf_task);
+
+ /* TMF_RESP_FUNC_SUCC means task is present in the task set */
+ if (rc != TMF_RESP_FUNC_SUCC)
+ goto out;
+ tmf_task.tmf = TMF_ABORT_TASK;
+ tmf_task.tag_of_task_to_be_managed = cpu_to_le16(tag);
+
+ rc = hisi_sas_debug_issue_ssp_tmf(task->dev, lun.scsi_lun, &tmf_task);
+out:
+ hisi_sas_slot_task_free(hisi_hba, task, abort_slot);
+ if (task->task_done)
+ task->task_done(task);
+ if (sas_dev && sas_dev->running_req)
+ sas_dev->running_req--;
+}
+
static int hisi_sas_task_prep(struct sas_task *task, struct hisi_hba *hisi_hba,
int is_tmf, struct hisi_sas_tmf_task *tmf,
int *pass)
@@ -206,6 +248,7 @@ static int hisi_sas_task_prep(struct sas_task *task, struct hisi_hba *hisi_hba,
slot->task = task;
slot->port = port;
task->lldd_task = slot;
+ INIT_WORK(&slot->abort_slot, hisi_sas_slot_abort);
slot->status_buffer = dma_pool_alloc(hisi_hba->status_buffer_pool,
GFP_ATOMIC,
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/6] hisi_sas: add abort and retry feature John Garry <john.garry@huawei.com> - 2016-02-16 13:10 +0100
[PATCH 1/6] hisi_sas: add TMF_RESP_FUNC_SUCC check John Garry <john.garry@huawei.com> - 2016-02-16 13:10 +0100
Re: [PATCH 1/6] hisi_sas: add TMF_RESP_FUNC_SUCC check Hannes Reinecke <hare@suse.de> - 2016-02-16 16:30 +0100
[PATCH 6/6] hisi_sas: update driver version to 1.3 John Garry <john.garry@huawei.com> - 2016-02-16 13:10 +0100
[PATCH 2/6] hisi_sas: add hisi_sas_slot_abort() John Garry <john.garry@huawei.com> - 2016-02-16 13:10 +0100
Re: [PATCH 2/6] hisi_sas: add hisi_sas_slot_abort() Hannes Reinecke <hare@suse.de> - 2016-02-16 16:30 +0100
Re: [PATCH 2/6] hisi_sas: add hisi_sas_slot_abort() John Garry <john.garry@huawei.com> - 2016-02-16 16:50 +0100
Re: [PATCH 2/6] hisi_sas: add hisi_sas_slot_abort() John Garry <john.garry@huawei.com> - 2016-02-18 10:40 +0100
[PATCH 5/6] hisi_sas: add hisi_sas_slave_configure() John Garry <john.garry@huawei.com> - 2016-02-16 13:10 +0100
Re: [PATCH 5/6] hisi_sas: add hisi_sas_slave_configure() Hannes Reinecke <hare@suse.de> - 2016-02-16 16:40 +0100
Re: [PATCH 5/6] hisi_sas: add hisi_sas_slave_configure() John Garry <john.garry@huawei.com> - 2016-02-16 18:00 +0100
Re: [PATCH 5/6] hisi_sas: add hisi_sas_slave_configure() Hannes Reinecke <hare@suse.de> - 2016-02-18 08:50 +0100
Re: [PATCH 5/6] hisi_sas: add hisi_sas_slave_configure() John Garry <john.garry@huawei.com> - 2016-02-18 11:20 +0100
Re: [PATCH 5/6] hisi_sas: add hisi_sas_slave_configure() Hannes Reinecke <hare@suse.de> - 2016-02-18 11:40 +0100
Re: [PATCH 5/6] hisi_sas: add hisi_sas_slave_configure() John Garry <john.garry@huawei.com> - 2016-02-18 12:00 +0100
Re: [PATCH 5/6] hisi_sas: add hisi_sas_slave_configure() John Garry <john.garry@huawei.com> - 2016-02-19 11:50 +0100
Re: [PATCH 5/6] hisi_sas: add hisi_sas_slave_configure() Hannes Reinecke <hare@suse.de> - 2016-02-19 15:40 +0100
Re: [PATCH 5/6] hisi_sas: add hisi_sas_slave_configure() John Garry <john.garry@huawei.com> - 2016-02-22 11:10 +0100
[PATCH 3/6] hisi_sas: use slot abort in v1 hw John Garry <john.garry@huawei.com> - 2016-02-16 13:10 +0100
Re: [PATCH 3/6] hisi_sas: use slot abort in v1 hw Hannes Reinecke <hare@suse.de> - 2016-02-16 16:40 +0100
Re: [PATCH 3/6] hisi_sas: use slot abort in v1 hw John Garry <john.garry@huawei.com> - 2016-02-16 17:20 +0100
Re: [PATCH 3/6] hisi_sas: use slot abort in v1 hw Hannes Reinecke <hare@suse.de> - 2016-02-18 08:20 +0100
Re: [PATCH 3/6] hisi_sas: use slot abort in v1 hw John Garry <john.garry@huawei.com> - 2016-02-18 11:00 +0100
[PATCH 4/6] hisi_sas: use slot abort in v2 hw John Garry <john.garry@huawei.com> - 2016-02-16 13:10 +0100
Re: [PATCH 4/6] hisi_sas: use slot abort in v2 hw Hannes Reinecke <hare@suse.de> - 2016-02-16 16:40 +0100
Re: [PATCH 4/6] hisi_sas: use slot abort in v2 hw John Garry <john.garry@huawei.com> - 2016-02-16 18:00 +0100
csiph-web