IBV_MODIFY_QP(3)

πŸ“¦
version 65.0 Β· 3 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 noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 15.1 Β· freebsd 14.5, freebsd 15.1
  • 39.0 Β· ubuntu jammy
, 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 noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’… ibv_modify_qp(3) β€” straight outta the Libibverbs Programmer's Manual πŸ¦‹

okay bestie, sit down, hydrate, because we're about to give your queue pair the glow-up it deserves πŸ’–


🌸 NAME 🌸

ibv_modify_qp β€” modify the attributes of a queue pair (QP) ✨


✨ SYNOPSIS ✨

#include <infiniband/verbs.h>

int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
                  int attr_mask);

πŸ’– DESCRIPTION πŸ’–

so ibv_modify_qp() modifies the attributes of QP qp with the attributes sitting in attr, and it does that according to the mask attr_mask. the argument attr is an ibv_qp_attr struct, as defined in <infiniband/verbs.h>. no cap.

struct ibv_qp_attr {
        enum ibv_qp_state       qp_state;               /* Move the QP to this state */
        enum ibv_qp_state       cur_qp_state;           /* Assume this is the current QP state */
        enum ibv_mtu            path_mtu;               /* Path MTU (valid only for RC/UC QPs) */
        enum ibv_mig_state      path_mig_state;         /* Path migration state (valid if HCA supports APM) */
        uint32_t                qkey;                   /* Q_Key for the QP (valid only for UD QPs) */
        uint32_t                rq_psn;                 /* PSN for receive queue (valid only for RC/UC QPs) */
        uint32_t                sq_psn;                 /* PSN for send queue */
        uint32_t                dest_qp_num;            /* Destination QP number (valid only for RC/UC QPs) */
        unsigned int            qp_access_flags;        /* Mask of enabled remote access operations (valid only for RC/UC QPs) */
        struct ibv_qp_cap       cap;                    /* QP capabilities (valid if HCA supports QP resizing) */
        struct ibv_ah_attr      ah_attr;                /* Primary path address vector (valid only for RC/UC QPs) */
        struct ibv_ah_attr      alt_ah_attr;            /* Alternate path address vector (valid only for RC/UC QPs) */
        uint16_t                pkey_index;             /* Primary P_Key index */
        uint16_t                alt_pkey_index;         /* Alternate P_Key index */
        uint8_t                 en_sqd_async_notify;    /* Enable SQD.drained async notification (Valid only if qp_state is SQD) */
        uint8_t                 sq_draining;            /* Is the QP draining? Irrelevant for ibv_modify_qp() */
        uint8_t                 max_rd_atomic;          /* Number of outstanding RDMA reads & atomic operations on the destination QP (valid only for RC QPs) */
        uint8_t                 max_dest_rd_atomic;     /* Number of responder resources for handling incoming RDMA reads & atomic operations (valid only for RC QPs) */
        uint8_t                 min_rnr_timer;          /* Minimum RNR NAK timer (valid only for RC QPs) */
        uint8_t                 port_num;               /* Primary port number */
        uint8_t                 timeout;                /* Local ack timeout for primary path (valid only for RC QPs) */
        uint8_t                 retry_cnt;              /* Retry count (valid only for RC QPs) */
        uint8_t                 rnr_retry;              /* RNR retry (valid only for RC QPs) */
        uint8_t                 alt_port_num;           /* Alternate port number */
        uint8_t                 alt_timeout;            /* Local ack timeout for alternate path (valid only for RC QPs) */
        uint32_t                rate_limit;             /* Rate limit in kbps for packet pacing */
};

want the tea on struct ibv_qp_cap? πŸ«– go read the description of ibv_create_qp(). and for struct ibv_ah_attr, check out the description of ibv_create_ah(). iykyk.

