mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1 0/1] nvmet: implement discovery Get Log indexing and LID 0x00
@ 2026-06-18  3:03 Xixin Liu
  2026-06-18  3:03 ` [PATCH v1 1/1] " Xixin Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Xixin Liu @ 2026-06-18  3:03 UTC (permalink / raw)
  To: linux-nvme
  Cc: hch, sagi, kch, kbusch, axboe, linux-nvme, linux-kernel, liuxixin

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


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

end of thread, other threads:[~2026-06-18  3:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-18  3:03 [PATCH v1 0/1] nvmet: implement discovery Get Log indexing and LID 0x00 Xixin Liu
2026-06-18  3:03 ` [PATCH v1 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

Powered by JetHome