DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wang Ying A <ying.a.wang@intel.com>
To: qi.z.zhang@intel.com, ferruh.yigit@intel.com
Cc: dev@dpdk.org, adrien.mazarguil@6wind.com, xiaolong.ye@intel.com,
	qiming.yang@intel.com, ying.a.wang@intel.com
Subject: [dpdk-dev] [PATCH v4 1/2] ethdev: add GTP extension header to flow API
Date: Wed, 28 Aug 2019 14:00:37 +0800	[thread overview]
Message-ID: <20190828060038.437857-2-ying.a.wang@intel.com> (raw)
In-Reply-To: <20190828060038.437857-1-ying.a.wang@intel.com>

- RTE_FLOW_ITEM_TYPE_GTP_PSC: matches a GTP
  PDU extension header (PDU session container).

Signed-off-by: Wang Ying A <ying.a.wang@intel.com>
---
 app/test-pmd/cmdline_flow.c                 | 36 +++++++++++++++++++++++++++++
 doc/guides/prog_guide/rte_flow.rst          |  9 ++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  5 ++++
 lib/librte_ethdev/rte_flow.c                |  1 +
 lib/librte_ethdev/rte_flow.h                | 27 ++++++++++++++++++++++
 5 files changed, 78 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 495871394..944a3e852 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -196,6 +196,9 @@ enum index {
 	ITEM_META_DATA,
 	ITEM_GRE_KEY,
 	ITEM_GRE_KEY_VALUE,
+	ITEM_GTP_PSC,
+	ITEM_GTP_PSC_QFI,
+	ITEM_GTP_PSC_PDU_T,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -663,6 +666,7 @@ static const enum index next_item[] = {
 	ITEM_ICMP6_ND_OPT_TLA_ETH,
 	ITEM_META,
 	ITEM_GRE_KEY,
+	ITEM_GTP_PSC,
 	END_SET,
 	ZERO,
 };
@@ -902,6 +906,13 @@ static const enum index item_meta[] = {
 	ZERO,
 };
 
+static const enum index item_gtp_psc[] = {
+	ITEM_GTP_PSC_QFI,
+	ITEM_GTP_PSC_PDU_T,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -2331,6 +2342,28 @@ static const struct token token_list[] = {
 		.next = NEXT(item_gre_key, NEXT_ENTRY(UNSIGNED), item_param),
 		.args = ARGS(ARG_ENTRY_HTON(rte_be32_t)),
 	},
+	[ITEM_GTP_PSC] = {
+		.name = "gtp_psc",
+		.help = "match GTP extension header with type 0x85",
+		.priv = PRIV_ITEM(GTP_PSC,
+				sizeof(struct rte_flow_item_gtp_psc)),
+		.next = NEXT(item_gtp_psc),
+		.call = parse_vc,
+	},
+	[ITEM_GTP_PSC_QFI] = {
+		.name = "qfi",
+		.help = "QoS flow identifier",
+		.next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc,
+					qfi)),
+	},
+	[ITEM_GTP_PSC_PDU_T] = {
+		.name = "pdu_t",
+		.help = "PDU type",
+		.next = NEXT(item_gtp_psc, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp_psc,
+					pdu_type)),
+	},
 
 	/* Validate/create actions. */
 	[ACTIONS] = {
@@ -5756,6 +5789,9 @@ flow_item_default_mask(const struct rte_flow_item *item)
 	case RTE_FLOW_ITEM_TYPE_ESP:
 		mask = &rte_flow_item_esp_mask;
 		break;
+	case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+		mask = &rte_flow_item_gtp_psc_mask;
+		break;
 	default:
 		break;
 	}
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 821b524b3..7521a1ec4 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -1205,6 +1205,15 @@ Matches an application specific 32 bit metadata item.
 
 - Default ``mask`` matches the specified metadata value.
 
+Item: ``GTP_PSC``
+^^^^^^^^^^^^^^^^^
+
+Matches a GTP PDU extension header with type 0x85.
+
+- ``pdu_type``: PDU type.
+- ``qfi``: QoS flow identifier.
+- Default ``mask`` matches QFI 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 313e0707e..4f71ae234 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3955,6 +3955,11 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``data {unsigned}``: metadata value.
 
+- ``gtp_psc``: match GTP PDU extension header with type 0x85.
+
+  - ``pdu_type {unsigned}``: PDU type.
+  - ``qfi {unsigned}``: QoS flow identifier.
+
 Actions list
 ^^^^^^^^^^^^
 
diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index 18fcb018e..fb25219d1 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -75,6 +75,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(MARK, sizeof(struct rte_flow_item_mark)),
 	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)),
 };
 
 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index b66bf1495..8bb37aafb 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -434,6 +434,15 @@ enum rte_flow_item_type {
 	 * @code rte_be32_t * @endcode
 	 */
 	RTE_FLOW_ITEM_TYPE_GRE_KEY,
+
+	/**
+	 * Matches a GTP extension header: PDU session container.
+	 *
+	 * Configure flow for GTP packets with extension header type 0x85.
+	 *
+	 * See struct rte_flow_item_gtp_psc.
+	 */
+	RTE_FLOW_ITEM_TYPE_GTP_PSC,
 };
 
 /**
@@ -1192,6 +1201,24 @@ static const struct rte_flow_item_meta rte_flow_item_meta_mask = {
 };
 #endif
 
+/**
+ * RTE_FLOW_ITEM_TYPE_GTP_PSC.
+ *
+ * Matches a GTP PDU extension header with type 0x85.
+ */
+struct rte_flow_item_gtp_psc {
+	uint8_t pdu_type; /**< PDU type. */
+	uint8_t qfi; /**< QoS flow identifier. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_GTP_PSC. */
+#ifndef __cplusplus
+static const struct rte_flow_item_gtp_psc
+rte_flow_item_gtp_psc_mask = {
+	.qfi = 0x3f,
+};
+#endif
+
 /**
  * @warning
  * @b EXPERIMENTAL: this structure may change without prior notice
-- 
2.15.1


  reply	other threads:[~2019-08-28  6:17 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         ` Wang Ying A [this message]
2019-09-28 19:02           ` [dpdk-dev] [PATCH v4 1/2] ethdev: add GTP extension header " 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     ` [dpdk-dev] [PATCH v3 2/2] ethdev: add PPPoE " Wang Ying A

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=20190828060038.437857-2-ying.a.wang@intel.com \
    --to=ying.a.wang@intel.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --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).