mlx5: Make MLX5_COMP_EQ_SIZE tunable.

When using hardware pacing, this value can be increased, because more SQ's
means more EQ events aswell. Make it tunable, hw.mlx5.comp_eq_size .

MFC after:	1 week
Sponsored by:	NVIDIA Networking
This commit is contained in:
Hans Petter Selasky 2023-04-18 13:11:02 +02:00
parent 37229fed38
commit 3bb3e4768f
2 changed files with 22 additions and 5 deletions

View file

@ -805,10 +805,6 @@ struct mlx5_core_dct {
u16 uid;
};
enum {
MLX5_COMP_EQ_SIZE = 1024,
};
enum {
MLX5_PTYS_IB = 1 << 0,
MLX5_PTYS_EN = 1 << 2,

View file

@ -84,6 +84,11 @@ SYSCTL_INT(_hw_mlx5, OID_AUTO, fast_unload_enabled, CTLFLAG_RWTUN,
&mlx5_fast_unload_enabled, 0,
"Set to enable fast unload. Clear to disable.");
static int mlx5_core_comp_eq_size = 1024;
SYSCTL_INT(_hw_mlx5, OID_AUTO, comp_eq_size, CTLFLAG_RDTUN | CTLFLAG_MPSAFE,
&mlx5_core_comp_eq_size, 0,
"Set default completion EQ size between 1024 and 16384 inclusivly. Value should be power of two.");
static LIST_HEAD(intf_list);
static LIST_HEAD(dev_list);
static DEFINE_MUTEX(intf_mutex);
@ -178,6 +183,22 @@ static struct mlx5_profile profiles[] = {
},
};
static int
mlx5_core_get_comp_eq_size(void)
{
int value = mlx5_core_comp_eq_size;
if (value < 1024)
value = 1024;
else if (value > 16384)
value = 16384;
/* make value power of two, rounded down */
while (value & (value - 1))
value &= (value - 1);
return (value);
}
static void mlx5_set_driver_version(struct mlx5_core_dev *dev)
{
const size_t driver_ver_sz =
@ -686,7 +707,7 @@ static int alloc_comp_eqs(struct mlx5_core_dev *dev)
INIT_LIST_HEAD(&table->comp_eqs_list);
ncomp_vec = table->num_comp_vectors;
nent = MLX5_COMP_EQ_SIZE;
nent = mlx5_core_get_comp_eq_size();
for (i = 0; i < ncomp_vec; i++) {
eq = kzalloc_node(sizeof(*eq), GFP_KERNEL, dev->priv.numa_node);