Add a function to issue an SSP TMF.
Add a temp prototype to keep make W=1 happy.
Signed-off-by: John Garry <[email protected]>
---
drivers/scsi/libsas/sas_scsi_host.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 93ca6da63104..cfdf4a031be0 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -938,6 +938,11 @@ int sas_execute_tmf(struct domain_device *device, void *parameter,
task->dev = device;
task->task_proto = device->tproto;
+ if (dev_is_sata(device)) {
+ } else {
+ memcpy(&task->ssp_task, parameter, para_len);
+ }
+
task->task_done = sas_task_internal_done;
task->tmf = tmf;
@@ -1023,6 +1028,21 @@ int sas_execute_tmf(struct domain_device *device, void *parameter,
return res;
}
+int sas_execute_ssp_tmf(struct domain_device *device, u8 *lun,
+ struct sas_tmf_task *tmf);
+int sas_execute_ssp_tmf(struct domain_device *device, u8 *lun,
+ struct sas_tmf_task *tmf)
+{
+ struct sas_ssp_task ssp_task;
+
+ if (!(device->tproto & SAS_PROTOCOL_SSP))
+ return TMF_RESP_FUNC_ESUPP;
+
+ memcpy(ssp_task.LUN, lun, 8);
+
+ return sas_execute_tmf(device, &ssp_task, sizeof(ssp_task), -1, tmf);
+}
+
/*
* Tell an upper layer that it needs to initiate an abort for a given task.
* This should only ever be called by an LLDD.
--
2.26.2
On Tue, Jan 25, 2022 at 07:32:44PM +0800, John Garry wrote:
> Add a function to issue an SSP TMF.
>
> Add a temp prototype to keep make W=1 happy.
>
> Signed-off-by: John Garry <[email protected]>
> ---
> drivers/scsi/libsas/sas_scsi_host.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
> index 93ca6da63104..cfdf4a031be0 100644
> --- a/drivers/scsi/libsas/sas_scsi_host.c
> +++ b/drivers/scsi/libsas/sas_scsi_host.c
> @@ -938,6 +938,11 @@ int sas_execute_tmf(struct domain_device *device, void *parameter,
> task->dev = device;
> task->task_proto = device->tproto;
>
> + if (dev_is_sata(device)) {
> + } else {
> + memcpy(&task->ssp_task, parameter, para_len);
> + }
This looks strange, why not:
if (!dev_is_sata(device))
memcpy(&task->ssp_task, parameter, para_len);
On 27/01/2022 10:24, Christoph Hellwig wrote:
> On Tue, Jan 25, 2022 at 07:32:44PM +0800, John Garry wrote:
>> Add a function to issue an SSP TMF.
>>
>> Add a temp prototype to keep make W=1 happy.
>>
>> Signed-off-by: John Garry <[email protected]>
>> ---
>> drivers/scsi/libsas/sas_scsi_host.c | 20 ++++++++++++++++++++
>> 1 file changed, 20 insertions(+)
>>
>> diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
>> index 93ca6da63104..cfdf4a031be0 100644
>> --- a/drivers/scsi/libsas/sas_scsi_host.c
>> +++ b/drivers/scsi/libsas/sas_scsi_host.c
>> @@ -938,6 +938,11 @@ int sas_execute_tmf(struct domain_device *device, void *parameter,
>> task->dev = device;
>> task->task_proto = device->tproto;
>>
>> + if (dev_is_sata(device)) {
>> + } else {
>> + memcpy(&task->ssp_task, parameter, para_len);
>> + }
>
> This looks strange,
>
I'm trying to be too cute. I did this as I add in the 'if' part in a
later patch.
In hindsight, I don't think it's a good practice and I'll code as suggested.
> why not:
> if (!dev_is_sata(device))
> memcpy(&task->ssp_task, parameter, para_len);
> .
>
Thanks,
John