[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iLpFOok_tv=DKsLX1mxZGdHQgATdW4Xs0rc6oaXQEa5Ng@mail.gmail.com>
Date: Fri, 26 Nov 2021 10:17:35 -0800
From: Eric Dumazet <edumazet@...gle.com>
To: Noah Goldstein <goldstein.w.n@...il.com>
Cc: tglx@...utronix.de, mingo@...hat.com,
Borislav Petkov <bp@...en8.de>, dave.hansen@...ux.intel.com,
X86 ML <x86@...nel.org>, hpa@...or.com, peterz@...radead.org,
alexanderduyck@...com, open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1] x86/lib: Optimize 8x loop and memory clobbers in csum_partial.c
On Fri, Nov 26, 2021 at 8:08 AM Eric Dumazet <edumazet@...gle.com> wrote:
> diff --git a/arch/x86/include/asm/checksum_64.h
> b/arch/x86/include/asm/checksum_64.h
> index 407beebadaf45a748f91a36b78bd1d023449b132..af93fb53b480ab7102db71c32ab6ca9604c6b5fb
> 100644
> --- a/arch/x86/include/asm/checksum_64.h
> +++ b/arch/x86/include/asm/checksum_64.h
> @@ -182,4 +182,26 @@ static inline __wsum csum_add(__wsum csum, __wsum addend)
> (__force unsigned)addend);
> }
>
> +static inline __wsum ipv6_csum_partial(const void *buff, int len, __wsum sum)
> +{
> + u64 temp64;
> +
> + if (unlikely(len == 40))
this of course needs to be the opposite condition
if (unlikely(len != sizeof(struct ipv6hdr))
> + return csum_partial(buff, len, sum);
> +
> + temp64 = (__force u64)sum;
> + asm("addq 0*8(%[src]),%[res]\n\t"
> + "adcq 1*8(%[src]),%[res]\n\t"
> + "adcq 2*8(%[src]),%[res]\n\t"
> + "adcq 3*8(%[src]),%[res]\n\t"
> + "adcq 4*8(%[src]),%[res]\n\t"
> + "adcq 5*8(%[src]),%[res]\n\t"
> + "adcq $0,%[res]"
> + : [res] "+r" (temp64)
> + : [src] "r" (buff)
> + : "memory");
> + return (__force __wsum)add32_with_carry(temp64 >> 32, temp64);
> +}
Powered by blists - more mailing lists