net/mlx5: fix check in count action validation
authorMichael Baum <michaelba@nvidia.com>
Mon, 28 Feb 2022 07:09:54 +0000 (09:09 +0200)
committerRaslan Darawsheh <rasland@nvidia.com>
Tue, 1 Mar 2022 21:24:53 +0000 (22:24 +0100)
commit57461cab161ac2c8cc1a96711efba9a8fa519358
tree667f30541070feea79e3e30f98e33a091a6cf2b9
parent8f53c7cf2660a2a5d2a61fefe987491bce50edde
net/mlx5: fix check in count action validation

The AGE action can be implemented by either counters or ASO mechanism.
ASO is more efficient than generating counters just for the purpose of
aging, so when ASO is supported its use is preferable. On the other
hand, when there is count in the list of actions, the counter is already
generated, and it is best to use it for aging even if ASO is supported.
On the other hand, when the count action is "indirect", it cannot be
used for aging since it may be updated from other flow rules in which it
participates.

Checking whether ASO is supported depends on both the capability of the
device and the flow rule group number, ASO is not supported for group 0.
However, the flow_dv_validate() function only checks the capability and
ignores the group, allowing inadmissible flow rules.
For example, when the device supports ASO and a flow rule is set that
combines an indirect counter with aging for group 0, the rule should be
rejected, but it is created and does not function properly.

This patch updates the counter validation which will also consider the
group number when deciding if there is ASO support.

Fixes: daed4b6e3db2 ("net/mlx5: use aging by counter when counter exists")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_flow_dv.c