ibv_modify_qp

Modifies the attributes of a queue pair (QP).

Syntax

#include <rdma/verbs.h>
int ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, enum ibv_qp_attr_mask attr_mask)

Queue pairs (QP) must be taken through an incremental sequence of states prior to use them for communication.

QP States:
RESET Newly created, queues empty.
INIT Basic information set. Ready for posting to receive queue.
RTR Ready to Receive. Remote address info set for connected QPs, QP may now receive packets.
RTS Ready to Send. Timeout and retry parameters set, QP might now send packets.

The state transitions are accomplished by using the ibv_modify_qp command.

Description

The ibv_modify_qp() function modifies the attributes of a QP qp with the attributes in attr according to the mask attr_mask. The parameter attr is an ibv_qp_attr struct, as defined in <rdma/verbs.h>.

The parameter attr_mask specifies the QP attributes to be modified. The argument is either 0 or the bitwise OR of one or more of the following flags:
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
Notes:
  • If any of the modify attributes or the modify mask is invalid, none of the attributes are modified (including the QP state).
  • Not all devices support resizing QPs. To check if a device supports it, check if the IBV_DEVICE_RESIZE_MAX_WR bit is set in the device capabilities flags.
  • Not all devices support alternate paths. To check if a device supports it, check if the IBV_DEVICE_AUTO_PATH_MIG bit is set in the device capabilities flags.
  • The following tables indicate for QP Transport Service Type IBV_QPT_RC, the minimum list of attributes that must be changed upon transitioning QP state from Reset --> Init --> RTR --> RTS.
Next state Required attributes
Init IBV_QP_STATE, IBV_QP_PKEY_INDEX, IBV_QP_PORT, IBV_QP_ACCESS_FLAGS
RTR 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 IBV_QP_STATE, IBV_QP_SQ_PSN, IBV_QP_MAX_QP_RD_ATOMIC, IBV_QP_RETRY_CNT, IBV_QP_RNR_RETRY, IBV_QP_TIMEOUT

Input Parameters

qp Specifies the struct ibv_qp from ibv_create_qp.
attr Specifies the QP attributes.
attr_mask Specifies the bit mask that defines which attributes within attr is set for this call.

Return Values

0 On success.
EINVAL The error occurs when qp, qp->context, or attr is NULL.
[ Feedback ]