[ewg] [PATCH v2] backports: fix csum_tcpudp_nofold backport for ia64

Yossi Etigin yosefe at voltaire.com
Wed Oct 1 12:00:18 PDT 2008


On ia64, kernels <= 2.6.22, csum_tcpudp_nofold is an unexported symbol
(on other platforms it's inline and in ia64 later kernels it's exported).
So need to put our own inline declaration.

Signed-off-by: Yossi Etigin <yosefe at voltaire.com>

--

diff -urN a/kernel_addons/backport/2.6.16/include/asm/checksum.h
b/kernel_addons/backport/2.6.16/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.16/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.16/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.16_sles10/include/asm/checksum.h
b/kernel_addons/backport/2.6.16_sles10/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.16_sles10/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.16_sles10/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.16_sles10_sp1/include/asm/checksum.h
b/kernel_addons/backport/2.6.16_sles10_sp1/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.16_sles10_sp1/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.16_sles10_sp1/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.16_sles10_sp2/include/asm/checksum.h
b/kernel_addons/backport/2.6.16_sles10_sp2/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.16_sles10_sp2/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.16_sles10_sp2/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.17/include/asm/checksum.h
b/kernel_addons/backport/2.6.17/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.17/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.17/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.18/include/asm/checksum.h
b/kernel_addons/backport/2.6.18/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.18/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.18/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.18_suse10_2/include/asm/checksum.h
b/kernel_addons/backport/2.6.18_suse10_2/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.18_suse10_2/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.18_suse10_2/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.19/include/asm/checksum.h
b/kernel_addons/backport/2.6.19/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.19/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.19/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.20/include/asm/checksum.h
b/kernel_addons/backport/2.6.20/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.20/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.20/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.21/include/asm/checksum.h
b/kernel_addons/backport/2.6.21/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.21/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.21/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.22/include/asm/checksum.h
b/kernel_addons/backport/2.6.22/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.22/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.22/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.22_suse10_3/include/asm/checksum.h
b/kernel_addons/backport/2.6.22_suse10_3/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.22_suse10_3/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.22_suse10_3/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.9_U4/include/asm/checksum.h
b/kernel_addons/backport/2.6.9_U4/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.9_U4/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.9_U4/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.9_U5/include/asm/checksum.h
b/kernel_addons/backport/2.6.9_U5/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.9_U5/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.9_U5/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */
diff -urN a/kernel_addons/backport/2.6.9_U6/include/asm/checksum.h
b/kernel_addons/backport/2.6.9_U6/include/asm/checksum.h
--- a/kernel_addons/backport/2.6.9_U6/include/asm/checksum.h	1970-01-01
02:00:00.000000000 +0200
+++ b/kernel_addons/backport/2.6.9_U6/include/asm/checksum.h	2008-09-29
15:00:21.000000000 +0300
@@ -0,0 +1,30 @@
+#ifndef __BACKPORT_CHECKSUM_H__
+#define __BACKPORT_CHECKSUM_H__
+
+#include_next <asm/checksum.h>
+
+#if defined(__ia64__)
+
+static inline __wsum
+backport_csum_tcpudp_nofold (__be32 saddr, __be32 daddr, unsigned short len,
+		    unsigned short proto, __wsum sum)
+{
+	unsigned long result;
+
+	result = (__force u64)saddr + (__force u64)daddr +
+		 (__force u64)sum + ((len + proto) << 8);
+
+	/* Fold down to 32-bits so we don't lose in the typedef-less network
stack.  */
+	/* 64 to 33 */
+	result = (result & 0xffffffff) + (result >> 32);
+	/* 33 to 32 */
+	result = (result & 0xffffffff) + (result >> 32);
+	return (__force __wsum)result;
+}
+
+#undef csum_tcpudp_nofold
+#define csum_tcpudp_nofold backport_csum_tcpudp_nofold
+
+#endif
+
+#endif /* __BACKPORT_CHECKSUM_H__ */



More information about the ewg mailing list