Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f73bafc authored by Greg Ungerer's avatar Greg Ungerer
Browse files

m68k: simpler m68k and ColdFire CPU's can use generic csum code



We have two implementations of the IP checksuming code for the m68k arch.
One uses the more advanced instructions available in 68020 and above
processors, the other uses the simpler instructions available on the
original 68000 processors and the modern ColdFire processors.

This simpler code is pretty much the same as the generic lib implementation
of the IP csum functions. So lets just switch over to using that. That
means we can completely remove the checksum_no.c file, and only have the
local fast code used for the more complex 68k CPU family members.

Signed-off-by: default avatarGreg Ungerer <gerg@uclinux.org>
parent 479badc3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -40,6 +40,9 @@ config GENERIC_CALIBRATE_DELAY
config GENERIC_IOMAP
	def_bool MMU

config GENERIC_CSUM
	bool

config TIME_LOW_RES
	bool
	default y
+2 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ comment "Processor Type"
config M68000
	bool
	select CPU_HAS_NO_BITFIELDS
	select GENERIC_CSUM
	help
	  The Freescale (was Motorola) 68000 CPU is the first generation of
	  the well known M68K family of processors. The CPU core as well as
@@ -23,6 +24,7 @@ config COLDFIRE
	select GENERIC_GPIO
	select ARCH_REQUIRE_GPIOLIB
	select CPU_HAS_NO_BITFIELDS
	select GENERIC_CSUM
	help
	  The Freescale ColdFire family of processors is a modern derivitive
	  of the 68000 processor family. They are mainly targeted at embedded
+5 −26
Original line number Diff line number Diff line
@@ -3,6 +3,10 @@

#include <linux/in6.h>

#ifdef CONFIG_GENERIC_CSUM
#include <asm-generic/checksum.h>
#else

/*
 * computes the checksum of a memory block at buff, length len,
 * and adds in "sum" (32-bit)
@@ -34,30 +38,6 @@ extern __wsum csum_partial_copy_nocheck(const void *src,
					      void *dst, int len,
					      __wsum sum);


#ifdef CONFIG_COLDFIRE

/*
 *	The ColdFire cores don't support all the 68k instructions used
 *	in the optimized checksum code below. So it reverts back to using
 *	more standard C coded checksums. The fast checksum code is
 *	significantly larger than the optimized version, so it is not
 *	inlined here.
 */
__sum16 ip_fast_csum(const void *iph, unsigned int ihl);

static inline __sum16 csum_fold(__wsum sum)
{
	unsigned int tmp = (__force u32)sum;

	tmp = (tmp & 0xffff) + (tmp >> 16);
	tmp = (tmp & 0xffff) + (tmp >> 16);

	return (__force __sum16)~tmp;
}

#else

/*
 *	This is a version of ip_fast_csum() optimized for IP headers,
 *	which always checksum on 4 octet boundaries.
@@ -97,8 +77,6 @@ static inline __sum16 csum_fold(__wsum sum)
	return (__force __sum16)~sum;
}

#endif /* CONFIG_COLDFIRE */

static inline __wsum
csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
		  unsigned short proto, __wsum sum)
@@ -167,4 +145,5 @@ csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
	return csum_fold(sum);
}

#endif /* CONFIG_GENERIC_CSUM */
#endif /* _M68K_CHECKSUM_H */
+6 −2
Original line number Diff line number Diff line
@@ -7,8 +7,12 @@ lib-y := ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
	   memcpy.o memset.o memmove.o

ifdef CONFIG_MMU
lib-y	+= string.o uaccess.o checksum_mm.o
lib-y	+= string.o uaccess.o
else
lib-y	+= mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o checksum_no.o
lib-y	+= mulsi3.o divsi3.o udivsi3.o modsi3.o umodsi3.o
endif

ifndef CONFIG_GENERIC_CSUM
lib-y	+= checksum.o
endif
+0 −0

File moved.

Loading