Skip to content

Commit f086858

Browse files
author
Dmitry Akhmedzhanov
committed
Added new RoCE version choosing mechanism
Signed-off-by: Dmitry Akhmedzhanov <[email protected]>
1 parent 86c98b2 commit f086858

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

configure.ac

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
# SOFTWARE.
3030
dnl Process this file with autoconf to produce a configure script.
3131

32-
AC_INIT([perftest],[5.93],[[email protected]])
32+
AC_INIT([perftest],[5.94],[[email protected]])
3333
AC_CONFIG_HEADERS([config.h])
3434
AC_CONFIG_AUX_DIR([config])
3535
AC_CONFIG_MACRO_DIR([m4])
@@ -142,6 +142,13 @@ AC_TRY_LINK([
142142
[int x = MLX5DV_QP_INIT_ATTR_MASK_QP_CREATE_FLAGS;],[HAVE_MLX5DV=yes], [HAVE_MLX5DV=no])
143143
AM_CONDITIONAL([HAVE_MLX5DV],[test "x$HAVE_MLX5DV" = "xyes"])
144144

145+
AC_TRY_LINK([#include <infiniband/verbs.h>],
146+
[int c = IBV_GID_TYPE_ROCE_V1;],[HAVE_GID_TYPE_DECLARED=yes], [HAVE_GID_TYPE_DECLARED=no])
147+
AM_CONDITIONAL([HAVE_GID_TYPE_DECLARED],[test "x$HAVE_GID_TYPE_DECLARED" = "xyes"])
148+
if [test $HAVE_GID_TYPE_DECLARED = yes]; then
149+
AC_DEFINE([HAVE_GID_TYPE_DECLARED], [1], [API GID compatibility])
150+
fi
151+
145152
AC_TRY_LINK([
146153
#include <infiniband/verbs.h>],
147154
[int x = IBV_FLOW_SPEC_IPV6;],[HAVE_IPV6=yes], [HAVE_IPV6=no])

src/perftest_communication.c

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ static int rdma_read_keys(struct pingpong_dest *rem_dest,
531531
}
532532

533533
#ifdef HAVE_GID_TYPE
534-
// declaration is copied from rdma-core, since it is private there.
534+
#ifndef HAVE_GID_TYPE_DECLARED
535535
enum ibv_gid_type
536536
{
537537
IBV_GID_TYPE_IB_ROCE_V1,
@@ -541,6 +541,7 @@ enum ibv_gid_type
541541
int ibv_query_gid_type(struct ibv_context *context, uint8_t port_num,
542542
unsigned int index, enum ibv_gid_type *type);
543543

544+
#endif
544545

545546
enum who_is_better {LEFT_IS_BETTER, EQUAL, RIGHT_IS_BETTER};
546547

@@ -550,10 +551,17 @@ struct roce_version_sorted_enum {
550551
};
551552

552553
/* This struct defines which RoCE version is more important for default usage */
554+
#ifndef HAVE_GID_TYPE_DECLARED
553555
struct roce_version_sorted_enum roce_versions_sorted[] = {
554556
{IBV_GID_TYPE_IB_ROCE_V1, 1},
555557
{IBV_GID_TYPE_ROCE_V2, 2},
556558
};
559+
#else
560+
struct roce_version_sorted_enum roce_versions_sorted[] = {
561+
{IBV_GID_TYPE_ROCE_V1, 1},
562+
{IBV_GID_TYPE_ROCE_V2, 2},
563+
};
564+
#endif
557565

558566
int find_roce_version_rate(enum ibv_gid_type roce_ver) {
559567
int i;
@@ -609,6 +617,20 @@ static int get_best_gid_index (struct pingpong_context *ctx,
609617
gid_index = i;
610618
#ifdef HAVE_GID_TYPE
611619
else {
620+
#ifdef HAVE_GID_TYPE_DECLARED
621+
struct ibv_gid_entry roce_version, roce_version_rival;
622+
623+
if (ibv_query_gid_ex(ctx->context, port, gid_index, &roce_version, 0))
624+
continue;
625+
626+
if (ibv_query_gid_ex(ctx->context, port, i, &roce_version_rival, 0))
627+
continue;
628+
629+
if (check_better_roce_version(roce_version.gid_type, roce_version_rival.gid_type) == RIGHT_IS_BETTER) {
630+
gid_index = i;
631+
}
632+
633+
#else
612634
enum ibv_gid_type roce_version, roce_version_rival;
613635

614636
if (ibv_query_gid_type(ctx->context, port, gid_index, &roce_version))
@@ -617,8 +639,10 @@ static int get_best_gid_index (struct pingpong_context *ctx,
617639
if (ibv_query_gid_type(ctx->context, port, i, &roce_version_rival))
618640
continue;
619641

620-
if (check_better_roce_version(roce_version, roce_version_rival) == RIGHT_IS_BETTER)
621-
gid_index = i;
642+
if (check_better_roce_version(roce_version, roce_version_rival) == RIGHT_IS_BETTER) {
643+
gid_index = i;
644+
}
645+
#endif
622646
}
623647
#endif
624648
}

0 commit comments

Comments
 (0)