Skip to content

Commit dc3b25f

Browse files
committed
verbs: Allow query only device support for QP data in order
Add a flag to query directly the RDMA device support for QP data-in-order semantics without enforcing host CPU architecture restrictions. It is particularly useful in scenarios where the GPU performs data polling directly, with the application responsible for ensuring the GPU side support for data-in-order semantics. Reviewed-by: Michael Margolin <[email protected]> Reviewed-by: Yonatan Nachum <[email protected]> Signed-off-by: Daniel Kranzdorf <[email protected]>
1 parent 6fc7569 commit dc3b25f

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

libibverbs/man/ibv_query_qp_data_in_order.3.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ This function describes ordering at the receiving side of the QP, not the sendin
4545
4646
IBV_QUERY_QP_DATA_IN_ORDER_RETURN_CAPS - Query for supported capabilities and return a capabilities vector.
4747
48+
IBV_QUERY_QP_DATA_IN_ORDER_DEVICE_ONLY - Allows querying only the RDMA device side support for data-in-order semantics
49+
without enforcing host CPU architecture restrictions. It is the responsibility of the application
50+
to ensure data-in-order semantics support for the host CPU or receiver device.
51+
4852
Passing 0 is equivalent to using IBV_QUERY_QP_DATA_IN_ORDER_RETURN_CAPS and checking for IBV_QUERY_QP_DATA_IN_ORDER_WHOLE_MSG support.
4953
5054
# RETURN VALUE

libibverbs/verbs.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -695,23 +695,31 @@ LATEST_SYMVER_FUNC(ibv_query_qp, 1_1, "IBVERBS_1.1",
695695
int ibv_query_qp_data_in_order(struct ibv_qp *qp, enum ibv_wr_opcode op,
696696
uint32_t flags)
697697
{
698+
int result;
699+
700+
if (!check_comp_mask(flags,
701+
IBV_QUERY_QP_DATA_IN_ORDER_RETURN_CAPS |
702+
IBV_QUERY_QP_DATA_IN_ORDER_DEVICE_ONLY))
703+
return 0;
704+
698705
#if !defined(__i386__) && !defined(__x86_64__)
699706
/* Currently this API is only supported for x86 architectures since most
700707
* non-x86 platforms are known to be OOO and need to do a per-platform study.
708+
* However, it is possible to override this restriction to allow querying
709+
* the device capability directly, regardless of the host CPU architecture.
701710
*/
702-
return 0;
703-
#else
704-
int result;
705-
706-
if (!check_comp_mask(flags, IBV_QUERY_QP_DATA_IN_ORDER_RETURN_CAPS))
711+
if (!(flags & IBV_QUERY_QP_DATA_IN_ORDER_DEVICE_ONLY))
707712
return 0;
713+
#endif
708714

709715
result = get_ops(qp->context)->query_qp_data_in_order(qp, op, flags);
710716
if (result & IBV_QUERY_QP_DATA_IN_ORDER_WHOLE_MSG)
711717
result |= IBV_QUERY_QP_DATA_IN_ORDER_ALIGNED_128_BYTES;
712718

713-
return flags ? result : !!(result & IBV_QUERY_QP_DATA_IN_ORDER_WHOLE_MSG);
714-
#endif
719+
if (flags & IBV_QUERY_QP_DATA_IN_ORDER_RETURN_CAPS)
720+
return result;
721+
722+
return !!(result & IBV_QUERY_QP_DATA_IN_ORDER_WHOLE_MSG);
715723
}
716724

717725
LATEST_SYMVER_FUNC(ibv_modify_qp, 1_1, "IBVERBS_1.1",

libibverbs/verbs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,6 +1042,7 @@ enum ibv_qp_attr_mask {
10421042

10431043
enum ibv_query_qp_data_in_order_flags {
10441044
IBV_QUERY_QP_DATA_IN_ORDER_RETURN_CAPS = 1 << 0,
1045+
IBV_QUERY_QP_DATA_IN_ORDER_DEVICE_ONLY = 1 << 1,
10451046
};
10461047

10471048
enum ibv_query_qp_data_in_order_caps {

0 commit comments

Comments
 (0)