From 2fb2c0351237aed71abedb7eb6d737b4390b490a Mon Sep 17 00:00:00 2001 From: Ariel Ehrenberg Date: Mon, 25 Nov 2024 15:10:41 +0200 Subject: [PATCH] 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 --- sys/dev/mlx5/mlx5_core/fs_ft_pool.h | 2 +- sys/dev/mlx5/mlx5_core/mlx5_fs_ft_pool.c | 3 ++- 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 b81e70d51bd..a5e4df624e2 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 #include -#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 c14590acc77..70d9d235b62 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)