Skip to content

Commit

Permalink
datapath: compat: Detect GSO support at ovs configure
Browse files Browse the repository at this point in the history
OVS turns on tunnel GSO for statically for kernel older than 3.18.
Some distributions kernel could backport tunnel GSO. To make use
of device offload on such kernel detect the support at configure
stage.

Signed-off-by: Pravin B Shelar <[email protected]>
Acked-by: Jesse Gross <[email protected]>
  • Loading branch information
pshelar committed Aug 3, 2016
1 parent 42e22f9 commit 0a0d909
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions acinclude.m4
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [__skb_gso_segment])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [can_checksum_protocol])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_get_iflink])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_features_check],
[OVS_DEFINE([USE_UPSTREAM_TUNNEL_GSO])])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_add_vxlan_port])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [ndo_add_geneve_port])
OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [netdev_features_t])
Expand Down
4 changes: 2 additions & 2 deletions datapath/linux/compat/gso.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ int rpl_dev_queue_xmit(struct sk_buff *skb)
EXPORT_SYMBOL_GPL(rpl_dev_queue_xmit);
#endif /* OVS_USE_COMPAT_GSO_SEGMENTATION */

#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
#ifndef USE_UPSTREAM_TUNNEL_GSO
static __be16 __skb_network_protocol(struct sk_buff *skb)
{
__be16 type = skb->protocol;
Expand Down Expand Up @@ -310,4 +310,4 @@ int rpl_ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)
return output_ipv6(skb);
}
EXPORT_SYMBOL_GPL(rpl_ip6_local_out);
#endif /* 3.18 */
#endif /* USE_UPSTREAM_TUNNEL_GSO */
9 changes: 5 additions & 4 deletions datapath/linux/compat/gso.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct ovs_gso_cb {
#ifndef USE_UPSTREAM_TUNNEL
struct metadata_dst *tun_dst;
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
#ifndef USE_UPSTREAM_TUNNEL_GSO
gso_fix_segment_t fix_segment;
#endif
#ifndef HAVE_INNER_PROTOCOL
Expand All @@ -26,7 +26,7 @@ struct ovs_gso_cb {
#define OVS_GSO_CB(skb) ((struct ovs_gso_cb *)(skb)->cb)


#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
#ifndef USE_UPSTREAM_TUNNEL_GSO
#include <linux/netdevice.h>
#include <linux/skbuff.h>
#include <net/protocol.h>
Expand Down Expand Up @@ -85,12 +85,13 @@ static inline void ovs_skb_set_inner_protocol(struct sk_buff *skb,
#endif /* ENCAP_TYPE_ETHER */
#endif /* HAVE_INNER_PROTOCOL */

#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
#define skb_inner_mac_offset rpl_skb_inner_mac_offset
static inline int skb_inner_mac_offset(const struct sk_buff *skb)
{
return skb_inner_mac_header(skb) - skb->data;
}

#ifndef USE_UPSTREAM_TUNNEL_GSO
#define ip_local_out rpl_ip_local_out
int rpl_ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb);

Expand Down Expand Up @@ -121,7 +122,7 @@ static inline int rpl_ip6_local_out(struct net *net, struct sock *sk, struct sk_
}
#define ip6_local_out rpl_ip6_local_out

#endif /* 3.18 */
#endif /* USE_UPSTREAM_TUNNEL_GSO */

#ifndef USE_UPSTREAM_TUNNEL
/* We need two separate functions to manage different dst in this case.
Expand Down
2 changes: 1 addition & 1 deletion datapath/linux/compat/include/net/udp_tunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static inline int rpl_udp_tunnel_handle_offloads(struct sk_buff *skb,
fix_segment = ovs_udp_gso;
else
fix_segment = ovs_udp_csum_gso;
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
#ifndef USE_UPSTREAM_TUNNEL_GSO
/* This functuin is not used by vxlan lan tunnel. On older
* udp offload only supports vxlan, therefore fallback to software
* segmentation.
Expand Down
2 changes: 1 addition & 1 deletion datapath/linux/compat/ip_tunnels_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ int ovs_iptunnel_handle_offloads(struct sk_buff *skb,
goto error;
skb_shinfo(skb)->gso_type |= gso_type_mask;

#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
#ifndef USE_UPSTREAM_TUNNEL_GSO
if (gso_type_mask)
fix_segment = NULL;

Expand Down

0 comments on commit 0a0d909

Please sign in to comment.