net: add rte prefix to ether structures
[dpdk.git] / examples / tep_termination / vxlan.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2015 Intel Corporation
3  */
4
5 #ifndef _VXLAN_H_
6 #define _VXLAN_H_
7
8 #include <rte_ether.h>
9 #include <rte_ip.h>
10
11 #define PORT_MIN        49152
12 #define PORT_MAX        65535
13 #define PORT_RANGE ((PORT_MAX - PORT_MIN) + 1)
14
15 #define VXLAN_N_PORTS  2
16 #define VXLAN_HF_VNI 0x08000000
17 #define DEFAULT_VXLAN_PORT 4789
18
19 extern struct ipv4_hdr app_ip_hdr[VXLAN_N_PORTS];
20 extern struct rte_ether_hdr app_l2_hdr[VXLAN_N_PORTS];
21 extern uint8_t tx_checksum;
22 extern uint16_t tso_segsz;
23
24 struct vxlan_port {
25         uint32_t vport_id;           /**< VirtIO port id */
26         uint32_t peer_ip;            /**< remote VTEP IP address */
27         struct rte_ether_addr peer_mac;  /**< remote VTEP MAC address */
28         struct rte_ether_addr vport_mac; /**< VirtIO port MAC address */
29 } __rte_cache_aligned;
30
31 struct vxlan_conf {
32         uint16_t dst_port;      /**< VXLAN UDP destination port */
33         uint32_t port_ip;       /**< DPDK port IP address*/
34         uint32_t in_key;        /**< VLAN  ID */
35         uint32_t out_key;       /**< VXLAN VNI */
36         struct vxlan_port port[VXLAN_N_PORTS]; /**< VXLAN configuration */
37 } __rte_cache_aligned;
38
39 extern struct vxlan_conf vxdev;
40
41 /* structure that caches offload info for the current packet */
42 union tunnel_offload_info {
43         uint64_t data;
44         struct {
45                 uint64_t l2_len:7; /**< L2 (MAC) Header Length. */
46                 uint64_t l3_len:9; /**< L3 (IP) Header Length. */
47                 uint64_t l4_len:8; /**< L4 Header Length. */
48                 uint64_t tso_segsz:16; /**< TCP TSO segment size */
49                 uint64_t outer_l2_len:7; /**< outer L2 Header Length */
50                 uint64_t outer_l3_len:16; /**< outer L3 Header Length */
51         };
52 } __rte_cache_aligned;
53
54 int decapsulation(struct rte_mbuf *pkt);
55 void encapsulation(struct rte_mbuf *m, uint8_t queue_id);
56
57 #endif /* _VXLAN_H_ */