DPDK  24.11.0-rc3
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 
20 #define RTE_VXLAN_DEFAULT_PORT 4789
21 
22 #define RTE_VXLAN_GPE_DEFAULT_PORT 4790
23 
29 __extension__ /* no named member in struct */
30 struct rte_vxlan_hdr {
31  union {
33  struct {
34  union {
35  uint8_t flags;
36  struct {
37 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
38  uint8_t flag_g:1,
39  flag_rsvd:1, /* Reserved. */
40  flag_ver:2,
41  flag_i:1,
42  flag_p:1,
43  flag_b:1,
44  flag_o:1;
45 #elif RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
46  uint8_t flag_o:1,
47  flag_b:1,
48  flag_p:1,
49  flag_i:1,
50  flag_ver:2,
51  flag_rsvd:1,
52  flag_g:1;
53 #endif
54  } __rte_packed;
55  }; /* end of 1st byte */
56  union {
57  uint8_t rsvd0[3]; /* Reserved for extensions. */
58  struct {
59 #if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
60  uint8_t rsvd0_gbp1:1, /* Reserved. */
61  flag_d:1,
62  rsvd0_gbp2:2, /* Reserved. */
63  flag_a:1,
64  rsvd0_gbp3:3; /* Reserved. */
65 #elif RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
66  uint8_t rsvd0_gbp3:3,
67  flag_a:1,
68  rsvd0_gbp2:2,
69  flag_d:1,
70  rsvd0_gbp1:1;
71 #endif
72  union {
73  uint16_t policy_id;
74  struct {
75  uint8_t rsvd0_gpe; /* Reserved. */
76  uint8_t proto;
77  /* 0x01 : IPv4
78  * 0x02 : IPv6
79  * 0x03 : Ethernet
80  * 0x04 : Network Service Header
81  */
82  } __rte_packed;
83  };
84  } __rte_packed;
85  };
86  } __rte_packed;
87  }; /* end of 1st 32-bit word */
88  union {
90  struct {
91  uint8_t vni[3];
92  union {
93  uint8_t rsvd1;
94  uint8_t last_rsvd;
95  };
96  } __rte_packed;
97  }; /* end of 2nd 32-bit word */
98 } __rte_packed;
99 
101 #define RTE_ETHER_VXLAN_HLEN \
102  (sizeof(struct rte_udp_hdr) + sizeof(struct rte_vxlan_hdr))
103 
104 
113 __extension__ /* no named member in struct */
115  union {
116  struct {
117  uint8_t vx_flags;
118  uint8_t reserved[2];
119  uint8_t protocol;
121  };
122  struct {
123  uint8_t flags;
124  uint8_t rsvd0[2];
125  uint8_t proto;
126  uint8_t vni[3];
127  uint8_t rsvd1;
128  };
129  };
130 } __rte_packed;
131 
138 #define RTE_ETHER_VXLAN_GPE_HLEN (sizeof(struct rte_udp_hdr) + \
139  sizeof(struct rte_vxlan_gpe_hdr))
140 
141 /* VXLAN-GPE next protocol types */
142 #define RTE_VXLAN_GPE_TYPE_IPV4 1
143 #define RTE_VXLAN_GPE_TYPE_IPV6 2
144 #define RTE_VXLAN_GPE_TYPE_ETH 3
145 #define RTE_VXLAN_GPE_TYPE_NSH 4
146 #define RTE_VXLAN_GPE_TYPE_MPLS 5
147 #define RTE_VXLAN_GPE_TYPE_GBP 6
148 #define RTE_VXLAN_GPE_TYPE_VBNG 7
150 #endif /* RTE_VXLAN_H_ */
uint8_t flag_a
Definition: rte_vxlan.h:60
uint32_t rte_be32_t
rte_be32_t vx_flags
Definition: rte_vxlan.h:32
uint8_t flag_o
Definition: rte_vxlan.h:38
uint8_t flag_i
Definition: rte_vxlan.h:38
rte_be32_t vx_vni
Definition: rte_vxlan.h:120
uint8_t rsvd1
Definition: rte_vxlan.h:93
uint8_t vx_flags
Definition: rte_vxlan.h:117
uint8_t flag_g
Definition: rte_vxlan.h:38
#define __rte_packed
Definition: rte_common.h:108
uint8_t flag_b
Definition: rte_vxlan.h:38
uint8_t vni[3]
Definition: rte_vxlan.h:91
uint8_t flags
Definition: rte_vxlan.h:35
uint8_t flag_p
Definition: rte_vxlan.h:38
rte_be32_t vx_vni
Definition: rte_vxlan.h:89
uint8_t last_rsvd
Definition: rte_vxlan.h:94
uint16_t policy_id
Definition: rte_vxlan.h:73
uint8_t proto
Definition: rte_vxlan.h:76
uint8_t flag_ver
Definition: rte_vxlan.h:38
uint8_t flag_d
Definition: rte_vxlan.h:60
uint8_t protocol
Definition: rte_vxlan.h:119