On Tue, Mar 22, 2022 at 06:39:37PM +0800, John Garry wrote:
> When SCSI HBA device drivers are required to process an ATA internal
> command they still need a tag for the IO. This often requires the driver
> to set aside a set of tags for these sorts of IOs and manage the tags
> themselves.
>
> If we associate a SCSI command (and request) with an ATA internal command
> then the tag is already provided, so introduce the change to send ATA
> internal commands through the block layer with a set of custom blk-mq ops.
>
> note: I think that the timeout handling needs to be fixed up.
Any reason to not just send them through an ATA_16 passthrough CDB and
just use all the normal SCSI command handling?
On 22/03/2022 11:20, Christoph Hellwig wrote:
> On Tue, Mar 22, 2022 at 06:39:37PM +0800, John Garry wrote:
>> When SCSI HBA device drivers are required to process an ATA internal
>> command they still need a tag for the IO. This often requires the driver
>> to set aside a set of tags for these sorts of IOs and manage the tags
>> themselves.
>>
>> If we associate a SCSI command (and request) with an ATA internal command
>> then the tag is already provided, so introduce the change to send ATA
>> internal commands through the block layer with a set of custom blk-mq ops.
>>
>> note: I think that the timeout handling needs to be fixed up.
Hi Christoph,
> Any reason to not just send them through an ATA_16 passthrough CDB and
> just use all the normal SCSI command handling?
I had a go at implementing this but I have come up against a few issues:
- ATA_16 handling translates the passthrough CDB to a ATA TF. However
ata_exec_internal_sg() is passed a TF already. So what to do? Change the
callers to generate a ATA_16 CDB? I guess not. Otherwise we could put
the already-generated TF in the SCSI cmd CDB somehow and use directly.
- We may have no SCSI device (yet) for the target when issuing an
internal command, but only the ATA port+dev. So need a method to pass
these pointers to ATA_16 handling
- we would need to change ata_scsi_translate(), ata_scsi_pass_thru() and
other friends to deal with ATA_TAG_INTERNAL and its peculiarities -
today it just deals with regular qc's.
It still does seem a reasonable idea to use ATA_16, but it looks like
significant modifications would be required....
Thanks,
John