the argument attr_mask tells you which QP attributes are getting modified. it's either 0, or the bitwise OR of one or more of these flags, bestie:

  • IBV_QP_STATE β€” modify qp_state
  • IBV_QP_CUR_STATE β€” set cur_qp_state
  • IBV_QP_EN_SQD_ASYNC_NOTIFY β€” set en_sqd_async_notify
  • IBV_QP_ACCESS_FLAGS β€” set qp_access_flags
  • IBV_QP_PKEY_INDEX β€” set pkey_index
  • IBV_QP_PORT β€” set port_num
  • IBV_QP_QKEY β€” set qkey
  • IBV_QP_AV β€” set ah_attr
  • IBV_QP_PATH_MTU β€” set path_mtu
  • IBV_QP_TIMEOUT β€” set timeout
  • IBV_QP_RETRY_CNT β€” set retry_cnt
  • IBV_QP_RNR_RETRY β€” set rnr_retry
  • IBV_QP_RQ_PSN β€” set rq_psn
  • IBV_QP_MAX_QP_RD_ATOMIC β€” set max_rd_atomic
  • IBV_QP_ALT_PATH β€” set the alternative path via: alt_ah_attr, alt_pkey_index, alt_port_num, alt_timeout
  • IBV_QP_MIN_RNR_TIMER β€” set min_rnr_timer
  • IBV_QP_SQ_PSN β€” set sq_psn
  • IBV_QP_MAX_DEST_RD_ATOMIC β€” set max_dest_rd_atomic
  • IBV_QP_PATH_MIG_STATE β€” set path_mig_state
  • IBV_QP_CAP β€” set cap
  • IBV_QP_DEST_QPN β€” set dest_qp_num
  • IBV_QP_RATE_LIMIT β€” set rate_limit

πŸ’« RETURN VALUE πŸ’«

ibv_modify_qp() returns 0 on success πŸŽ‰, or the value of errno on failure (which is literally the whole reason why it failed).


🚨 NOTES 🚨

⚠️ if any of the modify attributes or the modify mask are invalid, then none of the attributes will be modified β€” including the QP state. it's all or nothing, periodt. πŸ’€
  • not all devices support resizing QPs 😭 want to check? see if the IBV_DEVICE_RESIZE_MAX_WR bit is set in the device capabilities flags.
  • not all devices support alternate paths either πŸ™ˆ to check, see if the IBV_DEVICE_AUTO_PATH_MIG bit is set in the device capabilities flags.

okay so here's the chart of minimum required attributes for each QP Transport Service Type when you're transitioning the QP state through: Reset --> Init --> RTR --> RTS. this is the main character energy of this whole page ngl πŸ‘‘

For QP Transport Service Type IBV_QPT_UD:

  • Init β€” required attributes: IBV_QP_STATE, IBV_QP_PKEY_INDEX, IBV_QP_PORT, IBV_QP_QKEY
  • RTR β€” required attributes: IBV_QP_STATE
  • RTS β€” required attributes: IBV_QP_STATE, IBV_QP_SQ_PSN

For QP Transport Service Type IBV_QPT_UC:

  • Init β€” required attributes: IBV_QP_STATE, IBV_QP_PKEY_INDEX, IBV_QP_PORT, IBV_QP_ACCESS_FLAGS
  • RTR β€” required attributes: IBV_QP_STATE, IBV_QP_AV, IBV_QP_PATH_MTU, IBV_QP_DEST_QPN, IBV_QP_RQ_PSN
  • RTS β€” required attributes: IBV_QP_STATE, IBV_QP_SQ_PSN

For QP Transport Service Type IBV_QPT_RC:

  • Init β€” required attributes: IBV_QP_STATE, IBV_QP_PKEY_INDEX, IBV_QP_PORT, IBV_QP_ACCESS_FLAGS
  • RTR β€” required attributes: IBV_QP_STATE, IBV_QP_AV, IBV_QP_PATH_MTU, IBV_QP_DEST_QPN, IBV_QP_RQ_PSN, IBV_QP_MAX_DEST_RD_ATOMIC, IBV_QP_MIN_RNR_TIMER
  • RTS β€” required attributes: IBV_QP_STATE, IBV_QP_SQ_PSN, IBV_QP_MAX_QP_RD_ATOMIC, IBV_QP_RETRY_CNT, IBV_QP_RNR_RETRY, IBV_QP_TIMEOUT

For QP Transport Service Type IBV_QPT_RAW_PACKET:

  • Init β€” required attributes: IBV_QP_STATE, IBV_QP_PORT
  • RTR β€” required attributes: IBV_QP_STATE
  • RTS β€” required attributes: IBV_QP_STATE

and one more thing bestie, don't forget it πŸ’… β€” if port flag IBV_QPF_GRH_REQUIRED is set then ah_attr and alt_ah_attr must be passed with definition of 'struct ibv_ah_attr { .is_global = 1; .grh = {...}; }'.


πŸ‘€ SEE ALSO πŸ‘€


πŸ‘‘ AUTHORS πŸ‘‘

Dotan Barak <dotanba@gmail.com>


and that's the whole page, bestie 🫢 this came to you from libibverbs, dated 2006-10-31, and it lives under the name IBV_MODIFY_QP(3). go forth and modify those queue pairs responsibly, mwah πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from