1 Star 0 Fork 23

cxh/perftest

forked from src-openEuler/perftest 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0010-Perftest-Support-selecting-congestion-control-algori.patch 10.35 KB
一键复制 编辑 原始数据 按行查看 历史
From e8164fdc9ce332217a7877ffb6d1535bf0261fb1 Mon Sep 17 00:00:00 2001
From: Guofeng Yue <[email protected]>
Date: Fri, 28 Jun 2024 10:56:09 +0800
Subject: [PATCH] Perftest: Support selecting congestion control algorithms
Support configuring congestion control algorithms with hns direct verbs.
New option: --congest_type
Usage example:
./ib_send_bw -d hns_0 --congest_type=DCQCN
./ib_send_bw -d hns_0 --congest_type=DCQCN 192.168.100.100
Signed-off-by: Guofeng Yue <[email protected]>
Signed-off-by: Junxian Huang <[email protected]>
---
Makefile.am | 24 ++++++++---------
configure.ac | 7 +++++
src/perftest_parameters.c | 57 +++++++++++++++++++++++++++++++++++++++
src/perftest_parameters.h | 1 +
src/perftest_resources.c | 12 +++++++++
src/perftest_resources.h | 3 +++
6 files changed, 92 insertions(+), 12 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index e6a1132..1f09a61 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -57,41 +57,41 @@ LIBMLX4=
endif
ib_send_bw_SOURCES = src/send_bw.c src/multicast_resources.c src/multicast_resources.h
-ib_send_bw_LDADD = libperftest.a $(LIBUMAD) $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA)
+ib_send_bw_LDADD = libperftest.a $(LIBUMAD) $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA) $(LIBHNS)
ib_send_lat_SOURCES = src/send_lat.c src/multicast_resources.c src/multicast_resources.h
-ib_send_lat_LDADD = libperftest.a $(LIBUMAD) $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA)
+ib_send_lat_LDADD = libperftest.a $(LIBUMAD) $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA) $(LIBHNS)
ib_write_lat_SOURCES = src/write_lat.c
-ib_write_lat_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA)
+ib_write_lat_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA) $(LIBHNS)
ib_write_bw_SOURCES = src/write_bw.c
-ib_write_bw_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA)
+ib_write_bw_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA) $(LIBHNS)
ib_read_lat_SOURCES = src/read_lat.c
-ib_read_lat_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA)
+ib_read_lat_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA) $(LIBHNS)
ib_read_bw_SOURCES = src/read_bw.c
-ib_read_bw_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA)
+ib_read_bw_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA) $(LIBHNS)
ib_atomic_lat_SOURCES = src/atomic_lat.c
-ib_atomic_lat_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA)
+ib_atomic_lat_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA) $(LIBHNS)
ib_atomic_bw_SOURCES = src/atomic_bw.c
-ib_atomic_bw_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA)
+ib_atomic_bw_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA) $(LIBHNS)
if HAVE_RAW_ETH
raw_ethernet_bw_SOURCES = src/raw_ethernet_send_bw.c
-raw_ethernet_bw_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA)
+raw_ethernet_bw_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA) $(LIBHNS)
raw_ethernet_lat_SOURCES = src/raw_ethernet_send_lat.c
-raw_ethernet_lat_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA)
+raw_ethernet_lat_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA) $(LIBHNS)
raw_ethernet_burst_lat_SOURCES = src/raw_ethernet_send_burst_lat.c
-raw_ethernet_burst_lat_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA)
+raw_ethernet_burst_lat_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA) $(LIBHNS)
raw_ethernet_fs_rate_SOURCES = src/raw_ethernet_fs_rate.c
-raw_ethernet_fs_rate_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA)
+raw_ethernet_fs_rate_LDADD = libperftest.a $(LIBMATH) $(LIBMLX4) $(LIBMLX5) $(LIBEFA) $(LIBHNS)
else
raw_ethernet_bw_SOURCES =
diff --git a/configure.ac b/configure.ac
index 2bbc7fc..54fc2cc 100755
--- a/configure.ac
+++ b/configure.ac
@@ -291,6 +291,13 @@ if [test $HAVE_MLX5DV_LIB = yes] && [test $HAVE_MLX5DV = yes]; then
AC_SUBST([LIBMLX5])
fi
+AC_CHECK_LIB([hns], [hnsdv_query_device], [HAVE_HNSDV=yes LIBHNS=-lhns], [HAVE_HNSDV=no])
+AM_CONDITIONAL([HAVE_HNSDV], [test "x$HAVE_HNSDV" = "xyes"])
+if [test $HAVE_HNSDV = yes]; then
+ AC_DEFINE([HAVE_HNSDV], [1], [Have hns Direct Verbs support])
+ AC_SUBST([LIBHNS])
+fi
+
CFLAGS="-g -Wall -D_GNU_SOURCE -O3 $CFLAGS"
LIBS=$LIBS" -lpthread"
AC_SUBST([LIBUMAD])
diff --git a/src/perftest_parameters.c b/src/perftest_parameters.c
index 034a20e..6fdf0a1 100755
--- a/src/perftest_parameters.c
+++ b/src/perftest_parameters.c
@@ -27,6 +27,9 @@ static const char *portStates[] = {"Nop","Down","Init","Armed","","Active Defer"
static const char *qp_state[] = {"OFF","ON"};
static const char *exchange_state[] = {"Ethernet","rdma_cm"};
static const char *atomicTypesStr[] = {"CMP_AND_SWAP","FETCH_AND_ADD"};
+#ifdef HAVE_HNSDV
+static const char *congestStr[] = {"DCQCN","LDCP","HC3","DIP"};
+#endif
/******************************************************************************
* parse_mac_from_str.
@@ -432,6 +435,11 @@ static void usage(const char *argv0, VerbType verb, TestType tst, int connection
printf(" --cpu_util ");
printf(" Show CPU Utilization in report, valid only in Duration mode \n");
+ #ifdef HAVE_HNSDV
+ printf(" --congest_type=<DCQCN, LDCP, HC3, DIP> ");
+ printf(" Use the hnsdv interface to set congestion control algorithm.\n");
+ #endif
+
if (tst != FS_RATE) {
printf(" --dlid ");
printf(" Set a Destination LID instead of getting it from the other side.\n");
@@ -814,6 +822,7 @@ static void init_perftest_params(struct perftest_parameters *user_param)
user_param->disable_pcir = 0;
user_param->source_ip = NULL;
user_param->has_source_ip = 0;
+ user_param->congest_type = OFF;
}
static int open_file_write(const char* file_path)
@@ -911,6 +920,25 @@ static void change_conn_type(int *cptr, VerbType verb, const char *optarg)
exit(1);
}
}
+
+#ifdef HAVE_HNSDV
+static void set_congest_type(int *cgtr, const char *optarg)
+{
+ if (strcmp(congestStr[0], optarg) == 0) {
+ *cgtr = HNSDV_QP_CREATE_ENABLE_DCQCN;
+ } else if (strcmp(congestStr[1], optarg) == 0) {
+ *cgtr = HNSDV_QP_CREATE_ENABLE_LDCP;
+ } else if (strcmp(congestStr[2], optarg) == 0) {
+ *cgtr = HNSDV_QP_CREATE_ENABLE_HC3;
+ } else if (strcmp(congestStr[3], optarg) == 0) {
+ *cgtr = HNSDV_QP_CREATE_ENABLE_DIP;
+ } else {
+ fprintf(stderr, " Invalid congest type. Please choose from {DCQCN,LDCP,HC3,DIP}\n");
+ exit(1);
+ }
+}
+#endif
+
/******************************************************************************
*
******************************************************************************/
@@ -2057,6 +2085,23 @@ static void ctx_set_max_inline(struct ibv_context *context,struct perftest_param
}
}
+ #ifdef HAVE_HNSDV
+ if (user_param->congest_type) {
+ if (user_param->work_rdma_cm == ON)
+ {
+ printf(RESULT_LINE);
+ fprintf(stderr, "rdma_cm does not support setting congest type.\n");
+ exit(1);
+ }
+
+ if (user_param->connection_type == XRC || user_param->connection_type == UD) {
+ printf(RESULT_LINE);
+ fprintf(stdout, "XRC/UD does not support setting congest type.\n");
+ exit(1);
+ }
+ }
+ #endif
+
return;
}
/******************************************************************************
@@ -2176,6 +2221,9 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
static int credentials_path_flag = 0;
static int data_enc_key_app_path_flag = 0;
#endif
+ #ifdef HAVE_HNSDV
+ static int congest_type_flag = 0;
+ #endif
char *server_ip = NULL;
char *client_ip = NULL;
@@ -2323,6 +2371,9 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
#if defined HAVE_OOO_ATTR
{.name = "use_ooo", .has_arg = 0, .flag = &use_ooo_flag, .val = 1},
#endif
+ #ifdef HAVE_HNSDV
+ { .name = "congest_type", .has_arg = 1, .flag = &congest_type_flag, .val = 1},
+ #endif
{.name = "source_ip", .has_arg = 1, .flag = &source_ip_flag, .val = 1},
{0}
};
@@ -2569,6 +2620,12 @@ int parser(struct perftest_parameters *user_param,char *argv[], int argc)
case 'v': user_param->mac_fwd = ON; break;
case 'G': user_param->use_rss = ON; break;
case 0: /* required for long options to work. */
+ #ifdef HAVE_HNSDV
+ if (congest_type_flag) {
+ set_congest_type(&user_param->congest_type, optarg);
+ congest_type_flag = 0;
+ }
+ #endif
if (pkey_flag) {
user_param->pkey_index = strtol(optarg,NULL,0);
pkey_flag = 0;
diff --git a/src/perftest_parameters.h b/src/perftest_parameters.h
index 909d771..ffc19ab 100755
--- a/src/perftest_parameters.h
+++ b/src/perftest_parameters.h
@@ -462,6 +462,7 @@ struct perftest_parameters {
int recv_post_list;
int duration;
int use_srq;
+ int congest_type;
int use_xrc;
int use_rss;
int srq_exists;
diff --git a/src/perftest_resources.c b/src/perftest_resources.c
index bcec080..451f11d 100755
--- a/src/perftest_resources.c
+++ b/src/perftest_resources.c
@@ -2155,6 +2155,9 @@ struct ibv_qp* ctx_qp_create(struct pingpong_context *ctx,
struct efadv_qp_init_attr efa_attr = {};
#endif
#endif
+ #ifdef HAVE_HNSDV
+ struct hnsdv_qp_init_attr hns_attr = {};
+ #endif
attr.send_cq = ctx->send_cq;
attr.recv_cq = (user_param->verb == SEND) ? ctx->recv_cq : ctx->send_cq;
@@ -2316,6 +2319,15 @@ struct ibv_qp* ctx_qp_create(struct pingpong_context *ctx,
#endif // HAVE_AES_XTS
else
#endif // HAVE_MLX5DV
+
+ #ifdef HAVE_HNSDV
+ if (user_param->congest_type) {
+ hns_attr.comp_mask = HNSDV_QP_INIT_ATTR_MASK_QP_CONGEST_TYPE;
+ hns_attr.congest_type = user_param->congest_type;
+ qp = hnsdv_create_qp(ctx->context, &attr_ex, &hns_attr);
+ }
+ else
+ #endif //HAVE_HNSDV
qp = ibv_create_qp_ex(ctx->context, &attr_ex);
}
else
diff --git a/src/perftest_resources.h b/src/perftest_resources.h
index ea4a6c4..cf0502c 100755
--- a/src/perftest_resources.h
+++ b/src/perftest_resources.h
@@ -55,6 +55,9 @@
#if defined(HAVE_MLX5DV)
#include <infiniband/mlx5dv.h>
#endif
+#if defined(HAVE_HNSDV)
+#include <infiniband/hnsdv.h>
+#endif
#include <rdma/rdma_cma.h>
#include <stdint.h>
#if defined(__FreeBSD__)
--
2.25.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cxh269/perftest.git
[email protected]:cxh269/perftest.git
cxh269
perftest
perftest
master

搜索帮助