[dpdk-dev,v2,2/5] ethdev: introduce new tunnel VXLAN-GPE

Message ID 20180410130036.188819-3-xuemingl@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Xueming Li April 10, 2018, 1 p.m. UTC
  VXLAN-GPE enables VXLAN for all protocols. Protocol link:
https://datatracker.ietf.org/doc/draft-ietf-nvo3-vxlan-gpe/

Signed-off-by: Xueming Li <xuemingl@mellanox.com>
---
 lib/librte_ether/rte_eth_ctrl.h  |  3 ++-
 lib/librte_ether/rte_flow.c      |  1 +
 lib/librte_ether/rte_flow.h      | 27 +++++++++++++++++++++++++++
 lib/librte_mbuf/rte_mbuf.c       |  3 +++
 lib/librte_mbuf/rte_mbuf.h       |  1 +
 lib/librte_mbuf/rte_mbuf_ptype.c |  1 +
 lib/librte_mbuf/rte_mbuf_ptype.h | 13 +++++++++++++
 lib/librte_net/rte_ether.h       | 25 +++++++++++++++++++++++++
 8 files changed, 73 insertions(+), 1 deletion(-)
  

Comments

Adrien Mazarguil April 11, 2018, 9:59 a.m. UTC | #1
On Tue, Apr 10, 2018 at 09:00:33PM +0800, Xueming Li wrote:
> VXLAN-GPE enables VXLAN for all protocols. Protocol link:
> https://datatracker.ietf.org/doc/draft-ietf-nvo3-vxlan-gpe/
> 
> Signed-off-by: Xueming Li <xuemingl@mellanox.com>

Adding a new rte_flow pattern item in the middle of enum rte_flow_item_type
breaks ABI compatibility. It's fine for 18.05 because prior series already
destroyed it, however for this patch you need to choose between:

- Adding the new entry at the end of the enum and modifying the rest of the
  code to follow the same order (preferred approach when not doing a full
  API overhaul).

*or*

- Stating in the commit log what functions are impacted by ABI changes as in
  "ethdev: remove DUP action from flow API" [1].

Also you must add a new "Item: ``VXLAN_GPE``" section to
doc/guides/prog_guide/rte_flow.rst (look for "VXLAN" for clues).

Otherwise patch is mostly fine, just a few comments below.

[1] http://dpdk.org/ml/archives/dev/2018-April/096526.html

