net/mlx5: fix use of atomic cmpset for age state
authorDekel Peled <dekelp@nvidia.com>
Thu, 15 Oct 2020 11:44:24 +0000 (14:44 +0300)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 3 Nov 2020 21:29:25 +0000 (22:29 +0100)
commit90e30c748801eaabb14c25c87550df01e9aaa6a9
treea0cd0ac9c9f0ee4e80a7cc13a4ce410ac5885a63
parent491757372f98acbc6aa346730a55ed4cd2bfd676
net/mlx5: fix use of atomic cmpset for age state

According to documentation [1], function rte_atomic16_cmpset()
return value is non-zero on success; 0 on failure.
In existing code this function is called, and the return value
is compared to AGE_CANDIDATE, which is defined as 1.
Such comparison is incorrect and can lead to unwanted behavior.

This patch updates the calls to rte_atomic16_cmpset(), to check
that the return value is 0 or non-zero.

[1] https://doc.dpdk.org/api/rte__atomic_8h.html

Fixes: fa2d01c87d2b ("net/mlx5: support flow aging")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_flow.c
drivers/net/mlx5/mlx5_flow_dv.c