DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rory Sexton <rory.sexton@intel.com>
To: dev@dpdk.org
Cc: qi.z.zhang@intel.com, beilei.xing@intel.com,
	rory.sexton@intel.com, adrien.mazarguil@6wind.com,
	Dariusz Jagus <dariuszx.jagus@intel.com>
Subject: [dpdk-dev] [PATCH] ethdev: add L2TPv3 header to flow API
Date: Wed,  4 Dec 2019 14:10:54 +0000	[thread overview]
Message-ID: <20191204141055.3647-1-rory.sexton@intel.com> (raw)

- RTE_FLOW_ITEM_TYPE_L2TPV3: matches a L2TPv3 header

Signed-off-by: Rory Sexton <rory.sexton@intel.com>
Signed-off-by: Dariusz Jagus <dariuszx.jagus@intel.com>
---
 app/test-pmd/cmdline_flow.c                 | 28 +++++++++++++++++++++
 doc/guides/prog_guide/rte_flow.rst          |  8 ++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  4 +++
 lib/librte_ethdev/rte_flow.c                |  1 +
 lib/librte_ethdev/rte_flow.h                | 27 ++++++++++++++++++++
 5 files changed, 68 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 99dade7d8..a7fe7a7a8 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -213,6 +213,8 @@ enum index {
 	ITEM_TAG,
 	ITEM_TAG_DATA,
 	ITEM_TAG_INDEX,
+	ITEM_L2TPV3,
+	ITEM_L2TPV3_SESSION_ID,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -746,6 +748,7 @@ static const enum index next_item[] = {
 	ITEM_PPPOE_PROTO_ID,
 	ITEM_HIGIG2,
 	ITEM_TAG,
+	ITEM_L2TPV3,
 	END_SET,
 	ZERO,
 };
@@ -1030,6 +1033,12 @@ static const enum index item_tag[] = {
 	ZERO,
 };
 
+static const enum index item_l2tpv3[] = {
+	ITEM_L2TPV3_SESSION_ID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -2593,6 +2602,21 @@ static const struct token token_list[] = {
 			     NEXT_ENTRY(ITEM_PARAM_IS)),
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag, index)),
 	},
+	[ITEM_L2TPV3] = {
+		.name = "l2tpv3",
+		.help = "match L2TPv3 header",
+		.priv = PRIV_ITEM(L2TPV3, sizeof(struct rte_flow_item_l2tpv3)),
+		.next = NEXT(item_l2tpv3),
+		.call = parse_vc,
+	},
+	[ITEM_L2TPV3_SESSION_ID] = {
+		.name = "session_id",
+		.help = "session identifier",
+		.next = NEXT(item_l2tpv3, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv3,
+					     session_id)),
+	},
+
 	/* Validate/create actions. */
 	[ACTIONS] = {
 		.name = "actions",
@@ -6238,6 +6262,10 @@ flow_item_default_mask(const struct rte_flow_item *item)
 		break;
 	case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
 		mask = &rte_flow_item_pppoe_proto_id_mask;
+		break;
+	case RTE_FLOW_ITEM_TYPE_L2TPV3:
+		mask = &rte_flow_item_l2tpv3_mask;
+		break;
 	default:
 		break;
 	}
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index a254c81ef..c7ddb38c5 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1336,6 +1336,14 @@ Broadcom switches.
 
 - Default ``mask`` matches classification and vlan.
 
+Item: ``L2TPV3``
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches a L2TPv3 header.
+
+- ``session_id``: L2TPv3 session identifier.
+- Default ``mask`` matches session_id only.
+
 
 Actions
 ~~~~~~~
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 73ef0b41d..a48e77619 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3954,6 +3954,10 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``proto_id {unsigned}``: PPP protocol identifier.
 
+- ``l2tpv3``: match L2TPv3 header.
+
+  - ``session_id {unsigned}``: L2TPv3 session identifier.
+
 Actions list
 ^^^^^^^^^^^^
 
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 87a3e8c4c..fcda73320 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -93,6 +93,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(IGMP, sizeof(struct rte_flow_item_igmp)),
 	MK_FLOW_ITEM(AH, sizeof(struct rte_flow_item_ah)),
 	MK_FLOW_ITEM(HIGIG2, sizeof(struct rte_flow_item_higig2_hdr)),
+	MK_FLOW_ITEM(L2TPV3, sizeof(struct rte_flow_item_l2tpv3)),
 };
 
 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 452d359a1..5ee055c28 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -510,6 +510,16 @@ enum rte_flow_item_type {
 	 * See struct rte_flow_item_tag.
 	 */
 	RTE_FLOW_ITEM_TYPE_TAG,
+
+	/*
+	 * Matches a L2TPv3 header.
+	 *
+	 * Configure flow for L2TPv3 packets.
+	 *
+	 * See struct rte_flow_item_l2tpv3.
+	 */
+	RTE_FLOW_ITEM_TYPE_L2TPV3,
+
 };
 
 /**
@@ -1373,6 +1383,23 @@ static const struct rte_flow_item_tag rte_flow_item_tag_mask = {
 };
 #endif
 
+/**
+ * RTE_FLOW_ITEM_TYPE_L2TPV3.
+ *
+ * Matches a L2TPv3 header.
+ */
+struct rte_flow_item_l2tpv3 {
+	rte_be32_t session_id; /**< Session ID. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV3. */
+#ifndef __cplusplus
+static const struct rte_flow_item_l2tpv3 rte_flow_item_l2tpv3_mask = {
+	.session_id = RTE_BE32(UINT32_MAX),
+};
+#endif
+
+
 /**
  * @warning
  * @b EXPERIMENTAL: this structure may change without prior notice
-- 
2.17.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.


             reply	other threads:[~2019-12-04 14:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-04 14:10 Rory Sexton [this message]
2019-12-04 14:10 ` [dpdk-dev] [PATCH] net/i40e: Add new customized pctype for l2tpv3 Rory Sexton
2019-12-11 22:51   ` Xing, Beilei
2019-12-13 11:17     ` Sexton, Rory
2019-12-13 17:33       ` Xing, Beilei
2019-12-16 10:13         ` Sexton, Rory
2019-12-10 10:16 ` [dpdk-dev] [PATCH] ethdev: add L2TPv3 header to flow API Ori Kam
2019-12-10 14:52   ` Sexton, Rory
2019-12-10 20:32     ` Ori Kam
2019-12-11 11:36       ` Sexton, Rory
2019-12-11 13:30         ` Ori Kam
2019-12-11 16:31           ` Sexton, Rory
2019-12-12 13:38             ` Sexton, Rory

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=20191204141055.3647-1-rory.sexton@intel.com \
    --to=rory.sexton@intel.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=beilei.xing@intel.com \
    --cc=dariuszx.jagus@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    /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).