net/mlx5: fix meter action pool protection
authorJiawei Wang <jiaweiw@nvidia.com>
Mon, 1 Nov 2021 06:30:40 +0000 (08:30 +0200)
committerRaslan Darawsheh <rasland@nvidia.com>
Mon, 1 Nov 2021 13:53:36 +0000 (14:53 +0100)
commit7797b0fe64463d46b0c91f61bacc01a48e23f8e8
treefa566a40638bd5e116fffbca47dcfae69663a84b
parent7cf2d15a399255eca96746948a715f678736eebf
net/mlx5: fix meter action pool protection

The ASO meter action with flows creation could be supported on
multiple threads. The meter pools were created to manage the meter
object resources, if there is no room in the current meter pool then
resize the meter pool to the new pool size and free the old one.

There's a race condition while one thread resizes the meter pool and
the old pool resource be freed, and another thread query the meter
object by index on the old pool, the return value is invalid.

This patch adds a read-write lock to protect the pool resource while
resizing and query.

Fixes: a5835d530f00 ("net/mlx5: optimize Rx queue match")
Cc: stable@dpdk.org
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5.c
drivers/net/mlx5/mlx5.h
drivers/net/mlx5/mlx5_flow.h
drivers/net/mlx5/mlx5_flow_dv.c
drivers/net/mlx5/mlx5_flow_meter.c