From: John Garry <john.garry@huawei.com>
To: Hannes Reinecke <hare@suse.de>, <JBottomley@odin.com>,
<martin.petersen@oracle.com>
Cc: <linuxarm@huawei.com>, <zhangfei.gao@linaro.org>,
<xuwei5@hisilicon.com>, <john.garry2@mail.dcu.ie>,
<linux-scsi@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/6] hisi_sas: add hisi_sas_slot_abort()
Date: Tue, 16 Feb 2016 15:41:54 +0000 [thread overview]
Message-ID: <56C34342.9050605@huawei.com> (raw)
In-Reply-To: <56C33EC2.3020005@suse.de>
On 16/02/2016 15:22, Hannes Reinecke wrote:
> On 02/16/2016 01:22 PM, John Garry wrote:
>> 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)
> Do you really need to query the task first?
> As per SAM a successful return from an ABORT TASK TMF has this meaning:
>
> A response of FUNCTION COMPLETE shall indicate that the task was
> aborted or was not in the task set.
>
> Ie it doesn't matter if the task was present or not.
>
> Cheers,
>
> Hannes
>
I think that it should be ok to the abort without first querying. I'll
just test this to double-check. (This would make the first patch in the
series superflous)
Cheers,
John
next prev parent reply other threads:[~2016-02-16 15:43 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 12:22 [PATCH 0/6] hisi_sas: add abort and retry feature John Garry
2016-02-16 12:22 ` [PATCH 1/6] hisi_sas: add TMF_RESP_FUNC_SUCC check John Garry
2016-02-16 15:20 ` Hannes Reinecke
2016-02-16 12:22 ` [PATCH 2/6] hisi_sas: add hisi_sas_slot_abort() John Garry
2016-02-16 15:22 ` Hannes Reinecke
2016-02-16 15:41 ` John Garry [this message]
2016-02-18 9:30 ` John Garry
2016-02-16 12:22 ` [PATCH 3/6] hisi_sas: use slot abort in v1 hw John Garry
2016-02-16 15:31 ` Hannes Reinecke
2016-02-16 16:13 ` John Garry
2016-02-18 7:16 ` Hannes Reinecke
2016-02-18 9:52 ` John Garry
2016-02-16 12:22 ` [PATCH 4/6] hisi_sas: use slot abort in v2 hw John Garry
2016-02-16 15:32 ` Hannes Reinecke
2016-02-16 16:58 ` John Garry
2016-02-16 12:22 ` [PATCH 5/6] hisi_sas: add hisi_sas_slave_configure() John Garry
2016-02-16 15:33 ` Hannes Reinecke
2016-02-16 16:56 ` John Garry
2016-02-18 7:40 ` Hannes Reinecke
2016-02-18 10:12 ` John Garry
2016-02-18 10:30 ` Hannes Reinecke
2016-02-18 10:57 ` John Garry
2016-02-19 10:46 ` John Garry
2016-02-19 14:31 ` Hannes Reinecke
2016-02-22 10:02 ` John Garry
2016-02-16 12:22 ` [PATCH 6/6] hisi_sas: update driver version to 1.3 John Garry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56C34342.9050605@huawei.com \
--to=john.garry@huawei.com \
--cc=JBottomley@odin.com \
--cc=hare@suse.de \
--cc=john.garry2@mail.dcu.ie \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=martin.petersen@oracle.com \
--cc=xuwei5@hisilicon.com \
--cc=zhangfei.gao@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).