Skip to content

Commit 718ce4d

Browse files
Eli BritsteinSaeed Mahameed
Eli Britstein
authored and
Saeed Mahameed
committed
net/mlx5: Consolidate update FTE for all removal changes
With commit a18e879 ("net/mlx5e: Annul encap action ordering requirement") and a use-case of e-switch remote mirroring, the incremental/stepped FTE removal process done by the fs core got us to illegal transient states and FW errors: SET_FLOW_TABLE_ENTRY(0x936) op_mod(0x0) failed, status bad parameter(0x3), syndrome (0x9c2e40) To avoid that and improve FTE removal performance, aggregate the FTE's updates that should be applied. Remove the FTE if it is empty, or apply one FW update command with the aggregated updates. Fixes: a18e879 ("net/mlx5e: Annul encap action ordering requirement") Signed-off-by: Eli Britstein <[email protected]> Reviewed-by: Maor Gottlieb <[email protected]> Reviewed-by: Mark Bloch <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 476d61b commit 718ce4d

File tree

1 file changed

+25
-6
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+25
-6
lines changed

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

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -430,9 +430,6 @@ static void modify_fte(struct fs_fte *fte)
430430
struct mlx5_core_dev *dev;
431431
int err;
432432

433-
if (!fte->modify_mask)
434-
return;
435-
436433
fs_get_obj(fg, fte->node.parent);
437434
fs_get_obj(ft, fg->node.parent);
438435
dev = get_dev(&fte->node);
@@ -475,7 +472,6 @@ static void del_sw_hw_rule(struct fs_node *node)
475472
BIT(MLX5_SET_FTE_MODIFY_ENABLE_MASK_DESTINATION_LIST);
476473
}
477474
out:
478-
modify_fte(fte);
479475
kfree(rule);
480476
}
481477

@@ -602,7 +598,7 @@ static struct fs_fte *alloc_fte(struct mlx5_flow_table *ft,
602598
fte->node.type = FS_TYPE_FLOW_ENTRY;
603599
fte->action = *flow_act;
604600

605-
tree_init_node(&fte->node, del_hw_fte, del_sw_fte);
601+
tree_init_node(&fte->node, NULL, del_sw_fte);
606602

607603
return fte;
608604
}
@@ -1882,10 +1878,33 @@ EXPORT_SYMBOL(mlx5_add_flow_rules);
18821878

18831879
void mlx5_del_flow_rules(struct mlx5_flow_handle *handle)
18841880
{
1881+
struct fs_fte *fte;
18851882
int i;
18861883

1884+
/* In order to consolidate the HW changes we lock the FTE for other
1885+
* changes, and increase its refcount, in order not to perform the
1886+
* "del" functions of the FTE. Will handle them here.
1887+
* The removal of the rules is done under locked FTE.
1888+
* After removing all the handle's rules, if there are remaining
1889+
* rules, it means we just need to modify the FTE in FW, and
1890+
* unlock/decrease the refcount we increased before.
1891+
* Otherwise, it means the FTE should be deleted. First delete the
1892+
* FTE in FW. Then, unlock the FTE, and proceed the tree_put_node of
1893+
* the FTE, which will handle the last decrease of the refcount, as
1894+
* well as required handling of its parent.
1895+
*/
1896+
fs_get_obj(fte, handle->rule[0]->node.parent);
1897+
down_write_ref_node(&fte->node, false);
18871898
for (i = handle->num_rules - 1; i >= 0; i--)
1888-
tree_remove_node(&handle->rule[i]->node, false);
1899+
tree_remove_node(&handle->rule[i]->node, true);
1900+
if (fte->modify_mask && fte->dests_size) {
1901+
modify_fte(fte);
1902+
up_write_ref_node(&fte->node, false);
1903+
} else {
1904+
del_hw_fte(&fte->node);
1905+
up_write(&fte->node.lock);
1906+
tree_put_node(&fte->node, false);
1907+
}
18891908
kfree(handle);
18901909
}
18911910
EXPORT_SYMBOL(mlx5_del_flow_rules);

0 commit comments

Comments
 (0)