From: Xixin Liu <liuxixin@kylinos.cn>
To: linux-nvme@lists.infradead.org
Cc: hch@lst.de, sagi@grimberg.me, kch@nvidia.com, kbusch@kernel.org,
axboe@kernel.dk, linux-nvme@lists.infradead.org,
linux-kernel@vger.kernel.org, liuxixin@kylinos.cn
Subject: [PATCH v1 0/1] nvmet: implement discovery Get Log indexing and LID 0x00
Date: Thu, 18 Jun 2026 11:03:36 +0800 [thread overview]
Message-ID: <cover.1781751816.git.liuxixin@kylinos.cn> (raw)
Hi,
NVM Express Base Specification 2.3 defines Get Log CDW14 Offset Type (OT):
when OT is set, LPO is a structure index into the log page rather than a
byte offset. For the Discovery log (LID 0x70), the controller advertises
Index Offset Supported (IOS) in Supported Log Pages (LID 0x00) and must
reject OT=1 when IOS is clear for the requested LID.
nvmet already handles OT=0 byte offsets on the Discovery controller
(including partial reads and zero-fill within the log page). It does not
implement LID 0x00 there, does not set IOS for LID 0x70, and treats LPO
as bytes even when OT=1.
This patch:
- Answers Get Log LID 0x00 on the Discovery controller.
- Sets LSUPP|IOS for the Supported and Discovery log page IDs.
- Adds NVME_LIDS_IOS and NVME_LOG_CDW14_OT (bit 23, matching libnvme).
- Translates OT=1 LPO from index to byte offset (index 0 = header).
- Rejects OT=1 when IOS is not set for the requested LID.
- Guards u64 overflow when converting large indices so a wrapped offset
cannot bypass the existing offset > alloc_len check.
OT=0 behaviour and nvme discover (libnvme default) are unchanged.
Tested on linux-next (7.1.0-rc7-next-20260611) with nvmet-tcp and
null_blk:
- nvme get-log LID 0x00 / 0x70 with OT=0 and OT=1 (index and byte paths)
- blktests nvme/003 (tcp), nvme/002/016/017/030 (loop): passed
- make -C drivers/nvme/target
Thanks,
Xixin Liu
---
Xixin Liu (1):
nvmet: implement discovery Get Log indexing and LID 0x00
drivers/nvme/target/discovery.c | 101 +++++++++++++++++++++++++++++++++++++++--
include/linux/nvme.h | 18 +++++++-
2 files changed, 113 insertions(+), 6 deletions(-)
--
2.43.0
next reply other threads:[~2026-06-18 3:12 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 3:03 Xixin Liu [this message]
2026-06-18 3:03 ` [PATCH v1 1/1] nvmet: implement discovery Get Log indexing and LID 0x00 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.1781751816.git.liuxixin@kylinos.cn \
--to=liuxixin@kylinos.cn \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=kch@nvidia.com \
--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