DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jie Wang <jie1x.wang@intel.com>
To: dev@dpdk.org
Cc: stevex.yang@intel.com, orika@nvidia.com,
	aman.deep.singh@intel.com, ferruh.yigit@intel.com,
	thomas@monjalon.net, andrew.rybchenko@oktetlabs.ru,
	jingjing.wu@intel.com, beilei.xing@intel.com,
	qi.z.zhang@intel.com, olivier.matz@6wind.com,
	Jie Wang <jie1x.wang@intel.com>
Subject: [PATCH v5 3/6] app/testpmd: add 6 types of L2TPv2 message
Date: Wed,  9 Feb 2022 17:38:54 +0800	[thread overview]
Message-ID: <20220209093857.79364-4-jie1x.wang@intel.com> (raw)
In-Reply-To: <20220209093857.79364-1-jie1x.wang@intel.com>

This patch adds L2TPv2 control message and 5 types of data message
support for testpmd.

The added L2TPv2 message types are listed below:
1. L2TPv2 control
2. L2TPv2
3. L2TPv2 + length option
4. L2TPv2 + sequence option
5. L2TPv2 + offset option
6. L2TPv2 + length option + sequence option

Signed-off-by: Jie Wang <jie1x.wang@intel.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 app/test-pmd/cmdline_flow.c                 | 313 ++++++++++++++++----
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  35 ++-
 lib/net/rte_l2tpv2.h                        |  13 +
 3 files changed, 308 insertions(+), 53 deletions(-)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 7b56b1b0ff..e0c79d57a3 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -323,13 +323,30 @@ enum index {
 	ITEM_FLEX_ITEM_HANDLE,
 	ITEM_FLEX_PATTERN_HANDLE,
 	ITEM_L2TPV2,
-	ITEM_L2TPV2_COMMON,
-	ITEM_L2TPV2_COMMON_TYPE,
-	ITEM_L2TPV2_COMMON_TYPE_DATA_L,
-	ITEM_L2TPV2_COMMON_TYPE_CTRL,
+	ITEM_L2TPV2_TYPE,
+	ITEM_L2TPV2_TYPE_DATA,
+	ITEM_L2TPV2_TYPE_DATA_L,
+	ITEM_L2TPV2_TYPE_DATA_S,
+	ITEM_L2TPV2_TYPE_DATA_O,
+	ITEM_L2TPV2_TYPE_DATA_L_S,
+	ITEM_L2TPV2_TYPE_CTRL,
+	ITEM_L2TPV2_MSG_DATA_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_SESSION_ID,
 	ITEM_L2TPV2_MSG_DATA_L_LENGTH,
 	ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID,
 	ITEM_L2TPV2_MSG_DATA_L_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_S_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_S_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_S_NS,
+	ITEM_L2TPV2_MSG_DATA_S_NR,
+	ITEM_L2TPV2_MSG_DATA_O_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_O_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_O_OFFSET,
+	ITEM_L2TPV2_MSG_DATA_L_S_LENGTH,
+	ITEM_L2TPV2_MSG_DATA_L_S_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_L_S_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_L_S_NS,
+	ITEM_L2TPV2_MSG_DATA_L_S_NR,
 	ITEM_L2TPV2_MSG_CTRL_LENGTH,
 	ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID,
 	ITEM_L2TPV2_MSG_CTRL_SESSION_ID,
@@ -1451,19 +1468,70 @@ static const enum index item_flex[] = {
 };
 
 static const enum index item_l2tpv2[] = {
-	ITEM_L2TPV2_COMMON,
+	ITEM_L2TPV2_TYPE,
 	ITEM_NEXT,
 	ZERO,
 };
 
-static const enum index item_l2tpv2_common[] = {
-	ITEM_L2TPV2_COMMON_TYPE,
+static const enum index item_l2tpv2_type[] = {
+	ITEM_L2TPV2_TYPE_DATA,
+	ITEM_L2TPV2_TYPE_DATA_L,
+	ITEM_L2TPV2_TYPE_DATA_S,
+	ITEM_L2TPV2_TYPE_DATA_O,
+	ITEM_L2TPV2_TYPE_DATA_L_S,
+	ITEM_L2TPV2_TYPE_CTRL,
 	ZERO,
 };
 
-static const enum index item_l2tpv2_common_type[] = {
-	ITEM_L2TPV2_COMMON_TYPE_DATA_L,
-	ITEM_L2TPV2_COMMON_TYPE_CTRL,
+static const enum index item_l2tpv2_type_data[] = {
+	ITEM_L2TPV2_MSG_DATA_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_SESSION_ID,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_l2tpv2_type_data_l[] = {
+	ITEM_L2TPV2_MSG_DATA_L_LENGTH,
+	ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_L_SESSION_ID,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_l2tpv2_type_data_s[] = {
+	ITEM_L2TPV2_MSG_DATA_S_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_S_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_S_NS,
+	ITEM_L2TPV2_MSG_DATA_S_NR,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_l2tpv2_type_data_o[] = {
+	ITEM_L2TPV2_MSG_DATA_O_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_O_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_O_OFFSET,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_l2tpv2_type_data_l_s[] = {
+	ITEM_L2TPV2_MSG_DATA_L_S_LENGTH,
+	ITEM_L2TPV2_MSG_DATA_L_S_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_DATA_L_S_SESSION_ID,
+	ITEM_L2TPV2_MSG_DATA_L_S_NS,
+	ITEM_L2TPV2_MSG_DATA_L_S_NR,
+	ITEM_NEXT,
+	ZERO,
+};
+
+static const enum index item_l2tpv2_type_ctrl[] = {
+	ITEM_L2TPV2_MSG_CTRL_LENGTH,
+	ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID,
+	ITEM_L2TPV2_MSG_CTRL_SESSION_ID,
+	ITEM_L2TPV2_MSG_CTRL_NS,
+	ITEM_L2TPV2_MSG_CTRL_NR,
+	ITEM_NEXT,
 	ZERO,
 };
 
@@ -3858,31 +3926,46 @@ static const struct token token_list[] = {
 		.next = NEXT(item_l2tpv2),
 		.call = parse_vc,
 	},
-	[ITEM_L2TPV2_COMMON] = {
-		.name = "common",
-		.help = "L2TPv2 common header",
-		.next = NEXT(item_l2tpv2_common),
-	},
-	[ITEM_L2TPV2_COMMON_TYPE] = {
+	[ITEM_L2TPV2_TYPE] = {
 		.name = "type",
-		.help = "type of common header",
-		.next = NEXT(item_l2tpv2_common_type),
+		.help = "type of l2tpv2",
+		.next = NEXT(item_l2tpv2_type),
 		.args = ARGS(ARG_ENTRY_HTON(struct rte_flow_item_l2tpv2)),
 	},
-	[ITEM_L2TPV2_COMMON_TYPE_DATA_L] = {
+	[ITEM_L2TPV2_TYPE_DATA] = {
+		.name = "data",
+		.help = "Type #7: data message without any options",
+		.next = NEXT(item_l2tpv2_type_data),
+		.call = parse_vc_item_l2tpv2_type,
+	},
+	[ITEM_L2TPV2_MSG_DATA_TUNNEL_ID] = {
+		.name = "tunnel_id",
+		.help = "tunnel identifier",
+		.next = NEXT(item_l2tpv2_type_data,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type7.tunnel_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_SESSION_ID] = {
+		.name = "session_id",
+		.help = "session identifier",
+		.next = NEXT(item_l2tpv2_type_data,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type7.session_id)),
+	},
+	[ITEM_L2TPV2_TYPE_DATA_L] = {
 		.name = "data_l",
 		.help = "Type #6: data message with length option",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_DATA_L_LENGTH,
-					ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID,
-					ITEM_L2TPV2_MSG_DATA_L_SESSION_ID,
-					ITEM_NEXT)),
+		.next = NEXT(item_l2tpv2_type_data_l),
 		.call = parse_vc_item_l2tpv2_type,
 	},
 	[ITEM_L2TPV2_MSG_DATA_L_LENGTH] = {
 		.name = "length",
 		.help = "message length",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_DATA_L_LENGTH,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_data_l,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -3891,8 +3974,7 @@ static const struct token token_list[] = {
 	[ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID] = {
 		.name = "tunnel_id",
 		.help = "tunnel identifier",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_DATA_L_TUNNEL_ID,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_data_l,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -3901,29 +3983,150 @@ static const struct token token_list[] = {
 	[ITEM_L2TPV2_MSG_DATA_L_SESSION_ID] = {
 		.name = "session_id",
 		.help = "session identifier",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_DATA_L_SESSION_ID,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_data_l,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
 					     hdr.type6.session_id)),
 	},
-	[ITEM_L2TPV2_COMMON_TYPE_CTRL] = {
+	[ITEM_L2TPV2_TYPE_DATA_S] = {
+		.name = "data_s",
+		.help = "Type #5: data message with ns, nr option",
+		.next = NEXT(item_l2tpv2_type_data_s),
+		.call = parse_vc_item_l2tpv2_type,
+	},
+	[ITEM_L2TPV2_MSG_DATA_S_TUNNEL_ID] = {
+		.name = "tunnel_id",
+		.help = "tunnel identifier",
+		.next = NEXT(item_l2tpv2_type_data_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type5.tunnel_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_S_SESSION_ID] = {
+		.name = "session_id",
+		.help = "session identifier",
+		.next = NEXT(item_l2tpv2_type_data_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type5.session_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_S_NS] = {
+		.name = "ns",
+		.help = "sequence number for message",
+		.next = NEXT(item_l2tpv2_type_data_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type5.ns)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_S_NR] = {
+		.name = "nr",
+		.help = "sequence number for next receive message",
+		.next = NEXT(item_l2tpv2_type_data_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type5.nr)),
+	},
+	[ITEM_L2TPV2_TYPE_DATA_O] = {
+		.name = "data_o",
+		.help = "Type #4: data message with offset option",
+		.next = NEXT(item_l2tpv2_type_data_o),
+		.call = parse_vc_item_l2tpv2_type,
+	},
+	[ITEM_L2TPV2_MSG_DATA_O_TUNNEL_ID] = {
+		.name = "tunnel_id",
+		.help = "tunnel identifier",
+		.next = NEXT(item_l2tpv2_type_data_o,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type4.tunnel_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_O_SESSION_ID] = {
+		.name = "session_id",
+		.help = "session identifier",
+		.next = NEXT(item_l2tpv2_type_data_o,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type5.session_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_O_OFFSET] = {
+		.name = "offset_size",
+		.help = "the size of offset padding",
+		.next = NEXT(item_l2tpv2_type_data_o,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type4.offset_size)),
+	},
+	[ITEM_L2TPV2_TYPE_DATA_L_S] = {
+		.name = "data_l_s",
+		.help = "Type #3: data message contains length, ns, nr "
+			"options",
+		.next = NEXT(item_l2tpv2_type_data_l_s),
+		.call = parse_vc_item_l2tpv2_type,
+	},
+	[ITEM_L2TPV2_MSG_DATA_L_S_LENGTH] = {
+		.name = "length",
+		.help = "message length",
+		.next = NEXT(item_l2tpv2_type_data_l_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type3.length)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_L_S_TUNNEL_ID] = {
+		.name = "tunnel_id",
+		.help = "tunnel identifier",
+		.next = NEXT(item_l2tpv2_type_data_l_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type3.tunnel_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_L_S_SESSION_ID] = {
+		.name = "session_id",
+		.help = "session identifier",
+		.next = NEXT(item_l2tpv2_type_data_l_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type3.session_id)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_L_S_NS] = {
+		.name = "ns",
+		.help = "sequence number for message",
+		.next = NEXT(item_l2tpv2_type_data_l_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type3.ns)),
+	},
+	[ITEM_L2TPV2_MSG_DATA_L_S_NR] = {
+		.name = "nr",
+		.help = "sequence number for next receive message",
+		.next = NEXT(item_l2tpv2_type_data_l_s,
+			     NEXT_ENTRY(COMMON_UNSIGNED),
+			     item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
+					     hdr.type3.nr)),
+	},
+	[ITEM_L2TPV2_TYPE_CTRL] = {
 		.name = "control",
-		.help = "Type #3: conrtol message contains length, ns, nr options",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_LENGTH,
-					ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID,
-					ITEM_L2TPV2_MSG_CTRL_SESSION_ID,
-					ITEM_L2TPV2_MSG_CTRL_NS,
-					ITEM_L2TPV2_MSG_CTRL_NR,
-					ITEM_NEXT)),
+		.help = "Type #3: conrtol message contains length, ns, nr "
+			"options",
+		.next = NEXT(item_l2tpv2_type_ctrl),
 		.call = parse_vc_item_l2tpv2_type,
 	},
 	[ITEM_L2TPV2_MSG_CTRL_LENGTH] = {
 		.name = "length",
 		.help = "message length",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_LENGTH,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_ctrl,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -3932,8 +4135,7 @@ static const struct token token_list[] = {
 	[ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID] = {
 		.name = "tunnel_id",
 		.help = "tunnel identifier",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_TUNNEL_ID,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_ctrl,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -3942,8 +4144,7 @@ static const struct token token_list[] = {
 	[ITEM_L2TPV2_MSG_CTRL_SESSION_ID] = {
 		.name = "session_id",
 		.help = "session identifier",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_SESSION_ID,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_ctrl,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -3952,8 +4153,7 @@ static const struct token token_list[] = {
 	[ITEM_L2TPV2_MSG_CTRL_NS] = {
 		.name = "ns",
 		.help = "sequence number for message",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_NS,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_ctrl,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -3962,8 +4162,7 @@ static const struct token token_list[] = {
 	[ITEM_L2TPV2_MSG_CTRL_NR] = {
 		.name = "nr",
 		.help = "sequence number for next receive message",
-		.next = NEXT(NEXT_ENTRY(ITEM_L2TPV2_MSG_CTRL_NS,
-					ITEM_L2TPV2_COMMON, ITEM_NEXT),
+		.next = NEXT(item_l2tpv2_type_ctrl,
 			     NEXT_ENTRY(COMMON_UNSIGNED),
 			     item_param),
 		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv2,
@@ -5904,11 +6103,23 @@ parse_vc_item_l2tpv2_type(struct context *ctx, const struct token *token,
 	if (parse_default(ctx, token, str, len, NULL, 0) < 0)
 		return -1;
 	switch (ctx->curr) {
-	case ITEM_L2TPV2_COMMON_TYPE_DATA_L:
-		msg_type |= 0x4000;
+	case ITEM_L2TPV2_TYPE_DATA:
+		msg_type |= RTE_L2TPV2_MSG_TYPE_DATA;
+		break;
+	case ITEM_L2TPV2_TYPE_DATA_L:
+		msg_type |= RTE_L2TPV2_MSG_TYPE_DATA_L;
+		break;
+	case ITEM_L2TPV2_TYPE_DATA_S:
+		msg_type |= RTE_L2TPV2_MSG_TYPE_DATA_S;
+		break;
+	case ITEM_L2TPV2_TYPE_DATA_O:
+		msg_type |= RTE_L2TPV2_MSG_TYPE_DATA_O;
+		break;
+	case ITEM_L2TPV2_TYPE_DATA_L_S:
+		msg_type |= RTE_L2TPV2_MSG_TYPE_DATA_L_S;
 		break;
-	case ITEM_L2TPV2_COMMON_TYPE_CTRL:
-		msg_type |= 0xC800;
+	case ITEM_L2TPV2_TYPE_CTRL:
+		msg_type |= RTE_L2TPV2_MSG_TYPE_CONTROL;
 		break;
 	default:
 		return -1;
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f8adcb0a40..f957f2b0ab 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3857,6 +3857,7 @@ This section lists supported pattern items and their attributes, if any.
   - ``session_id {unsigned}``: L2TPv2 session identifier.
   - ``ns {unsigned}``: L2TPv2 option ns.
   - ``nr {unsigned}``: L2TPv2 option nr.
+  - ``offset_size {unsigned}``: L2TPv2 option offset.
 
 - ``ppp``: match PPP header.
 
@@ -5090,11 +5091,19 @@ The meter policy action list: ``green -> green, yellow -> yellow, red -> red``.
    testpmd> create port meter 0 1 13 1 yes 0xffff 0 0
    testpmd> flow create 0 priority 0 ingress group 1 pattern eth / end actions meter mtr_id 1 / end
 
-Sample PPPoL2TPv2oUDP RSS rules
+Sample L2TPv2 RSS rules
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-PPPoL2TPv2oUDP RSS rules can be created by the following commands::
+L2TPv2 RSS rules can be created by the following commands:
 
+::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control
+          / end actions rss types l2tpv2 end queues end / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / end
+          actions rss types eth l2-src-only end queues end / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / end
+          actions rss types l2tpv2 end queues end / end
  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
           / end actions rss types ipv4 end queues end / end
  testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv6
@@ -5104,6 +5113,28 @@ PPPoL2TPv2oUDP RSS rules can be created by the following commands::
  testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6
           / end actions rss types ipv6 end queues end / end
 
+Sample L2TPv2 FDIR rules
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+L2TPv2 FDIR rules can be created by the following commands:
+
+::
+
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type control
+          session_id is 0x1111 / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth src is 00:00:00:00:00:01 / ipv4
+          / udp / l2tpv2 type data / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 type data
+          session_id is 0x1111 / ppp / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
+          src is 10.0.0.1 / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv6 / udp / l2tpv2 / ppp / ipv6
+          dst is ABAB:910B:6666:3457:8295:3333:1800:2929 / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
+          / udp src is 22 / end actions queue index 3 / end
+ testpmd> flow create 0 ingress pattern eth / ipv4 / udp / l2tpv2 / ppp / ipv4
+          / tcp dst is 23 / end actions queue index 3 / end
+
 Sample RAW rule
 ~~~~~~~~~~~~~~~
 
diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h
index 1f3ad3f03c..d41123a504 100644
--- a/lib/net/rte_l2tpv2.h
+++ b/lib/net/rte_l2tpv2.h
@@ -78,6 +78,19 @@
 extern "C" {
 #endif
 
+/*
+ * L2TPv2 Message Type
+ */
+#define RTE_L2TPV2_MSG_TYPE_CONTROL	0xC802
+#define RTE_L2TPV2_MSG_TYPE_DATA	0x0002
+#define RTE_L2TPV2_MSG_TYPE_DATA_L	0x4002
+#define RTE_L2TPV2_MSG_TYPE_DATA_S	0x0802
+#define RTE_L2TPV2_MSG_TYPE_DATA_O	0x0202
+#define RTE_L2TPV2_MSG_TYPE_DATA_L_S	0x4802
+#define RTE_L2TPV2_MSG_TYPE_DATA_L_O	0x4202
+#define RTE_L2TPV2_MSG_TYPE_DATA_S_O	0x0A02
+#define RTE_L2TPV2_MSG_TYPE_DATA_L_S_O	0x4A02
+
 /**
  * L2TPv2 Common Header
  */
-- 
2.25.1


  parent reply	other threads:[~2022-02-09  9:39 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-29  6:24 [PATCH v3 0/6] support L2TPv2 for AVF RSS hash and FDIR Jie Wang
2022-01-29  6:24 ` [PATCH v3 1/6] ethdev: add L2TPv2 RSS offload type Jie Wang
2022-01-30  9:15   ` Ori Kam
2022-02-01 12:19   ` Ferruh Yigit
2022-01-29  6:24 ` [PATCH v3 2/6] net: fix L2TPv2 common header Jie Wang
2022-01-30  9:17   ` Ori Kam
2022-02-01 12:20     ` Ferruh Yigit
2022-01-29  6:24 ` [PATCH v3 3/6] app/testpmd: add 6 types of L2TPv2 message Jie Wang
2022-01-30  9:19   ` Ori Kam
2022-01-29  6:24 ` [PATCH v3 4/6] common/iavf: add session ID fields for L2TPv2 Jie Wang
2022-01-29  6:24 ` [PATCH v3 5/6] net/iavf: support L2TPv2 for AVF HASH Jie Wang
2022-01-29  6:24 ` [PATCH v3 6/6] net/iavf: support L2TPv2 for AVF FDIR Jie Wang
2022-02-01 12:22 ` [PATCH v3 0/6] support L2TPv2 for AVF RSS hash and FDIR Ferruh Yigit
2022-02-08  8:38 ` [PATCH v4 " Jie Wang
2022-02-08  8:38   ` [PATCH v4 1/6] ethdev: add L2TPv2 RSS offload type Jie Wang
2022-02-08 13:13     ` Ferruh Yigit
2022-02-08 14:43       ` Ferruh Yigit
2022-02-08  8:38   ` [PATCH v4 2/6] net: fix L2TPv2 common header Jie Wang
2022-02-08  8:38   ` [PATCH v4 3/6] app/testpmd: add 6 types of L2TPv2 message Jie Wang
2022-02-08  8:38   ` [PATCH v4 4/6] common/iavf: add session ID fields for L2TPv2 Jie Wang
2022-02-08  8:38   ` [PATCH v4 5/6] net/iavf: support L2TPv2 for AVF HASH Jie Wang
2022-02-09  7:01     ` Xing, Beilei
2022-02-09  7:43       ` Wang, Jie1X
2022-02-09  8:17       ` Zhang, Qi Z
2022-02-08  8:38   ` [PATCH v4 6/6] net/iavf: support L2TPv2 for AVF FDIR Jie Wang
2022-02-09  7:30     ` Xing, Beilei
2022-02-09  7:45       ` Wang, Jie1X
2022-02-08 14:44   ` [PATCH v4 0/6] support L2TPv2 for AVF RSS hash and FDIR Ferruh Yigit
2022-02-09  8:20     ` Zhang, Qi Z
2022-02-09  9:38   ` [PATCH v5 " Jie Wang
2022-02-09  9:38     ` [PATCH v5 1/6] ethdev: add L2TPv2 RSS offload type Jie Wang
2022-02-09 20:42       ` Ferruh Yigit
2022-02-09  9:38     ` [PATCH v5 2/6] net: fix L2TPv2 common header Jie Wang
2022-02-09  9:38     ` Jie Wang [this message]
2022-02-09  9:38     ` [PATCH v5 4/6] common/iavf: add session ID fields for L2TPv2 Jie Wang
2022-02-11  1:37       ` Zhang, Qi Z
2022-02-09  9:38     ` [PATCH v5 5/6] net/iavf: support L2TPv2 for AVF HASH Jie Wang
2022-02-09 12:21       ` Xing, Beilei
2022-02-09  9:38     ` [PATCH v5 6/6] net/iavf: support L2TPv2 for AVF FDIR Jie Wang
2022-02-09 20:44     ` [PATCH v5 0/6] support L2TPv2 for AVF RSS hash and FDIR Ferruh Yigit
2022-02-10  2:13       ` Wang, Jie1X

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220209093857.79364-4-jie1x.wang@intel.com \
    --to=jie1x.wang@intel.com \
    --cc=aman.deep.singh@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=orika@nvidia.com \
    --cc=qi.z.zhang@intel.com \
    --cc=stevex.yang@intel.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).