UMAD_SET_GRH(3)

πŸ“¦
version 65.0 Β· 2 versions
  • 65.0 Β· alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.3.10.2 Β· nixos 26.05, nixpkgs unstable
, in alpine 3.24, arch rolling, centos-stream 10, centos-stream 9, debian bookworm, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– UMAD_SET_GRH β€” the "bestie, please fill in my GRH" function πŸ’–

okay so this is umad_set_grh from the OpenIB Programmer's Manual, section 3 (library calls, iykyk) πŸ¦‹


✨ NAME ✨

umad_set_grh β€” set GRH fields within umad buffer using host ordering πŸ’…


✨ SYNOPSIS ✨

#include <infiniband/umad.h>

int umad_set_grh(void *umad, void *mad_addr);

✨ DESCRIPTION ✨

okay so here's the vibe 🌸 β€” umad_set_grh() sets the GRH fields (grh_present, gid, hop_limit, traffic_class, flow_label) inside the umad buffer you hand it, and it figures all of that out from the mad_addr you supply. literally just "here's my address struct, go do the thing" ✨

and bestie, important: the fields you put in mad_addr are expected to be in host order. not network order. host order. write that down πŸ“

if the mad_addr pointer you pass is NULL, then no GRH gets set at all. nothing. zero. the GRH stays un-GRH'd πŸ™ˆ

so mad_addr is a pointer to an ib_mad_addr_t struct β€” it's specified in <infiniband/umad.h>, and umad is a pointer to an ib_user_mad_t struct, also specified in <infiniband/umad.h>. here's what they look like, exactly, no cap:

typedef struct ib_mad_addr {
        uint32_t qpn;
        uint32_t qkey;
        uint16_t lid;
        uint8_t  sl;
        uint8_t  path_bits;
        uint8_t  grh_present;
        uint8_t  gid_index;
        uint8_t  hop_limit;
        uint8_t  traffic_class;
        uint8_t  gid[16];
        uint32_t flow_label;
} ib_mad_addr_t;
typedef struct ib_user_mad {
        uint32_t agent_id;
        uint32_t status;
        uint32_t timeout_ms;
        uint32_t retries;
        uint32_t length;
        ib_mad_addr_t addr;
        uint8_t  data[0];
} ib_user_mad_t;

✨ RETURN VALUE ✨

umad_set_grh() returns 0 on success πŸŽ‰ and a negative value on errors.

and like… currently? there are no errors indicated. so basically it's always slaying. iconic behaviour honestly πŸ‘‘


✨ SEE ALSO ✨


✨ AUTHOR ✨

Hal Rosenstock <halr@voltaire.com> β€” thank u for ur service πŸ«‘πŸ’–


ngl, if you were looking for the network-order twin, that's umad_set_grh_net(3). this one is the host-order one. don't mix them up bestie, that's a vibe check you do NOT want to fail 😭

and that's the whole page, fr fr πŸŽ€ this one came out of the OpenIB crew and it's dated May 24, 2007 β€” so it's lowkey vintage, highkey still iconic. mwah, go set some GRHs πŸ’…πŸŒΈβœ¨

πŸ“¦ where this page comes from