Link: https://lore.kernel.org/r/20260217200002.683975158@linuxfoundation.org Tested-by: Florian Fainelli <florian.fainelli@broadcom.com> Tested-by: Takeshi Ogasawara <takeshi.ogasawara@futuring-girl.com> Tested-by: Peter Schneider <pschneider1968@googlemail.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Salvatore Bonaccorso <carnil@debian.org> Tested-by: Brett A C Sheffield <bacs@librecast.net> Tested-by: Mark Brown <broonie@kernel.org> Tested-by: Luna Jernberg <droidbittin@gmail.com> Tested-by: Ronald Warsow <rwarsow@gmx.de> Tested-by: Justin M. Forbes <jforbes@fedoraproject.org> Tested-by: Ron Economos <re@w6rz.net> Tested-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
39 lines
804 B
C
39 lines
804 B
C
/*
|
|
* Licensed under the GPL
|
|
*/
|
|
|
|
#ifndef __UM_SYSDEP_CHECKSUM_H
|
|
#define __UM_SYSDEP_CHECKSUM_H
|
|
|
|
static inline __sum16 ip_compute_csum(const void *buff, int len)
|
|
{
|
|
return csum_fold (csum_partial(buff, len, 0));
|
|
}
|
|
|
|
#define _HAVE_ARCH_IPV6_CSUM
|
|
static __inline__ __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
|
|
const struct in6_addr *daddr,
|
|
__u32 len, __u8 proto,
|
|
__wsum sum)
|
|
{
|
|
__asm__(
|
|
"addl 0(%1), %0 ;\n"
|
|
"adcl 4(%1), %0 ;\n"
|
|
"adcl 8(%1), %0 ;\n"
|
|
"adcl 12(%1), %0 ;\n"
|
|
"adcl 0(%2), %0 ;\n"
|
|
"adcl 4(%2), %0 ;\n"
|
|
"adcl 8(%2), %0 ;\n"
|
|
"adcl 12(%2), %0 ;\n"
|
|
"adcl %3, %0 ;\n"
|
|
"adcl %4, %0 ;\n"
|
|
"adcl $0, %0 ;\n"
|
|
: "=&r" (sum)
|
|
: "r" (saddr), "r" (daddr),
|
|
"r"(htonl(len)), "r"(htonl(proto)), "0"(sum));
|
|
|
|
return csum_fold(sum);
|
|
}
|
|
|
|
#endif
|