> -----Original Message-----
> From: Suanming Mou <suanmi...@nvidia.com>
> Sent: Thursday, October 20, 2022 18:42
> To: Matan Azrad <ma...@nvidia.com>; Slava Ovsiienko
> <viachesl...@nvidia.com>; Ray Kinsella <m...@ashroe.eu>
> Cc: dev@dpdk.org; Raslan Darawsheh <rasl...@nvidia.com>; Ori Kam
> <or...@nvidia.com>; Jack Min <jack...@nvidia.com>
> Subject: [PATCH v6 08/18] net/mlx5: add HW steering counter action
>
> From: Xiaoyu Min <jack...@nvidia.com>
>
> This commit adds HW steering counter action support.
> Pool mechanism is the basic data structure for the HW steering counter.
>
> The HW steering's counter pool is based on the rte_ring of zero-copy
> variation.
>
> There are two global rte_rings:
> 1. free_list:
> Store the counters indexes, which are ready for use.
> 2. wait_reset_list:
> Store the counters indexes, which are just freed from the user and
> need to query the hardware counter to get the reset value before
> this counter can be reused again.
>
> The counter pool also supports cache per HW steering's queues, which are
> also based on rte_ring of zero-copy variation.
>
> The cache can be configured in size, preload, threshold, and fetch size,
> they are all exposed via device args.
>
> The main operations of the counter pool are as follows:
>
> - Get one counter from the pool:
> 1. The user call _get_* API.
> 2. If the cache is enabled, dequeue one counter index from the local
> cache:
> 2.A: if the dequeued one from the local cache is still in reset
> status (counter's query_gen_when_free is equal to pool's query
> gen):
> I. Flush all counters in local cache back to global
> wait_reset_list.
> II. Fetch _fetch_sz_ counters into the cache from the global
> free list.
> III. Fetch one counter from the cache.
> 3. If the cache is empty, fetch _fetch_sz_ counters from the global
> free list into the cache and fetch one counter from the cache.
> - Free one counter into the pool:
> 1. The user calls _put_* API.
> 2. Put the counter into the local cache.
> 3. If the local cache is full:
> 3.A: Write back all counters above _threshold_ into the global
> wait_reset_list.
> 3.B: Also, write back this counter into the global wait_reset_list.
>
> When the local cache is disabled, _get_/_put_ cache directly from/into
> global list.
>
> Signed-off-by: Xiaoyu Min <jack...@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viachesl...@nvidia.com>