]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | /* SPDX-License-Identifier: BSD-3-Clause |
2 | * Copyright(c) 2018-2019 Intel Corporation | |
3 | */ | |
4 | ||
5 | #ifndef _RTE_VXLAN_H_ | |
6 | #define _RTE_VXLAN_H_ | |
7 | ||
8 | /** | |
9 | * @file | |
10 | * | |
11 | * VXLAN-related definitions | |
12 | */ | |
13 | ||
14 | #include <stdint.h> | |
15 | ||
16 | #include <rte_udp.h> | |
17 | ||
18 | ||
19 | #ifdef __cplusplus | |
20 | extern "C" { | |
21 | #endif | |
22 | ||
23 | /** VXLAN default port. */ | |
24 | #define RTE_VXLAN_DEFAULT_PORT 4789 | |
25 | ||
26 | /** | |
27 | * VXLAN protocol header. | |
28 | * Contains the 8-bit flag, 24-bit VXLAN Network Identifier and | |
29 | * Reserved fields (24 bits and 8 bits) | |
30 | */ | |
31 | struct rte_vxlan_hdr { | |
32 | uint32_t vx_flags; /**< flag (8) + Reserved (24). */ | |
33 | uint32_t vx_vni; /**< VNI (24) + Reserved (8). */ | |
34 | } __rte_packed; | |
35 | ||
36 | /** VXLAN tunnel header length. */ | |
37 | #define RTE_ETHER_VXLAN_HLEN \ | |
38 | (sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr)) | |
39 | ||
40 | ||
41 | /** | |
42 | * VXLAN-GPE protocol header (draft-ietf-nvo3-vxlan-gpe-05). | |
43 | * Contains the 8-bit flag, 8-bit next-protocol, 24-bit VXLAN Network | |
44 | * Identifier and Reserved fields (16 bits and 8 bits). | |
45 | */ | |
46 | struct rte_vxlan_gpe_hdr { | |
47 | uint8_t vx_flags; /**< flag (8). */ | |
48 | uint8_t reserved[2]; /**< Reserved (16). */ | |
49 | uint8_t proto; /**< next-protocol (8). */ | |
50 | uint32_t vx_vni; /**< VNI (24) + Reserved (8). */ | |
51 | } __rte_packed; | |
52 | ||
53 | /** VXLAN-GPE tunnel header length. */ | |
54 | #define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \ | |
55 | sizeof(struct rte_vxlan_gpe_hdr)) | |
56 | ||
57 | /* VXLAN-GPE next protocol types */ | |
58 | #define RTE_VXLAN_GPE_TYPE_IPV4 1 /**< IPv4 Protocol. */ | |
59 | #define RTE_VXLAN_GPE_TYPE_IPV6 2 /**< IPv6 Protocol. */ | |
60 | #define RTE_VXLAN_GPE_TYPE_ETH 3 /**< Ethernet Protocol. */ | |
61 | #define RTE_VXLAN_GPE_TYPE_NSH 4 /**< NSH Protocol. */ | |
62 | #define RTE_VXLAN_GPE_TYPE_MPLS 5 /**< MPLS Protocol. */ | |
63 | #define RTE_VXLAN_GPE_TYPE_GBP 6 /**< GBP Protocol. */ | |
64 | #define RTE_VXLAN_GPE_TYPE_VBNG 7 /**< vBNG Protocol. */ | |
65 | ||
66 | ||
67 | #ifdef __cplusplus | |
68 | } | |
69 | #endif | |
70 | ||
71 | #endif /* RTE_VXLAN_H_ */ |