net/mlx5e: CT: Fix releasing ft entries
authorRoi Dayan <roid@mellanox.com>
Tue, 30 Jun 2020 12:40:37 +0000 (15:40 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Fri, 10 Jul 2020 02:51:17 +0000 (19:51 -0700)
Before this commit, on ft flush, ft entries were not removed
from the ct_tuple hashtables. Fix it.

Fixes: ac991b48d43c ("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>
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c

index 96225e897064d4702c5f4220849e269c8251d74a..4c65677feaabfacffdde19f99cb209151568519d 100644 (file)
@@ -817,6 +817,19 @@ err_set:
        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
 mlx5_tc_ct_block_flow_offload_del(struct mlx5_ct_ft *ft,
                                  struct flow_cls_offload *flow)
@@ -829,13 +842,7 @@ mlx5_tc_ct_block_flow_offload_del(struct mlx5_ct_ft *ft,
        if (!entry)
                return -ENOENT;
 
-       mlx5_tc_ct_entry_del_rules(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);
+       mlx5_tc_ct_del_ft_entry(ft->ct_priv, entry);
        WARN_ON(rhashtable_remove_fast(&ft->ct_entries_ht,
                                       &entry->node,
                                       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_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