mlx5dv_create_qp(3)
β¨ NAME β¨
mlx5dv_create_qp β creates a queue pair (QP), straight out of the mlx5 Programmerβs Manual π
no cap, this is the one.
π SYNOPSIS π
#include <infiniband/mlx5dv.h>
struct ibv_qp *mlx5dv_create_qp(struct ibv_context *context,
struct ibv_qp_init_attr_ex *qp_attr,
struct mlx5dv_qp_init_attr *mlx5_qp_attr)
π¦ DESCRIPTION π¦
Okay so mlx5dv_create_qp() creates a queue pair (QP) with specific driver properties. Thatβs the whole vibe. Iconic, honestly β¨
π ARGUMENTS π
For context and qp_attr, bestie, please see the ibv_create_qp_ex(3) man page β thatβs where those two get their full lore drop π
π mlx5_qp_attr π
Hereβs the struct, and yes, weβre gonna go through every field because we donβt skip details in this house π«Ά
struct mlx5dv_qp_init_attr {
uint64_t comp_mask;
uint32_t create_flags;
struct mlx5dv_dc_init_attr dc_init_attr;
uint64_t send_ops_flags;
};
πΈ comp_mask πΈ
Bitmask specifying what fields in the structure are valid β itβs basically the βwhich of these are actually invited to the partyβ list:
MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGSβ valid values increate_flagsMLX5DV_QP_INIT_ATTR_MASK_DCβ valid values indc_init_attrMLX5DV_QP_INIT_ATTR_MASK_SEND_OPS_FLAGSβ valid values insend_ops_flags
π₯ create_flags π₯
A bitwise OR of the various values described below. Bitwise OR, bestie β not a group chat poll, okay? π
MLX5DV_QP_CREATE_TUNNEL_OFFLOADSβ Enable offloading such as checksum and LRO for incoming tunneling traffic.MLX5DV_QP_CREATE_TIR_ALLOW_SELF_LOOPBACK_UCβ Allow receiving loopback unicast traffic.MLX5DV_QP_CREATE_TIR_ALLOW_SELF_LOOPBACK_MCβ Allow receiving loopback multicast traffic.MLX5DV_QP_CREATE_DISABLE_SCATTER_TO_CQEβ Disable scatter to CQE feature which is enabled by default.MLX5DV_QP_CREATE_ALLOW_SCATTER_TO_CQEβ Allow scatter to CQE for requester even if the qp was not configured to signal all WRs.MLX5DV_QP_CREATE_PACKET_BASED_CREDIT_MODEβ Set QP to work in end-to-end packet-based credit, instead of the default message-based credits (IB spec. section 9.7.7.2). It is the applications responsibility to make sure that the peer QP is configured with same mode.MLX5DV_QP_CREATE_SIG_PIPELININGβ If the flag is set, the QP is moved to SQD state upon encountering a signature error, andIBV_EVENT_SQ_DRAINEDis generated to inform about the new state. The signature pipelining feature is a performance optimization, which reduces latency for read operations in the storage protocols. The feature is optional. Creating the QP fails if the kernel or device does not support the feature. In this case, an application should fallback to backward compatibility mode and handle read operations without the pipelining. See details about the signature pipelining inmlx5dv_qp_cancel_posted_send_wrs(3).MLX5DV_QP_CREATE_OOO_DPβ If the flag is set, Receive WRs on the receiver side of the QP are allowed to be consumed out-of-order and sender side of the QP is allowed to transmit messages without guaranteeing any arrival ordering on the receiver side.
Extra tea on MLX5DV_QP_CREATE_OOO_DP β this is all about a QP with that flag set, and itβs giving very βread the whole note before you touch itβ energy π₯
Note All the following describe the behavior and semantics of a QP with this flag set.
The flag, when set, must be set both on the sender and receiver side of a QP (e.g., DCT and DCI).
Setting the flag is optional and the availability of this feature should be queried by the application (See details in mlx5dv_query_device(3)) and there is no automatic fallback: If the flag is set while kernel or device does not support the feature, then creating the QP fails. Thus, before creating a QP with this flag set, application must query the maximal outstanding Receive WRs possible on a QP with this flag set, according to the QP type (see details in mlx5dv_query_device(3)) and make sure the capability is supported.
Completionsβ delivery ordering:
A Receive WR posted on this QP may be consumed by any arriving message to this QP that requires Receive WR consumption. Nonetheless, the ordering in which work completions are delivered for the posted WRs, both on sender side and receiver side, remains unchanged when this flag is set (and is independent of the ordering in which the Receive WRs are consumed). The ID delivered in every work completion (wr_id) will specify which WR was completed by the delivered work completion.
Data placing and operationsβ execution ordering:
RDMA Read and RDMA Atomic operations are executed on the responder side in order, i.e., these operations are executed after all previous messages are done executing. However, the ordering of RDMA Read response packets being scattered to memory on the requestor side is not guaranteed. This means that, although the data is read after executing all previous messages, it may be scattered out-of-order on the requestor side.
Ordering of write requests towards the memory on the responder side, initiated by RDMA Send, RDMA Send with Immediate, RDMA Write or RDMA Write with Immediate is not guaranteed.
Good and bad practice:
Since it cannot be guaranteed which RDMA Send (and/or RDMA Send with Immediate) will consume a Receive WR (and will scatter its data to the memory buffers specified in the WR) itβs not recommended to post different sizes of Receive WRs.
Polling on any memory that is used by the device to scatter data, is not recommended since ordering of data placement of RDMA Send, RDMA Write and RDMA Write with Immediate is not guaranteed.
Receiver, upon getting a completion for an RDMA Write with Immediate, should not rely on wr_id alone to determine to which memory data was scattered by the operation.
π§ dc_init_attr π§
DC init attributes. Yes bestie, the name is about to appear again β stay with me π
π§ dc_init_attr β the structs, fr π§
struct mlx5dv_dci_streams {
uint8_t log_num_concurent;
uint8_t log_num_errored;
};
struct mlx5dv_dc_init_attr {
enum mlx5dv_dc_type dc_type;
union {
uint64_t dct_access_key;
struct mlx5dv_dci_streams dci_streams;
};
};
dc_typeβMLX5DV_DCTYPE_DCTQP type: Target DC.MLX5DV_DCTYPE_DCIQP type: Initiator DC.dct_access_keyβ used to create a DCT QP.dci_streamsβ dci_streams used to define DCI QP with multiple concurrent streams. Valid whencomp_maskincludesMLX5DV_QP_INIT_ATTR_MASK_DCI_STREAMS.log_num_concurentβ Defines the number of parallel different streams that could be handled by HW. All work request of a specificstream_idare handled in order.log_num_erroredβ Defines the number of dci error stream channels before moving DCI to an error state.
β send_ops_flags β
A bitwise OR of the various values described below. Again: bitwise OR, okay? We love a flag combo π
MLX5DV_QP_EX_WITH_MR_INTERLEAVEDβ Enables themlx5dv_wr_mr_interleaved()work requset on this QP.MLX5DV_QP_EX_WITH_MR_LISTβ Enables themlx5dv_wr_mr_list()work requset on this QP.MLX5DV_QP_EX_WITH_MKEY_CONFIGUREβ Enables themlx5dv_wr_mkey_configure()work request and the related setters on this QP.
π NOTES π
mlx5dv_qp_ex_from_ibv_qp_ex()is used to getstruct mlx5dv_qp_exfor accessing the send ops interfaces whenIBV_QP_INIT_ATTR_SEND_OPS_FLAGSis used.- The
MLX5DV_QP_CREATE_DISABLE_SCATTER_TO_CQEflag should be set in cases that IOVA doesnβt match the processβ VA and the message payload size is small enough to trigger the scatter to CQE feature. - When device memory is used
IBV_SEND_INLINEand scatter to CQE should not be used, as the memcpy is not possible.
π«Ά RETURN VALUE π«Ά
mlx5dv_create_qp() returns a pointer to the created QP, on error NULL will be returned and errno will be set. Periodt π
π SEE ALSO π
π AUTHOR π
Yonatan Cohen <yonatanc@mellanox.com> π«Ά
Signed, sealed, delivered: this page is from mlx5, dated 2018-9-1, and the manual page is mlx5dv_create_qp(3) β kisses, bestie πβ¨
π¦ where this page comes from
- alpine 3.24: rdma-core-doc 61.0-r0 Β· GPL-2.0-only OR BSD-2-Clause
- 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
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms