I'd prefer to see the spec only cover things
which are implemented and tested, otherwise the risk of a flaw in the
spec is really high in my experience.
Comments below:
num_queues is the total number of virtqueues exposed by the
device. The driver is free to use only one request queue, or
it can use more to achieve better performance.
s/total number of virtqueues/total number of request virtqueues/ ?
max_channel, max_target and max_lun can be used by the driver
as hints for scanning the logical units on the host. In the
current version of the spec, they will always be respectively
0, 255 and 16383.
s/hints for scanning/hints to constrain scanning/ ? (I assume).
The driver queues requests to an arbitrary request queue, and they are
used by the device on that same queue. In this version of the spec,
if a driver uses more than one queue it is the responsibility of the
driver to ensure strict request ordering; commands placed on different
queue will be consumed with no order constraints.
Suggest simplification of second sentence:
It is the responsibility of the driver to ensure strict request
ordering; commands placed on different queues will be consumed with no
order constraints.
Task_attr, prio and crn should be left to zero: command priority
is explicitly not supported by this version of the device;
task_attr defines the task attribute as in the table above, but
all task attributes may be mapped to SIMPLE by the device; crn
may also be provided by clients, but is generally expected to be
0. The maximum CRN value defined by the protocol is 255, since
CRN is stored in an 8-bit integer.
Be braver in your language please. It helps poor implementers who are
already confused by learning SCSI and virtio:
Task_attr, and prio must be zero.[1] task_attr defines the task
attribute as in the table above, but all task attributes may be mapped
to SIMPLE by the device; crn may also be provided by clients, but is
generally expected to be 0.
[1] Future extensions may use these fields.
Is it useful for a driver to specify ordered (or other) modes, knowing
it could be reduced to SIMPLE without it being aware? Or should we use
feature bits to indicate what the device supports?
Note that since ACA is not supported by this version of the
spec, VIRTIO_SCSI_T_TMF_CLEAR_ACA is always a no-operation.
I think if you don't support ACA in the spec, don't define this. How
will a driver author use this information?
struct virtio_scsi_ctrl_an {
u32 type;
u8 lun[8];
u32 event_requested;
u32 event_actual;
u8 response;
}
With all these structures, you might want a comment indicating the
read-only and write-only (from the device POV) parts of the struct, eg:
struct virtio_scsi_ctrl_an {
// Read-only part
u32 type;
u8 lun[8];
u32 event_requested;
// Write-only part
u32 event_actual;
u8 response;
}