diff mbox series

[1/2] net/mlx5: fix the checking for age action

Message ID 20210511042407.5742-1-jiaweiw@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers show
Series [1/2] net/mlx5: fix the checking for age action | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Jiawei Wang May 11, 2021, 4:24 a.m. UTC
Current the ASO age action was supported in the non-root table,
and the counter based age action was be used in the root table.

The FDB table skips group 0 on MLX5 PMD by adding implicit rule
that jump to non-root table, but PMD code use the original group
value for checking.

This patch uses the actual group value for age action checking,

Fixes: f9bc5274a6f9 ("net/mlx5: allow age modes combination")
Cc: stable@dpdk.org

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 70e8d0b113..8eddd850f2 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -12252,12 +12252,16 @@  flow_dv_translate(struct rte_eth_dev *dev,
 				MLX5_FLOW_FATE_QUEUE;
 			break;
 		case MLX5_RTE_FLOW_ACTION_TYPE_AGE:
-			flow->age = (uint32_t)(uintptr_t)(action->conf);
-			age_act = flow_aso_age_get_by_idx(dev, flow->age);
-			__atomic_fetch_add(&age_act->refcnt, 1,
-					   __ATOMIC_RELAXED);
-			age_act_pos = actions_n++;
-			action_flags |= MLX5_FLOW_ACTION_AGE;
+			if (priv->sh->flow_hit_aso_en && (attr->group ||
+			    attr->transfer)) {
+				flow->age = (uint32_t)(uintptr_t)(action->conf);
+				age_act = flow_aso_age_get_by_idx(dev,
+								  flow->age);
+				__atomic_fetch_add(&age_act->refcnt, 1,
+						   __ATOMIC_RELAXED);
+				age_act_pos = actions_n++;
+				action_flags |= MLX5_FLOW_ACTION_AGE;
+			}
 			break;
 		case RTE_FLOW_ACTION_TYPE_AGE:
 			non_shared_age = action->conf;
@@ -12615,7 +12619,7 @@  flow_dv_translate(struct rte_eth_dev *dev,
 				if ((non_shared_age &&
 				     count && !count->shared) ||
 				    !(priv->sh->flow_hit_aso_en &&
-				      attr->group)) {
+				      dev_flow->dv.group)) {
 					/* Creates age by counters. */
 					cnt_act = flow_dv_prepare_counter
 								(dev, dev_flow,
@@ -12628,7 +12632,9 @@  flow_dv_translate(struct rte_eth_dev *dev,
 								cnt_act->action;
 					break;
 				}
-				if (!flow->age && non_shared_age) {
+				if (!flow->age && non_shared_age &&
+				    priv->sh->flow_hit_aso_en &&
+				    dev_flow->dv.group) {
 					flow->age =
 						flow_dv_translate_create_aso_age
 								(dev,
@@ -12641,6 +12647,8 @@  flow_dv_translate(struct rte_eth_dev *dev,
 						     NULL,
 						     "can't create ASO age action");
 				}
+				if (!flow->age)
+					return -rte_errno;
 				age_act = flow_aso_age_get_by_idx(dev,
 								  flow->age);
 				dev_flow->dv.actions[age_act_pos] =