Commit c2c922da authored by Mark Bloch's avatar Mark Bloch Committed by Saeed Mahameed

net/mlx5: Add ability to insert to specific flow group

If the flow table isn't an autogroup the upper driver has to create the
flow groups explicitly. This information can't later be used when
creating rules to insert into a specific flow group. Allow such use case.
Signed-off-by: default avatarMark Bloch <mbloch@nvidia.com>
Reviewed-by: default avatarMaor Gottlieb <maorg@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 43c07595
...@@ -1696,6 +1696,7 @@ static void free_match_list(struct match_list *head, bool ft_locked) ...@@ -1696,6 +1696,7 @@ static void free_match_list(struct match_list *head, bool ft_locked)
static int build_match_list(struct match_list *match_head, static int build_match_list(struct match_list *match_head,
struct mlx5_flow_table *ft, struct mlx5_flow_table *ft,
const struct mlx5_flow_spec *spec, const struct mlx5_flow_spec *spec,
struct mlx5_flow_group *fg,
bool ft_locked) bool ft_locked)
{ {
struct rhlist_head *tmp, *list; struct rhlist_head *tmp, *list;
...@@ -1710,6 +1711,9 @@ static int build_match_list(struct match_list *match_head, ...@@ -1710,6 +1711,9 @@ static int build_match_list(struct match_list *match_head,
rhl_for_each_entry_rcu(g, tmp, list, hash) { rhl_for_each_entry_rcu(g, tmp, list, hash) {
struct match_list *curr_match; struct match_list *curr_match;
if (fg && fg != g)
continue;
if (unlikely(!tree_get_node(&g->node))) if (unlikely(!tree_get_node(&g->node)))
continue; continue;
...@@ -1889,6 +1893,9 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft, ...@@ -1889,6 +1893,9 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
if (!check_valid_spec(spec)) if (!check_valid_spec(spec))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
if (flow_act->fg && ft->autogroup.active)
return ERR_PTR(-EINVAL);
for (i = 0; i < dest_num; i++) { for (i = 0; i < dest_num; i++) {
if (!dest_is_valid(&dest[i], flow_act, ft)) if (!dest_is_valid(&dest[i], flow_act, ft))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
...@@ -1898,7 +1905,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft, ...@@ -1898,7 +1905,7 @@ _mlx5_add_flow_rules(struct mlx5_flow_table *ft,
version = atomic_read(&ft->node.version); version = atomic_read(&ft->node.version);
/* Collect all fgs which has a matching match_criteria */ /* Collect all fgs which has a matching match_criteria */
err = build_match_list(&match_head, ft, spec, take_write); err = build_match_list(&match_head, ft, spec, flow_act->fg, take_write);
if (err) { if (err) {
if (take_write) if (take_write)
up_write_ref_node(&ft->node, false); up_write_ref_node(&ft->node, false);
......
...@@ -224,6 +224,7 @@ struct mlx5_flow_act { ...@@ -224,6 +224,7 @@ struct mlx5_flow_act {
u32 flags; u32 flags;
struct mlx5_fs_vlan vlan[MLX5_FS_VLAN_DEPTH]; struct mlx5_fs_vlan vlan[MLX5_FS_VLAN_DEPTH];
struct ib_counters *counters; struct ib_counters *counters;
struct mlx5_flow_group *fg;
}; };
#define MLX5_DECLARE_FLOW_ACT(name) \ #define MLX5_DECLARE_FLOW_ACT(name) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment