DPDK  24.07.0
rte_vxlan.h
Go to the documentation of this file.
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 
14 #include <stdint.h>
15 
16 #include <rte_byteorder.h>
17 #include <rte_udp.h>
18 
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
25 #define RTE_VXLAN_DEFAULT_PORT 4789
26 
27 #define RTE_VXLAN_GPE_DEFAULT_PORT 4790
28 
34 __extension__ /* no named member in struct */
35 struct rte_vxlan_hdr {
36  union {
38  struct {
39  union {
40  uint8_t flags;
41  struct {
42 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
43  uint8_t flag_g:1,
44  flag_rsvd:1, /* Reserved. */
45  flag_ver:2,
46  flag_i:1,
47  flag_p:1,
48  flag_b:1,
49  flag_o:1;
50 #elif RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
51  uint8_t flag_o:1,
52  flag_b:1,
53  flag_p:1,
54  flag_i:1,
55  flag_ver:2,
56  flag_rsvd:1,
57  flag_g:1;
58 #endif
59  } __rte_packed;
60  }; /* end of 1st byte */
61  union {
62  uint8_t rsvd0[3]; /* Reserved for extensions. */
63  struct {
64 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
65  uint8_t rsvd0_gbp1:1, /* Reserved. */
66  flag_d:1,
67  rsvd0_gbp2:2, /* Reserved. */
68  flag_a:1,
69  rsvd0_gbp3:3; /* Reserved. */
70 #elif RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
71  uint8_t rsvd0_gbp3:3,
72  flag_a:1,
73  rsvd0_gbp2:2,
74  flag_d:1,
75  rsvd0_gbp1:1;
76 #endif
77  union {
78  uint16_t policy_id;
79  struct {
80  uint8_t rsvd0_gpe; /* Reserved. */
81  uint8_t proto;
82  /* 0x01 : IPv4
83  * 0x02 : IPv6
84  * 0x03 : Ethernet
85  * 0x04 : Network Service Header
86  */
87  } __rte_packed;
88  };
89  } __rte_packed;
90  };
91  } __rte_packed;
92  }; /* end of 1st 32-bit word */
93  union {
95  struct {
96  uint8_t vni[3];
97  union {
98  uint8_t rsvd1;
99  uint8_t last_rsvd;
100  };
101  } __rte_packed;
102  }; /* end of 2nd 32-bit word */
103 } __rte_packed;
104 
106 #define RTE_ETHER_VXLAN_HLEN \
107  (sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr))
108 
109 
118 __extension__ /* no named member in struct */
120  union {
121  struct {
122  uint8_t vx_flags;
123  uint8_t reserved[2];
124  uint8_t protocol;
126  };
127  struct {
128  uint8_t flags;
129  uint8_t rsvd0[2];
130  uint8_t proto;
131  uint8_t vni[3];
132  uint8_t rsvd1;
133  };
134  };
135 } __rte_packed;
136 
143 #define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \
144  sizeof(struct rte_vxlan_gpe_hdr))
145 
146 /* VXLAN-GPE next protocol types */
147 #define RTE_VXLAN_GPE_TYPE_IPV4 1
148 #define RTE_VXLAN_GPE_TYPE_IPV6 2
149 #define RTE_VXLAN_GPE_TYPE_ETH 3
150 #define RTE_VXLAN_GPE_TYPE_NSH 4
151 #define RTE_VXLAN_GPE_TYPE_MPLS 5
152 #define RTE_VXLAN_GPE_TYPE_GBP 6
153 #define RTE_VXLAN_GPE_TYPE_VBNG 7
156 #ifdef __cplusplus
157 }
158 #endif
159 
160 #endif /* RTE_VXLAN_H_ */
uint8_t flag_a
Definition: rte_vxlan.h:65
uint32_t rte_be32_t
rte_be32_t vx_flags
Definition: rte_vxlan.h:37
uint8_t flag_o
Definition: rte_vxlan.h:43
uint8_t flag_i
Definition: rte_vxlan.h:43
rte_be32_t vx_vni
Definition: rte_vxlan.h:125
uint8_t rsvd1
Definition: rte_vxlan.h:98
uint8_t vx_flags
Definition: rte_vxlan.h:122
uint8_t flag_g
Definition: rte_vxlan.h:43
#define __rte_packed
Definition: rte_common.h:108
uint8_t flag_b
Definition: rte_vxlan.h:43
uint8_t vni[3]
Definition: rte_vxlan.h:96
uint8_t flags
Definition: rte_vxlan.h:40
uint8_t flag_p
Definition: rte_vxlan.h:43
rte_be32_t vx_vni
Definition: rte_vxlan.h:94
uint8_t last_rsvd
Definition: rte_vxlan.h:99
uint16_t policy_id
Definition: rte_vxlan.h:78
uint8_t proto
Definition: rte_vxlan.h:81
uint8_t flag_ver
Definition: rte_vxlan.h:43
uint8_t flag_d
Definition: rte_vxlan.h:65
uint8_t protocol
Definition: rte_vxlan.h:124