diff options
author | Vlad Buslov <vladbu@mellanox.com> | 2018-06-03 20:31:47 +0300 |
---|---|---|
committer | Saeed Mahameed <saeedm@mellanox.com> | 2019-08-09 14:54:10 -0700 |
commit | 948993f2beebbdc1c9d926cfdad9827cf6bb67c0 (patch) | |
tree | 274340778e3f71a940ea92f8f8816329a5541589 /drivers/net/ethernet/mellanox/mlx5/core/en_tc.h | |
parent | net/mlx5e: Allow concurrent creation of mod_hdr entries (diff) | |
download | linux-dev-948993f2beebbdc1c9d926cfdad9827cf6bb67c0.tar.xz linux-dev-948993f2beebbdc1c9d926cfdad9827cf6bb67c0.zip |
net/mlx5e: Extend encap entry with reference counter
List of flows attached to encap entry is used as implicit reference
counter (encap entry is deallocated when list becomes free) and as a
mechanism to obtain encap entry that flow is attached to (through list
head). This is not safe when concurrent modification of list of flows
attached to encap entry is possible. Proper atomic reference counter is
required to support concurrent access.
As a preparation for extending encap with reference counting, extract code
that lookups and deletes encap entry into standalone put/get helpers. In
order to remove this dependency on external locking, extend encap entry
with reference counter to manage its lifetime and extend flow structure
with direct pointer to encap entry that flow is attached to.
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>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/en_tc.h')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx5/core/en_tc.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h index 20f045e96c92..ea2072e2fe84 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.h @@ -75,6 +75,8 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv, struct mlx5e_encap_entry *e); void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv, struct mlx5e_encap_entry *e); +bool mlx5e_encap_take(struct mlx5e_encap_entry *e); +void mlx5e_encap_put(struct mlx5e_priv *priv, struct mlx5e_encap_entry *e); struct mlx5e_neigh_hash_entry; void mlx5e_tc_update_neigh_used_value(struct mlx5e_neigh_hash_entry *nhe); |