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

Engel, Amit Amit.Engel at Dell.com
Mon Sep 22 12:35:11 PDT 2025


You are right, the only place that writes to this field is:
cqe->sq_id = cpu_to_le16(req->sq->qid);
in __nvmet_req_complete(). We can simply remove this assignment and rely on the memory being cleared when allocated.
Linux host ignores sq_id on completions, but this avoids potential interoperability issues with other hosts or compliance tests that might
validate that sq_id is zero (per spec).

I can respin the patch this way if that sounds good.

Amit
-----Original Message-----
From: Keith Busch <kbusch at kernel.org> 
Sent: Monday, 22 September 2025 20:17
To: Engel, Amit <Amit.Engel at Dell.com>
Cc: NVME-ML <linux-nvme at lists.infradead.org>
Subject: Re: [RFC PATCH] nvmet: set sq_id to zero in NVMe-oF CQE


[EXTERNAL EMAIL] 

On Sun, Sep 21, 2025 at 05:06:01PM +0000, Engel, Amit wrote:
> @@ -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;

What's the point of doing this per-io? No one ever sets the sq_id to a non-zero value, and it looks like everyone has the memory cleared when it's allocated. Is this actually fixing anything?


More information about the Linux-nvme mailing list