Skip to content

Commit a7f0291

Browse files
committed
verbs: Allow query only device support for QP data in order
Add a flag to query directly the 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. Reviewed-by: Michael Margolin <[email protected]> Reviewed-by: Yonatan Nachum <[email protected]> Signed-off-by: Daniel Kranzdorf <[email protected]>
1 parent 378bd1b commit a7f0291

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

libibverbs/man/ibv_query_qp_data_in_order.3.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ 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 device support for data-in-order semantics
49+
without enforcing host CPU architecture restrictions.
50+
4851
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.
4952
5053
# RETURN VALUE

libibverbs/verbs.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -695,23 +695,26 @@ 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, IBV_QUERY_QP_DATA_IN_ORDER_RETURN_CAPS))
701+
return 0;
702+
698703
#if !defined(__i386__) && !defined(__x86_64__)
699704
/* Currently this API is only supported for x86 architectures since most
700705
* non-x86 platforms are known to be OOO and need to do a per-platform study.
706+
* However, it is possible to override this restriction to allow querying
707+
* the device capability directly, regardless of the host CPU architecture.
701708
*/
702-
return 0;
703-
#else
704-
int result;
705-
706-
if (!check_comp_mask(flags, IBV_QUERY_QP_DATA_IN_ORDER_RETURN_CAPS))
709+
if (!(flags & IBV_QUERY_QP_DATA_IN_ORDER_DEVICE_ONLY))
707710
return 0;
711+
#endif
708712

709713
result = get_ops(qp->context)->query_qp_data_in_order(qp, op, flags);
710714
if (result & IBV_QUERY_QP_DATA_IN_ORDER_WHOLE_MSG)
711715
result |= IBV_QUERY_QP_DATA_IN_ORDER_ALIGNED_128_BYTES;
712716

713717
return flags ? result : !!(result & IBV_QUERY_QP_DATA_IN_ORDER_WHOLE_MSG);
714-
#endif
715718
}
716719

717720
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)