net/mlx5e: Extend hairpin entry with reference counter
authorVlad Buslov <vladbu@mellanox.com>
Fri, 8 Jun 2018 16:26:50 +0000 (19:26 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Fri, 9 Aug 2019 21:54:08 +0000 (14:54 -0700)
commite4f9abbd38e468c73710ad3678005ad05f79c818
tree0cf24788744eda89fb9508b6f32e46337506d9cd
parentca497fb6aa9fbd3b0a87fd0a71e9e1df2600ac30
net/mlx5e: Extend hairpin entry with reference counter

List of flows attached to hairpin entry is used as implicit reference
counter (hairpin entry is deallocated when list becomes free) and as a
mechanism to obtain hairpin entry that flow is attached to (through list
head). This is not safe when concurrent modification of list of flows
attached to hairpin entry is possible. Proper atomic reference counter is
required to support concurrent access.

As a preparation for extending hairpin with reference counting, extract
code that deletes hairpin entry into standalone function. In order to
remove this dependency on external locking, extend hairpin entry with
reference counter to manage its lifetime and extend flow structure with
direct pointer to hairpin 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>
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c