Skip to content

Commit

Permalink
m68k: simpler m68k and ColdFire CPU's can use generic csum code
Browse files Browse the repository at this point in the history
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: Greg Ungerer <gerg@uclinux.org>
  • Loading branch information
Greg Ungerer committed Dec 24, 2011
1 parent 479badc commit 7f73baf
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 184 deletions.
3 changes: 3 additions & 0 deletions arch/m68k/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions arch/m68k/Kconfig.cpu
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
31 changes: 5 additions & 26 deletions arch/m68k/include/asm/checksum.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 */
8 changes: 6 additions & 2 deletions arch/m68k/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

File renamed without changes.
156 changes: 0 additions & 156 deletions arch/m68k/lib/checksum_no.c

This file was deleted.

0 comments on commit 7f73baf

Please sign in to comment.