|
10 | 10 | #include <sys/stat.h> |
11 | 11 | #endif |
12 | 12 | #include "perftest_parameters.h" |
| 13 | +#include "mlx5_devx.h" |
13 | 14 | #include "raw_ethernet_resources.h" |
14 | 15 | #include<math.h> |
15 | 16 | #ifdef HAVE_RO |
@@ -1974,17 +1975,49 @@ static int set_link_layer(struct ibv_context *context, struct perftest_parameter |
1974 | 1975 | return SUCCESS; |
1975 | 1976 | } |
1976 | 1977 |
|
| 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 | + |
1977 | 2011 | /****************************************************************************** |
1978 | 2012 | * |
1979 | 2013 | ******************************************************************************/ |
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) |
1981 | 2016 | { |
1982 | 2017 | int max_reads = 0; |
1983 | | - struct ibv_device_attr attr; |
| 2018 | + int num_user_reads = user_param->out_reads; |
1984 | 2019 |
|
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); |
1988 | 2021 |
|
1989 | 2022 | if (num_user_reads > max_reads) { |
1990 | 2023 | printf(RESULT_LINE); |
@@ -3043,7 +3076,7 @@ int check_link_and_mtu(struct ibv_context *context,struct perftest_parameters *u |
3043 | 3076 | ctx_set_max_inline(context,user_param); |
3044 | 3077 |
|
3045 | 3078 | 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); |
3047 | 3080 | else |
3048 | 3081 | user_param->out_reads = 1; |
3049 | 3082 |
|
@@ -3109,7 +3142,7 @@ int check_link(struct ibv_context *context,struct perftest_parameters *user_para |
3109 | 3142 | ctx_set_max_inline(context,user_param); |
3110 | 3143 |
|
3111 | 3144 | 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); |
3113 | 3146 | else |
3114 | 3147 | user_param->out_reads = 1; |
3115 | 3148 |
|
|
0 commit comments