[ovs-dev] [PATCH] datapath: Avoid backported csum_replace4() on RHEL 5.
Jesse Gross
jesse at nicira.com
Wed Jan 19 17:33:21 UTC 2011
Reported-by: Koichi Yagishita <yagishita.koichi at jrc.co.jp>
Signed-off-by: Jesse Gross <jesse at nicira.com>
---
acinclude.m4 | 1 +
.../linux-2.6/compat-2.6/include/net/checksum.h | 4 +++-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/acinclude.m4 b/acinclude.m4
index 565ca6d..3b69164 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 e7e7966..73f2f59 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)
--
1.7.1
More information about the dev
mailing list