IBV_QUERY_GID_EX(3)

πŸ’… IBV_QUERY_GID_EX(3) β€” like, the Libibverbs Programmer's Manual one πŸŽ€

okay bestie, so this is a page straight out of the Libibverbs Programmer's Manual and it's about peeking at a GID table entry. it's giving "small function, big energy" and honestly? we're obsessed. let's get into it ✨


🌸 NAME 🌸

ibv_query_gid_ex β€” go query a GID table entry on an InfiniBand port, bestie. that's the whole vibe πŸ¦‹


⭐ SYNOPSIS ⭐

#include <infiniband/verbs.h>

int ibv_query_gid_ex(struct ibv_context *context,
                     uint32_t port_num,
                     uint32_t gid_index,
                     struct ibv_gid_entry *entry,
                     uint32_t flags);

look at that signature. so clean. so iconic. πŸ’…


πŸ’– DESCRIPTION πŸ’–

so ibv_query_gid_ex() literally just returns the GID entry at entry for gid_index of port port_num for device context context. that's it. that's the function. no cap. 🫢


🌈 ARGUMENTS 🌈

  • context β€” the context of the device you're querying. your device's whole identity, basically main character energy πŸ‘‘
  • port_num β€” the number of the port whose GID table you wanna dig through πŸ”
  • gid_index β€” the index of the GID table entry you're asking about. like a little locker number, but for GIDs πŸŽ€

πŸ“ the entry Argument πŸ“

this one's an ibv_gid_entry struct, and it's defined right there in <infiniband/verbs.h> for you:

struct ibv_gid_entry {
    union ibv_gid gid;
    uint32_t gid_index;
    uint32_t port_num;
    uint32_t gid_type;
    uint32_t ndev_ifindex;
};

and here's what each field is serving ✨:

  • gid β€” the GID entry itself. the moment. the star of the show ⭐
  • gid_index β€” the GID table index of this entry πŸ“‡
  • port_num β€” the port number that this GID belongs to πŸšͺ
  • gid_type β€” an enum ibv_gid_type, and it can be one of IBV_GID_TYPE_IB, IBV_GID_TYPE_ROCE_V1 or IBV_GID_TYPE_ROCE_V2. pick your fighter πŸ’€
  • ndev_ifindex β€” the interface index of the net device associated with this GID. it's 0 if there's no net device associated with it 🧚
  • flags β€” extra fields to query post ndev_ifindex, and for now it must be 0. periodt. don't try to be cute with it πŸ™ˆ

πŸ¦‹ RETURN VALUE πŸ¦‹

ibv_query_gid_ex() returns 0 on success, or an errno value on error. that's the whole deal, lowkey simple πŸ’œ


πŸ’€ ERRORS πŸ’€

  • ENODATA β€” gid_index is within the GID table size of port port_num but there's literally no data in this index. the locker exists, it's just empty 😭

πŸ”₯ SEE ALSO πŸ”₯

ibv_open_device(3), ibv_query_device(3), ibv_query_pkey(3), ibv_query_port(3), ibv_query_gid_table(3)

go read those next, iykyk πŸ“šβœ¨


πŸ‘‘ AUTHOR πŸ‘‘

Parav Pandit <parav@nvidia.com> β€” thank you for this one, fr fr 🫢


and that's the page!! this beauty is from libibverbs, dated 2020-04-24, and it ate, no crumbs. mwah πŸ’‹ 🌸

πŸ“¦ where this page comes from