[1/8] lib/librte_ethdev: introduce GENEVE header TLV option item

Message ID 1609085183-25229-2-git-send-email-shirik@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: introduce GENEVE header TLV option item |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Shiri Kuzin Dec. 27, 2020, 4:06 p.m. UTC
  The Geneve tunneling protocol is designed to allow the
user to specify some data context on the packet.
The GENEVE TLV (Type-Length-Variable) Option
is the mean intended to present the user data.

In order to support GENEVE TLV Option the new rte_flow
item "rte_flow_item_geneve_opt" is added.
The new item contains the values and masks for the
following fields:
-option class
-option type
-length
-data

New item will be added to testpmd to support match and
raw encap/decap actions.

Signed-off-by: Shiri Kuzin <shirik@nvidia.com>
---
 lib/librte_ethdev/rte_flow.c |  1 +
 lib/librte_ethdev/rte_flow.h | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
  

Comments

Stephen Hemminger Dec. 27, 2020, 5:25 p.m. UTC | #1
On Sun, 27 Dec 2020 18:06:16 +0200
Shiri Kuzin <shirik@nvidia.com> wrote:

> +#ifdef PEDANTIC
> +#pragma GCC diagnostic ignored "-Wpedantic"
> +#endif

Please do not introduce pragma's for pedantic in standard headers.
It just clutters the code unnecessarily. The rest of DPDK is not guaranteed
to be free of pedantic warnings, so starting now is not worth the mess.
  
Ori Kam Dec. 29, 2020, 10:12 a.m. UTC | #2
> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> 
> On Sun, 27 Dec 2020 18:06:16 +0200
> Shiri Kuzin <shirik@nvidia.com> wrote:
> 
> > +#ifdef PEDANTIC
> > +#pragma GCC diagnostic ignored "-Wpedantic"
> > +#endif
> 
> Please do not introduce pragma's for pedantic in standard headers.
> It just clutters the code unnecessarily. The rest of DPDK is not guaranteed
> to be free of pedantic warnings, so starting now is not worth the mess.

+1

Thanks,
Ori
  
Shiri Kuzin Dec. 30, 2020, 8:22 a.m. UTC | #3
> -----Original Message-----
> From: Ori Kam <orika@nvidia.com>
> Sent: Tuesday, December 29, 2020 12:13 PM
> To: Stephen Hemminger <stephen@networkplumber.org>; Shiri Kuzin
> <shirik@nvidia.com>
> Cc: dev@dpdk.org; Slava Ovsiienko <viacheslavo@nvidia.com>; NBU-
> Contact-Adrien Mazarguil <adrien.mazarguil@6wind.com>;
> ferruh.yigit@intel.com; NBU-Contact-Thomas Monjalon
> <thomas@monjalon.net>; Raslan Darawsheh <rasland@nvidia.com>
> Subject: RE: [dpdk-dev] [PATCH 1/8] lib/librte_ethdev: introduce GENEVE
> header TLV option item
> 
> 
> 
> > -----Original Message-----
> > From: Stephen Hemminger <stephen@networkplumber.org>
> >
> > On Sun, 27 Dec 2020 18:06:16 +0200
> > Shiri Kuzin <shirik@nvidia.com> wrote:
> >
> > > +#ifdef PEDANTIC
> > > +#pragma GCC diagnostic ignored "-Wpedantic"
> > > +#endif
> >
> > Please do not introduce pragma's for pedantic in standard headers.
> > It just clutters the code unnecessarily. The rest of DPDK is not
> > guaranteed to be free of pedantic warnings, so starting now is not worth
> the mess.
> 
> +1
> 
> Thanks,
> Ori

Thank you for the comment.
I will update it in the revised patch set.

Thanks,
Shiri.
  

Patch

diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c
index a06f64c..2af7d96 100644
--- a/lib/librte_ethdev/rte_flow.c
+++ b/lib/librte_ethdev/rte_flow.c
@@ -97,6 +97,7 @@  struct rte_flow_desc_data {
 	MK_FLOW_ITEM(L2TPV3OIP, sizeof(struct rte_flow_item_l2tpv3oip)),
 	MK_FLOW_ITEM(PFCP, sizeof(struct rte_flow_item_pfcp)),
 	MK_FLOW_ITEM(ECPRI, sizeof(struct rte_flow_item_ecpri)),
+	MK_FLOW_ITEM(GENEVE_OPT, sizeof(struct rte_flow_item_geneve_opt)),
 };
 
 /** Generate flow_action[] entry. */
diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h
index 0977a78..e17a630 100644
--- a/lib/librte_ethdev/rte_flow.h
+++ b/lib/librte_ethdev/rte_flow.h
@@ -543,6 +543,14 @@  enum rte_flow_item_type {
 	 * See struct rte_flow_item_ipv6_frag_ext.
 	 */
 	RTE_FLOW_ITEM_TYPE_IPV6_FRAG_EXT,
+
+	/**
+	 * Matches Geneve Variable Length Option
+	 *
+	 * See struct rte_flow_item_geneve_opt
+	 */
+	RTE_FLOW_ITEM_TYPE_GENEVE_OPT,
+
 };
 
 /**
@@ -1626,7 +1634,32 @@  struct rte_flow_item_ecpri {
 	},
 };
 #endif
+#ifdef PEDANTIC
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
+/**
+ * RTE_FLOW_ITEM_TYPE_GENEVE_OPT
+ *
+ * Matches a GENEVE Variable Length Option
+ */
+RTE_STD_C11
+struct rte_flow_item_geneve_opt {
+	rte_be16_t option_class;
+	uint8_t option_type;
+	uint8_t option_len;
+	uint32_t *data;
+};
+#ifdef PEDANTIC
+#pragma GCC diagnostic ignored "-Wpedantic"
+#endif
 
+/** Default mask for RTE_FLOW_ITEM_TYPE_GENEVE_OPT. */
+#ifndef __cplusplus
+static const struct rte_flow_item_geneve_opt
+rte_flow_item_geneve_opt_mask = {
+	.option_type = 0xff,
+};
+#endif
 /**
  * Matching pattern item definition.
  *