[PATCH v1 0/1] nvmet: implement discovery Get Log indexing and LID 0x00

Xixin Liu liuxixin at kylinos.cn
Wed Jun 17 20:03:36 PDT 2026


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




More information about the Linux-nvme mailing list