> ---
>  lib/librte_ether/rte_eth_ctrl.h  |  3 ++-
>  lib/librte_ether/rte_flow.c      |  1 +
>  lib/librte_ether/rte_flow.h      | 27 +++++++++++++++++++++++++++
>  lib/librte_mbuf/rte_mbuf.c       |  3 +++
>  lib/librte_mbuf/rte_mbuf.h       |  1 +
>  lib/librte_mbuf/rte_mbuf_ptype.c |  1 +
>  lib/librte_mbuf/rte_mbuf_ptype.h | 13 +++++++++++++
>  lib/librte_net/rte_ether.h       | 25 +++++++++++++++++++++++++
>  8 files changed, 73 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
> index 668f59acb..5ea8ae24c 100644
> --- a/lib/librte_ether/rte_eth_ctrl.h
> +++ b/lib/librte_ether/rte_eth_ctrl.h
> @@ -54,7 +54,8 @@ extern "C" {
>  #define RTE_ETH_FLOW_VXLAN              19 /**< VXLAN protocol based flow */
>  #define RTE_ETH_FLOW_GENEVE             20 /**< GENEVE protocol based flow */
>  #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
> -#define RTE_ETH_FLOW_MAX                22
> +#define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol based flow */
> +#define RTE_ETH_FLOW_MAX                23
>  
>  /**
>   * Feature filter types
> diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c
> index 3d8116ebd..fb710fff7 100644
> --- a/lib/librte_ether/rte_flow.c
> +++ b/lib/librte_ether/rte_flow.c
> @@ -50,6 +50,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = {
>  	MK_FLOW_ITEM(TCP, sizeof(struct rte_flow_item_tcp)),
>  	MK_FLOW_ITEM(SCTP, sizeof(struct rte_flow_item_sctp)),
>  	MK_FLOW_ITEM(VXLAN, sizeof(struct rte_flow_item_vxlan)),
> +	MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)),

Should be at the end of this array if you choose to not impact ABI.

>  	MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)),
>  	MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)),
>  	MK_FLOW_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)),
> diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
> index bed727df8..c7cfc201a 100644
> --- a/lib/librte_ether/rte_flow.h
> +++ b/lib/librte_ether/rte_flow.h
> @@ -256,6 +256,13 @@ enum rte_flow_item_type {
>  	RTE_FLOW_ITEM_TYPE_VXLAN,
>  
>  	/**
> +	 * Matches a VXLAN-GPE header.
> +	 *
> +	 * See struct rte_flow_item_vxlan_gpe.
> +	 */
> +	RTE_FLOW_ITEM_TYPE_VXLAN_GPE,
> +
> +	/**

Ditto for the enum definition.

>  	 * Matches a E_TAG header.
>  	 *
>  	 * See struct rte_flow_item_e_tag.
> @@ -676,6 +683,26 @@ static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
>  #endif
>  
>  /**
> + * RTE_FLOW_ITEM_TYPE_VXLAN_GPE.
> + *
> + * Matches a VXLAN-GPE header.

You should name the current IETF draft pending a proper RFC:

 Matches a VXLAN-GPE header (draft-ietf-nvo3-vxlan-gpe-05).

> + */
> +struct rte_flow_item_vxlan_gpe {
> +	uint8_t flags; /**< Normally 0x0c (I and P flag). */
> +	uint8_t rsvd0[2]; /**< Reserved, normally 0x0000. */
> +	uint8_t protocol; /**< Protocol type. */
> +	uint8_t vni[3]; /**< VXLAN identifier. */
> +	uint8_t rsvd1; /**< Reserved, normally 0x00. */
> +};
> +
> +/** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */
> +#ifndef __cplusplus
> +static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = {
> +	.vni = "\xff\xff\xff",
> +};
> +#endif

Again if you choose to not impact ABI, this should be moved further down,
after the last item definition for consistency.

> +
> +/**
>   * RTE_FLOW_ITEM_TYPE_E_TAG.
>   *
>   * Matches a E-tag header.
> diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
> index 091d388d3..dc90379e5 100644
> --- a/lib/librte_mbuf/rte_mbuf.c
> +++ b/lib/librte_mbuf/rte_mbuf.c
> @@ -405,6 +405,7 @@ const char *rte_get_tx_ol_flag_name(uint64_t mask)
>  	case PKT_TX_TUNNEL_IPIP: return "PKT_TX_TUNNEL_IPIP";
>  	case PKT_TX_TUNNEL_GENEVE: return "PKT_TX_TUNNEL_GENEVE";
>  	case PKT_TX_TUNNEL_MPLSINUDP: return "PKT_TX_TUNNEL_MPLSINUDP";
> +	case PKT_TX_TUNNEL_VXLAN_GPE: return "PKT_TX_TUNNEL_VXLAN_GPE";
>  	case PKT_TX_MACSEC: return "PKT_TX_MACSEC";
>  	case PKT_TX_SEC_OFFLOAD: return "PKT_TX_SEC_OFFLOAD";
>  	default: return NULL;
> @@ -439,6 +440,8 @@ rte_get_tx_ol_flag_list(uint64_t mask, char *buf, size_t buflen)
>  		  "PKT_TX_TUNNEL_NONE" },
>  		{ PKT_TX_TUNNEL_MPLSINUDP, PKT_TX_TUNNEL_MASK,
>  		  "PKT_TX_TUNNEL_NONE" },
> +		{ PKT_TX_TUNNEL_VXLAN_GPE, PKT_TX_TUNNEL_MASK,
> +		  "PKT_TX_TUNNEL_NONE" },
>  		{ PKT_TX_MACSEC, PKT_TX_MACSEC, NULL },
>  		{ PKT_TX_SEC_OFFLOAD, PKT_TX_SEC_OFFLOAD, NULL },
>  	};
> diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
> index 62740254d..1839cf2ed 100644
> --- a/lib/librte_mbuf/rte_mbuf.h
> +++ b/lib/librte_mbuf/rte_mbuf.h
> @@ -210,6 +210,7 @@ extern "C" {
>  #define PKT_TX_TUNNEL_GENEVE  (0x4ULL << 45)
>  /**< TX packet with MPLS-in-UDP RFC 7510 header. */
>  #define PKT_TX_TUNNEL_MPLSINUDP (0x5ULL << 45)
> +#define PKT_TX_TUNNEL_VXLAN_GPE (0x6ULL << 45)
>  /* add new TX TUNNEL type here */
>  #define PKT_TX_TUNNEL_MASK    (0xFULL << 45)
>  
> diff --git a/lib/librte_mbuf/rte_mbuf_ptype.c b/lib/librte_mbuf/rte_mbuf_ptype.c
> index 1feefacc6..49106c7df 100644
> --- a/lib/librte_mbuf/rte_mbuf_ptype.c
> +++ b/lib/librte_mbuf/rte_mbuf_ptype.c
> @@ -65,6 +65,7 @@ const char *rte_get_ptype_tunnel_name(uint32_t ptype)
>  	case RTE_PTYPE_TUNNEL_GTPU: return "TUNNEL_GTPU";
>  	case RTE_PTYPE_TUNNEL_ESP: return "TUNNEL_ESP";
>  	case RTE_PTYPE_TUNNEL_L2TP: return "TUNNEL_L2TP";
> +	case RTE_PTYPE_TUNNEL_VXLAN_GPE: return "TUNNEL_VXLAN_GPE";
>  	default: return "TUNNEL_UNKNOWN";
>  	}
>  }
> diff --git a/lib/librte_mbuf/rte_mbuf_ptype.h b/lib/librte_mbuf/rte_mbuf_ptype.h
> index b9a338110..7caf83312 100644
> --- a/lib/librte_mbuf/rte_mbuf_ptype.h
> +++ b/lib/librte_mbuf/rte_mbuf_ptype.h
> @@ -423,6 +423,19 @@ extern "C" {
>   */
>  #define RTE_PTYPE_TUNNEL_L2TP               0x0000a000
>  /**
> + * VXLAN-GPE (VXLAN Generic Protocol Extension) tunneling packet type.
> + *
> + * Packet format:
> + * <'ether type'=0x0800
> + * | 'version'=4, 'protocol'=17
> + * | 'destination port'=4790>
> + * or,
> + * <'ether type'=0x86DD
> + * | 'version'=6, 'next header'=17
> + * | 'destination port'=4790>
> + */
> +#define RTE_PTYPE_TUNNEL_VXLAN_GPE          0x0000b000
> +/**
>   * Mask of tunneling packet types.
>   */
>  #define RTE_PTYPE_TUNNEL_MASK               0x0000f000
> diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
> index a271d1c86..a64814179 100644
> --- a/lib/librte_net/rte_ether.h
> +++ b/lib/librte_net/rte_ether.h
> @@ -311,6 +311,31 @@ struct vxlan_hdr {
>  /**< VXLAN tunnel header length. */
>  
>  /**
> + * VXLAN-GPE protocol header.
> + * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network
> + * Identifier and Reserved fields (16 bits and 8 bits).

Another reference to the current IETF draft here shouldn't hurt.

> + */
> +struct vxlan_gpe_hdr {
> +	uint8_t vx_flags; /**< flag (8). */
> +	uint8_t reserved[2]; /**< Reserved (16). */
> +	uint8_t proto; /**< next-protocol (8). */
> +	uint32_t vx_vni;   /**< VNI (24) + Reserved (8). */
> +} __attribute__((__packed__));
> +
> +/* VXLAN-GPE next protocol types */
> +#define VXLAN_GPE_TYPE_IPv4 1 /**< IPv4 Protocol. */
> +#define VXLAN_GPE_TYPE_IPv6 2 /**< IPv6 Protocol. */
> +#define VXLAN_GPE_TYPE_ETH  3 /**< Ethernet Protocol. */
> +#define VXLAN_GPE_TYPE_NSH  4 /**< NSH Protocol. */
> +#define VXLAN_GPE_TYPE_MPLS 5 /**< MPLS Protocol. */
> +#define VXLAN_GPE_TYPE_GBP  6 /**< GBP Protocol. */
> +#define VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */
> +
> +#define ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \
> +			      sizeof(struct vxlan_gpe_hdr))
> +/**< VXLAN-GPE tunnel header length. */
> +
> +/**
>   * Extract VLAN tag information into mbuf
>   *
>   * Software version of VLAN stripping
> -- 
> 2.13.3
  
Xueming Li April 11, 2018, 12:04 p.m. UTC | #2
Hi Adrien,

> -----Original Message-----

> From: Adrien Mazarguil <adrien.mazarguil@6wind.com>

> Sent: Wednesday, April 11, 2018 5:59 PM

> To: Xueming(Steven) Li <xuemingl@mellanox.com>

> Cc: Wenzhuo Lu <wenzhuo.lu@intel.com>; Jingjing Wu <jingjing.wu@intel.com>;

> Thomas Monjalon <thomas@monjalon.net>; Nélio Laranjeiro

> <nelio.laranjeiro@6wind.com>; Shahaf Shuler <shahafs@mellanox.com>;

> dev@dpdk.org; Olivier Matz <olivier.matz@6wind.com>

> Subject: Re: [dpdk-dev] [PATCH v2 2/5] ethdev: introduce new tunnel VXLAN-

> GPE

> 

> On Tue, Apr 10, 2018 at 09:00:33PM +0800, Xueming Li wrote:

> > VXLAN-GPE enables VXLAN for all protocols. Protocol link:

> > https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdat

> > atracker.ietf.org%2Fdoc%2Fdraft-ietf-nvo3-vxlan-gpe%2F&data=02%7C01%7C

> > xuemingl%40mellanox.com%7Ce69c95d98f5f457c966908d59f92e393%7Ca652971c7

> > d2e4d9ba6a4d149256f461b%7C0%7C0%7C636590375601220397&sdata=XZ6kpgEIrbB

> > wHrpODaZiByf6a2NQl4J6MadYYAsuNsc%3D&reserved=0

> >

> > Signed-off-by: Xueming Li <xuemingl@mellanox.com>

> 

> Adding a new rte_flow pattern item in the middle of enum

> rte_flow_item_type breaks ABI compatibility. It's fine for 18.05 because

> prior series already destroyed it, however for this patch you need to

> choose between:

> 

> - Adding the new entry at the end of the enum and modifying the rest of

> the

>   code to follow the same order (preferred approach when not doing a full

>   API overhaul).

> 

> *or*

> 

> - Stating in the commit log what functions are impacted by ABI changes as

> in

>   "ethdev: remove DUP action from flow API" [1].

> 

> Also you must add a new "Item: ``VXLAN_GPE``" section to

> doc/guides/prog_guide/rte_flow.rst (look for "VXLAN" for clues).

> 

> Otherwise patch is mostly fine, just a few comments below.

> 

> [1]

> https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdpdk.org

> %2Fml%2Farchives%2Fdev%2F2018-

> April%2F096526.html&data=02%7C01%7Cxuemingl%40mellanox.com%7Ce69c95d98f5f4

> 57c966908d59f92e393%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C636590375

> 601220397&sdata=8Q%2FMigA8hSHmM25UWUvhTOtVuit%2FxQRFBA6iF6lYxv8%3D&reserve

> d=0

> 


Thanks, I've update code according to option 1.

> > ---

> >  lib/librte_ether/rte_eth_ctrl.h  |  3 ++-

> >  lib/librte_ether/rte_flow.c      |  1 +

> >  lib/librte_ether/rte_flow.h      | 27 +++++++++++++++++++++++++++

> >  lib/librte_mbuf/rte_mbuf.c       |  3 +++

> >  lib/librte_mbuf/rte_mbuf.h       |  1 +

> >  lib/librte_mbuf/rte_mbuf_ptype.c |  1 +

> > lib/librte_mbuf/rte_mbuf_ptype.h | 13 +++++++++++++

> >  lib/librte_net/rte_ether.h       | 25 +++++++++++++++++++++++++

> >  8 files changed, 73 insertions(+), 1 deletion(-)

> >

> > diff --git a/lib/librte_ether/rte_eth_ctrl.h

> > b/lib/librte_ether/rte_eth_ctrl.h index 668f59acb..5ea8ae24c 100644

> > --- a/lib/librte_ether/rte_eth_ctrl.h

> > +++ b/lib/librte_ether/rte_eth_ctrl.h

> > @@ -54,7 +54,8 @@ extern "C" {

> >  #define RTE_ETH_FLOW_VXLAN              19 /**< VXLAN protocol based

> flow */

> >  #define RTE_ETH_FLOW_GENEVE             20 /**< GENEVE protocol based

> flow */

> >  #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based

> flow */

> > -#define RTE_ETH_FLOW_MAX                22

> > +#define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol

> based flow */

> > +#define RTE_ETH_FLOW_MAX                23

> >

> >  /**

> >   * Feature filter types

> > diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c

> > index 3d8116ebd..fb710fff7 100644

> > --- a/lib/librte_ether/rte_flow.c

> > +++ b/lib/librte_ether/rte_flow.c

> > @@ -50,6 +50,7 @@ static const struct rte_flow_desc_data

> rte_flow_desc_item[] = {

> >  	MK_FLOW_ITEM(TCP, sizeof(struct rte_flow_item_tcp)),

> >  	MK_FLOW_ITEM(SCTP, sizeof(struct rte_flow_item_sctp)),

> >  	MK_FLOW_ITEM(VXLAN, sizeof(struct rte_flow_item_vxlan)),

> > +	MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)),

> 

> Should be at the end of this array if you choose to not impact ABI.

> 

> >  	MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)),

> >  	MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)),

> >  	MK_FLOW_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)), diff --git

> > a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h index

> > bed727df8..c7cfc201a 100644

> > --- a/lib/librte_ether/rte_flow.h

> > +++ b/lib/librte_ether/rte_flow.h

> > @@ -256,6 +256,13 @@ enum rte_flow_item_type {

> >  	RTE_FLOW_ITEM_TYPE_VXLAN,

> >

> >  	/**

> > +	 * Matches a VXLAN-GPE header.

> > +	 *

> > +	 * See struct rte_flow_item_vxlan_gpe.

> > +	 */

> > +	RTE_FLOW_ITEM_TYPE_VXLAN_GPE,

> > +

> > +	/**

> 

> Ditto for the enum definition.

> 

> >  	 * Matches a E_TAG header.

> >  	 *

> >  	 * See struct rte_flow_item_e_tag.

> > @@ -676,6 +683,26 @@ static const struct rte_flow_item_vxlan

> > rte_flow_item_vxlan_mask = {  #endif

> >

> >  /**

> > + * RTE_FLOW_ITEM_TYPE_VXLAN_GPE.

> > + *

> > + * Matches a VXLAN-GPE header.

> 

> You should name the current IETF draft pending a proper RFC:

> 

>  Matches a VXLAN-GPE header (draft-ietf-nvo3-vxlan-gpe-05).

> 

> > + */

> > +struct rte_flow_item_vxlan_gpe {

> > +	uint8_t flags; /**< Normally 0x0c (I and P flag). */

> > +	uint8_t rsvd0[2]; /**< Reserved, normally 0x0000. */

> > +	uint8_t protocol; /**< Protocol type. */

> > +	uint8_t vni[3]; /**< VXLAN identifier. */

> > +	uint8_t rsvd1; /**< Reserved, normally 0x00. */ };

> > +

> > +/** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */ #ifndef

> > +__cplusplus static const struct rte_flow_item_vxlan_gpe

> > +rte_flow_item_vxlan_gpe_mask = {

> > +	.vni = "\xff\xff\xff",

> > +};

> > +#endif

> 

> Again if you choose to not impact ABI, this should be moved further down,

> after the last item definition for consistency.

> 

> > +

> > +/**

> >   * RTE_FLOW_ITEM_TYPE_E_TAG.

> >   *

> >   * Matches a E-tag header.

> > diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c

> > index 091d388d3..dc90379e5 100644

> > --- a/lib/librte_mbuf/rte_mbuf.c

> > +++ b/lib/librte_mbuf/rte_mbuf.c

> > @@ -405,6 +405,7 @@ const char *rte_get_tx_ol_flag_name(uint64_t mask)

> >  	case PKT_TX_TUNNEL_IPIP: return "PKT_TX_TUNNEL_IPIP";

> >  	case PKT_TX_TUNNEL_GENEVE: return "PKT_TX_TUNNEL_GENEVE";

> >  	case PKT_TX_TUNNEL_MPLSINUDP: return "PKT_TX_TUNNEL_MPLSINUDP";

> > +	case PKT_TX_TUNNEL_VXLAN_GPE: return "PKT_TX_TUNNEL_VXLAN_GPE";

> >  	case PKT_TX_MACSEC: return "PKT_TX_MACSEC";

> >  	case PKT_TX_SEC_OFFLOAD: return "PKT_TX_SEC_OFFLOAD";

> >  	default: return NULL;

> > @@ -439,6 +440,8 @@ rte_get_tx_ol_flag_list(uint64_t mask, char *buf,

> size_t buflen)

> >  		  "PKT_TX_TUNNEL_NONE" },

> >  		{ PKT_TX_TUNNEL_MPLSINUDP, PKT_TX_TUNNEL_MASK,

> >  		  "PKT_TX_TUNNEL_NONE" },

> > +		{ PKT_TX_TUNNEL_VXLAN_GPE, PKT_TX_TUNNEL_MASK,

> > +		  "PKT_TX_TUNNEL_NONE" },

> >  		{ PKT_TX_MACSEC, PKT_TX_MACSEC, NULL },

> >  		{ PKT_TX_SEC_OFFLOAD, PKT_TX_SEC_OFFLOAD, NULL },

> >  	};

> > diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h

> > index 62740254d..1839cf2ed 100644

> > --- a/lib/librte_mbuf/rte_mbuf.h

> > +++ b/lib/librte_mbuf/rte_mbuf.h

> > @@ -210,6 +210,7 @@ extern "C" {

> >  #define PKT_TX_TUNNEL_GENEVE  (0x4ULL << 45)  /**< TX packet with

> > MPLS-in-UDP RFC 7510 header. */  #define PKT_TX_TUNNEL_MPLSINUDP

> > (0x5ULL << 45)

> > +#define PKT_TX_TUNNEL_VXLAN_GPE (0x6ULL << 45)

> >  /* add new TX TUNNEL type here */

> >  #define PKT_TX_TUNNEL_MASK    (0xFULL << 45)

> >

> > diff --git a/lib/librte_mbuf/rte_mbuf_ptype.c

> > b/lib/librte_mbuf/rte_mbuf_ptype.c

> > index 1feefacc6..49106c7df 100644

> > --- a/lib/librte_mbuf/rte_mbuf_ptype.c

> > +++ b/lib/librte_mbuf/rte_mbuf_ptype.c

> > @@ -65,6 +65,7 @@ const char *rte_get_ptype_tunnel_name(uint32_t ptype)

> >  	case RTE_PTYPE_TUNNEL_GTPU: return "TUNNEL_GTPU";

> >  	case RTE_PTYPE_TUNNEL_ESP: return "TUNNEL_ESP";

> >  	case RTE_PTYPE_TUNNEL_L2TP: return "TUNNEL_L2TP";

> > +	case RTE_PTYPE_TUNNEL_VXLAN_GPE: return "TUNNEL_VXLAN_GPE";

> >  	default: return "TUNNEL_UNKNOWN";

> >  	}

