numam-dpdk/lib/librte_net/rte_geneve.h
Ophir Munk ea0e711b8a app/testpmd: add GENEVE parsing
GENEVE is a widely used tunneling protocol in modern Virtualized
Networks. testpmd already supports parsing of several tunneling
protocols including VXLAN, VXLAN-GPE, GRE. This commit adds GENEVE
parsing of inner protocols (IPv4-0x0800, IPv6-0x86dd, Ethernet-0x6558)
based on IETF draft-ietf-nvo3-geneve-09. GENEVE is considered more
flexible than the other protocols.  In terms of protocol format GENEVE
header has a variable length options as opposed to other tunneling
protocols which have a fixed header size.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-10-16 19:18:47 +02:00

67 lines
1.8 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause
* Copyright 2020 Mellanox Technologies, Ltd
*/
#ifndef _RTE_GENEVE_H_
#define _RTE_GENEVE_H_
/**
* @file
*
* GENEVE-related definitions
*/
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/** GENEVE default port. */
#define RTE_GENEVE_DEFAULT_PORT 6081
/**
* GENEVE protocol header. (draft-ietf-nvo3-geneve-09)
* Contains:
* 2-bits version (must be 0).
* 6-bits option length in four byte multiples, not including the eight
* bytes of the fixed tunnel header.
* 1-bit control packet.
* 1-bit critical options in packet.
* 6-bits reserved
* 16-bits Protocol Type. The protocol data unit after the Geneve header
* following the EtherType convention. Ethernet itself is represented by
* the value 0x6558.
* 24-bits Virtual Network Identifier (VNI). Virtual network unique identified.
* 8-bits reserved bits (must be 0 on transmission and ignored on receipt).
* More-bits (optional) variable length options.
*/
__extension__
struct rte_geneve_hdr {
#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
uint8_t ver:2; /**< Version. */
uint8_t opt_len:6; /**< Options length. */
uint8_t oam:1; /**< Control packet. */
uint8_t critical:1; /**< Critical packet. */
uint8_t reserved1:6; /**< Reserved. */
#else
uint8_t opt_len:6; /**< Options length. */
uint8_t ver:2; /**< Version. */
uint8_t reserved1:6; /**< Reserved. */
uint8_t critical:1; /**< Critical packet. */
uint8_t oam:1; /**< Control packet. */
#endif
rte_be16_t proto; /**< Protocol type. */
uint8_t vni[3]; /**< Virtual network identifier. */
uint8_t reserved2; /**< Reserved. */
uint32_t opts[]; /**< Variable length options. */
} __rte_packed;
/* GENEVE ETH next protocol types */
#define RTE_GENEVE_TYPE_ETH 0x6558 /**< Ethernet Protocol. */
#ifdef __cplusplus
}
#endif
#endif /* RTE_GENEVE_H_ */