From 918097dacf8f08a52d94b85d276b031b5fb69d4d Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Wed, 19 Jan 2011 09:29:06 -0800 Subject: [PATCH] datapath: Avoid backported csum_replace4() on RHEL 5. Reported-by: Koichi Yagishita Signed-off-by: Jesse Gross Acked-by: Ben Pfaff --- AUTHORS | 1 + acinclude.m4 | 1 + datapath/linux-2.6/compat-2.6/include/net/checksum.h | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 38afb2c8..6abd7ea0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -56,6 +56,7 @@ Jan Medved jmedved@juniper.net Jeongkeun Lee jklee@hp.com Joan Cirer joan@ev0.net John Galgay john@galgay.net +Koichi Yagishita yagishita.koichi@jrc.co.jp Krishna Miriyala krishna@nicira.com Luiz Henrique Ozaki luiz.ozaki@gmail.com Michael Mao mmao@nicira.com diff --git a/acinclude.m4 b/acinclude.m4 index 565ca6d2..3b691647 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -195,6 +195,7 @@ AC_DEFUN([OVS_CHECK_LINUX26_COMPAT], [ OVS_GREP_IFELSE([$KSRC26/include/linux/types.h], [__wsum], [OVS_DEFINE([HAVE_CSUM_TYPES])]) + OVS_GREP_IFELSE([$KSRC26/include/net/checksum.h], [csum_replace4]) OVS_GREP_IFELSE([$KSRC26/include/net/checksum.h], [csum_unfold]) OVS_GREP_IFELSE([$KSRC26/include/net/netlink.h], [NLA_NUL_STRING]) 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 e7e7966c..73f2f599 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 @@ -18,14 +18,16 @@ static inline __wsum csum_unfold(__sum16 n) csum_and_copy_to_user(src, dst, len, sum, NULL, err_ptr) #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) +#ifndef HAVE_CSUM_REPLACE4 static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) { __be32 diff[] = { ~from, to }; *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); } +#endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) #define inet_proto_csum_replace2(sum, skb, from, to, pseudohdr) \ inet_proto_csum_replace4(sum, skb, (__force __be32)(from), \ (__force __be32)(to), pseudohdr) -- 2.30.2