git: 3bb3e4768ff8 - main - mlx5: Make MLX5_COMP_EQ_SIZE tunable.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 18 Apr 2023 13:02:02 UTC
The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=3bb3e4768ff854b88ba0a7d129edad49f15d7ce3 commit 3bb3e4768ff854b88ba0a7d129edad49f15d7ce3 Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2023-04-18 11:11:02 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> CommitDate: 2023-04-18 13:01:06 +0000 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 --- sys/dev/mlx5/driver.h | 4 ---- sys/dev/mlx5/mlx5_core/mlx5_main.c | 23 ++++++++++++++++++++++- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/sys/dev/mlx5/driver.h b/sys/dev/mlx5/driver.h index 16ada325b1be..47ed4a9d73f3 100644 --- a/sys/dev/mlx5/driver.h +++ b/sys/dev/mlx5/driver.h @@ -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, diff --git a/sys/dev/mlx5/mlx5_core/mlx5_main.c b/sys/dev/mlx5/mlx5_core/mlx5_main.c index 6ddeaf64ed89..9e9b7b845528 100644 --- a/sys/dev/mlx5/mlx5_core/mlx5_main.c +++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c @@ -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);