Skip to content

Commit 80df31f

Browse files
PatrisiousHaddadrleon
authored andcommitted
net/mlx5: Change POOL_NEXT_SIZE define value and make it global
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 some 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. In addition move the definition to "include/linux/mlx5/fs.h" to expose the define to IB driver as well, while appropriately renaming it. Signed-off-by: Patrisious Haddad <[email protected]> Reviewed-by: Maor Gottlieb <[email protected]> Reviewed-by: Mark Bloch <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Leon Romanovsky <[email protected]>
1 parent 531ca2b commit 80df31f

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

drivers/net/ethernet/mellanox/mlx5/core/esw/legacy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static int esw_create_legacy_fdb_table(struct mlx5_eswitch *esw)
9696
if (!flow_group_in)
9797
return -ENOMEM;
9898

99-
ft_attr.max_fte = POOL_NEXT_SIZE;
99+
ft_attr.max_fte = MLX5_FS_MAX_POOL_SIZE;
100100
ft_attr.prio = LEGACY_FDB_PRIO;
101101
fdb = mlx5_create_flow_table(root_ns, &ft_attr);
102102
if (IS_ERR(fdb)) {

drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ mlx5_ft_pool_get_avail_sz(struct mlx5_core_dev *dev, enum fs_flow_table_type tab
5050
int i, found_i = -1;
5151

5252
for (i = ARRAY_SIZE(FT_POOLS) - 1; i >= 0; i--) {
53-
if (dev->priv.ft_pool->ft_left[i] && FT_POOLS[i] >= desired_size &&
53+
if (dev->priv.ft_pool->ft_left[i] &&
54+
(FT_POOLS[i] >= desired_size ||
55+
desired_size == MLX5_FS_MAX_POOL_SIZE) &&
5456
FT_POOLS[i] <= max_ft_size) {
5557
found_i = i;
56-
if (desired_size != POOL_NEXT_SIZE)
58+
if (desired_size != MLX5_FS_MAX_POOL_SIZE)
5759
break;
5860
}
5961
}

drivers/net/ethernet/mellanox/mlx5/core/fs_ft_pool.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
#include <linux/mlx5/driver.h>
88
#include "fs_core.h"
99

10-
#define POOL_NEXT_SIZE 0
11-
1210
int mlx5_ft_pool_init(struct mlx5_core_dev *dev);
1311
void mlx5_ft_pool_destroy(struct mlx5_core_dev *dev);
1412

drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ mlx5_chains_create_table(struct mlx5_fs_chains *chains,
161161
ft_attr.flags |= (MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT |
162162
MLX5_FLOW_TABLE_TUNNEL_EN_DECAP);
163163

164-
sz = (chain == mlx5_chains_get_nf_ft_chain(chains)) ? FT_TBL_SZ : POOL_NEXT_SIZE;
164+
sz = (chain == mlx5_chains_get_nf_ft_chain(chains)) ?
165+
FT_TBL_SZ : MLX5_FS_MAX_POOL_SIZE;
165166
ft_attr.max_fte = sz;
166167

167168
/* We use chains_default_ft(chains) as the table's next_ft till

include/linux/mlx5/fs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040

4141
#define MLX5_SET_CFG(p, f, v) MLX5_SET(create_flow_group_in, p, f, v)
4242

43+
#define MLX5_FS_MAX_POOL_SIZE BIT(30)
44+
4345
enum mlx5_flow_destination_type {
4446
MLX5_FLOW_DESTINATION_TYPE_NONE,
4547
MLX5_FLOW_DESTINATION_TYPE_VPORT,

0 commit comments

Comments
 (0)