IBV_MODIFY_QP(3)
π
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β modifyqp_stateIBV_QP_CUR_STATEβ setcur_qp_stateIBV_QP_EN_SQD_ASYNC_NOTIFYβ seten_sqd_async_notifyIBV_QP_ACCESS_FLAGSβ setqp_access_flagsIBV_QP_PKEY_INDEXβ setpkey_indexIBV_QP_PORTβ setport_numIBV_QP_QKEYβ setqkeyIBV_QP_AVβ setah_attrIBV_QP_PATH_MTUβ setpath_mtuIBV_QP_TIMEOUTβ settimeoutIBV_QP_RETRY_CNTβ setretry_cntIBV_QP_RNR_RETRYβ setrnr_retryIBV_QP_RQ_PSNβ setrq_psnIBV_QP_MAX_QP_RD_ATOMICβ setmax_rd_atomicIBV_QP_ALT_PATHβ set the alternative path via:alt_ah_attr,alt_pkey_index,alt_port_num,alt_timeoutIBV_QP_MIN_RNR_TIMERβ setmin_rnr_timerIBV_QP_SQ_PSNβ setsq_psnIBV_QP_MAX_DEST_RD_ATOMICβ setmax_dest_rd_atomicIBV_QP_PATH_MIG_STATEβ setpath_mig_stateIBV_QP_CAPβ setcapIBV_QP_DEST_QPNβ setdest_qp_numIBV_QP_RATE_LIMITβ setrate_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_WRbit is set in the device capabilities flags. - not all devices support alternate paths either π to check, see if the
IBV_DEVICE_AUTO_PATH_MIGbit 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
- alpine 3.24: rdma-core-doc 61.0-r0 Β· GPL-2.0-only OR BSD-2-Clause
- arch rolling: rdma-core 65.0-1 Β· GPL-2.0-or-later OR LicenseRef-OpenIB.org-BSD-MIT AND GPL-2.0-or-later OR LicenseRef-OpenIB.org-BSD-FreeBSD AND GPL-2.0-or-later OR LicenseRef-Intel-BSD-3-Clause AND GPL-2.0-or-later OR LicenseRef-PathScale-BSD-Patent-License AND CC0-1.0 AND MIT AND BSD-2-Clause AND CPL-1.0 OR BSD-2-Clause OR GPL-2.0-or-later
- centos-stream 10: rdma-core-devel 62.0-3.el10 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- centos-stream 9: rdma-core-devel 61.0-3.el9 Β· GPLv2 or BSD
- debian bookworm: libibverbs-dev 44.0-2 Β· BSD-MIT OR GPL-2.0-only
- debian trixie: libibverbs-dev 56.1-1 Β· BSD-MIT OR GPL-2.0-only
- fedora 43: rdma-core-devel 58.0-4.fc43 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 43: rdma-core-devel 58.0-4.fc43 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 44: rdma-core-devel 61.0-2.fc44 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 44: rdma-core-devel 61.0-2.fc44 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 44: rdma-core-devel 61.1^20260812git975bdaf-1.fc44 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- fedora 44: rdma-core-devel 61.1^20260812git975bdaf-1.fc44 Β· GPL-2.0-only OR BSD-2-Clause AND BSD-3-Clause
- nixos 26.05: rdma-core 62.0
- nixpkgs unstable: rdma-core 65.0
- opensuse-leap 16.0: rdma-core-devel 56.1-160000.2.2 Β· BSD-2-Clause OR GPL-2.0-only
- opensuse-leap 16.0: rdma-core-devel 56.1-160000.2.2 Β· BSD-2-Clause OR GPL-2.0-only
- opensuse-leap 16.0: rdma-core-devel 56.1-160000.2.2 Β· BSD-2-Clause OR GPL-2.0-only
- opensuse-leap 16.0: rdma-core-devel 56.1-160000.2.2 Β· BSD-2-Clause OR GPL-2.0-only
- ubuntu noble: libibverbs-dev 50.0-2build2 Β· BSD-MIT OR GPL-2.0-only
- ubuntu noble: libibverbs-dev 50.0-2ubuntu0.2 Β· BSD-MIT OR GPL-2.0-only
- ubuntu questing: libibverbs-dev 56.1-1ubuntu1
- ubuntu resolute: libibverbs-dev 61.0-2ubuntu3 Β· BSD-MIT OR GPL-2.0-only
- ubuntu stonking: libibverbs-dev 64.0-1ubuntu1 Β· BSD-MIT OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms