All of lore.kernel.org
 help / color / mirror / Atom feed
From: Beilei Xing <beilei.xing@intel.com>
To: jingjing.wu@intel.com
Cc: andrey.chilikin@intel.com, dev@dpdk.org
Subject: [PATCH v4 4/8] ethdev: add GTP items to support flow API
Date: Thu, 28 Sep 2017 10:17:30 +0800	[thread overview]
Message-ID: <1506565054-67690-5-git-send-email-beilei.xing@intel.com> (raw)
In-Reply-To: <1506565054-67690-1-git-send-email-beilei.xing@intel.com>

This patch adds GTP, GTPC and GTPU items for
generic flow API, and also exposes item fields
through the flow command.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 app/test-pmd/cmdline_flow.c                 | 40 ++++++++++++++++++++++
 app/test-pmd/config.c                       |  3 ++
 doc/guides/prog_guide/rte_flow.rst          | 18 ++++++++++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  4 +++
 lib/librte_ether/rte_flow.h                 | 52 +++++++++++++++++++++++++++++
 5 files changed, 117 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index a17a004..26c3e4f 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -171,6 +171,10 @@ enum index {
 	ITEM_GRE_PROTO,
 	ITEM_FUZZY,
 	ITEM_FUZZY_THRESH,
+	ITEM_GTP,
+	ITEM_GTP_TEID,
+	ITEM_GTPC,
+	ITEM_GTPU,
 
 	/* Validate/create actions. */
 	ACTIONS,
@@ -451,6 +455,9 @@ static const enum index next_item[] = {
 	ITEM_MPLS,
 	ITEM_GRE,
 	ITEM_FUZZY,
+	ITEM_GTP,
+	ITEM_GTPC,
+	ITEM_GTPU,
 	ZERO,
 };
 
@@ -588,6 +595,12 @@ static const enum index item_gre[] = {
 	ZERO,
 };
 
+static const enum index item_gtp[] = {
+	ITEM_GTP_TEID,
+	ITEM_NEXT,
+	ZERO,
+};
+
 static const enum index next_action[] = {
 	ACTION_END,
 	ACTION_VOID,
@@ -1421,6 +1434,33 @@ static const struct token token_list[] = {
 		.args = ARGS(ARGS_ENTRY(struct rte_flow_item_fuzzy,
 					thresh)),
 	},
+	[ITEM_GTP] = {
+		.name = "gtp",
+		.help = "match GTP header",
+		.priv = PRIV_ITEM(GTP, sizeof(struct rte_flow_item_gtp)),
+		.next = NEXT(item_gtp),
+		.call = parse_vc,
+	},
+	[ITEM_GTP_TEID] = {
+		.name = "teid",
+		.help = "tunnel endpoint identifier",
+		.next = NEXT(item_gtp, NEXT_ENTRY(UNSIGNED), item_param),
+		.args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gtp, teid)),
+	},
+	[ITEM_GTPC] = {
+		.name = "gtpc",
+		.help = "match GTP header",
+		.priv = PRIV_ITEM(GTPC, sizeof(struct rte_flow_item_gtp)),
+		.next = NEXT(item_gtp),
+		.call = parse_vc,
+	},
+	[ITEM_GTPU] = {
+		.name = "gtpu",
+		.help = "match GTP header",
+		.priv = PRIV_ITEM(GTPU, sizeof(struct rte_flow_item_gtp)),
+		.next = NEXT(item_gtp),
+		.call = parse_vc,
+	},
 
 	/* Validate/create actions. */
 	[ACTIONS] = {
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index e8e311c..9b09bbd 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -949,6 +949,9 @@ static const struct {
 	MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)),
 	MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)),
 	MK_FLOW_ITEM(FUZZY, sizeof(struct rte_flow_item_fuzzy)),
