mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xixin Liu <liuxixin@kylinos.cn>
To: linux-nvme@lists.infradead.org
Cc: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me,
	hare@suse.de, dwagner@suse.de, linux-kernel@vger.kernel.org,
	liuxixin@kylinos.cn
Subject: [PATCH v1 0/1] nvme-tcp: fix wrong status on deferred digest error
Date: Wed, 26 Aug 2026 10:15:00 +0800	[thread overview]
Message-ID: <cover.nvme-tcp-req-status.v1.git.liuxixin@kylinos.cn> (raw)

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


             reply	other threads:[~2026-08-26  2:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26  2:15 Xixin Liu [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.nvme-tcp-req-status.v1.git.liuxixin@kylinos.cn \
    --to=liuxixin@kylinos.cn \
    --cc=axboe@kernel.dk \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®