> >  }

> > diff --git a/lib/librte_mbuf/rte_mbuf_ptype.h

> > b/lib/librte_mbuf/rte_mbuf_ptype.h

> > index b9a338110..7caf83312 100644

> > --- a/lib/librte_mbuf/rte_mbuf_ptype.h

> > +++ b/lib/librte_mbuf/rte_mbuf_ptype.h

> > @@ -423,6 +423,19 @@ extern "C" {

> >   */

> >  #define RTE_PTYPE_TUNNEL_L2TP               0x0000a000

> >  /**

> > + * VXLAN-GPE (VXLAN Generic Protocol Extension) tunneling packet type.

> > + *

> > + * Packet format:

> > + * <'ether type'=0x0800

> > + * | 'version'=4, 'protocol'=17

> > + * | 'destination port'=4790>

> > + * or,

> > + * <'ether type'=0x86DD

> > + * | 'version'=6, 'next header'=17

> > + * | 'destination port'=4790>

> > + */

> > +#define RTE_PTYPE_TUNNEL_VXLAN_GPE          0x0000b000

> > +/**

> >   * Mask of tunneling packet types.

> >   */

> >  #define RTE_PTYPE_TUNNEL_MASK               0x0000f000

> > diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h

> > index a271d1c86..a64814179 100644

> > --- a/lib/librte_net/rte_ether.h

> > +++ b/lib/librte_net/rte_ether.h

> > @@ -311,6 +311,31 @@ struct vxlan_hdr {  /**< VXLAN tunnel header

> > length. */

> >

> >  /**

> > + * VXLAN-GPE protocol header.

> > + * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network

> > + * Identifier and Reserved fields (16 bits and 8 bits).

> 

> Another reference to the current IETF draft here shouldn't hurt.

> 

> > + */

> > +struct vxlan_gpe_hdr {

> > +	uint8_t vx_flags; /**< flag (8). */

> > +	uint8_t reserved[2]; /**< Reserved (16). */

> > +	uint8_t proto; /**< next-protocol (8). */

> > +	uint32_t vx_vni;   /**< VNI (24) + Reserved (8). */

> > +} __attribute__((__packed__));

> > +

> > +/* VXLAN-GPE next protocol types */

> > +#define VXLAN_GPE_TYPE_IPv4 1 /**< IPv4 Protocol. */ #define

> > +VXLAN_GPE_TYPE_IPv6 2 /**< IPv6 Protocol. */ #define

> > +VXLAN_GPE_TYPE_ETH  3 /**< Ethernet Protocol. */ #define

> > +VXLAN_GPE_TYPE_NSH  4 /**< NSH Protocol. */ #define

> > +VXLAN_GPE_TYPE_MPLS 5 /**< MPLS Protocol. */ #define

> > +VXLAN_GPE_TYPE_GBP  6 /**< GBP Protocol. */ #define

> > +VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */

> > +

> > +#define ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \

> > +			      sizeof(struct vxlan_gpe_hdr)) /**< VXLAN-GPE

> tunnel header

> > +length. */

> > +

> > +/**

> >   * Extract VLAN tag information into mbuf

> >   *

> >   * Software version of VLAN stripping

> > --

> > 2.13.3

> 

> --

> Adrien Mazarguil

> 6WIND
  

Patch

diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 668f59acb..5ea8ae24c 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -54,7 +54,8 @@  extern "C" {
 #define RTE_ETH_FLOW_VXLAN              19 /**< VXLAN protocol based flow */
 #define RTE_ETH_FLOW_GENEVE             20 /**< GENEVE protocol based flow */
 #define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
-#define RTE_ETH_FLOW_MAX                22
+#define RTE_ETH_FLOW_VXLAN_GPE          22 /**< VXLAN-GPE protocol based flow */
+#define RTE_ETH_FLOW_MAX                23
 
 /**
  * Feature filter types
diff --git a/lib/librte_ether/rte_flow.c b/lib/librte_ether/rte_flow.c
index 3d8116ebd..fb710fff7 100644
--- a/lib/librte_ether/rte_flow.c
+++ b/lib/librte_ether/rte_flow.c
@@ -50,6 +50,7 @@  static const struct rte_flow_desc_data rte_flow_desc_item[] = {
 	MK_FLOW_ITEM(TCP, sizeof(struct rte_flow_item_tcp)),
 	MK_FLOW_ITEM(SCTP, sizeof(struct rte_flow_item_sctp)),
 	MK_FLOW_ITEM(VXLAN, sizeof(struct rte_flow_item_vxlan)),
+	MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)),
 	MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)),
 	MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)),
 	MK_FLOW_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)),
diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h
index bed727df8..c7cfc201a 100644
--- a/lib/librte_ether/rte_flow.h
+++ b/lib/librte_ether/rte_flow.h
@@ -256,6 +256,13 @@  enum rte_flow_item_type {
 	RTE_FLOW_ITEM_TYPE_VXLAN,
 
 	/**
+	 * Matches a VXLAN-GPE header.
+	 *
+	 * See struct rte_flow_item_vxlan_gpe.
+	 */
+	RTE_FLOW_ITEM_TYPE_VXLAN_GPE,
+
+	/**
 	 * Matches a E_TAG header.
 	 *
 	 * See struct rte_flow_item_e_tag.
@@ -676,6 +683,26 @@  static const struct rte_flow_item_vxlan rte_flow_item_vxlan_mask = {
 #endif
 
 /**
+ * RTE_FLOW_ITEM_TYPE_VXLAN_GPE.
+ *
+ * Matches a VXLAN-GPE header.
+ */
+struct rte_flow_item_vxlan_gpe {
+	uint8_t flags; /**< Normally 0x0c (I and P flag). */
+	uint8_t rsvd0[2]; /**< Reserved, normally 0x0000. */
+	uint8_t protocol; /**< Protocol type. */
+	uint8_t vni[3]; /**< VXLAN identifier. */
+	uint8_t rsvd1; /**< Reserved, normally 0x00. */
+};
+
+/** Default mask for RTE_FLOW_ITEM_TYPE_VXLAN_GPE. */
+#ifndef __cplusplus
+static const struct rte_flow_item_vxlan_gpe rte_flow_item_vxlan_gpe_mask = {
+	.vni = "\xff\xff\xff",
+};
+#endif
+
+/**
  * RTE_FLOW_ITEM_TYPE_E_TAG.
  *
  * Matches a E-tag header.
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 091d388d3..dc90379e5 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -405,6 +405,7 @@  const char *rte_get_tx_ol_flag_name(uint64_t mask)
 	case PKT_TX_TUNNEL_IPIP: return "PKT_TX_TUNNEL_IPIP";
 	case PKT_TX_TUNNEL_GENEVE: return "PKT_TX_TUNNEL_GENEVE";
 	case PKT_TX_TUNNEL_MPLSINUDP: return "PKT_TX_TUNNEL_MPLSINUDP";
+	case PKT_TX_TUNNEL_VXLAN_GPE: return "PKT_TX_TUNNEL_VXLAN_GPE";
 	case PKT_TX_MACSEC: return "PKT_TX_MACSEC";
 	case PKT_TX_SEC_OFFLOAD: return "PKT_TX_SEC_OFFLOAD";
 	default: return NULL;
@@ -439,6 +440,8 @@  rte_get_tx_ol_flag_list(uint64_t mask, char *buf, size_t buflen)
 		  "PKT_TX_TUNNEL_NONE" },
 		{ PKT_TX_TUNNEL_MPLSINUDP, PKT_TX_TUNNEL_MASK,
 		  "PKT_TX_TUNNEL_NONE" },
+		{ PKT_TX_TUNNEL_VXLAN_GPE, PKT_TX_TUNNEL_MASK,
+		  "PKT_TX_TUNNEL_NONE" },
 		{ PKT_TX_MACSEC, PKT_TX_MACSEC, NULL },
 		{ PKT_TX_SEC_OFFLOAD, PKT_TX_SEC_OFFLOAD, NULL },
 	};
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 62740254d..1839cf2ed 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -210,6 +210,7 @@  extern "C" {
 #define PKT_TX_TUNNEL_GENEVE  (0x4ULL << 45)
 /**< TX packet with MPLS-in-UDP RFC 7510 header. */
 #define PKT_TX_TUNNEL_MPLSINUDP (0x5ULL << 45)
+#define PKT_TX_TUNNEL_VXLAN_GPE (0x6ULL << 45)
 /* add new TX TUNNEL type here */
 #define PKT_TX_TUNNEL_MASK    (0xFULL << 45)
 
diff --git a/lib/librte_mbuf/rte_mbuf_ptype.c b/lib/librte_mbuf/rte_mbuf_ptype.c
index 1feefacc6..49106c7df 100644
--- a/lib/librte_mbuf/rte_mbuf_ptype.c
+++ b/lib/librte_mbuf/rte_mbuf_ptype.c
@@ -65,6 +65,7 @@  const char *rte_get_ptype_tunnel_name(uint32_t ptype)
 	case RTE_PTYPE_TUNNEL_GTPU: return "TUNNEL_GTPU";
 	case RTE_PTYPE_TUNNEL_ESP: return "TUNNEL_ESP";
 	case RTE_PTYPE_TUNNEL_L2TP: return "TUNNEL_L2TP";
+	case RTE_PTYPE_TUNNEL_VXLAN_GPE: return "TUNNEL_VXLAN_GPE";
 	default: return "TUNNEL_UNKNOWN";
 	}
 }
