[PATCH v6 08/18] net/mlx5: add HW steering counter action

Slava Ovsiienko viacheslavo at nvidia.com
Mon Oct 24 11:45:10 CEST 2022


> -----Original Message-----
> From: Suanming Mou <suanmingm at nvidia.com>
> Sent: Thursday, October 20, 2022 18:42
> To: Matan Azrad <matan at nvidia.com>; Slava Ovsiienko
> <viacheslavo at nvidia.com>; Ray Kinsella <mdr at ashroe.eu>
> Cc: dev at dpdk.org; Raslan Darawsheh <rasland at nvidia.com>; Ori Kam
> <orika at nvidia.com>; Jack Min <jackmin at nvidia.com>
> Subject: [PATCH v6 08/18] net/mlx5: add HW steering counter action
> 
> From: Xiaoyu Min <jackmin at 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 <jackmin at nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo at nvidia.com>



More information about the dev mailing list