[ovs-dev] [PATCH 2/2] datapath: Fix build with Centos 5.3 kernel.

Justin Pettit jpettit at nicira.com
Fri Oct 9 17:01:01 UTC 2009


Looks good.  Thanks for tracking this down.  Which branch were you  
targeting?

--Justin


On Oct 9, 2009, at 9:45 AM, Ben Pfaff wrote:

> Centos 5.3 backports more functions from later kernel versions to  
> 2.6.18,
> so the kernel version number is no longer a reliable way to check  
> for these
> functions.  Thus, add a "configure" test for them.
>
> Reported-by: Paulo Cravero <pcravero at as2594.net>
> ---
> acinclude.m4                                       |    4 ++++
> .../linux-2.6/compat-2.6/include/linux/skbuff.h    |    4 ++--
> .../linux-2.6/compat-2.6/include/net/checksum.h    |    7 ++-----
> 3 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/acinclude.m4 b/acinclude.m4
> index 4294920..d5d7c09 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -133,6 +133,10 @@ AC_DEFUN([OVS_CHECK_LINUX26_COMPAT], [
>                   [OVS_DEFINE([HAVE_NLA_NUL_STRING])])
>   OVS_GREP_IFELSE([$KSRC26/include/linux/err.h], [ERR_CAST],
>                   [OVS_DEFINE([HAVE_ERR_CAST])])
> +  OVS_GREP_IFELSE([$KSRC26/include/net/checksum.h], [csum_unfold],
> +                  [OVS_DEFINE([HAVE_CSUM_UNFOLD])])
> +  OVS_GREP_IFELSE([$KSRC26/include/linux/skbuff.h], [skb_cow],
> +                  [OVS_DEFINE([HAVE_SKB_COW])])
>   OVS_CHECK_LOG2_H
>   OVS_CHECK_VETH
>   if cmp -s datapath/linux-2.6/kcompat.h.new \
> diff --git a/datapath/linux-2.6/compat-2.6/include/linux/skbuff.h b/ 
> datapath/linux-2.6/compat-2.6/include/linux/skbuff.h
> index 666ef85..2831721 100644
> --- a/datapath/linux-2.6/compat-2.6/include/linux/skbuff.h
> +++ b/datapath/linux-2.6/compat-2.6/include/linux/skbuff.h
> @@ -42,7 +42,7 @@ static inline void skb_copy_to_linear_data_offset 
> (struct sk_buff *skb,
> #define NET_SKB_PAD	16
> #endif
>
> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
> +#ifndef HAVE_SKB_COW
> static inline int __skb_cow(struct sk_buff *skb, unsigned int  
> headroom,
>                             int cloned)
> {
> @@ -63,7 +63,7 @@ static inline int skb_cow_head(struct sk_buff  
> *skb, unsigned int headroom)
> {
> 	return __skb_cow(skb, headroom, skb_header_cloned(skb));
> }
> -#endif  /* linux < 2.6.23 */
> +#endif  /* !HAVE_SKB_COW */
>
>
> #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
> diff --git a/datapath/linux-2.6/compat-2.6/include/net/checksum.h b/ 
> datapath/linux-2.6/compat-2.6/include/net/checksum.h
> index c64c6bd..3b6debb 100644
> --- a/datapath/linux-2.6/compat-2.6/include/net/checksum.h
> +++ b/datapath/linux-2.6/compat-2.6/include/net/checksum.h
> @@ -3,14 +3,11 @@
>
> #include_next <net/checksum.h>
>
> -#include <linux/version.h>
> -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
> -
> +#ifndef HAVE_CSUM_UNFOLD
> static inline __wsum csum_unfold(__sum16 n)
> {
> 	return (__force __wsum)n;
> }
> -
> -#endif /* linux kernel < 2.6.20 */
> +#endif /* !HAVE_CSUM_UNFOLD */
>
> #endif /* checksum.h */
> -- 
> 1.6.3.3
>
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org





More information about the dev mailing list