Skip to content

Commit e63987c

Browse files
maorgottliebHassanKhadour
authored andcommitted
Perftest: Query correct RDMA/atomic caps for DC
Currently, verbs exposed those caps only for RC, therefore for DC we need to query it through DEVX. Without this fix, we use the RC caps for DC QPs, this cause perfomance degredation in ConnectX-7. Signed-off-by: Maor Gottlieb <[email protected]>
1 parent 3e594ed commit e63987c

File tree

2 files changed

+48
-7
lines changed

2 files changed

+48
-7
lines changed

configure.ac

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ 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([
146+
#include <infiniband/mlx5dv.h>],
147+
[int x = __devx_dw_off(32);],[HAVE_MLX5_DEVX=yes], [HAVE_MLX5_DEVX=no])
148+
AM_CONDITIONAL([HAVE_MLX5_DEVX],[test "x$HAVE_MLX5_DEVX" = "xyes"])
149+
if [test $HAVE_MLX5_DEVX = yes] && [test $HAVE_MLX5DV = yes]; then
150+
AC_DEFINE([HAVE_MLX5_DEVX], [1], [Have MLX5 DEVX support])
151+
fi
152+
145153
AC_TRY_LINK([
146154
#include <infiniband/mlx5dv.h>],
147155
[int x = MLX5DV_QP_INIT_ATTR_MASK_DCI_STREAMS;],[HAVE_DCS=yes], [HAVE_DCS=no])

src/perftest_parameters.c

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <sys/stat.h>
1111
#endif
1212
#include "perftest_parameters.h"
13+
#include "mlx5_devx.h"
1314
#include "raw_ethernet_resources.h"
1415
#include<math.h>
1516
#ifdef HAVE_RO
@@ -1974,17 +1975,49 @@ static int set_link_layer(struct ibv_context *context, struct perftest_parameter
19741975
return SUCCESS;
19751976
}
19761977

1978+
static int get_device_max_reads_dc(struct ibv_context *context)
1979+
{
1980+
#ifdef HAVE_MLX5_DEVX
1981+
uint32_t in[DEVX_ST_SZ_DW(query_hca_cap_in)] = {};
1982+
uint32_t out[DEVX_ST_SZ_DW(query_hca_cap_out)] = {};
1983+
uint16_t opmod = HCA_CAP_OPMOD_GET_CUR;
1984+
int ret;
1985+
1986+
DEVX_SET(query_hca_cap_in, in, opcode, MLX5_CMD_OP_QUERY_HCA_CAP);
1987+
DEVX_SET(query_hca_cap_in, in, op_mod, opmod);
1988+
1989+
ret = mlx5dv_devx_general_cmd(context, in, sizeof(in), out,
1990+
sizeof(out));
1991+
if (!ret)
1992+
return (1 << DEVX_GET(query_hca_cap_out, out,
1993+
cmd_hca_cap.log_max_ra_req_dc));
1994+
#endif
1995+
return 0;
1996+
}
1997+
1998+
static int get_device_max_reads(struct ibv_context *context,
1999+
struct perftest_parameters *user_param)
2000+
{
2001+
struct ibv_device_attr attr;
2002+
int max_reads = 0;
2003+
2004+
if (user_param->connection_type == DC)
2005+
max_reads = get_device_max_reads_dc(context);
2006+
if (!max_reads && !ibv_query_device(context,&attr))
2007+
max_reads = attr.max_qp_rd_atom;
2008+
return max_reads;
2009+
}
2010+
19772011
/******************************************************************************
19782012
*
19792013
******************************************************************************/
1980-
static int ctx_set_out_reads(struct ibv_context *context,int num_user_reads)
2014+
static int ctx_set_out_reads(struct ibv_context *context,
2015+
struct perftest_parameters *user_param)
19812016
{
19822017
int max_reads = 0;
1983-
struct ibv_device_attr attr;
2018+
int num_user_reads = user_param->out_reads;
19842019

1985-
if (!ibv_query_device(context,&attr)) {
1986-
max_reads = attr.max_qp_rd_atom;
1987-
}
2020+
max_reads = get_device_max_reads(context, user_param);
19882021

19892022
if (num_user_reads > max_reads) {
19902023
printf(RESULT_LINE);
@@ -3043,7 +3076,7 @@ int check_link_and_mtu(struct ibv_context *context,struct perftest_parameters *u
30433076
ctx_set_max_inline(context,user_param);
30443077

30453078
if (user_param->verb == READ || user_param->verb == ATOMIC)
3046-
user_param->out_reads = ctx_set_out_reads(context,user_param->out_reads);
3079+
user_param->out_reads = ctx_set_out_reads(context,user_param);
30473080
else
30483081
user_param->out_reads = 1;
30493082

@@ -3109,7 +3142,7 @@ int check_link(struct ibv_context *context,struct perftest_parameters *user_para
31093142
ctx_set_max_inline(context,user_param);
31103143

31113144
if (user_param->verb == READ || user_param->verb == ATOMIC)
3112-
user_param->out_reads = ctx_set_out_reads(context,user_param->out_reads);
3145+
user_param->out_reads = ctx_set_out_reads(context,user_param);
31133146
else
31143147
user_param->out_reads = 1;
31153148

0 commit comments

Comments
 (0)