]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5: Introduce mapping infra for mapping unique ids to data
authorPaul Blakey <paulb@mellanox.com>
Sun, 16 Feb 2020 10:01:25 +0000 (12:01 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 20 Feb 2020 01:49:48 +0000 (17:49 -0800)
commit4d10b151dc922cc22a2f647080899aa49f77e57d
tree209c283fc516e9236e7cff8caac37955da20492e
parent31fb806a8fa1cf4547e48f10f9a87b8a05482d5a
net/mlx5: Introduce mapping infra for mapping unique ids to data

Add a new interface for mapping data to a given id range (max_id),
and back again. It uses xarray as the id allocator and for finding a
given id. For locking it uses xa_lock (spin_lock) for add()/del(),
and rcu_read_lock for find().

This mapping interface also supports delaying the mapping removal via
a workqueue. This is for cases where we need the mapping to have
some grace period in regards to finding it back again, for example
for packets arriving from hardware that were marked with by a rule
with an old mapping that no longer exists.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/Makefile
drivers/net/ethernet/mellanox/mlx5/core/en/mapping.c [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/en/mapping.h [new file with mode: 0644]