git: 3d052f97cef5 - stable/13 - mlx5: Make MLX5_COMP_EQ_SIZE tunable.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 30 Apr 2023 06:58:15 UTC
The branch stable/13 has been updated by hselasky:
URL: https://cgit.FreeBSD.org/src/commit/?id=3d052f97cef570f0b65b8c93936e690af6d37acb
commit 3d052f97cef570f0b65b8c93936e690af6d37acb
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-30 06:56:19 +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 .
Sponsored by: NVIDIA Networking
(cherry picked from commit 3bb3e4768ff854b88ba0a7d129edad49f15d7ce3)
---
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 e1766ae8a742..cdf8deb34a6c 100644
--- a/sys/dev/mlx5/driver.h
+++ b/sys/dev/mlx5/driver.h
@@ -831,10 +831,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 431a277119cf..9862b9ecec56 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_main.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_main.c
@@ -86,6 +86,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);
@@ -180,6 +185,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 =
@@ -688,7 +709,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);