Subject: Re: [PATCH] arm64: lib: accelerate do_csum() with NEON instruction

From: Will Deacon <[email-masked]>
Date: Mon, 3 Dec 2018 19:32:41 +0000

[+ Ard and Jackie]

On Wed, Nov 21, 2018 at 05:21:05PM +0800, huanglingyan wrote:
> From: Lingyan Huang <[email-masked]>
> 
> Function do_csum() in lib/checksum.c is used to compute checksum,
> which is turned out to be slowly and costs a lot of resources.
> Let's use neon instructions to accelerate the checksum computation
> for arm64.
> 
> Cc: Catalin Marinas <[email-masked]>
> Cc: Will Deacon <[email-masked]>
> Signed-off-by: Lingyan Huang <[email-masked]>
> ---
>  arch/arm64/include/asm/checksum.h |   8 ++
>  arch/arm64/lib/Makefile           |   3 +
>  arch/arm64/lib/checksum.c         |  30 +++++++
>  arch/arm64/lib/do_csum.S          | 182 ++++++++++++++++++++++++++++++++++++++
>  lib/checksum.c                    |   6 +-
>  5 files changed, 226 insertions(+), 3 deletions(-)
>  create mode 100644 arch/arm64/lib/checksum.c
>  create mode 100644 arch/arm64/lib/do_csum.S

I think we can avoid dropping into assembly for this if we build on top of
arm_neon.h for the core of the loop:

> +do_loop_64:
> +
> +	ldp	q5, q4, [x0], #32
> +	ldp	q7, q6, [x0], #32
> +
> +    uadalp v0.4s, v4.8h
> +    uadalp v1.4s, v5.8h
> +    uadalp v2.4s, v6.8h
> +    uadalp v3.4s, v7.8h

So please look at Jackie's patch for XOR checksumming as inspiration:

http://lists.infradead.org/pipermail/linux-arm-kernel/2018-November/615625.html

Thanks,

Will

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel