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

Commit 1e940829 authored by Alexander Duyck's avatar Alexander Duyck Committed by David S. Miller
Browse files

ipv6: Pass proto to csum_ipv6_magic as __u8 instead of unsigned short



This patch updates csum_ipv6_magic so that it correctly recognizes that
protocol is a unsigned 8 bit value.

This will allow us to better understand what limitations may or may not be
present in how we handle the data.  For example there are a number of
places that call htonl on the protocol value.  This is likely not necessary
and can be replaced with a multiplication by ntohl(1) which will be
converted to a shift by the compiler.

Signed-off-by: default avatarAlexander Duyck <aduyck@mirantis.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 01cfbad7
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -67,6 +67,5 @@ static inline __sum16 csum_fold(__wsum csum)
#define _HAVE_ARCH_IPV6_CSUM
extern __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
			       const struct in6_addr *daddr,
			       __u32 len, unsigned short proto,
			       __wsum sum);
			       __u32 len, __u8 proto, __wsum sum);
#endif
+2 −2
Original line number Diff line number Diff line
@@ -144,8 +144,8 @@ __csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __
		__be32 proto, __wsum sum);

static inline __sum16
csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __u32 len,
		unsigned short proto, __wsum sum)
csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
		__u32 len, __u8 proto, __wsum sum)
{
	return csum_fold(__csum_ipv6_magic(saddr, daddr, htonl(len),
					   htonl(proto), sum));
+1 −1
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ extern __sum16 ip_compute_csum(const void *buff, int len);
#define _HAVE_ARCH_IPV6_CSUM
static inline __sum16
csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
		__u32 len, unsigned short proto, __wsum sum)
		__u32 len, __u8 proto, __wsum sum)
{
	unsigned long tmp, tmp2;

+2 −2
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ static inline __sum16 csum_fold(__wsum csum)
#define _HAVE_ARCH_IPV6_CSUM	1
struct in6_addr;
extern __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
	const struct in6_addr *daddr, __u32 len, unsigned short proto,
	__wsum csum);
			       const struct in6_addr *daddr,
			       __u32 len, __u8 proto, __wsum csum);

#endif /* _ASM_IA64_CHECKSUM_H */
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ static inline __sum16 ip_compute_csum(const void *buff, int len)
#define _HAVE_ARCH_IPV6_CSUM
static __inline__ __sum16
csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr,
		__u32 len, unsigned short proto, __wsum sum)
		__u32 len, __u8 proto, __wsum sum)
{
	register unsigned long tmp;
	__asm__("addl %2@,%0\n\t"
Loading