From: Pravin B Shelar Date: Wed, 20 Nov 2013 17:50:14 +0000 (-0800) Subject: datapath: gre: Fix kernel 3.11 compatibility. X-Git-Tag: sliver-openvswitch-2.0.90-1~4^2~1 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=9a27329d2ce023e4399fdffe44cd49e0309dbfb5 datapath: gre: Fix kernel 3.11 compatibility. On 3.11 kernel, gre module exports IP_GRE demux API, ovs needs to use it to register for GRE protocol handler. Reported-by: Nithin Nayak Sujir Signed-off-by: Pravin B Shelar Tested-by: Nithin Nayak Sujir Acked-by: Jesse Gross --- diff --git a/datapath/linux/compat/gre.c b/datapath/linux/compat/gre.c index 582bd94c2..f35f11fd6 100644 --- a/datapath/linux/compat/gre.c +++ b/datapath/linux/compat/gre.c @@ -39,8 +39,6 @@ #include "gso.h" -static struct gre_cisco_protocol __rcu *gre_cisco_proto; - static void gre_csum_fix(struct sk_buff *skb) { struct gre_base_hdr *greh; @@ -114,6 +112,8 @@ void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, } } +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) + static __sum16 check_checksum(struct sk_buff *skb) { __sum16 csum = 0; @@ -197,6 +197,8 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi, return iptunnel_pull_header(skb, hdr_len, tpi->proto); } +static struct gre_cisco_protocol __rcu *gre_cisco_proto; + static int gre_cisco_rcv(struct sk_buff *skb) { struct tnl_ptk_info tpi; @@ -354,4 +356,6 @@ int gre_cisco_unregister(struct gre_cisco_protocol *proto) return ret; } +#endif /* 3.11 */ + #endif /* CONFIG_NET_IPGRE_DEMUX */ diff --git a/datapath/linux/compat/include/net/gre.h b/datapath/linux/compat/include/net/gre.h index 5b17dcc53..91fb7af4e 100644 --- a/datapath/linux/compat/include/net/gre.h +++ b/datapath/linux/compat/include/net/gre.h @@ -73,6 +73,8 @@ static inline __be16 tnl_flags_to_gre_flags(__be16 tflags) } #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) +/* GRE demux not available, implement our own demux. */ #define MAX_GRE_PROTO_PRIORITY 255 #define gre_cisco_protocol rpl_gre_cisco_protocol @@ -87,6 +89,8 @@ int gre_cisco_register(struct gre_cisco_protocol *proto); #define gre_cisco_unregister rpl_gre_cisco_unregister int gre_cisco_unregister(struct gre_cisco_protocol *proto); +#endif + #define gre_build_header rpl_gre_build_header void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, int hdr_len);