RHEL6-openstack kernel has backported gre DEMUX module, Therefore add configure check to detect it.
Signed-off-by: Pravin B Shelar <[email protected]> Bug #21936 --- acinclude.m4 | 1 + datapath/linux/compat/gre.c | 4 +- datapath/linux/compat/include/net/gre.h | 47 ++++++++++++++----------------- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 99b4054..7078654 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -274,6 +274,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ OVS_GREP_IFELSE([$KSRC/include/net/checksum.h], [csum_unfold]) OVS_GREP_IFELSE([$KSRC/include/net/genetlink.h], [parallel_ops]) + OVS_GREP_IFELSE([$KSRC/include/net/gre.h], [gre_cisco_register]) OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_get_be16]) OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_be16]) OVS_GREP_IFELSE([$KSRC/include/net/netlink.h], [nla_put_be32]) diff --git a/datapath/linux/compat/gre.c b/datapath/linux/compat/gre.c index f35f11f..83ced38 100644 --- a/datapath/linux/compat/gre.c +++ b/datapath/linux/compat/gre.c @@ -112,7 +112,7 @@ void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, } } -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0) +#ifndef HAVE_GRE_CISCO_REGISTER static __sum16 check_checksum(struct sk_buff *skb) { @@ -356,6 +356,6 @@ int gre_cisco_unregister(struct gre_cisco_protocol *proto) return ret; } -#endif /* 3.11 */ +#endif /* HAVE_GRE_CISCO_REGISTER */ #endif /* CONFIG_NET_IPGRE_DEMUX */ diff --git a/datapath/linux/compat/include/net/gre.h b/datapath/linux/compat/include/net/gre.h index 91fb7af..2678af5 100644 --- a/datapath/linux/compat/include/net/gre.h +++ b/datapath/linux/compat/include/net/gre.h @@ -4,7 +4,7 @@ #include <linux/skbuff.h> #include <net/ip_tunnels.h> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) +#ifdef HAVE_GRE_CISCO_REGISTER #include_next <net/gre.h> #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37) */ @@ -19,14 +19,14 @@ struct gre_protocol { int gre_add_protocol(const struct gre_protocol *proto, u8 version); int gre_del_protocol(const struct gre_protocol *proto, u8 version); -#endif +/* GRE demux not available, implement our own demux. */ +#define MAX_GRE_PROTO_PRIORITY 255 +#define gre_cisco_protocol rpl_gre_cisco_protocol -#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) -struct gre_base_hdr { - __be16 flags; - __be16 protocol; +struct gre_cisco_protocol { + int (*handler)(struct sk_buff *skb, const struct tnl_ptk_info *tpi); + u8 priority; }; -#define GRE_HEADER_SECTION 4 static inline __be16 gre_flags_to_tnl_flags(__be16 flags) { @@ -50,6 +50,19 @@ static inline __be16 gre_flags_to_tnl_flags(__be16 flags) return tflags; } +#define gre_cisco_register rpl_gre_cisco_register +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); + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) +struct gre_base_hdr { + __be16 flags; + __be16 protocol; +}; +#define GRE_HEADER_SECTION 4 + static inline __be16 tnl_flags_to_gre_flags(__be16 tflags) { __be16 flags = 0; @@ -73,24 +86,6 @@ 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 - -struct gre_cisco_protocol { - int (*handler)(struct sk_buff *skb, const struct tnl_ptk_info *tpi); - u8 priority; -}; - -#define gre_cisco_register rpl_gre_cisco_register -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); @@ -112,5 +107,5 @@ static inline int ip_gre_calc_hlen(__be16 o_flags) return addend; } - +#endif /* HAVE_GRE_CISCO_REGISTER */ #endif -- 1.7.1 _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
