xref: /f-stack/dpdk/lib/librte_net/rte_geneve.h (revision 2d9fd380)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2020 Mellanox Technologies, Ltd
3  */
4 
5 #ifndef _RTE_GENEVE_H_
6 #define _RTE_GENEVE_H_
7 
8 /**
9  * @file
10  *
11  * GENEVE-related definitions
12  */
13 #include <stdint.h>
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 /** GENEVE default port. */
20 #define RTE_GENEVE_DEFAULT_PORT 6081
21 
22 /**
23  * GENEVE protocol header. (draft-ietf-nvo3-geneve-09)
24  * Contains:
25  * 2-bits version (must be 0).
26  * 6-bits option length in four byte multiples, not including the eight
27  *	bytes of the fixed tunnel header.
28  * 1-bit control packet.
29  * 1-bit critical options in packet.
30  * 6-bits reserved
31  * 16-bits Protocol Type. The protocol data unit after the Geneve header
32  *	following the EtherType convention. Ethernet itself is represented by
33  *	the value 0x6558.
34  * 24-bits Virtual Network Identifier (VNI). Virtual network unique identified.
35  * 8-bits reserved bits (must be 0 on transmission and ignored on receipt).
36  * More-bits (optional) variable length options.
37  */
38 __extension__
39 struct rte_geneve_hdr {
40 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
41 	uint8_t ver:2;		/**< Version. */
42 	uint8_t opt_len:6;	/**< Options length. */
43 	uint8_t oam:1;		/**< Control packet. */
44 	uint8_t critical:1;	/**< Critical packet. */
45 	uint8_t reserved1:6;	/**< Reserved. */
46 #else
47 	uint8_t opt_len:6;	/**< Options length. */
48 	uint8_t ver:2;		/**< Version. */
49 	uint8_t reserved1:6;	/**< Reserved. */
50 	uint8_t critical:1;	/**< Critical packet. */
51 	uint8_t oam:1;		/**< Control packet. */
52 #endif
53 	rte_be16_t proto;	/**< Protocol type. */
54 	uint8_t vni[3];		/**< Virtual network identifier. */
55 	uint8_t reserved2;	/**< Reserved. */
56 	uint32_t opts[];	/**< Variable length options. */
57 } __rte_packed;
58 
59 /* GENEVE ETH next protocol types */
60 #define RTE_GENEVE_TYPE_ETH	0x6558 /**< Ethernet Protocol. */
61 
62 #ifdef __cplusplus
63 }
64 #endif
65 
66 #endif /* RTE_GENEVE_H_ */
67