]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
net/mlx5: Fix deletion of duplicate rules
authorMaor Gottlieb <maorg@nvidia.com>
Wed, 21 Oct 2020 05:42:49 +0000 (08:42 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 5 Nov 2020 20:17:06 +0000 (12:17 -0800)
When a rule is duplicated, the refcount of the rule is increased so only
the second deletion of the rule should cause destruction of the FTE.
Currently, the FTE will be destroyed in the first deletion of rule since
the modify_mask will be 0.
Fix it and call to destroy FTE only if all the rules (FTE's children)
have been removed.

Fixes: 718ce4d601db ("net/mlx5: Consolidate update FTE for all removal changes")
Signed-off-by: Maor Gottlieb <maorg@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

index 16091838bfcf9002582303d34863d7c43882dc6c..325a5b0d6829ee19ebfce647db51aabdd557e39b 100644 (file)
@@ -2010,10 +2010,11 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle)
        down_write_ref_node(&fte->node, false);
        for (i = handle->num_rules - 1; i >= 0; i--)
                tree_remove_node(&handle->rule[i]->node, true);
-       if (fte->modify_mask && fte->dests_size) {
-               modify_fte(fte);
+       if (fte->dests_size) {
+               if (fte->modify_mask)
+                       modify_fte(fte);
                up_write_ref_node(&fte->node, false);
-       } else {
+       } else if (list_empty(&fte->node.children)) {
                del_hw_fte(&fte->node);
                /* Avoid double call to del_hw_fte */
                fte->node.del_hw_func = NULL;