nvme: allow ioctl to submit io command with dif for NVMeoF
PATCH 1/1 nvme: allow ioctl to submit io command with dif for NVMeoF
If nvme over fabrics support t10dif, NVME_NS_EXT_LBAS and NVME_NS_METADATA_SUPPORTED of ns->features will be set to 1. Now nvme_submit_io do not allow the metadata if NVME_NS_EXT_LBAS of ns->features is setted. Indeed It should allow the metadata if both NVME_NS_EXT_LBAS and NVME_NS_METADATA_SUPPORTED of ns->features are setted.
--- drivers/nvme/host/ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/ioctl.c +2 -1
@@ -199,7 +199,8 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) metadata =nvme_to_user_ptr (io.metadata); } -if (ns->features &NVME_NS_EXT_LBAS ) { +if ((ns->features & (NVME_NS_EXT_LBAS |NVME_NS_METADATA_SUPPORTED )) == +NVME_NS_EXT_LBAS ) { length += meta_len; meta_len =0 ; }else if (meta_len) {
Signature · 1 line
2.16.4
Keith Busch
maintainerQuoted 5 lines · Chao Leng
If nvme over fabrics support t10dif,
NVME_NS_EXT_LBASandNVME_NS_METADATA_SUPPORTEDofns->featureswill be set to 1. Nownvme_submit_iodo not allow the metadata ifNVME_NS_EXT_LBASofns->featuresis setted. Indeed It should allow the metadata if bothNVME_NS_EXT_LBASandNVME_NS_METADATA_SUPPORTEDofns->featuresare setted.
I'm not sure. As a passthrough interface, don't you want to set up the host buffers with the inline metadata instead of relying on the HBA to splice separate ones?
If you really want to control this kind of thing, it would be better to use NVME_IOCTL_IO_CMD instead of NVME_IOCTL_SUBMIT_IO.
Quoted 10 lines · Keith Busch
Quoted 5 lines · Chao Leng
If nvme over fabrics support t10dif,
NVME_NS_EXT_LBASandNVME_NS_METADATA_SUPPORTEDofns->featureswill be set to 1. Nownvme_submit_iodo not allow the metadata ifNVME_NS_EXT_LBASofns->featuresis setted. Indeed It should allow the metadata if bothNVME_NS_EXT_LBASandNVME_NS_METADATA_SUPPORTEDofns->featuresare setted.I'm not sure. As a passthrough interface, don't you want to set up the host buffers with the inline metadata instead of relying on the HBA to splice separate ones?
If HBA support t10DIF, we need the HBA to verify the metadata for end-to-end DIF. So we need set up the metadata separately.
Two scenarios:
1.Test whether the HBA verification meets expectations when specify data and metadata. 2.The user wants to use the capability of end-to-end DIF through IOCTL. If the HBA does not support T10DIF, Keep the old behavior.
Quoted 3 lines
If you really want to control this kind of thing, it would be better to use
NVME_IOCTL_IO_CMDinstead ofNVME_IOCTL_SUBMIT_IO.
NVME_IOCTL_IO_CMD is a universal interface, of course, it can work well. But nvme-cli do not support customized commands, and it is not friendly to use. We can use nvme write/read simply, it looks better.
Quoted 2 lines
.
Hi, Keith
Any other comments on this patch?
Is there any chance that this patch can be accepted?
Quoted 29 lines · Chao Leng
Quoted 10 lines · Keith Busch
Quoted 5 lines · Chao Leng
If nvme over fabrics support t10dif,
NVME_NS_EXT_LBASandNVME_NS_METADATA_SUPPORTEDofns->featureswill be set to 1. Nownvme_submit_iodo not allow the metadata ifNVME_NS_EXT_LBASofns->featuresis setted. Indeed It should allow the metadata if bothNVME_NS_EXT_LBASandNVME_NS_METADATA_SUPPORTEDofns->featuresare setted.I'm not sure. As a passthrough interface, don't you want to set up the host buffers with the inline metadata instead of relying on the HBA to splice separate ones?
If HBA support t10DIF, we need the HBA to verify the metadata for end-to-end DIF. So we need set up the metadata separately.
Two scenarios:
1.Test whether the HBA verification meets expectations when specify data and metadata. 2.The user wants to use the capability of end-to-end DIF through IOCTL. If the HBA does not support T10DIF, Keep the old behavior.Quoted 3 lines
If you really want to control this kind of thing, it would be better to use
NVME_IOCTL_IO_CMDinstead ofNVME_IOCTL_SUBMIT_IO.
NVME_IOCTL_IO_CMDis a universal interface, of course, it can work well. But nvme-cli do not support customized commands, and it is not friendly to use. We can use nvme write/read simply, it looks better.Quoted 2 lines
.
.