[PATCH v2] ethdev: add support for flow action pop E-tag

kirankumark at marvell.com kirankumark at marvell.com
Tue Apr 22 07:47:17 CEST 2025


From: Kiran Kumar K <kirankumark at marvell.com>

Add support for the following OpenFlow-defined action.

RTE_FLOW_ACTION_TYPE_OF_POP_ETAG: Pop E-tag from the packet.

Signed-off-by: Kiran Kumar K <kirankumark at marvell.com>
---
*V2 Changes:
- Address comment related to order of enum values

 app/test-pmd/cmdline_flow.c |  9 +++++++++
 lib/ethdev/rte_flow.c       |  1 +
 lib/ethdev/rte_flow.h       | 10 +++++++++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 998527590f..b486bfd348 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -651,6 +651,7 @@ enum index {
 	ACTION_METER_COLOR_MODE,
 	ACTION_METER_STATE,
 	ACTION_OF_DEC_NW_TTL,
+	ACTION_OF_POP_ETAG,
 	ACTION_OF_POP_VLAN,
 	ACTION_OF_PUSH_VLAN,
 	ACTION_OF_PUSH_VLAN_ETHERTYPE,
@@ -2274,6 +2275,7 @@ static const enum index next_action[] = {
 	ACTION_METER_MARK,
 	ACTION_METER_MARK_CONF,
 	ACTION_OF_DEC_NW_TTL,
+	ACTION_OF_POP_ETAG,
 	ACTION_OF_POP_VLAN,
 	ACTION_OF_PUSH_VLAN,
 	ACTION_OF_SET_VLAN_VID,
@@ -6925,6 +6927,13 @@ static const struct token token_list[] = {
 		.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
 		.call = parse_vc,
 	},
+	[ACTION_OF_POP_ETAG] = {
+		.name = "of_pop_etag",
+		.help = "OpenFlow's OFPAT_POP_ETAG",
+		.priv = PRIV_ACTION(OF_POP_ETAG, 0),
+		.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
+		.call = parse_vc,
+	},
 	[ACTION_OF_POP_VLAN] = {
 		.name = "of_pop_vlan",
 		.help = "OpenFlow's OFPAT_POP_VLAN",
diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c
index 9f8d8f3dc2..3d227f3bc5 100644
--- a/lib/ethdev/rte_flow.c
+++ b/lib/ethdev/rte_flow.c
@@ -212,6 +212,7 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = {
 	MK_FLOW_ACTION(METER, sizeof(struct rte_flow_action_meter)),
 	MK_FLOW_ACTION(SECURITY, sizeof(struct rte_flow_action_security)),
 	MK_FLOW_ACTION(OF_DEC_NW_TTL, 0),
+	MK_FLOW_ACTION(OF_POP_ETAG, 0),
 	MK_FLOW_ACTION(OF_POP_VLAN, 0),
 	MK_FLOW_ACTION(OF_PUSH_VLAN,
 		       sizeof(struct rte_flow_action_of_push_vlan)),
diff --git a/lib/ethdev/rte_flow.h b/lib/ethdev/rte_flow.h
index 3d2ccdeb92..fb4f4bf9b7 100644
--- a/lib/ethdev/rte_flow.h
+++ b/lib/ethdev/rte_flow.h
@@ -3201,7 +3201,7 @@ enum rte_flow_action_type {
 	 * @see struct rte_flow_query_quota
 	 * @see struct rte_flow_update_quota
 	 */
-	 RTE_FLOW_ACTION_TYPE_QUOTA,
+	RTE_FLOW_ACTION_TYPE_QUOTA,

 	/**
 	 * Skip congestion management configuration.
@@ -3263,6 +3263,14 @@ enum rte_flow_action_type {
 	 * @see struct rte_flow_action_jump_to_table_index.
 	 */
 	RTE_FLOW_ACTION_TYPE_JUMP_TO_TABLE_INDEX,
+
+	/**
+	 * Implements POP_ETAG ("pop the outer 802.1BR Etag") as defined
+	 * by the OpenFlow Switch Specification.
+	 *
+	 * No associated configuration structure.
+	 */
+	RTE_FLOW_ACTION_TYPE_OF_POP_ETAG,
 };

 /**
--
2.48.1



More information about the dev mailing list