[RFC PATCH] nvmet: set sq_id to zero in NVMe-oF CQE

Engel, Amit Amit.Engel at Dell.com
Sun Sep 21 10:06:01 PDT 2025


Hi all,

Feedback on whether the below change is acceptable for upstream would be appreciated.

From 756e3ae677c0d1ed0bbaf2fc3e146d21ac63c91f Mon Sep 17 00:00:00 2001
From: Amit Engel <Amit.Engel at dell.com>
Date: Sun, 21 Sep 2025 19:41:40 +0300
Subject: [PATCH] nvmet: set sq_id to zero in NVMe-oF CQE

The NVMe spec defines the Submission Queue Identifier (sq_id) field
in completion entries as reserved for NVMe over Fabrics.

While Linux hosts ignore sq_id in completions, other host implementations or
compliance tests might expect this field to be zero for NVMe-oF.
Setting sq_id to zero ensures spec compliance and avoids potential interoperability
issues.

Signed-off-by: Amit Engel <Amit.Engel at dell.com>
---
 drivers/nvme/target/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 8658e9c08534..bf8e35f51c6d 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -741,7 +741,8 @@ static void __nvmet_req_complete(struct nvmet_req *req, u16 status)
 
 	if (!req->sq->sqhd_disabled)
 		nvmet_update_sq_head(req);
-	req->cqe->sq_id = cpu_to_le16(req->sq->qid);
+	/* sq_id is reserved for NVMe-oF */
+	req->cqe->sq_id = 0;
 	req->cqe->command_id = req->cmd->common.command_id;
 
 	if (unlikely(status))
-- 
2.31.1



More information about the Linux-nvme mailing list