: Add proper SG_IO struct cmd CDB passthrough
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 10 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | : Add proper CDB passthrough for SG_IO backstoresusr/ usr/ usr/ | +29 | 5 replies | |
| 2/2 | : Add support for SG_IO CDB passthrough in scsi_cmd_perform()usr/ usr/ usr/ | +13 | 2 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] [tgt]: Add proper SG_IO struct cmd CDB passthrough
From: Nicholas Bellinger <[email protected]>
Greetings Tomo and Mike,
These are two patches to allow the STGT SG_IO backstore to function using a new struct scsi_cmd->sg_iovec member with sg_io_hdr->iovec_count=1, and to update usr/scsi.c:scsi_cmd_perform() to allow for a hand off incoming descriptors into the struct device_type_template->cmd_passthrough() function pointer.
I initially updated usr/sbc.c to set sbc_rw() as it's CDB passthrough function for TYPE_DISK, but the logic should apply to any device types *_rw() functions. Please let me know if this makes sense, and I will look at updating the other stgt device types.
So far with this patch, I am able to successfully mkfs new iSCSI TYPE_DISK LUNS with Open-iSCSI to the userspace STGT iSCSI fabric module + SG_IO into kernel level TCM_Loop virtual iSCSI target ports on a x86 HVM, and bulk 512KB DATA_SG_IO payloads between STGT and TCM_Loop are now functioning as expected.
There is one unresolved issue that I ran into while running initially with TCM_Loop and struct scsi_device->max_sectors=256. SG_IO writes larger than the struct scsi_device->max_sectors are being returned with -EINVAL, but it appears that the CHECK_CONDITION is not actually being propigated back into STGT/iSCSI.
After increasing the TCM_Loop ports to struct scsi_device->max_sectors=1024 following the Open-iSCSI Initiator default, the 512KB paylods begin work as expected. I will need to have a look at the case for CDB length > max_sectors, which means that bs_sg.c getting the correct scsi_status and sense data out of the kernel might still need more work.
In the mean time, please have a look at applying these patches.
Best,
Nicholas Bellinger (2):
[tgt]: Add proper CDB passthrough for SG_IO backstores [tgt]: Add support for SG_IO CDB passthrough in scsi_cmd_perform()
usr/bs_sg.c | 31 ++++++++++++++++++++++++------- usr/sbc.c | 1 + usr/scsi.c | 11 +++++++++++ usr/scsi_cmnd.h | 4 ++++ usr/tgtd.h | 2 ++ 5 files changed, 42 insertions(+), 7 deletions(-)