Skip to content

Commit 97fd8da

Browse files
Maor GottliebSaeed Mahameed
authored andcommitted
net/mlx5: Fix auto group size calculation
Once all the large flow groups (defined by the user when the flow table is created - max_num_groups) were created, then all the following new flow groups will have only one flow table entry, even though the flow table has place to larger groups. Fix the condition to prefer large flow group. Fixes: f0d22d1 ("net/mlx5_core: Introduce flow steering autogrouped flow table") Signed-off-by: Maor Gottlieb <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 9c98f7e commit 97fd8da

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ static void del_sw_flow_group(struct fs_node *node)
579579

580580
rhashtable_destroy(&fg->ftes_hash);
581581
ida_destroy(&fg->fte_allocator);
582-
if (ft->autogroup.active)
582+
if (ft->autogroup.active && fg->max_ftes == ft->autogroup.group_size)
583583
ft->autogroup.num_groups--;
584584
err = rhltable_remove(&ft->fgs_hash,
585585
&fg->hash,
@@ -1126,6 +1126,8 @@ mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns,
11261126

11271127
ft->autogroup.active = true;
11281128
ft->autogroup.required_groups = max_num_groups;
1129+
/* We save place for flow groups in addition to max types */
1130+
ft->autogroup.group_size = ft->max_fte / (max_num_groups + 1);
11291131

11301132
return ft;
11311133
}
@@ -1328,8 +1330,7 @@ static struct mlx5_flow_group *alloc_auto_flow_group(struct mlx5_flow_table *ft
13281330
return ERR_PTR(-ENOENT);
13291331

13301332
if (ft->autogroup.num_groups < ft->autogroup.required_groups)
1331-
/* We save place for flow groups in addition to max types */
1332-
group_size = ft->max_fte / (ft->autogroup.required_groups + 1);
1333+
group_size = ft->autogroup.group_size;
13331334

13341335
/* ft->max_fte == ft->autogroup.max_types */
13351336
if (group_size == 0)
@@ -1356,7 +1357,8 @@ static struct mlx5_flow_group *alloc_auto_flow_group(struct mlx5_flow_table *ft
13561357
if (IS_ERR(fg))
13571358
goto out;
13581359

1359-
ft->autogroup.num_groups++;
1360+
if (group_size == ft->autogroup.group_size)
1361+
ft->autogroup.num_groups++;
13601362

13611363
out:
13621364
return fg;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ struct mlx5_flow_table {
162162
struct {
163163
bool active;
164164
unsigned int required_groups;
165+
unsigned int group_size;
165166
unsigned int num_groups;
166167
} autogroup;
167168
/* Protect fwd_rules */

0 commit comments

Comments
 (0)