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