+	MK_FLOW_ITEM(GTP, sizeof(struct rte_flow_item_gtp)),
+	MK_FLOW_ITEM(GTPC, sizeof(struct rte_flow_item_gtp)),
+	MK_FLOW_ITEM(GTPU, sizeof(struct rte_flow_item_gtp)),
 };
 
 /** Compute storage space needed by item specification. */
diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index 662a912..1bc8f19 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -955,6 +955,24 @@ Usage example, fuzzy match a TCPv4 packets:
    | 4     | END      |
    +-------+----------+
 
+Item: ``GTP``, ``GTPC``, ``GTPU``
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Matches a GTP header.
+
+Note: GTP, GTPC and GTPU use the same structure. Since only UDP destination port
+is used to distinguish GTP_C (port is 2123) and GTP_U packets (port is 2152),
+GTPC and GTPU item are defined for a user-friendly API when creating GTP-C and
+GTP-U flow.
+
+- ``v_pt_rsv_flags``: version (3b), protocol type (1b), reserved (1b),
+  extension header flag (1b), sequence number flag (1b), N-PDU number
+  flag (1b).
+- ``msg_type``: message type.
+- ``msg_len``: message length.
+- ``teid``: tunnel endpoint identifier.
+- Default ``mask`` matches teid only.
+
 Actions
 ~~~~~~~
 
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index 2ed62f5..8cc2399 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -2696,6 +2696,10 @@ This section lists supported pattern items and their attributes, if any.
 
   - ``thresh {unsigned}``: accuracy threshold.
 
+- ``gtp``, ``gtpc``, ``gtpu``: match GTP header.
+
+  - ``teid {unsigned}``: tunnel endpoint identifier.
+
 Actions list
 ^^^^^^^^^^^^
 
diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
index bba6169..5da3aff 100644
--- a/lib/librte_ether/rte_flow.h
+++ b/lib/librte_ether/rte_flow.h
@@ -309,6 +309,33 @@ enum rte_flow_item_type {
 	 * See struct rte_flow_item_fuzzy.
 	 */
 	RTE_FLOW_ITEM_TYPE_FUZZY,
+
+	/**
+	 * Matches a GTP header.
+	 *
+	 * Configure flow for GTP packets.
+	 *
+	 * See struct rte_flow_item_gtp.
+	 */
+	RTE_FLOW_ITEM_TYPE_GTP,
+
+	/**
+	 * Matches a GTP header.
+	 *
+	 * Configure flow for GTP-C packets.
+	 *
+	 * See struct rte_flow_item_gtp.
+	 */
+	RTE_FLOW_ITEM_TYPE_GTPC,
+
+	/**
+	 * Matches a GTP header.
+	 *
+	 * Configure flow for GTP-U packets.
+	 *
+	 * See struct rte_flow_item_gtp.
+	 */
+	RTE_FLOW_ITEM_TYPE_GTPU,
 };
 
 /**
@@ -735,6 +762,31 @@ static const struct rte_flow_item_fuzzy rte_flow_item_fuzzy_mask = {
 #endif
 
 /**
+ * RTE_FLOW_ITEM_TYPE_GTP.
+ *
+ * Matches a GTP header.
+ */
+struct rte_flow_item_gtp {
+	/**
+	 * Version (2b), protocol type (1b), reserved (1b),
+	 * Extension header flag (1b),
+	 * Sequence number flag (1b),
+	 * N-PDU number flag (1b).
+	 */
+	uint8_t v_pt_rsv_flags;
+	uint8_t msg_type; /**< Message type. */
+	rte_be16_t msg_len; /**< Message length. */
+	rte_be32_t teid; /**< Tunnel endpoint identifier. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_GTP. */
+#ifndef __cplusplus
+static const struct rte_flow_item_gtp rte_flow_item_gtp_mask = {
+	.teid = RTE_BE32(0xffffffff),
+};
+#endif
+
+/**
  * Matching pattern item definition.
  *
  * A pattern is formed by stacking items starting from the lowest protocol
-- 
2.5.5

  parent reply	other threads:[~2017-09-27 13:25 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25  7:50 [PATCH 0/7] GTP enabling Beilei Xing
2017-08-25  7:50 ` [PATCH 1/7] net/i40e: support RSS for GTP-C and GTP-U Beilei Xing
2017-09-07 11:20   ` [PATCH v2 0/6] GPT-C and GTP-U enabling Beilei Xing
2017-09-07 11:20     ` [PATCH v2 1/6] net/i40e: support RSS for GTP-C and GTP-U Beilei Xing
2017-09-18 14:17       ` Bruce Richardson
2017-09-18 14:21         ` Bruce Richardson
2017-09-07 11:20     ` [PATCH v2 2/6] ethdev: add GTPC and GTPU items Beilei Xing
2017-09-07 12:19       ` Adrien Mazarguil
2017-09-12  6:40         ` Xing, Beilei
2017-09-12 10:46           ` Adrien Mazarguil
2017-09-13  3:09             ` Xing, Beilei
2017-09-07 11:21     ` [PATCH v2 3/6] net/i40e: finish integration FDIR with generic flow API Beilei Xing
2017-09-07 11:21     ` [PATCH v2 4/6] net/i40e: add FDIR support for GTP-C and GTP-U Beilei Xing
2017-09-07 11:21     ` [PATCH v2 5/6] net/i40e: add cloud filter parsing function for GTP Beilei Xing
2017-09-07 11:21     ` [PATCH v2 6/6] net/i40e: enable cloud filter for GTP-C and GTP-U Beilei Xing
2017-09-22 22:35     ` [PATCH v3 0/8] GPT-C and GTP-U enabling Beilei Xing
2017-09-22 22:35       ` [PATCH v3 1/8] mbuf: support GTP in software packet type parser Beilei Xing
2017-09-25  9:21         ` Olivier MATZ
2017-09-28  2:17         ` [PATCH v4 0/8] GPT-C and GTP-U enabling Beilei Xing
2017-09-28  2:17           ` [PATCH v4 1/8] mbuf: support GTP in software packet type parser Beilei Xing
2017-09-28  2:17           ` [PATCH v4 2/8] net/i40e: update ptype and pctype info Beilei Xing
2017-09-28  2:17           ` [PATCH v4 3/8] net/i40e: support RSS for new pctype Beilei Xing
2017-09-28  2:17           ` Beilei Xing [this message]
2017-09-28  2:17           ` [PATCH v4 5/8] net/i40e: finish integration FDIR with generic flow API Beilei Xing
2017-09-28  2:17           ` [PATCH v4 6/8] net/i40e: add FDIR support for GTP-C and GTP-U Beilei Xing
2017-09-28  2:17           ` [PATCH v4 7/8] net/i40e: add cloud filter parsing function for GTP Beilei Xing
2017-09-28  2:17           ` [PATCH v4 8/8] net/i40e: enable cloud filter for GTP-C and GTP-U Beilei Xing
2017-09-28  8:13           ` [PATCH v5 0/8] GPT-C and GTP-U enabling Beilei Xing
2017-09-28  8:13             ` [PATCH v5 1/8] mbuf: support GTP in software packet type parser Beilei Xing
2017-09-28  8:13             ` [PATCH v5 2/8] net/i40e: update ptype and pctype info Beilei Xing
2017-09-28  8:13             ` [PATCH v5 3/8] net/i40e: support RSS for new pctype Beilei Xing
2017-09-28  8:13             ` [PATCH v5 4/8] ethdev: add GTP items to support flow API Beilei Xing
2017-09-28 13:43               ` Sean Harte
2017-09-29  2:12                 ` Xing, Beilei
2017-09-28  8:13             ` [PATCH v5 5/8] net/i40e: finish integration FDIR with generic " Beilei Xing
2017-09-28  8:13             ` [PATCH v5 6/8] net/i40e: add FDIR support for GTP-C and GTP-U Beilei Xing
2017-09-28  8:13             ` [PATCH v5 7/8] net/i40e: add cloud filter parsing function for GTP Beilei Xing
2017-09-28  8:13             ` [PATCH v5 8/8] net/i40e: enable cloud filter for GTP-C and GTP-U Beilei Xing
2017-09-29  5:18           ` [PATCH v6 0/8] GPT-C and GTP-U enabling Beilei Xing
2017-09-29  5:18             ` [PATCH v6 1/8] mbuf: support GTP in software packet type parser Beilei Xing
2017-09-29  8:15               ` Sean Harte
2017-09-29  8:41                 ` Xing, Beilei
2017-09-29  5:18             ` [PATCH v6 2/8] net/i40e: update ptype and pctype info Beilei Xing
2017-09-29 13:22               ` Wu, Jingjing
2017-09-29 13:24                 ` Xing, Beilei
2017-09-29  5:18             ` [PATCH v6 3/8] net/i40e: support RSS for new pctype Beilei Xing
2017-09-29 13:24               ` Wu, Jingjing
2017-09-29  5:18             ` [PATCH v6 4/8] ethdev: add GTP items to support flow API Beilei Xing
2017-09-29  8:15               ` Sean Harte
2017-09-29  8:54                 ` Xing, Beilei
2017-09-29  9:29                   ` Sean Harte
2017-09-29  9:37                     ` Xing, Beilei
2017-10-02 12:27                     ` Adrien Mazarguil
2017-10-03  8:56                       ` Sean Harte
2017-10-05  8:06                         ` Wu, Jingjing
2017-10-05  8:30                           ` Adrien Mazarguil
2017-10-05  8:39                             ` Wu, Jingjing
2017-09-29  5:18             ` [PATCH v6 5/8] net/i40e: finish integration FDIR with generic " Beilei Xing
2017-09-29 13:28               ` Wu, Jingjing
2017-09-29  5:19             ` [PATCH v6 6/8] net/i40e: add FDIR support for GTP-C and GTP-U Beilei Xing
2017-09-29  8:15               ` Sean Harte
2017-09-29  9:33                 ` Xing, Beilei
2017-09-29 10:09                   ` Sean Harte
2017-09-29 11:30                     ` Xing, Beilei
2017-09-29 11:39                       ` Xing, Beilei
2017-09-29 13:14                     ` Xing, Beilei
2017-09-29 15:15                     ` Xing, Beilei
2017-09-29  5:19             ` [PATCH v6 7/8] net/i40e: add cloud filter parsing function for GTP Beilei Xing
2017-09-29  5:19             ` [PATCH v6 8/8] net/i40e: enable cloud filter for GTP-C and GTP-U Beilei Xing
2017-09-29 15:50             ` [PATCH v7 0/8] net/i40e: GPT-C and GTP-U enabling Beilei Xing
2017-09-29 15:50               ` [PATCH v7 1/8] mbuf: support GTP in software packet type parser Beilei Xing
2017-09-29 15:50               ` [PATCH v7 2/8] net/i40e: update ptype and pctype info Beilei Xing
2017-10-05  2:51                 ` Wu, Jingjing
2017-09-29 15:50               ` [PATCH v7 3/8] net/i40e: support RSS for new pctype Beilei Xing
2017-09-29 15:50               ` [PATCH v7 4/8] ethdev: add GTP items to support flow API Beilei Xing
2017-10-05  8:01                 ` Wu, Jingjing
2017-09-29 15:50               ` [PATCH v7 5/8] net/i40e: finish integration FDIR with generic " Beilei Xing
2017-10-05  2:52                 ` Wu, Jingjing
2017-09-29 15:50               ` [PATCH v7 6/8] net/i40e: add FDIR support for GTP-C and GTP-U Beilei Xing
2017-10-05  3:09                 ` Wu, Jingjing
2017-09-29 15:50               ` [PATCH v7 7/8] net/i40e: add cloud filter parsing function for GTP Beilei Xing
2017-10-05  3:13                 ` Wu, Jingjing
2017-09-29 15:50               ` [PATCH v7 8/8] net/i40e: enable cloud filter for GTP-C and GTP-U Beilei Xing
2017-10-05  8:03                 ` Wu, Jingjing
2017-10-04 22:43               ` [PATCH v7 0/8] net/i40e: GPT-C and GTP-U enabling Ferruh Yigit
2017-10-05  8:14               ` [PATCH v8 0/7] " Beilei Xing
2017-10-05  8:14                 ` [PATCH v8 1/7] mbuf: support GTP in software packet type parser Beilei Xing
2017-10-05 11:50                   ` Sean Harte
2017-10-05  8:14                 ` [PATCH v8 2/7] net/i40e: update ptype and pctype info Beilei Xing
2017-10-05  8:14                 ` [PATCH v8 3/7] ethdev: add GTP items to support flow API Beilei Xing
2017-10-05 11:50                   ` Sean Harte
2017-10-05  8:14                 ` [PATCH v8 4/7] net/i40e: finish integration FDIR with generic " Beilei Xing
2017-10-05  8:14                 ` [PATCH v8 5/7] net/i40e: add FDIR support for GTP-C and GTP-U Beilei Xing
2017-10-05 11:50                   ` Sean Harte
2017-10-05  8:14                 ` [PATCH v8 6/7] net/i40e: add cloud filter parsing function for GTP Beilei Xing
2017-10-05  8:14                 ` [PATCH v8 7/7] net/i40e: enable cloud filter for GTP-C and GTP-U Beilei Xing
2017-10-05  8:23                 ` [PATCH v8 0/7] net/i40e: GPT-C and GTP-U enabling Wu, Jingjing
2017-10-05 21:13                 ` Ferruh Yigit
2017-09-22 22:35       ` [PATCH v3 2/8] net/i40e: update ptype and pctype info Beilei Xing
2017-09-23  2:58         ` Wu, Jingjing
2017-09-22 22:35       ` [PATCH v3 3/8] net/i40e: support RSS for new pctype Beilei Xing
2017-09-22 22:35       ` [PATCH v3 4/8] ethdev: add GTP items to support flow API Beilei Xing
2017-09-22 13:39         ` Adrien Mazarguil
2017-09-22 22:35       ` [PATCH v3 5/8] net/i40e: finish integration FDIR with generic " Beilei Xing
2017-09-22 22:35       ` [PATCH v3 6/8] net/i40e: add FDIR support for GTP-C and GTP-U Beilei Xing
2017-09-22 22:35       ` [PATCH v3 7/8] net/i40e: add cloud filter parsing function for GTP Beilei Xing
2017-09-22 22:35       ` [PATCH v3 8/8] net/i40e: enable cloud filter for GTP-C and GTP-U Beilei Xing
2017-08-25  7:50 ` [PATCH 2/7] ethdev: add GTP item Beilei Xing
2017-09-06 16:02   ` Adrien Mazarguil
2017-09-07  6:31     ` Xing, Beilei
2017-08-25  7:50 ` [PATCH 3/7] app/testpmd: add GTP fields to flow command Beilei Xing
2017-09-06 16:03   ` Adrien Mazarguil
2017-08-25  7:50 ` [PATCH 4/7] net/i40e: finish integration FDIR with generic flow API Beilei Xing
2017-08-25  7:50 ` [PATCH 5/7] net/i40e: add FDIR support for GTP-C and GTP-U Beilei Xing
2017-08-25  7:50 ` [PATCH 6/7] net/i40e: add cloud filter parsing function for GTP Beilei Xing
2017-08-25  7:50 ` [PATCH 7/7] net/i40e: enable cloud filter for GTP-C and GTP-U Beilei Xing

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=1506565054-67690-5-git-send-email-beilei.xing@intel.com \
    --to=beilei.xing@intel.com \
    --cc=andrey.chilikin@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.