Skip to content

Commit bffd2b6

Browse files
Max GurtovoyKeith Busch
authored andcommitted
nvmet: fix PSDT field check in command format
PSDT field section according to NVM_Express-1.3: "This field specifies whether PRPs or SGLs are used for any data transfer associated with the command. PRPs shall be used for all Admin commands for NVMe over PCIe. SGLs shall be used for all Admin and I/O commands for NVMe over Fabrics. This field shall be set to 01b for NVMe over Fabrics 1.0 implementations. Suggested-by: Idan Burstein <[email protected]> Signed-off-by: Max Gurtovoy <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 9bd82b1 commit bffd2b6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/nvme/target/core.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,12 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
520520
goto fail;
521521
}
522522

523-
/* either variant of SGLs is fine, as we don't support metadata */
524-
if (unlikely((flags & NVME_CMD_SGL_ALL) != NVME_CMD_SGL_METABUF &&
525-
(flags & NVME_CMD_SGL_ALL) != NVME_CMD_SGL_METASEG)) {
523+
/*
524+
* For fabrics, PSDT field shall describe metadata pointer (MPTR) that
525+
* contains an address of a single contiguous physical buffer that is
526+
* byte aligned.
527+
*/
528+
if (unlikely((flags & NVME_CMD_SGL_ALL) != NVME_CMD_SGL_METABUF)) {
526529
status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
527530
goto fail;
528531
}

0 commit comments

Comments
 (0)