From: Wang Ying A <ying.a.wang@intel.com>
To: qi.z.zhang@intel.com, adrien.mazarguil@6wind.com
Cc: xiaolong.ye@intel.com, qiming.yang@intel.com, dev@dpdk.org,
ying.a.wang@intel.com
Subject: [dpdk-dev] [PATCH v3 2/2] ethdev: add PPPoE to flow API
Date: Tue, 20 Aug 2019 14:50:59 +0800 [thread overview]
Message-ID: <20190820065059.62140-3-ying.a.wang@intel.com> (raw)
In-Reply-To: <20190820065059.62140-1-ying.a.wang@intel.com>
- RTE_FLOW_ITEM_TYPE_PPPOES: matches a PPPoE session header.
- RTE_FLOW_ITEM_TYPE_PPPOED: matches a PPPoE discovery header.
- RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID: matches a PPPoE session
protocol identifier.
Signed-off-by: Wang Ying A <ying.a.wang@intel.com>
---
app/test-pmd/cmdline_flow.c | 51 +++++++++++++++++++++-
doc/guides/prog_guide/rte_flow.rst | 19 +++++++++
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 ++++
lib/librte_ethdev/rte_flow.c | 4 ++
lib/librte_ethdev/rte_flow.h | 66 +++++++++++++++++++++++++++++
5 files changed, 147 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 944a3e852..a19fb65f2 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -199,6 +199,10 @@ enum index {
ITEM_GTP_PSC,
ITEM_GTP_PSC_QFI,
ITEM_GTP_PSC_PDU_T,
+ ITEM_PPPOES,
+ ITEM_PPPOED,
+ ITEM_PPPOE_SEID,
+ ITEM_PPPOE_PROTO_ID,
/* Validate/create actions. */
ACTIONS,
@@ -667,6 +671,9 @@ static const enum index next_item[] = {
ITEM_META,
ITEM_GRE_KEY,
ITEM_GTP_PSC,
+ ITEM_PPPOES,
+ ITEM_PPPOED,
+ ITEM_PPPOE_PROTO_ID,
END_SET,
ZERO,
};
@@ -913,6 +920,18 @@ static const enum index item_gtp_psc[] = {
ZERO,
};
+static const enum index item_pppoe[] = {
+ ITEM_PPPOE_SEID,
+ ITEM_NEXT,
+ ZERO,
+};
+
+static const enum index item_pppoe_proto_id[] = {
+ ITEM_PPPOE_PROTO_ID,
+ ITEM_NEXT,
+ ZERO,
+};
+
static const enum index next_action[] = {
ACTION_END,
ACTION_VOID,
@@ -2364,7 +2383,35 @@ static const struct token token_list[] = {
.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc,
pdu_type)),
},
-
+ [ITEM_PPPOES] = {
+ .name = "pppoe",
+ .help = "match PPPoE session header",
+ .priv = PRIV_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)),
+ .next = NEXT(item_pppoe),
+ .call = parse_vc,
+ },
+ [ITEM_PPPOED] = {
+ .name = "pppoe",
+ .help = "match PPPoE discovery header",
+ .priv = PRIV_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)),
+ .next = NEXT(item_pppoe),
+ .call = parse_vc,
+ },
+ [ITEM_PPPOE_SEID] = {
+ .name = "seid",
+ .help = "session identifier",
+ .next = NEXT(item_pppoe, NEXT_ENTRY(UNSIGNED), item_param),
+ .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_pppoe,
+ session_id)),
+ },
+ [ITEM_PPPOE_PROTO_ID] = {
+ .name = "proto_id",
+ .help = "match PPPoE session protocol identifier",
+ .priv = PRIV_ITEM(PPPOE_PROTO_ID,
+ sizeof(struct rte_flow_item_pppoe_proto_id)),
+ .next = NEXT(item_pppoe_proto_id),
+ .call = parse_vc,
+ },
/* Validate/create actions. */
[ACTIONS] = {
.name = "actions",
@@ -5792,6 +5839,8 @@ flow_item_default_mask(const struct rte_flow_item *item)
case RTE_FLOW_ITEM_TYPE_GTP_PSC:
mask = &rte_flow_item_gtp_psc_mask;
break;
+ case RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID:
+ mask = &rte_flow_item_pppoe_proto_id_mask;
default:
break;
}
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 7521a1ec4..ff6fb1186 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1214,6 +1214,25 @@ Matches a GTP PDU extension header with type 0x85.
- ``qfi``: QoS flow identifier.
- Default ``mask`` matches QFI only.
+Item: ``PPPOES``, ``PPPOED``
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches a PPPoE header.
+
+- ``version_type``: version (4b), type (4b).
+- ``code``: message type.
+- ``session_id``: session identifier.
+- ``length``: payload length.
+
+Item: ``PPPOE_PROTO_ID``
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches a PPPoE session protocol identifier.
+
+- ``proto_id``: PPP protocol identifier.
+- Default ``mask`` matches proto_id only.
+
+
.. _table_rte_flow_item_meta:
.. table:: META
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 4f71ae234..bc2ebe7b1 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3960,6 +3960,14 @@ This section lists supported pattern items and their attributes, if any.
- ``pdu_type {unsigned}``: PDU type.
- ``qfi {unsigned}``: QoS flow identifier.
+- ``pppoes``, ``pppoed``: match PPPoE header.
+
+ - ``session_id {unsigned}``: session identifier.
+
+- ``pppoe_proto_id``: match PPPoE session protocol identifier.
+
+ - ``proto_id {unsigned}``: PPP protocol identifier.
+
Actions list
^^^^^^^^^^^^
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index fb25219d1..cc03b159f 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -76,6 +76,10 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
MK_FLOW_ITEM(META, sizeof(struct rte_flow_item_meta)),
MK_FLOW_ITEM(GRE_KEY, sizeof(rte_be32_t)),
MK_FLOW_ITEM(GTP_PSC, sizeof(struct rte_flow_item_gtp_psc)),
+ MK_FLOW_ITEM(PPPOES, sizeof(struct rte_flow_item_pppoe)),
+ MK_FLOW_ITEM(PPPOED, sizeof(struct rte_flow_item_pppoe)),
+ MK_FLOW_ITEM(PPPOE_PROTO_ID,
+ sizeof(struct rte_flow_item_pppoe_proto_id)),
};
/** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 8bb37aafb..09d1db4b3 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -443,6 +443,33 @@ enum rte_flow_item_type {
* See struct rte_flow_item_gtp_psc.
*/
RTE_FLOW_ITEM_TYPE_GTP_PSC,
+
+ /**
+ * Matches a PPPoE header.
+ *
+ * Configure flow for PPPoE session packets.
+ *
+ * See struct rte_flow_item_pppoe.
+ */
+ RTE_FLOW_ITEM_TYPE_PPPOES,
+
+ /**
+ * Matches a PPPoE header.
+ *
+ * Configure flow for PPPoE discovery packets.
+ *
+ * See struct rte_flow_item_pppoe.
+ */
+ RTE_FLOW_ITEM_TYPE_PPPOED,
+
+ /**
+ * Matches a PPPoE optional proto_id field.
+ *
+ * It only applies to PPPoE session packets.
+ *
+ * See struct rte_flow_item_pppoe_proto_id.
+ */
+ RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID,
};
/**
@@ -1219,6 +1246,45 @@ rte_flow_item_gtp_psc_mask = {
};
#endif
+/**
+ * RTE_FLOW_ITEM_TYPE_PPPOE.
+ *
+ * Matches a PPPoE header.
+ */
+struct rte_flow_item_pppoe {
+ /**
+ * Version (4b), type (4b).
+ */
+ uint8_t version_type;
+ uint8_t code; /**< Message type. */
+ rte_be16_t session_id; /**< Session identifier. */
+ rte_be16_t length; /**< Payload length. */
+};
+
+/**
+ * RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID.
+ *
+ * Matches a PPPoE optional proto_id field.
+ *
+ * It only applies to PPPoE session packets.
+ *
+ * Normally preceded by any of:
+ *
+ * - RTE_FLOW_ITEM_TYPE_PPPOE
+ * - RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID
+ */
+struct rte_flow_item_pppoe_proto_id {
+ rte_be16_t proto_id; /**< PPP protocol identifier. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_PPPOE_PROTO_ID. */
+#ifndef __cplusplus
+static const struct rte_flow_item_pppoe_proto_id
+rte_flow_item_pppoe_proto_id_mask = {
+ .proto_id = RTE_BE16(0xffff),
+};
+#endif
+
/**
* @warning
* @b EXPERIMENTAL: this structure may change without prior notice
--
2.15.1
prev parent reply other threads:[~2019-08-20 7:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-14 3:00 [dpdk-dev] [PATCH] ethdev: add more protocol support in " Wang Ying A
2019-08-14 3:24 ` [dpdk-dev] [PATCH v2] " Wang Ying A
2019-08-14 9:08 ` Adrien Mazarguil
2019-08-19 11:53 ` Zhang, Qi Z
2019-08-20 6:50 ` [dpdk-dev] [PATCH v3 0/2] add GTP/PPPoE to " Wang Ying A
2019-08-20 6:50 ` [dpdk-dev] [PATCH v3 1/2] ethdev: add GTP extension header " Wang Ying A
2019-08-28 6:00 ` [dpdk-dev] [PATCH v4 0/2] add GTP/PPPoE " Wang Ying A
2019-08-28 6:00 ` [dpdk-dev] [PATCH v4 1/2] ethdev: add GTP extension header " Wang Ying A
2019-09-28 19:02 ` Ori Kam
2019-08-28 6:00 ` [dpdk-dev] [PATCH v4 2/2] ethdev: add PPPoE " Wang Ying A
2019-09-28 19:05 ` Ori Kam
2019-09-23 23:44 ` [dpdk-dev] [PATCH v4 0/2] add GTP/PPPoE " Zhang, Qi Z
2019-10-01 7:52 ` Ferruh Yigit
2019-08-20 6:50 ` Wang Ying A [this message]
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=20190820065059.62140-3-ying.a.wang@intel.com \
--to=ying.a.wang@intel.com \
--cc=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@intel.com \
--cc=xiaolong.ye@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).