diff --git a/lib/librte_mbuf/rte_mbuf_ptype.h b/lib/librte_mbuf/rte_mbuf_ptype.h
index b9a338110..7caf83312 100644
--- a/lib/librte_mbuf/rte_mbuf_ptype.h
+++ b/lib/librte_mbuf/rte_mbuf_ptype.h
@@ -423,6 +423,19 @@  extern "C" {
  */
 #define RTE_PTYPE_TUNNEL_L2TP               0x0000a000
 /**
+ * VXLAN-GPE (VXLAN Generic Protocol Extension) tunneling packet type.
+ *
+ * Packet format:
+ * <'ether type'=0x0800
+ * | 'version'=4, 'protocol'=17
+ * | 'destination port'=4790>
+ * or,
+ * <'ether type'=0x86DD
+ * | 'version'=6, 'next header'=17
+ * | 'destination port'=4790>
+ */
+#define RTE_PTYPE_TUNNEL_VXLAN_GPE          0x0000b000
+/**
  * Mask of tunneling packet types.
  */
 #define RTE_PTYPE_TUNNEL_MASK               0x0000f000
diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index a271d1c86..a64814179 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -311,6 +311,31 @@  struct vxlan_hdr {
 /**< VXLAN tunnel header length. */
 
 /**
+ * VXLAN-GPE protocol header.
+ * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network
+ * Identifier and Reserved fields (16 bits and 8 bits).
+ */
+struct vxlan_gpe_hdr {
+	uint8_t vx_flags; /**< flag (8). */
+	uint8_t reserved[2]; /**< Reserved (16). */
+	uint8_t proto; /**< next-protocol (8). */
+	uint32_t vx_vni;   /**< VNI (24) + Reserved (8). */
+} __attribute__((__packed__));
+
+/* VXLAN-GPE next protocol types */
+#define VXLAN_GPE_TYPE_IPv4 1 /**< IPv4 Protocol. */
+#define VXLAN_GPE_TYPE_IPv6 2 /**< IPv6 Protocol. */
+#define VXLAN_GPE_TYPE_ETH  3 /**< Ethernet Protocol. */
+#define VXLAN_GPE_TYPE_NSH  4 /**< NSH Protocol. */
+#define VXLAN_GPE_TYPE_MPLS 5 /**< MPLS Protocol. */
+#define VXLAN_GPE_TYPE_GBP  6 /**< GBP Protocol. */
+#define VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */
+
+#define ETHER_VXLAN_GPE_HLEN (sizeof(struct udp_hdr) + \
+			      sizeof(struct vxlan_gpe_hdr))
+/**< VXLAN-GPE tunnel header length. */
+
+/**
  * Extract VLAN tag information into mbuf
  *
  * Software version of VLAN stripping