nvmet: implement discovery Get Log indexing and LID 0x00
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest1 patch 0 repliesNew
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | nvmet: implement discovery Get Log indexing and LID 0x00drivers/ include/ | +113 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH v1 0/1] nvmet: implement discovery Get Log indexing and LID 0x00
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(-)
Signature · 1 line
2.43.0