DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Adrien Mazarguil <adrien.mazarguil@6wind.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Subject: [dpdk-dev] [PATCH v2 1/2] ethdev: add GENEVE flow pattern item
Date: Fri, 1 Dec 2017 10:43:15 +0000	[thread overview]
Message-ID: <1512124996-13388-2-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1512124996-13388-1-git-send-email-arybchenko@solarflare.com>

From: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>

Add new pattern item RTE_FLOW_ITEM_TYPE_GENEVE in flow API.
Add default mask for the item.

Signed-off-by: Roman Zhukov <Roman.Zhukov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++
 lib/librte_ether/rte_flow.c        |  1 +
 lib/librte_ether/rte_flow.h        | 30 ++++++++++++++++++++++++++++++
 3 files changed, 43 insertions(+)

diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst
index d158be5..5b8f9c5 100644
--- a/doc/guides/prog_guide/rte_flow.rst
+++ b/doc/guides/prog_guide/rte_flow.rst
@@ -980,6 +980,18 @@ Matches an ESP header.
 - ``hdr``: ESP header definition (``rte_esp.h``).
 - Default ``mask`` matches SPI only.
 
+Item: ``GENEVE``
+^^^^^^^^^^^^^^^
+
+Matches a GENEVE header.
+
+- ``ver_opt_len_o_c_rsvd0``: version (2b), length of the options fields (6b),
+  OAM packet (1b), critical options present (1b), reserved 0 (6b).
+- ``protocol``: protocol type.
+- ``vni``: virtual network identifier.
+- ``rsvd1``: reserved, normally 0x00.
+- Default ``mask`` matches VNI only.
+
 Actions
 ~~~~~~~
 
diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c
index 6659063..913d1a5 100644
--- a/lib/librte_ether/rte_flow.c
+++ b/lib/librte_ether/rte_flow.c
@@ -81,6 +81,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)),
 	MK_FLOW_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)),
 	MK_FLOW_ITEM(NVGRE, sizeof(struct rte_flow_item_nvgre)),
+	MK_FLOW_ITEM(GENEVE, sizeof(struct rte_flow_item_geneve)),
 };
 
 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
index 47c88ea..e0402cf 100644
--- a/lib/librte_ether/rte_flow.h
+++ b/lib/librte_ether/rte_flow.h
@@ -344,6 +344,13 @@ enum rte_flow_item_type {
 	 * See struct rte_flow_item_esp.
 	 */
 	RTE_FLOW_ITEM_TYPE_ESP,
+
+	/**
+	 * Matches a GENEVE header.
+	 *
+	 * See struct rte_flow_item_geneve.
+	 */
+	RTE_FLOW_ITEM_TYPE_GENEVE,
 };
 
 /**
@@ -813,6 +820,29 @@ static const struct rte_flow_item_esp rte_flow_item_esp_mask = {
 #endif
 
 /**
+ * RTE_FLOW_ITEM_TYPE_GENEVE.
+ *
+ * Matches a GENEVE header.
+ */
+struct rte_flow_item_geneve {
+	/**
+	 * Version (2b), length of the options fields (6b), OAM packet (1b),
+	 * critical options present (1b), reserved 0 (6b).
+	 */
+	rte_be16_t ver_opt_len_o_c_rsvd0;
+	rte_be16_t protocol; /**< Protocol type. */
+	uint8_t vni[3]; /**< Virtual Network Identifier. */
+	uint8_t rsvd1; /**< Reserved, normally 0x00. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE. */
+#ifndef __cplusplus
+static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = {
+	.vni = "\xff\xff\xff",
+};
+#endif
+
+/**
  * Matching pattern item definition.
  *
  * A pattern is formed by stacking items starting from the lowest protocol
-- 
2.7.4

  reply	other threads:[~2017-12-01 10:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-20  8:21 [dpdk-dev] [PATCH 0/2] ethdev: add GENEVE to flow API Andrew Rybchenko
2017-11-20  8:22 ` [dpdk-dev] [PATCH 1/2] ethdev: add GENEVE flow pattern item Andrew Rybchenko
2017-11-23  9:39   ` Adrien Mazarguil
2017-11-20  8:22 ` [dpdk-dev] [PATCH 2/2] app/testpmd: support GENEVE pattern item in flow rules Andrew Rybchenko
2017-11-23  9:40   ` Adrien Mazarguil
2017-11-23  9:39 ` [dpdk-dev] [PATCH 0/2] ethdev: add GENEVE to flow API Adrien Mazarguil
2017-11-23 10:07   ` Andrew Rybchenko
2017-12-01 10:43 ` [dpdk-dev] [PATCH v2 " Andrew Rybchenko
2017-12-01 10:43   ` Andrew Rybchenko [this message]
2017-12-04 14:03     ` [dpdk-dev] [PATCH v2 1/2] ethdev: add GENEVE flow pattern item Adrien Mazarguil
2017-12-07 23:52       ` Ferruh Yigit
2017-12-08 10:52         ` Adrien Mazarguil
2017-12-08 19:06         ` Ferruh Yigit
2017-12-01 10:43   ` [dpdk-dev] [PATCH v2 2/2] app/testpmd: support GENEVE pattern item in flow rules Andrew Rybchenko

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=1512124996-13388-2-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=Roman.Zhukov@oktetlabs.ru \
    --cc=adrien.mazarguil@6wind.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 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).