Skip to contentSkip to conversation

net/mlx5: support HW flag action

PATCH In review Shun Hao 2 participants 2 messages May 28, 2024 – Jun 3, 2024 Network drivers

lore
Share & tools
lore

Shun Hao

author
#0 lore raw

PATCH 1/1 net/mlx5: support HW flag action

The HW flag action is supported by adding the tag to packet, with the default tag value.

---
 drivers/net/mlx5/mlx5_flow_hw.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/net/mlx5/mlx5_flow_hw.c +14 -0
index 68c5a36bbb..9274a18ae0 100644
@@ -2292,6 +2292,15 @@ __flow_hw_actions_translate(struct rte_eth_dev *dev,
 			}
 			acts->rule_acts[dr_pos].action = priv->hw_def_miss;
 			break;
+		case RTE_FLOW_ACTION_TYPE_FLAG:
+			acts->mark = true;
+			acts->rule_acts[dr_pos].tag.value =
+				mlx5_flow_mark_set(MLX5_FLOW_MARK_DEFAULT);
+			acts->rule_acts[dr_pos].action =
+				priv->hw_tag[!!attr->group];
+			__atomic_add_fetch(&priv->hws_mark_refcnt, 1, __ATOMIC_RELAXED);
+			flow_hw_rxq_flag_set(dev, true);
+			break;
 		case RTE_FLOW_ACTION_TYPE_MARK:
 			acts->mark = true;
 			if (masks->conf &&
@@ -6415,6 +6424,10 @@ mlx5_flow_hw_actions_validate(struct rte_eth_dev *dev,
 			if (ret < 0)
 				return ret;
 			break;
+		case RTE_FLOW_ACTION_TYPE_FLAG:
+			/* TODO: Validation logic */
+			action_flags |= MLX5_FLOW_ACTION_FLAG;
+			break;
 		case RTE_FLOW_ACTION_TYPE_MARK:
 			/* TODO: Validation logic */
 			action_flags |= MLX5_FLOW_ACTION_MARK;
@@ -6606,6 +6619,7 @@ flow_hw_actions_validate(struct rte_eth_dev *dev,
 
 static enum mlx5dr_action_type mlx5_hw_dr_action_types[] = {
 	[RTE_FLOW_ACTION_TYPE_MARK] = MLX5DR_ACTION_TYP_TAG,
+	[RTE_FLOW_ACTION_TYPE_FLAG] = MLX5DR_ACTION_TYP_TAG,
 	[RTE_FLOW_ACTION_TYPE_DROP] = MLX5DR_ACTION_TYP_DROP,
 	[RTE_FLOW_ACTION_TYPE_JUMP] = MLX5DR_ACTION_TYP_TBL,
 	[RTE_FLOW_ACTION_TYPE_QUEUE] = MLX5DR_ACTION_TYP_TIR,
Signature · 1 line
2.20.0
Acked-by Suanming Mou on v1 1/1
#1 lore raw

Hi,

From: Shun Hao <[email protected]>
Sent: Tuesday, May 28, 2024 12:43 PM
To: Slava Ovsiienko; Matan Azrad; Ori Kam; Dariusz Sosnowski; Suanming Mou
Cc: [email protected]; Raslan Darawsheh
Subject: [PATCH] net/mlx5: support HW flag action

The HW flag action is supported by adding the tag to packet, with the default tag value.

---

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh