Skip to content

Commit 66fb1d5

Browse files
EdwardSrorleon
authored andcommitted
IB/mlx5: Extend debug control for CC parameters
This patch adds rtt_resp_dscp to the current debug controllability of congestion control (CC) parameters. rtt_resp_dscp can be read or written through debugfs. If set, its value overwrites the DSCP of the generated RTT response. Signed-off-by: Edward Srouji <[email protected]> Reviewed-by: Maor Gottlieb <[email protected]> Link: https://lore.kernel.org/r/1dcc3440ee53c688f19f579a051ded81a2aaa70a.1676538714.git.leon@kernel.org Signed-off-by: Leon Romanovsky <[email protected]>
1 parent fd8958e commit 66fb1d5

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

drivers/infiniband/hw/mlx5/cong.c

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
enum mlx5_ib_cong_node_type {
3939
MLX5_IB_RROCE_ECN_RP = 1,
4040
MLX5_IB_RROCE_ECN_NP = 2,
41+
MLX5_IB_RROCE_GENERAL = 3,
4142
};
4243

4344
static const char * const mlx5_ib_dbg_cc_name[] = {
@@ -61,6 +62,8 @@ static const char * const mlx5_ib_dbg_cc_name[] = {
6162
"np_cnp_dscp",
6263
"np_cnp_prio_mode",
6364
"np_cnp_prio",
65+
"rtt_resp_dscp_valid",
66+
"rtt_resp_dscp",
6467
};
6568

6669
#define MLX5_IB_RP_CLAMP_TGT_RATE_ATTR BIT(1)
@@ -84,14 +87,18 @@ static const char * const mlx5_ib_dbg_cc_name[] = {
8487
#define MLX5_IB_NP_CNP_DSCP_ATTR BIT(3)
8588
#define MLX5_IB_NP_CNP_PRIO_MODE_ATTR BIT(4)
8689

90+
#define MLX5_IB_GENERAL_RTT_RESP_DSCP_ATTR BIT(0)
91+
8792
static enum mlx5_ib_cong_node_type
8893
mlx5_ib_param_to_node(enum mlx5_ib_dbg_cc_types param_offset)
8994
{
90-
if (param_offset >= MLX5_IB_DBG_CC_RP_CLAMP_TGT_RATE &&
91-
param_offset <= MLX5_IB_DBG_CC_RP_GD)
95+
if (param_offset <= MLX5_IB_DBG_CC_RP_GD)
9296
return MLX5_IB_RROCE_ECN_RP;
93-
else
97+
98+
if (param_offset <= MLX5_IB_DBG_CC_NP_CNP_PRIO)
9499
return MLX5_IB_RROCE_ECN_NP;
100+
101+
return MLX5_IB_RROCE_GENERAL;
95102
}
96103

97104
static u32 mlx5_get_cc_param_val(void *field, int offset)
@@ -157,6 +164,12 @@ static u32 mlx5_get_cc_param_val(void *field, int offset)
157164
case MLX5_IB_DBG_CC_NP_CNP_PRIO:
158165
return MLX5_GET(cong_control_r_roce_ecn_np, field,
159166
cnp_802p_prio);
167+
case MLX5_IB_DBG_CC_GENERAL_RTT_RESP_DSCP_VALID:
168+
return MLX5_GET(cong_control_r_roce_general, field,
169+
rtt_resp_dscp_valid);
170+
case MLX5_IB_DBG_CC_GENERAL_RTT_RESP_DSCP:
171+
return MLX5_GET(cong_control_r_roce_general, field,
172+
rtt_resp_dscp);
160173
default:
161174
return 0;
162175
}
@@ -264,6 +277,15 @@ static void mlx5_ib_set_cc_param_mask_val(void *field, int offset,
264277
MLX5_SET(cong_control_r_roce_ecn_np, field, cnp_prio_mode, 0);
265278
MLX5_SET(cong_control_r_roce_ecn_np, field, cnp_802p_prio, var);
266279
break;
280+
case MLX5_IB_DBG_CC_GENERAL_RTT_RESP_DSCP_VALID:
281+
*attr_mask |= MLX5_IB_GENERAL_RTT_RESP_DSCP_ATTR;
282+
MLX5_SET(cong_control_r_roce_general, field, rtt_resp_dscp_valid, var);
283+
break;
284+
case MLX5_IB_DBG_CC_GENERAL_RTT_RESP_DSCP:
285+
*attr_mask |= MLX5_IB_GENERAL_RTT_RESP_DSCP_ATTR;
286+
MLX5_SET(cong_control_r_roce_general, field, rtt_resp_dscp_valid, 1);
287+
MLX5_SET(cong_control_r_roce_general, field, rtt_resp_dscp, var);
288+
break;
267289
}
268290
}
269291

drivers/infiniband/hw/mlx5/mlx5_ib.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,8 @@ enum mlx5_ib_dbg_cc_types {
888888
MLX5_IB_DBG_CC_NP_CNP_DSCP,
889889
MLX5_IB_DBG_CC_NP_CNP_PRIO_MODE,
890890
MLX5_IB_DBG_CC_NP_CNP_PRIO,
891+
MLX5_IB_DBG_CC_GENERAL_RTT_RESP_DSCP_VALID,
892+
MLX5_IB_DBG_CC_GENERAL_RTT_RESP_DSCP,
891893
MLX5_IB_DBG_CC_MAX,
892894
};
893895

include/linux/mlx5/mlx5_ifc.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,6 +2159,17 @@ struct mlx5_ifc_cong_control_r_roce_ecn_rp_bits {
21592159
u8 reserved_at_360[0x4a0];
21602160
};
21612161

2162+
struct mlx5_ifc_cong_control_r_roce_general_bits {
2163+
u8 reserved_at_0[0x80];
2164+
2165+
u8 reserved_at_80[0x10];
2166+
u8 rtt_resp_dscp_valid[0x1];
2167+
u8 reserved_at_91[0x9];
2168+
u8 rtt_resp_dscp[0x6];
2169+
2170+
u8 reserved_at_a0[0x760];
2171+
};
2172+
21622173
struct mlx5_ifc_cong_control_802_1qau_rp_bits {
21632174
u8 reserved_at_0[0x80];
21642175

@@ -4304,6 +4315,7 @@ union mlx5_ifc_cong_control_roce_ecn_auto_bits {
43044315
struct mlx5_ifc_cong_control_802_1qau_rp_bits cong_control_802_1qau_rp;
43054316
struct mlx5_ifc_cong_control_r_roce_ecn_rp_bits cong_control_r_roce_ecn_rp;
43064317
struct mlx5_ifc_cong_control_r_roce_ecn_np_bits cong_control_r_roce_ecn_np;
4318+
struct mlx5_ifc_cong_control_r_roce_general_bits cong_control_r_roce_general;
43074319
u8 reserved_at_0[0x800];
43084320
};
43094321

0 commit comments

Comments
 (0)