]>
git.proxmox.com Git - ceph.git/blob - ceph/src/dpdk/examples/tep_termination/vxlan.h
4 * Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 #include <rte_ether.h>
40 #define PORT_MIN 49152
41 #define PORT_MAX 65535
42 #define PORT_RANGE ((PORT_MAX - PORT_MIN) + 1)
44 #define VXLAN_N_PORTS 2
45 #define VXLAN_HF_VNI 0x08000000
46 #define DEFAULT_VXLAN_PORT 4789
48 extern struct ipv4_hdr app_ip_hdr
[VXLAN_N_PORTS
];
49 extern struct ether_hdr app_l2_hdr
[VXLAN_N_PORTS
];
50 extern uint8_t tx_checksum
;
51 extern uint16_t tso_segsz
;
54 uint32_t vport_id
; /**< VirtIO port id */
55 uint32_t peer_ip
; /**< remote VTEP IP address */
56 struct ether_addr peer_mac
; /**< remote VTEP MAC address */
57 struct ether_addr vport_mac
; /**< VirtIO port MAC address */
58 } __rte_cache_aligned
;
61 uint16_t dst_port
; /**< VXLAN UDP destination port */
62 uint32_t port_ip
; /**< DPDK port IP address*/
63 uint32_t in_key
; /**< VLAN ID */
64 uint32_t out_key
; /**< VXLAN VNI */
65 struct vxlan_port port
[VXLAN_N_PORTS
]; /**< VXLAN configuration */
66 } __rte_cache_aligned
;
68 extern struct vxlan_conf vxdev
;
70 /* structure that caches offload info for the current packet */
71 union tunnel_offload_info
{
74 uint64_t l2_len
:7; /**< L2 (MAC) Header Length. */
75 uint64_t l3_len
:9; /**< L3 (IP) Header Length. */
76 uint64_t l4_len
:8; /**< L4 Header Length. */
77 uint64_t tso_segsz
:16; /**< TCP TSO segment size */
78 uint64_t outer_l2_len
:7; /**< outer L2 Header Length */
79 uint64_t outer_l3_len
:16; /**< outer L3 Header Length */
81 } __rte_cache_aligned
;
83 int decapsulation(struct rte_mbuf
*pkt
);
84 void encapsulation(struct rte_mbuf
*m
, uint8_t queue_id
);
86 #endif /* _VXLAN_H_ */