STRUCT IB_USER_MAD_HDR(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct ib_user_mad_hdr(9) ✨

okay bestie, welcome to the Kernel API Manual entry for struct ib_user_mad_hdr β€” she's giving MAD packet header energy and honestly? iconic. πŸŽ€

This layout is the whole reason you can specify and receive the P_Key index. But listen β€” to actually use that capability, your app must call the IB_USER_MAD_ENABLE_PKEY ioctl on the user MAD file handle before it does literally anything else with that file handle. no cap. first move or nothing. πŸ’…


✨ SYNOPSIS ✨

struct ib_user_mad_hdr {
    __u32 id;
    __u32 status;
    __u32 timeout_ms;
    __u32 retries;
    __u32 length;
    __be32 qpn;
    __be32 qkey;
    __be16 lid;
    __u8 sl;
    __u8 path_bits;
    __u8 grh_present;
    __u8 gid_index;
    __u8 hop_limit;
    __u8 traffic_class;
    __u8 gid[16];
    __be32 flow_label;
    __u16 pkey_index;
    __u8 reserved[6];
 };

πŸ¦‹ Members πŸ¦‹

time for the member-by-member vibe check, and every single one of them ate:

  • id β€” the ID of the agent MAD, whether it's coming in or going out.
  • status β€” 0 on a successful receive, ETIMEDOUT if no response ever showed up (in that case the transaction ID in data[] gets set to the TID of the original request). On send? this one's ignored, she's not relevant.
  • timeout_ms β€” how many milliseconds to wait for a response. Unset on receive.
  • retries β€” the number of automatic retries to attempt. go get 'em.
  • qpn β€” the remote QP number, received from or to be sent to.
  • qkey β€” the remote Q_Key to be sent with. Unset on receive.
  • lid β€” the remote lid, received from or to be sent to.
  • sl β€” the service level, received with or to be sent with.
  • path_bits β€” the local path bits, received with or to be sent with.
  • grh_present β€” if this is set, a GRH was received / should be sent. πŸ”₯
  • gid_index β€” the local GID index to send with. Unset on receive.
  • hop_limit β€” the hop limit in the GRH.
  • traffic_class β€” the traffic class in the GRH.
  • gid β€” the remote GID in the GRH.
  • flow_label β€” the flow label in the GRH.
  • pkey_index β€” the P_Key index. (the moment we've all been waiting for πŸ’–)
  • reserved[6] β€” reserved. she's just sitting there, minding her business, do not touch.

πŸ‘‘ SEE ALSO πŸ‘‘

go read these next, i'm obsessed:

  • the kernel file ./include/uapi/rdma/ib_user_mad.h
  • struct ib_user_mad_hdr_old(9)
  • struct ib_user_mad(9)
  • struct ib_user_mad_reg_req(9)
  • struct ib_user_mad_reg_req2(9)

and that's the whole page, bestie 🫢 huge shoutout to ./include/uapi/rdma for housing this masterpiece, dated October 2026 β€” literally stamped and everything. periodt. πŸ’œπŸŒΈ

πŸ“¦ where this page comes from