From: Rory Sexton <rory.sexton@intel.com>
To: dev@dpdk.org, qi.z.zhang@intel.com, beilei.xing@intel.com,
adrien.mazarguil@6wind.com, orika@mellanox.com
Cc: Rory Sexton <rory.sexton@intel.com>,
Dariusz Jagus <dariuszx.jagus@intel.com>
Subject: [dpdk-dev] [PATCH v3 1/2] ethdev: add L2TPv3 over IP header to flow API
Date: Tue, 7 Jan 2020 15:39:45 +0000 [thread overview]
Message-ID: <20200107153946.6876-1-rory.sexton@intel.com> (raw)
This patch adds the new flow item RTE_FLOW_ITEM_TYPE_L2TPV3OIP to
flow API to match a L2TPv3 over IP header. This patch supports only
L2TPv3 over IP header format which is different to L2TPv2/L2TPv3
over UDP. The difference in header formats between L2TPv3 over IP
and L2TP over UDP require a separate implementation for each.
Signed-off-by: Rory Sexton <rory.sexton@intel.com>
Signed-off-by: Dariusz Jagus <dariuszx.jagus@intel.com>
---
v3 changes: adding testpmd docs updates
---
app/test-pmd/cmdline_flow.c | 33 +++++++++++++++++++++
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 | 29 +++++++++++++++++-
5 files changed, 74 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 99dade7d8..72a792d93 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_L2TPV3OIP,
+ ITEM_L2TPV3OIP_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_L2TPV3OIP,
END_SET,
ZERO,
};
@@ -1030,6 +1033,12 @@ static const enum index item_tag[] = {
ZERO,
};
+static const enum index item_l2tpv3oip[] = {
+ ITEM_L2TPV3OIP_SESSION_ID,
+ ITEM_NEXT,
+ ZERO,
+};
+
static const enum index next_action[] = {
ACTION_END,
ACTION_VOID,
@@ -2593,6 +2602,22 @@ static const struct token token_list[] = {
NEXT_ENTRY(ITEM_PARAM_IS)),
.args = ARGS(ARGS_ENTRY(struct rte_flow_item_tag, index)),
},
+ [ITEM_L2TPV3OIP] = {
+ .name = "l2tpv3oip",
+ .help = "match L2TPv3 over IP header",
+ .priv = PRIV_ITEM(L2TPV3OIP,
+ sizeof(struct rte_flow_item_l2tpv3oip)),
+ .next = NEXT(item_l2tpv3oip),
+ .call = parse_vc,
+ },
+ [ITEM_L2TPV3OIP_SESSION_ID] = {
+ .name = "session_id",
+ .help = "session identifier",
+ .next = NEXT(item_l2tpv3oip, NEXT_ENTRY(UNSIGNED), item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_l2tpv3oip,
+ session_id)),
+ },
+
/* Validate/create actions. */
[ACTIONS] = {
.name = "actions",
@@ -6238,6 +6263,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_L2TPV3OIP:
+ mask = &rte_flow_item_l2tpv3oip_mask;
+ break;
default:
break;
}
@@ -6327,6 +6356,10 @@ cmd_set_raw_parsed(const struct buffer *in)
case RTE_FLOW_ITEM_TYPE_GENEVE:
size = sizeof(struct rte_flow_item_geneve);
break;
+ case RTE_FLOW_ITEM_TYPE_L2TPV3OIP:
+ size = sizeof(struct rte_flow_item_l2tpv3oip);
+ proto = 0x73;
+ break;
default:
printf("Error - Not supported item\n");
*total_size = 0;
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index a254c81ef..d4cef4621 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: ``L2TPV3OIP``
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches a L2TPv3 over IP header.
+
+- ``session_id``: L2TPv3 over IP 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..5e6935829 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.
+- ``l2tpv3oip``: match L2TPv3 over IP header.
+
+ - ``session_id {unsigned}``: L2TPv3 over IP session identifier.
+
Actions list
^^^^^^^^^^^^
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 87a3e8c4c..4d130be77 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(L2TPV3OIP, sizeof(struct rte_flow_item_l2tpv3oip)),
};
/** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 452d359a1..8c7f6c12a 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -502,7 +502,7 @@ enum rte_flow_item_type {
*/
RTE_FLOW_ITEM_TYPE_HIGIG2,
- /*
+ /**
* [META]
*
* Matches a tag value.
@@ -510,6 +510,16 @@ enum rte_flow_item_type {
* See struct rte_flow_item_tag.
*/
RTE_FLOW_ITEM_TYPE_TAG,
+
+ /**
+ * Matches a L2TPv3 over IP header.
+ *
+ * Configure flow for L2TPv3 over IP packets.
+ *
+ * See struct rte_flow_item_l2tpv3oip.
+ */
+ RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
+
};
/**
@@ -1373,6 +1383,23 @@ static const struct rte_flow_item_tag rte_flow_item_tag_mask = {
};
#endif
+/**
+ * RTE_FLOW_ITEM_TYPE_L2TPV3OIP.
+ *
+ * Matches a L2TPv3 over IP header.
+ */
+struct rte_flow_item_l2tpv3oip {
+ rte_be32_t session_id; /**< Session ID. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_L2TPV3OIP. */
+#ifndef __cplusplus
+static const struct rte_flow_item_l2tpv3oip rte_flow_item_l2tpv3oip_mask = {
+ .session_id = RTE_BE32(UINT32_MAX),
+};
+#endif
+
+
/**
* @warning
* @b EXPERIMENTAL: this structure may change without prior notice
--
2.17.1
next reply other threads:[~2020-01-07 15:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-07 15:39 Rory Sexton [this message]
2020-01-07 15:39 ` [dpdk-dev] [PATCH v3 2/2] net/i40e: support FDIR for L2TPv3 over IP Rory Sexton
2020-01-10 18:27 ` Ferruh Yigit
2020-01-13 3:22 ` Xing, Beilei
2020-01-13 8:07 ` Xing, Beilei
2020-01-13 10:42 ` Sexton, Rory
2020-01-10 18:26 ` [dpdk-dev] [PATCH v3 1/2] ethdev: add L2TPv3 over IP header to flow API Ferruh Yigit
2020-01-12 10:57 ` Ori Kam
2020-01-12 10:56 ` Ori Kam
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=20200107153946.6876-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=orika@mellanox.com \
--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).