For object which wants efficient index allocate and free, local cache will be very helpful.
Two level cache is added, one as local and another as global. The global cache is able to save all the allocated index. That means all the allocated index will not be freed. Once the local cache is full, the extra index will be flushed to the global cache. Once local cache is empty, first try to fetch more index from global, if global is still empty, allocate new trunk and more index. Suanming Mou (4): net/mlx5: add index allocate with up limit net/mlx5: add indexed pool local cache net/mlx5: add index pool cache flush net/mlx5: replace flow list with index pool drivers/net/mlx5/linux/mlx5_os.c | 11 + drivers/net/mlx5/mlx5.c | 3 +- drivers/net/mlx5/mlx5.h | 4 +- drivers/net/mlx5/mlx5_flow.c | 111 ++++------ drivers/net/mlx5/mlx5_flow.h | 1 + drivers/net/mlx5/mlx5_flow_dv.c | 5 + drivers/net/mlx5/mlx5_trigger.c | 8 +- drivers/net/mlx5/mlx5_utils.c | 337 ++++++++++++++++++++++++++++++- drivers/net/mlx5/mlx5_utils.h | 69 ++++++- 9 files changed, 463 insertions(+), 86 deletions(-) -- 2.25.1