ethdev: introduce new tunnel VXLAN-GPE

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 <xuemingl@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Xueming Li 2018-04-23 20:16:32 +08:00 committed by Ferruh Yigit
parent fc6bbb3f28
commit 6f99e5b54e
9 changed files with 85 additions and 1 deletions

View File

@ -1054,6 +1054,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 flags).
- ``rsvd0``: reserved, normally 0x0000.
- ``protocol``: protocol type.
- ``vni``: VXLAN network identifier.
- ``rsvd1``: reserved, normally 0x00.
- Default ``mask`` matches VNI only.
Actions
~~~~~~~

View File

@ -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

View File

@ -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. */

View File

@ -339,6 +339,13 @@ enum rte_flow_item_type {
* See struct rte_flow_item_geneve.
*/
RTE_FLOW_ITEM_TYPE_GENEVE,
/**
* Matches a VXLAN-GPE header.
*
* See struct rte_flow_item_vxlan_gpe.
*/
RTE_FLOW_ITEM_TYPE_VXLAN_GPE,
};
/**
@ -867,6 +874,26 @@ static const struct rte_flow_item_geneve rte_flow_item_geneve_mask = {
};
#endif
/**
* RTE_FLOW_ITEM_TYPE_VXLAN_GPE (draft-ietf-nvo3-vxlan-gpe-05).
*
* Matches a VXLAN-GPE header.
*/
struct rte_flow_item_vxlan_gpe {
uint8_t flags; /**< Normally 0x0c (I and P 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.
*

View File

@ -390,6 +390,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_TUNNEL_IP: return "PKT_TX_TUNNEL_IP";
case PKT_TX_TUNNEL_UDP: return "PKT_TX_TUNNEL_UDP";
case PKT_TX_MACSEC: return "PKT_TX_MACSEC";
@ -426,6 +427,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_TUNNEL_IP, PKT_TX_TUNNEL_MASK,
"PKT_TX_TUNNEL_NONE" },
{ PKT_TX_TUNNEL_UDP, PKT_TX_TUNNEL_MASK,

View File

@ -213,6 +213,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)
/**
* Generic IP encapsulated tunnel type, used for TSO and checksum offload.
* It can be used for tunnels which are not standards or listed above.

View File

@ -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";
}
}

View File

@ -422,6 +422,19 @@ extern "C" {
* | 'version'=6, 'protocol'=115>
*/
#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.
*/

View File

@ -310,6 +310,31 @@ struct vxlan_hdr {
#define ETHER_VXLAN_HLEN (sizeof(struct udp_hdr) + sizeof(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. */
#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
*