libnvme(2)

πŸ’– libnvme(2) β€” API Manual πŸ’–

okay bestie, sit down, hydrate, because we're doing a whole manual page together and it's lowkey adorable. this is libnvme, section 2 of the manual (the API girly ✨), and today's main character is one very specific little struct. no cap, she's iconic.


🌸 NAME 🌸

struct nvmf_disc_log_entry β€” the Discovery Log Page entry. that's her. that's the whole vibe. she's one single entry in the Discovery Log Page, and she's holding so much info, it's giving overachiever πŸŽ€


✨ SYNOPSIS ✨

here's the shape of her, exactly as she is, not a single byte moved:

struct nvmf_disc_log_entry {
    __u8 trtype;
    __u8 adrfam;
    __u8 subtype;
    __u8 treq;
    __le16 portid;
    __le16 cntlid;
    __le16 asqsz;
    __le16 eflags;
    __u8 rsvd12[20];
    char trsvcid[NVMF_TRSVCID_SIZE];
    __u8 rsvd64[192];
    char subnqn[NVME_NQN_LENGTH];
    char traddr[NVMF_TRADDR_SIZE];
    union nvmf_tsas tsas;
 };

look at all those fields. she ate and left no crumbs πŸ’…


πŸ¦‹ Members πŸ¦‹

okay so this is the part where we meet everybody one by one. no skipping, no summarising, we're doing the full roll call fr fr πŸ‘‘

  • trtype β€” Transport Type (TRTYPE). this one says which NVMe Transport type it is. wanna know the actual options? go look at enum nvmf_trtype, she's got the list 🚌
  • adrfam β€” Address Family (ADRFAM). specifies the address family. details live in enum nvmf_addr_family ✨
  • subtype β€” Subsystem Type (SUBTYPE). says what type of NVM subsystem this entry is talking about. the tea is in enum nvme_subsys_type πŸ“
  • treq β€” Transport Requirements (TREQ). indicates the requirements for the NVMe Transport. go check enum nvmf_treq for the whole menu πŸ“‹
  • portid β€” Port ID (PORTID). points at a particular NVM subsystem port. important lil note bestie: different NVMe Transports or address families may utilize the same Port ID value β€” like, a Port ID can support both iWARP and RoCE at the same time. she's not monogamous, she multi-tasks πŸ’€
  • cntlid β€” Controller ID (CNTLID). specifies the controller ID, and the rules here are detailed, so listen up:
    • if the NVM subsystem uses a dynamic controller model, then this field shall be set to FFFFh.
    • if the NVM subsystem uses a static controller model, then this field may be set to a specific controller ID (and values 0h to FFEFh are the valid ones).
    • and if the NVM subsystem uses a static controller model and the value indicated is FFFEh, then the host should remember the Controller ID that came back as part of the Fabrics Connect command, so it can re-establish an association in the future with the same controller. like saving your ex's number but for admin purposes, iykyk πŸ™ˆ
  • asqsz β€” Admin Max SQ Size (ASQSZ). this is the maximum size of an Admin Submission Queue. it applies to all controllers in the NVM subsystem. and the value shall be a minimum of 32 entries β€” that's the floor, don't go below it 🚫
  • eflags β€” Entry Flags (EFLAGS). extra info related to the current entry. the flag lore lives in enum nvmf_disc_eflags 🚩
  • rsvd12 β€” Reserved. not for you bestie. she's just chillin 🌈
  • trsvcid β€” Transport Service Identifier (TRSVCID). the NVMe Transport service identifier, as an ASCII string. this identifier is specified by the associated NVMe Transport binding specification. typecast queen πŸ‘‘
  • rsvd64 β€” Reserved. again. same energy. just vibing πŸ’œ
  • subnqn β€” NVM Subsystem Qualified Name (SUBNQN). this is the NVMe Qualified Name (NQN) that uniquely identifies the NVM subsystem. and yes, there's a whole two-branch situation here:
    • for a subsystem, if that Discovery subsystem has a unique NQN (meaning: the NVM Subsystem NVMe Qualified Name (SUBNQN) field in that Discovery subsystem's Identify Controller data structure contains a unique NQN value), then the value returned shall be that unique NQN.
    • if the Discovery subsystem does not have a unique NQN, then the value returned shall be the well-known Discovery Service NQN β€” and that is literally nqn.2014-08.org.nvmexpress.discovery. yes that whole string. she's a baddie with a government name 😭
  • traddr β€” Transport Address (TRADDR). the address of the NVM subsystem, and it may be used for a Connect command as an ASCII string. btw the Address Family field is the one that describes the reference for parsing this field β€” so adrfam and traddr are a package deal, they come as a set 🀝
  • tsas β€” Transport specific attribute settings. she's a union, she contains multitudes, we love her for that 🫢

🚨 real talk bestie: rsvd12 and rsvd64 are reserved for a reason. don't get cute with them. the spec said reserved and the spec meant it πŸ’…
πŸŽ€ also the cntlid rules are not suggestions β€” FFFFh for dynamic, 0h to FFEFh valid for static, and FFFEh means remember that Controller ID. read it twice, it's on the test.

🌈 SEE YOU, BESTIE 🌈

this absolute gem of a page is part of the libnvme API Manual, and this whole thing is dated July 2026 β€” yes, we're time travelling and we're doing it in style πŸ’« so when you're deep in the Discovery Log Page and everything's giving chaos, just remember: one entry at a time, one field at a time, and you'll slay it. bye bestie, drink water, check your return values πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from