From 32cc1a9fe19c00bcf5512afa7b51a24de9dd8424 Mon Sep 17 00:00:00 2001 From: wenglianfa Date: Tue, 25 Feb 2025 20:29:53 +0800 Subject: [PATCH] libhns: Adapt UD inline data size for UCX driver inclusion category: feature bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IBSLL5 ---------------------------------------------------------------------- Adapt UD inline data size for UCX. The value must be at least 128 to avoid the ucx bug. The issue url: https://github.com/openucx/ucx/issues/10423 Signed-off-by: wenglianfa Signed-off-by: Xinghai Cen --- providers/hns/hns_roce_u.h | 2 ++ providers/hns/hns_roce_u_verbs.c | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h index 323d2f9..863d4b5 100644 --- a/providers/hns/hns_roce_u.h +++ b/providers/hns/hns_roce_u.h @@ -83,6 +83,8 @@ typedef _Atomic(uint64_t) atomic_bitmap_t; #define HNS_ROCE_ADDRESS_MASK 0xFFFFFFFF #define HNS_ROCE_ADDRESS_SHIFT 32 +#define HNS_ROCE_MIN_UD_INLINE 128 + #define roce_get_field(origin, mask, shift) \ (((le32toh(origin)) & (mask)) >> (shift)) diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c index 98a18c6..7418d2c 100644 --- a/providers/hns/hns_roce_u_verbs.c +++ b/providers/hns/hns_roce_u_verbs.c @@ -1715,11 +1715,19 @@ static unsigned int get_sge_num_from_max_inl_data(bool is_ud, } static uint32_t get_max_inline_data(struct hns_roce_context *ctx, - struct ibv_qp_cap *cap) + struct ibv_qp_cap *cap, + bool is_ud) { - if (cap->max_inline_data) { + uint32_t max_inline_data = cap->max_inline_data; + + if (max_inline_data) { + max_inline_data = roundup_pow_of_two(max_inline_data); + + if (is_ud && max_inline_data < HNS_ROCE_MIN_UD_INLINE) + max_inline_data = HNS_ROCE_MIN_UD_INLINE; + return min_t(uint32_t, - roundup_pow_of_two(cap->max_inline_data), + max_inline_data, ctx->max_inline_data); } @@ -1743,7 +1751,7 @@ static void set_ext_sge_param(struct hns_roce_context *ctx, if (ctx->config & HNS_ROCE_RSP_EXSGE_FLAGS) { attr->cap.max_inline_data = - get_max_inline_data(ctx, &attr->cap); + get_max_inline_data(ctx, &attr->cap, is_ud); inline_ext_sge = max(ext_wqe_sge_cnt, get_sge_num_from_max_inl_data(is_ud, -- 2.33.0