Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/1] nvme-tcp: fix wrong status on deferred digest error
@ 2026-08-26  2:15 Xixin Liu
  2026-08-26  1:30 ` [PATCH v1 1/1] " Xixin Liu
  2026-08-27  1:05 ` [PATCH v2 " Xixin Liu
  0 siblings, 2 replies; 10+ messages in thread
From: Xixin Liu @ 2026-08-26  2:15 UTC (permalink / raw)
  To: linux-nvme
  Cc: kbusch, axboe, hch, sagi, hare, dwagner, linux-kernel, liuxixin

Hi,

A C2HData digest error stores a host status code in the per-request
status field. Without DATA_SUCCESS the request is completed later from
the rsp path. That path used to pass the stored value straight into
complete, which expects CQE status field encoding and shifts right, so
DATA_XFER_ERROR could be reported as INVALID_FIELD.

This series keeps the per-request status as a host status code. On the
rsp path, shift left when a host error was already stored, otherwise use
the completion status field.

To hit the TCP DATA_XFER_ERROR path without DATA_SUCCESS, enable data
digest and temporarily change the target in
drivers/nvme/target/tcp.c, nvmet_setup_c2h_data_pdu, after the digest
is calculated:

  if (queue->data_digest) {
          pdu->hdr.flags |= NVME_TCP_F_DDGST;
          nvmet_tcp_calc_ddgst(cmd);
          cmd->exp_ddgst ^= cpu_to_le32(1);
  }

The default target path does not set DATA_SUCCESS on C2HData, so the
host stores the digest error and completes from the later rsp.

Verified on linux-next with an nvmet-tcp loopback target. Unpatched:

  nvme nvme0: data digest error: recv 0x2542708 expected 0x2542709
  nvme nvme0: Identify Controller failed (2)

Patched:

  nvme nvme0: data digest error: recv 0x7ebd5719 expected 0x7ebd5718
  nvme nvme0: Identify Controller failed (4)

Status code 0x2 is INVALID_FIELD. Status code 0x4 is DATA_XFER_ERROR.
recv and expected differ by one in both runs.

Thanks,
Xixin Liu

---

Xixin Liu (1):
  nvme-tcp: fix wrong status on deferred digest error

 drivers/nvme/host/tcp.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

-- 
2.53.0



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-08-31  2:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-26  2:15 [PATCH v1 0/1] nvme-tcp: fix wrong status on deferred digest error Xixin Liu
2026-08-26  1:30 ` [PATCH v1 1/1] " Xixin Liu
2026-08-26  9:39   ` Hannes Reinecke
2026-08-27  2:40     ` [PATCH v1 0/1] " Xixin Liu
2026-08-27  1:05 ` [PATCH v2 " Xixin Liu
2026-08-27  1:05   ` [PATCH v2 1/1] " Xixin Liu
2026-08-30 21:43     ` Sagi Grimberg
2026-08-31  2:15       ` Xixin Liu
2026-08-31  2:05   ` [PATCH v3 0/1] " Xixin Liu
2026-08-31  2:10     ` [PATCH v3 1/1] " Xixin Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox