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