Skip to content

Commit b9e8f9d

Browse files
maorgottliebgregkh
authored andcommitted
net/mlx5: Fix deletion of duplicate rules
[ Upstream commit 465e7ba ] 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: 718ce4d ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e74e514 commit b9e8f9d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx5/core

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,10 +1923,11 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle)
19231923
down_write_ref_node(&fte->node, false);
19241924
for (i = handle->num_rules - 1; i >= 0; i--)
19251925
tree_remove_node(&handle->rule[i]->node, true);
1926-
if (fte->modify_mask && fte->dests_size) {
1927-
modify_fte(fte);
1926+
if (fte->dests_size) {
1927+
if (fte->modify_mask)
1928+
modify_fte(fte);
19281929
up_write_ref_node(&fte->node, false);
1929-
} else {
1930+
} else if (list_empty(&fte->node.children)) {
19301931
del_hw_fte(&fte->node);
19311932
/* Avoid double call to del_hw_fte */
19321933
fte->node.del_hw_func = NULL;

0 commit comments

Comments
 (0)