Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net/mlx5: Fix rate limit packet pacing naming and struct

In mlx5_ifc, struct size was not complete, and thus driver was sending
garbage after the last defined field. Fixed it by adding reserved field
to complete the struct size.

In addition, rename all set_rate_limit to set_pp_rate_limit to be
compliant with the Firmware <-> Driver definition.

Fixes: 7486216b3a0b ("{net,IB}/mlx5: mlx5_ifc updates")
Fixes: 1466cc5b23d1 ("net/mlx5: Rate limit tables support")
Signed-off-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>

authored by

Eran Ben Elisha and committed by
Saeed Mahameed
37e92a9d 231243c8

+18 -16
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
··· 362 362 case MLX5_CMD_OP_QUERY_VPORT_COUNTER: 363 363 case MLX5_CMD_OP_ALLOC_Q_COUNTER: 364 364 case MLX5_CMD_OP_QUERY_Q_COUNTER: 365 - case MLX5_CMD_OP_SET_RATE_LIMIT: 365 + case MLX5_CMD_OP_SET_PP_RATE_LIMIT: 366 366 case MLX5_CMD_OP_QUERY_RATE_LIMIT: 367 367 case MLX5_CMD_OP_CREATE_SCHEDULING_ELEMENT: 368 368 case MLX5_CMD_OP_QUERY_SCHEDULING_ELEMENT: ··· 505 505 MLX5_COMMAND_STR_CASE(ALLOC_Q_COUNTER); 506 506 MLX5_COMMAND_STR_CASE(DEALLOC_Q_COUNTER); 507 507 MLX5_COMMAND_STR_CASE(QUERY_Q_COUNTER); 508 - MLX5_COMMAND_STR_CASE(SET_RATE_LIMIT); 508 + MLX5_COMMAND_STR_CASE(SET_PP_RATE_LIMIT); 509 509 MLX5_COMMAND_STR_CASE(QUERY_RATE_LIMIT); 510 510 MLX5_COMMAND_STR_CASE(CREATE_SCHEDULING_ELEMENT); 511 511 MLX5_COMMAND_STR_CASE(DESTROY_SCHEDULING_ELEMENT);
+11 -11
drivers/net/ethernet/mellanox/mlx5/core/rl.c
··· 125 125 return ret_entry; 126 126 } 127 127 128 - static int mlx5_set_rate_limit_cmd(struct mlx5_core_dev *dev, 128 + static int mlx5_set_pp_rate_limit_cmd(struct mlx5_core_dev *dev, 129 129 u32 rate, u16 index) 130 130 { 131 - u32 in[MLX5_ST_SZ_DW(set_rate_limit_in)] = {0}; 132 - u32 out[MLX5_ST_SZ_DW(set_rate_limit_out)] = {0}; 131 + u32 in[MLX5_ST_SZ_DW(set_pp_rate_limit_in)] = {0}; 132 + u32 out[MLX5_ST_SZ_DW(set_pp_rate_limit_out)] = {0}; 133 133 134 - MLX5_SET(set_rate_limit_in, in, opcode, 135 - MLX5_CMD_OP_SET_RATE_LIMIT); 136 - MLX5_SET(set_rate_limit_in, in, rate_limit_index, index); 137 - MLX5_SET(set_rate_limit_in, in, rate_limit, rate); 134 + MLX5_SET(set_pp_rate_limit_in, in, opcode, 135 + MLX5_CMD_OP_SET_PP_RATE_LIMIT); 136 + MLX5_SET(set_pp_rate_limit_in, in, rate_limit_index, index); 137 + MLX5_SET(set_pp_rate_limit_in, in, rate_limit, rate); 138 138 return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); 139 139 } 140 140 ··· 173 173 entry->refcount++; 174 174 } else { 175 175 /* new rate limit */ 176 - err = mlx5_set_rate_limit_cmd(dev, rate, entry->index); 176 + err = mlx5_set_pp_rate_limit_cmd(dev, rate, entry->index); 177 177 if (err) { 178 178 mlx5_core_err(dev, "Failed configuring rate: %u (%d)\n", 179 179 rate, err); ··· 209 209 entry->refcount--; 210 210 if (!entry->refcount) { 211 211 /* need to remove rate */ 212 - mlx5_set_rate_limit_cmd(dev, 0, entry->index); 212 + mlx5_set_pp_rate_limit_cmd(dev, 0, entry->index); 213 213 entry->rate = 0; 214 214 } 215 215 ··· 262 262 /* Clear all configured rates */ 263 263 for (i = 0; i < table->max_size; i++) 264 264 if (table->rl_entry[i].rate) 265 - mlx5_set_rate_limit_cmd(dev, 0, 266 - table->rl_entry[i].index); 265 + mlx5_set_pp_rate_limit_cmd(dev, 0, 266 + table->rl_entry[i].index); 267 267 268 268 kfree(dev->priv.rl_table.rl_entry); 269 269 }
+5 -3
include/linux/mlx5/mlx5_ifc.h
··· 147 147 MLX5_CMD_OP_ALLOC_Q_COUNTER = 0x771, 148 148 MLX5_CMD_OP_DEALLOC_Q_COUNTER = 0x772, 149 149 MLX5_CMD_OP_QUERY_Q_COUNTER = 0x773, 150 - MLX5_CMD_OP_SET_RATE_LIMIT = 0x780, 150 + MLX5_CMD_OP_SET_PP_RATE_LIMIT = 0x780, 151 151 MLX5_CMD_OP_QUERY_RATE_LIMIT = 0x781, 152 152 MLX5_CMD_OP_CREATE_SCHEDULING_ELEMENT = 0x782, 153 153 MLX5_CMD_OP_DESTROY_SCHEDULING_ELEMENT = 0x783, ··· 7239 7239 u8 vxlan_udp_port[0x10]; 7240 7240 }; 7241 7241 7242 - struct mlx5_ifc_set_rate_limit_out_bits { 7242 + struct mlx5_ifc_set_pp_rate_limit_out_bits { 7243 7243 u8 status[0x8]; 7244 7244 u8 reserved_at_8[0x18]; 7245 7245 ··· 7248 7248 u8 reserved_at_40[0x40]; 7249 7249 }; 7250 7250 7251 - struct mlx5_ifc_set_rate_limit_in_bits { 7251 + struct mlx5_ifc_set_pp_rate_limit_in_bits { 7252 7252 u8 opcode[0x10]; 7253 7253 u8 reserved_at_10[0x10]; 7254 7254 ··· 7261 7261 u8 reserved_at_60[0x20]; 7262 7262 7263 7263 u8 rate_limit[0x20]; 7264 + 7265 + u8 reserved_at_a0[0x160]; 7264 7266 }; 7265 7267 7266 7268 struct mlx5_ifc_access_register_out_bits {