net/mlx5e: CT: Fix releasing ft entries

Before this commit, on ft flush, ft entries were not removed
from the ct_tuple hashtables. Fix it.

Fixes: ac991b48d4 ("net/mlx5e: CT: Offload established flows")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Eli Britstein <elibr@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
Roi Dayan 2020-06-30 15:40:37 +03:00 committed by Saeed Mahameed
parent de96d5732a
commit bbe1124944
1 changed files with 16 additions and 8 deletions

View File

@ -817,6 +817,19 @@ mlx5_tc_ct_block_flow_offload_add(struct mlx5_ct_ft *ft,
return err; return err;
} }
static void
mlx5_tc_ct_del_ft_entry(struct mlx5_tc_ct_priv *ct_priv,
struct mlx5_ct_entry *entry)
{
mlx5_tc_ct_entry_del_rules(ct_priv, entry);
if (entry->tuple_node.next)
rhashtable_remove_fast(&ct_priv->ct_tuples_nat_ht,
&entry->tuple_nat_node,
tuples_nat_ht_params);
rhashtable_remove_fast(&ct_priv->ct_tuples_ht, &entry->tuple_node,
tuples_ht_params);
}
static int static int
mlx5_tc_ct_block_flow_offload_del(struct mlx5_ct_ft *ft, mlx5_tc_ct_block_flow_offload_del(struct mlx5_ct_ft *ft,
struct flow_cls_offload *flow) struct flow_cls_offload *flow)
@ -829,13 +842,7 @@ mlx5_tc_ct_block_flow_offload_del(struct mlx5_ct_ft *ft,
if (!entry) if (!entry)
return -ENOENT; return -ENOENT;
mlx5_tc_ct_entry_del_rules(ft->ct_priv, entry); mlx5_tc_ct_del_ft_entry(ft->ct_priv, entry);
if (entry->tuple_node.next)
rhashtable_remove_fast(&ft->ct_priv->ct_tuples_nat_ht,
&entry->tuple_nat_node,
tuples_nat_ht_params);
rhashtable_remove_fast(&ft->ct_priv->ct_tuples_ht, &entry->tuple_node,
tuples_ht_params);
WARN_ON(rhashtable_remove_fast(&ft->ct_entries_ht, WARN_ON(rhashtable_remove_fast(&ft->ct_entries_ht,
&entry->node, &entry->node,
cts_ht_params)); cts_ht_params));
@ -1348,7 +1355,8 @@ mlx5_tc_ct_flush_ft_entry(void *ptr, void *arg)
struct mlx5_tc_ct_priv *ct_priv = arg; struct mlx5_tc_ct_priv *ct_priv = arg;
struct mlx5_ct_entry *entry = ptr; struct mlx5_ct_entry *entry = ptr;
mlx5_tc_ct_entry_del_rules(ct_priv, entry); mlx5_tc_ct_del_ft_entry(ct_priv, entry);
kfree(entry);
} }
static void static void