[PATCH] net/mlx5: fix the counters resource leak

Raslan Darawsheh rasland at nvidia.com
Tue Jan 6 14:14:32 CET 2026


Hi,


On 05/01/2026 9:05 AM, Bing Zhao wrote:
> The counters that are used to record the dropped packets (including
> hairpin) are created firstly. Then the counter objects are provided
> to the command to create the Rx queues, and they are used for the
> global drop and hairpin queues drop statistics. One counter can be
> associated with more than one queue in hairpin case.
> 
> So the reference count of a counter will be increased once attached
> to a queue. When closing the device, the queues and counters should
> be destroyed in the reverse order. The queues should be destroyed
> firstly in order to decrease the reference count of attached counter
> properlly. Then the counter can be recycled successfully. Or else the
> resource will be leaked before the application quits when doing port
> attach / detach rerepeatedly.
> 
> Fixes: f0c0731b6d40 ("net/mlx5: add counters for hairpin drop")
> Cc: shperetz at nvidia.com
> Cc: stable at dpdk.org
> 
> Signed-off-by: Bing Zhao <bingz at nvidia.com>
> Acked-by: Suanming Mou <suanmingm at nvidia.com>

Patch applied to next-net-mlx,


Kindest regards
Raslan Darawsheh



More information about the stable mailing list