ipv6_checksum_noasm.patch

Patch that disables ipv6 checksumming via asm - Robert Bradley, 04/15/2012 04:54 am

Download (1.9 kB)

 
b/arch/mips/include/asm/checksum.h
192 192
	return csum_fold(csum_partial(buff, len, 0));
193 193
}
194 194

  
195
#define _HAVE_ARCH_IPV6_CSUM
196
static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
197
				          const struct in6_addr *daddr,
198
					  __u32 len, unsigned short proto,
199
					  __wsum sum)
200
{
201
	__asm__(
202
	"	.set	push		# csum_ipv6_magic\n"
203
	"	.set	noreorder	\n"
204
	"	.set	noat		\n"
205
	"	addu	%0, %5		# proto (long in network byte order)\n"
206
	"	sltu	$1, %0, %5	\n"
207
	"	addu	%0, $1		\n"
208

  
209
	"	addu	%0, %6		# csum\n"
210
	"	sltu	$1, %0, %6	\n"
211
	"	lw	%1, 0(%2)	# four words source address\n"
212
	"	addu	%0, $1		\n"
213
	"	addu	%0, %1		\n"
214
	"	sltu	$1, %0, %1	\n"
215

  
216
	"	lw	%1, 4(%2)	\n"
217
	"	addu	%0, $1		\n"
218
	"	addu	%0, %1		\n"
219
	"	sltu	$1, %0, %1	\n"
220

  
221
	"	lw	%1, 8(%2)	\n"
222
	"	addu	%0, $1		\n"
223
	"	addu	%0, %1		\n"
224
	"	sltu	$1, %0, %1	\n"
225

  
226
	"	lw	%1, 12(%2)	\n"
227
	"	addu	%0, $1		\n"
228
	"	addu	%0, %1		\n"
229
	"	sltu	$1, %0, %1	\n"
230

  
231
	"	lw	%1, 0(%3)	\n"
232
	"	addu	%0, $1		\n"
233
	"	addu	%0, %1		\n"
234
	"	sltu	$1, %0, %1	\n"
235

  
236
	"	lw	%1, 4(%3)	\n"
237
	"	addu	%0, $1		\n"
238
	"	addu	%0, %1		\n"
239
	"	sltu	$1, %0, %1	\n"
240

  
241
	"	lw	%1, 8(%3)	\n"
242
	"	addu	%0, $1		\n"
243
	"	addu	%0, %1		\n"
244
	"	sltu	$1, %0, %1	\n"
245

  
246
	"	lw	%1, 12(%3)	\n"
247
	"	addu	%0, $1		\n"
248
	"	addu	%0, %1		\n"
249
	"	sltu	$1, %0, %1	\n"
250

  
251
	"	addu	%0, $1		# Add final carry\n"
252
	"	.set	pop"
253
	: "=r" (sum), "=r" (proto)
254
	: "r" (saddr), "r" (daddr),
255
	  "0" (htonl(len)), "1" (htonl(proto)), "r" (sum));
256

  
257
	return csum_fold(sum);
258
}
195
/*
196
 * Removed ipv6 asm checksumming so that GCC can produce generic code
197
 * that copes with unaligned addresses.  Necessary for dealing with the
198
 * ag71xx chipset, which cannot do unaligned DMA.
199
 */
259 200

  
260 201
#endif /* _ASM_CHECKSUM_H */