IBV_QUERY_PORT(3)

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

πŸ’… IBV_QUERY_PORT πŸ’…

okay bestie, welcome to the ibv_query_port page from the Libibverbs Programmer's Manual ✨ this is the one where you ask a port "hey girl, what's your deal?" and it tells you literally everything 🫢


🌸 NAME 🌸

ibv_query_port β€” query an RDMA port's attributes πŸ‘€


✨ SYNOPSIS ✨

#include <infiniband/verbs.h>

int ibv_query_port(struct ibv_context *context, uint8_t port_num,
                   struct ibv_port_attr *port_attr);

πŸ’– DESCRIPTION πŸ’–

so ibv_query_port() hands you back the attributes of port port_num for the device context, and it drops them through the pointer port_attr πŸŽ€

the port_attr argument is an ibv_port_attr struct, and it's defined in <infiniband/verbs.h> like this:

struct ibv_port_attr {
        enum ibv_port_state     state;          /* Logical port state */
        enum ibv_mtu            max_mtu;        /* Max MTU supported by port */
        enum ibv_mtu            active_mtu;     /* Actual MTU */
        int                     gid_tbl_len;    /* Length of source GID table */
        uint32_t                port_cap_flags; /* Port capabilities */
        uint32_t                max_msg_sz;     /* Maximum message size */
        uint32_t                bad_pkey_cntr;  /* Bad P_Key counter */
        uint32_t                qkey_viol_cntr; /* Q_Key violation counter */
        uint16_t                pkey_tbl_len;   /* Length of partition table */
        uint16_t                lid;            /* Base port LID */
        uint16_t                sm_lid;         /* SM LID */
        uint8_t                 lmc;            /* LMC of LID */
        uint8_t                 max_vl_num;     /* Maximum number of VLs */
        uint8_t                 sm_sl;          /* SM service level */
        uint8_t                 subnet_timeout; /* Subnet propagation delay */
        uint8_t                 init_type_reply;/* Type of initialization performed by SM */
        uint8_t                 active_width;   /* Currently active link width */
        uint8_t                 active_speed;   /* Currently active link speed if speed<XDR,NDR otherwise */
        uint8_t                 phys_state;     /* Physical port state */
        uint8_t                 link_layer;     /* link layer protocol of the port */
        uint8_t                 flags;          /* Port flags */
        uint16_t                port_cap_flags2;/* Port capabilities */
        uint32_t                active_speed_ex;/* Currently active link speed, if it is 0 refer to active_speed instead */
};

ngl that's a whole lot of fields and every single one is eating, no skips πŸ’€

the possible values for the link layer field are IBV_LINK_LAYER_INFINIBAND, IBV_LINK_LAYER_ETHERNET, or IBV_LINK_LAYER_UNSPECIFIED 🌈

and here are the supported port flags:

  • IBV_QPF_GRH_REQUIRED β€” when this flag is set, the applications must create all AH with GRH configured. it's giving mandatory, not optional, periodt πŸ’…

πŸ¦‹ RETURN VALUE πŸ¦‹

ibv_query_port() returns 0 on success, or the value of errno on failure (and that errno value is what tells you why it flopped 😭).


πŸŽ€ SEE ALSO πŸŽ€


πŸ‘‘ AUTHORS πŸ‘‘

Dotan Barak <dotanba@gmail.com> ⭐


libibverbs Β· 2006-10-31 β€” yeah she's been iconic since way back, and she's still serving πŸ’œβœ¨ go query that port bestie, you got this 🫢🌸

πŸ“¦ where this page comes from