From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com [209.85.128.176]) by dpdk.org (Postfix) with ESMTP id 2E92B1BB68 for ; Thu, 12 Apr 2018 14:01:41 +0200 (CEST) Received: by mail-wr0-f176.google.com with SMTP id q13so1426692wre.3 for ; Thu, 12 Apr 2018 05:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=076JKaydtdzSt5MhOQeTBiPBoHYrVG7Lm0Nju136YBg=; b=o68gVmHA+U3eWnprRdawrrmm1xwbIV54SKghwfqmwysAQXjKGd7WE9FtTPFGaii28A iE8LXC4VfQ5ZmzBy/kaULqYM515G8m8/rOvCUQhU/ZuNCLMUJVSi6FR6TbZwugF20ZN8 MEx0r2RSls0ifp8vPA2PbnCNIMr6CK4ehm1xITylWuw2otFNhIMj/l8gTRvbsxPl26fa C+v6weOJqZw36ILhUYGs1ZFxmHMCBKeUtl1LRUzNAtArIXRG7Tp+uZNCZwWHCfuLyMH4 i8JljEjJm1+JRWtCsMs5AxQM4gg0r2KCrgx88Tu3PIOuDXndnL1dNLbCQIKN3XSXOORS louA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=076JKaydtdzSt5MhOQeTBiPBoHYrVG7Lm0Nju136YBg=; b=hIV4F1t/+1bTKVzOXyqyb+QI3HOa/bTTR/E1aflu2xUvLHn8ISRUzw+WhIMW8bQj5q jYOjx3HpNmskmPYTv+kPUs7mRTF1a+RnGLCwZGbPwfV5xJANuP66/DyUjfAD382d0KXL Xd7F7otNZ30f7qTzI4ij3OKZia+kNZxA7/1ZlHhAN6b+t31bCNXmYAyE5ql/A9rQIaxt RIORSNrs/5l+JP1OKOfKbsqkEdBk3K0rIt7CsU5rrz6/UAgnswYpbUWkjokxEGS0oX8Y 4vHwbRXwcY4fYKa/dgBH4LG/fFAg5CGXgNJ9I4EowqUbAsHm16x74oSkTxT2uGbaDusA U73Q== X-Gm-Message-State: ALQs6tBxLBdfBMBE/54h1XWJYICe1K8KRRVhL/3WQ2rp8TthcrZ4Zzvd mGg3zRFNIozrm3qOcQHe2/MpIA== X-Google-Smtp-Source: AIpwx4+y1Mi+TOjDWkr6O3pLV4E066D0m+65ZETMT5O+PPGZfS18DsZEqJrBJQ5DrNp8wKZSG0dMOQ== X-Received: by 10.223.133.197 with SMTP id 5mr620533wru.130.1523534500642; Thu, 12 Apr 2018 05:01:40 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id g4sm4690260wrd.1.2018.04.12.05.01.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Apr 2018 05:01:39 -0700 (PDT) Date: Thu, 12 Apr 2018 14:01:26 +0200 From: Adrien Mazarguil To: Xueming Li Cc: Wenzhuo Lu , Jingjing Wu , Thomas Monjalon , Nelio Laranjeiro , Shahaf Shuler , dev@dpdk.org, Olivier Matz Message-ID: <20180412120126.GR4957@6wind.com> References: <20180226150947.107179-2-xuemingl@mellanox.com> <20180412073324.61972-3-xuemingl@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180412073324.61972-3-xuemingl@mellanox.com> Subject: Re: [dpdk-dev] [PATCH v3 2/5] ethdev: introduce new tunnel VXLAN-GPE X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Apr 2018 12:01:41 -0000 On Thu, Apr 12, 2018 at 03:33:21PM +0800, Xueming Li wrote: > VXLAN-GPE enables VXLAN for all protocols. Protocol link: > https://www.ietf.org/id/draft-ietf-nvo3-vxlan-gpe-05.txt > > Signed-off-by: Xueming Li A couple of remaining minor comments, see below. Once addressed: Acked-by: Adrien Mazarguil > --- > doc/guides/prog_guide/rte_flow.rst | 12 ++++++++++++ > 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 +++++++++++++++++++++++++ > 9 files changed, 85 insertions(+), 1 deletion(-) > > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst > index 91dbd61a0..9d92d4e1e 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -1044,6 +1044,18 @@ Matches a GENEVE header. > - ``rsvd1``: reserved, normally 0x00. > - Default ``mask`` matches VNI only. > > +Item: ``VXLAN-GPE`` > +^^^^^^^^^^^^^^^^^^^ > + > +Matches a VXLAN-GPE header (draft-ietf-nvo3-vxlan-gpe-05). > + > +- ``flags``: normally 0x0C (I and P flag). Minor nit: => - ``flags``: normally 0x0c (I and P flags). > +- ``rsvd0``: reserved, normally 0x0000. > +- ``protocol``: protocol type. > +- ``vni``: VXLAN network identifier. > +- ``rsvd1``: reserved, normally 0x00. > +- Default ``mask`` matches VNI only. > + > Actions > ~~~~~~~ > > 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..58ec80f42 100644 > --- a/lib/librte_ether/rte_flow.c > +++ b/lib/librte_ether/rte_flow.c > @@ -55,6 +55,7 @@ static const struct rte_flow_desc_data rte_flow_desc_item[] = { > 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)), > + MK_FLOW_ITEM(VXLAN_GPE, sizeof(struct rte_flow_item_vxlan_gpe)), > }; > > /** Generate flow_action[] entry. */ > diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h > index bed727df8..fefd69920 100644 > --- a/lib/librte_ether/rte_flow.h > +++ b/lib/librte_ether/rte_flow.h > @@ -335,6 +335,13 @@ enum rte_flow_item_type { > * See struct rte_flow_item_geneve. > */ > RTE_FLOW_ITEM_TYPE_GENEVE, > + > + /** > + * Matches a VXLAN-GPE header (draft-ietf-nvo3-vxlan-gpe-05). Draft reference is unnecessary here, it should be provided further down with the structure definition as for VXLAN. > + * > + * See struct rte_flow_item_vxlan_gpe. > + */ > + RTE_FLOW_ITEM_TYPE_VXLAN_GPE, > }; > > /** > @@ -864,6 +871,26 @@ static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = { > #endif > > /** > + * RTE_FLOW_ITEM_TYPE_VXLAN_GPE. > + * > + * Matches a VXLAN-GPE header. Here: => 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). */ flag => flags > + 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 > + > +/** > * Matching pattern item definition. > * > * A pattern is formed by stacking items starting from the lowest protocol > 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..19af00a02 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 (draft-ietf-nvo3-vxlan-gpe-05). > + * 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. */ I suggest using all-caps macro definitions, i.e.: #define VXLAN_GPE_TYPE_IPV4 1 /**< IPv4 protocol. */ #define VXLAN_GPE_TYPE_IPV6 2 /**< IPv6 protocol. */ checkpatch users will thank you :) > +#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