mirror of
https://github.com/openvswitch/ovs
synced 2025-10-27 15:18:06 +00:00
Following patch adds support for lwtunnel to OVS datapath. With this change OVS datapath detect lwtunnel support and make use of new APIs if available. On older kernel where the support is not there the backported tunnel modules are used. These backported tunnel devices acts as lwtunnel devices. I tried to keep backported module same as upstream for easier bug-fix backport. Since STT and LISP are not upstream OVS always needs to use respective modules from tunnel compat layer. To make it work on kernel 4.3 I have converted STT and LISP modules to lwtunnel API model. lwtunnel make use of skb-dst to pass tunnel information to the tunnel module. On older kernel this is not possible. So the in case of old kernel metadata ref is stored in OVS_CB and direct call to tunnel transmit function is made by respective tunnel vport modules. Similarly on receive side tunnel recv directly call netdev-vport-receive to pass the skb to OVS. Major backported components include: Geneve, GRE, VXLAN, ip_tunnel, udp-tunnels GRO. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Joe Stringer <joe@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
68 lines
1.5 KiB
C
68 lines
1.5 KiB
C
#ifndef __NET_STT_H
|
|
#define __NET_STT_H 1
|
|
|
|
#include <linux/kconfig.h>
|
|
#include <linux/errno.h>
|
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) && IS_ENABLED(CONFIG_NETFILTER)
|
|
#include <net/ip_tunnels.h>
|
|
#define OVS_STT
|
|
|
|
struct stthdr {
|
|
__u8 version;
|
|
__u8 flags;
|
|
__u8 l4_offset;
|
|
__u8 reserved;
|
|
__be16 mss;
|
|
__be16 vlan_tci;
|
|
__be64 key;
|
|
};
|
|
|
|
/* Padding after the end of the tunnel headers to provide alignment
|
|
* for inner packet IP header after 14 byte Ethernet header.
|
|
*/
|
|
#define STT_ETH_PAD 2
|
|
|
|
#define STT_BASE_HLEN (sizeof(struct stthdr) + STT_ETH_PAD)
|
|
#define STT_HEADER_LEN (sizeof(struct tcphdr) + STT_BASE_HLEN)
|
|
|
|
static inline struct stthdr *stt_hdr(const struct sk_buff *skb)
|
|
{
|
|
return (struct stthdr *)(skb_transport_header(skb) +
|
|
sizeof(struct tcphdr));
|
|
}
|
|
|
|
struct net_device *ovs_stt_dev_create_fb(struct net *net, const char *name,
|
|
u8 name_assign_type, u16 dst_port);
|
|
|
|
netdev_tx_t ovs_stt_xmit(struct sk_buff *skb);
|
|
|
|
int ovs_stt_init_module(void);
|
|
|
|
void ovs_stt_cleanup_module(void);
|
|
#else
|
|
static inline int ovs_stt_init_module(void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void ovs_stt_cleanup_module(void)
|
|
{}
|
|
|
|
static inline struct net_device *ovs_stt_dev_create_fb(struct net *net, const char *name,
|
|
u8 name_assign_type, u16 dst_port)
|
|
{
|
|
return ERR_PTR(-EOPNOTSUPP);
|
|
}
|
|
static inline netdev_tx_t ovs_stt_xmit(struct sk_buff *skb)
|
|
{
|
|
BUG();
|
|
return NETDEV_TX_OK;
|
|
}
|
|
#endif
|
|
|
|
#define stt_dev_create_fb ovs_stt_dev_create_fb
|
|
#define stt_init_module ovs_stt_init_module
|
|
#define stt_cleanup_module ovs_stt_cleanup_module
|
|
|
|
#endif /*ifdef__NET_STT_H */
|