net/mlx5e: Protect tc flows hashtable with rcu
authorVlad Buslov <vladbu@mellanox.com>
Wed, 10 Oct 2018 10:51:10 +0000 (13:51 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Mon, 29 Jul 2019 23:40:25 +0000 (16:40 -0700)
commitc5d326b29603bad4e5342801414b7302ba010209
treebe4fc89bd44a3eae9be803abb32b30bb21ed74b8
parent226f2ca3075ab20abf69c68235e8ba9ac2dab596
net/mlx5e: Protect tc flows hashtable with rcu

In order to remove dependency on rtnl lock, access to tc flows hashtable
must be explicitly protected from concurrent flows removal.

Extend tc flow structure with rcu to allow concurrent parallel access. Use
rcu read lock to safely lookup flow in tc flows hash table, and take
reference to it. Use rcu free for flow deletion to accommodate concurrent
stats requests.

Add new DELETED flow flag. Imlement new flow_flag_test_and_set() helper
that is used to set a flag and return its previous value. Use it to
atomically set the flag in mlx5e_delete_flower() to guarantee that flow can
only be deleted once, even when same flow is deleted concurrently by
multiple tasks.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Reviewed-by: Jianbo Liu <jianbol@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c