aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAriel Ehrenberg <aehrenberg@nvidia.com>2024-11-25 13:10:41 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2024-12-15 22:27:53 +0000
commit2fb2c0351237aed71abedb7eb6d737b4390b490a (patch)
tree3a29a42018339def5fcd0e2807dcf89cac62cc6b
parent29a9d7c6ce78825251ea127ade445236607b0b81 (diff)
mlx5_core: fix "no space" error on sriov enablement
Change POOL_NEXT_SIZE define value from 0 to BIT(30), since this define is used to request the available maximum sized flow table, and zero doesn't make sense for it, whereas many places in the driver use zero explicitly expecting the smallest table size possible but instead due to this define they end up allocating the biggest table size unawarely. Sponsored by: NVidia networking
-rw-r--r--sys/dev/mlx5/mlx5_core/fs_ft_pool.h2
-rw-r--r--sys/dev/mlx5/mlx5_core/mlx5_fs_ft_pool.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/sys/dev/mlx5/mlx5_core/fs_ft_pool.h b/sys/dev/mlx5/mlx5_core/fs_ft_pool.h
index b81e70d51bd6..a5e4df624e27 100644
--- a/sys/dev/mlx5/mlx5_core/fs_ft_pool.h
+++ b/sys/dev/mlx5/mlx5_core/fs_ft_pool.h
@@ -9,7 +9,7 @@
#include <dev/mlx5/mlx5_core/fs_core.h>
#include <linux/compiler.h>
-#define POOL_NEXT_SIZE 0
+#define POOL_NEXT_SIZE BIT(30)
int mlx5_ft_pool_init(struct mlx5_core_dev *dev);
void mlx5_ft_pool_destroy(struct mlx5_core_dev *dev);
diff --git a/sys/dev/mlx5/mlx5_core/mlx5_fs_ft_pool.c b/sys/dev/mlx5/mlx5_core/mlx5_fs_ft_pool.c
index c14590acc772..70d9d235b629 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_fs_ft_pool.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_fs_ft_pool.c
@@ -50,7 +50,8 @@ mlx5_ft_pool_get_avail_sz(struct mlx5_core_dev *dev, enum fs_flow_table_type tab
int i, found_i = -1;
for (i = ARRAY_SIZE(FT_POOLS) - 1; i >= 0; i--) {
- if (dev->priv.ft_pool->ft_left[i] && FT_POOLS[i] >= desired_size &&
+ if (dev->priv.ft_pool->ft_left[i] &&
+ (FT_POOLS[i] >= desired_size || desired_size == POOL_NEXT_SIZE) &&
FT_POOLS[i] <= max_ft_size) {
found_i = i;
if (desired_size != POOL_NEXT_SIZE)