mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
nvmet: Do not require SGL for PCI target controller commands
Support for SGL is optional for the PCI transport. Modify nvmet_req_init() to not require the NVME_CMD_SGL_METABUF command flag to be set if the target controller transport type is NVMF_TRTYPE_PCI. In addition to this, the NVMe base specification v2.1 mandate that all admin commands use PRP, that is, have CDW0.PSDT cleared to 0. Modify nvmet_parse_admin_cmd() to check this. Finally, modify nvmet_check_transfer_len() and nvmet_check_data_len_lte() to return the appropriate error status depending on the command using SGL or PRP. Since for fabrics nvmet_req_init() checks that a command uses SGL, always, this change affects only PCI target controllers. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Tested-by: Rick Wertenbroek <rick.wertenbroek@gmail.com> Tested-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
committed by
Keith Busch
parent
60d3cd8561
commit
1ad8630ffa
@@ -1478,6 +1478,11 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req)
|
||||
if (unlikely(ret))
|
||||
return ret;
|
||||
|
||||
/* For PCI controllers, admin commands shall not use SGL. */
|
||||
if (nvmet_is_pci_ctrl(req->sq->ctrl) && !req->sq->qid &&
|
||||
cmd->common.flags & NVME_CMD_SGL_ALL)
|
||||
return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
|
||||
|
||||
if (nvmet_is_passthru_req(req))
|
||||
return nvmet_parse_passthru_admin_cmd(req);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user