Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp565336rdb; Tue, 31 Oct 2023 16:00:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgQIGS35ipSO8IKPLy2JfkqelOw78VK/1xyD4C9cRK28hGT5zJ7Z6xa1yd/isQ6hy1+HAM X-Received: by 2002:a05:6871:2b24:b0:1ba:466d:5f9e with SMTP id dr36-20020a0568712b2400b001ba466d5f9emr14290075oac.49.1698793252386; Tue, 31 Oct 2023 16:00:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698793252; cv=none; d=google.com; s=arc-20160816; b=E+lofODhHk0zxc3+9sK1bgiTJErI6M2AJOmaVi330wVR7gdqAA69LOVEBt2/geTcUP Cv/yLMzQnqvH+vqHpldevd6xJtZZddtauWejLX/H+nwjgJzsT6aAL0rNFrpgBlgUeL8C GDBwnzpDEkkNZ2nv4caInoCpl1KUC9oLzmGRWbC/dspH7LgvukjIt/QIfQYs5ZfUyoX8 psc25Kv2gAG6rEm3vf1dgvd6EdvCwfHRpyNHzTk0E1yUi0ZKsZl5nVz4kYOOVqN2+EXX OTPLt3UhPi87wzl/B9+Y/WYcvlDl0qG303y5ngOIWNwQMVAe5GnGRij29L4w0IwgiLU2 ev7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=LDJ8Iq5L9/V1OZAz3rRoxOdZZ5rvNVFmc7VfBTtpIhM=; fh=g2Wkei5h9YgdCkwqzDuce3llv3EE+aS4cN8of2L87zc=; b=UzY8EOv33MNi0O3zIdiOLHcSG/IRjYUdFSi2120Nz2UyeNkfzikfzJrl0IubaR/ox6 CwbF1dGxalycGpuhyY5pc/2avddCc5lxIW8w3wG1eawRFXHNTFr+XnuDXGzaT+37hwRp V1VCRWFde1HFUWJQ6t/Vx0UAQeqp2EN6EPe+o3IclRfUpKI32Oj+WqHhGQikllAuT87J ybL/DokpN94Vyjo9PFUzjGo7CwCgHUmSmFZGtC/ky1ynsk2eAAMCGRfqt64UF37vqi1b nNmUAOPgiIAakYYM8EHW4Ktu+nd1gWia+W+CnvDlKpKz/nQs9xRA+bpjr+aYtiUOlfL8 Jcjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=3BB5LGmf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id lv21-20020a056871439500b001dc0e876a1asi102141oab.165.2023.10.31.16.00.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 16:00:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=3BB5LGmf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 86EDA8074CC3; Tue, 31 Oct 2023 16:00:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234810AbjJaW7x (ORCPT + 99 others); Tue, 31 Oct 2023 18:59:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237652AbjJaW7k (ORCPT ); Tue, 31 Oct 2023 18:59:40 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 291A9137 for ; Tue, 31 Oct 2023 15:59:36 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1cc1e1e74beso44046875ad.1 for ; Tue, 31 Oct 2023 15:59:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1698793175; x=1699397975; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=LDJ8Iq5L9/V1OZAz3rRoxOdZZ5rvNVFmc7VfBTtpIhM=; b=3BB5LGmfv/rVYcRmTVHSEmgLPVbzsLM10cnTNip0X/FCP4/zy6KGWixmifWBQo699V VNAST89ZP0AKESHzNGqE77ghJEXXbXk/+Dmpu2AxlqK/XEhgtRdaAbZxDNTc5xbwllVi PLIIqAtzWfYhEBCW6AlhSzebNNAVNQ1CxsEhFzPGfDVWM6oFxx7p29RyEgNv/HarZHBu TMutXlm+MAH2vbbVWIeLy2rKNr8sc5sBOpFy25JhqbsxC90m127e7jLom7M0xhQyTAx8 FnDsQuhuSW1pF3KAbqj4gAxYojM9i1vA3DGw3SJvyC+BmxYenqOX5nkeyZpUQ+BeHU0c 9NYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698793175; x=1699397975; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=LDJ8Iq5L9/V1OZAz3rRoxOdZZ5rvNVFmc7VfBTtpIhM=; b=ADHBNDFDNshPjHEN6PBEoPsG9059d+qaSWAKsItktj86rt1TxeNGYsMZXxQ72pGsdm U3joMy9C/KVmzf7vLX7avrxFSDTEOSEFpO7CCvoK3BGJzTMuZadw5ec/N/7GG4OFBzRI X9q7ENA+5hT6A9hekcMuiEk3Fsl868TMt0fP96X7v/ukhJxTHWyKjFUnLhXcxdkFU7XT bDfhdBy09BzStfNRvXzk+mE8IRh1Bf0PqOWSlUCUWssCAYwT/aQOFYFthwVC/fXz9M2V nDNFO+KYMTiFUMJthjMf1G7km+5DoHKnfkjbUXf092yQLdQo44OAX2bZUL6x0IsSayov 4FgQ== X-Gm-Message-State: AOJu0YzjpmI8japjMnnPzzT00UG+aBY9IK1phtW3/f/TeR+sbS0PGIVP yABZxz0KwmMNMQUkNwHaBi510w== X-Received: by 2002:a17:902:d4c9:b0:1cc:4e79:4b38 with SMTP id o9-20020a170902d4c900b001cc4e794b38mr8017652plg.3.1698793175507; Tue, 31 Oct 2023 15:59:35 -0700 (PDT) Received: from ghost ([12.44.203.122]) by smtp.gmail.com with ESMTPSA id e18-20020a17090301d200b001cc32f46757sm83952plh.107.2023.10.31.15.59.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 15:59:35 -0700 (PDT) Date: Tue, 31 Oct 2023 15:59:32 -0700 From: Charlie Jenkins To: "Wang, Xiao W" Cc: Palmer Dabbelt , Conor Dooley , Samuel Holland , David Laight , Evan Green , "linux-riscv@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" , Paul Walmsley , Albert Ou , Arnd Bergmann , Conor Dooley Subject: Re: [PATCH v8 4/5] riscv: Add checksum library Message-ID: References: <20231027-optimize_checksum-v8-0-feb7101d128d@rivosinc.com> <20231027-optimize_checksum-v8-4-feb7101d128d@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 31 Oct 2023 16:00:12 -0700 (PDT) On Tue, Oct 31, 2023 at 09:51:17AM +0000, Wang, Xiao W wrote: > > > > -----Original Message----- > > From: Charlie Jenkins > > Sent: Saturday, October 28, 2023 6:44 AM > > To: Charlie Jenkins ; Palmer Dabbelt > > ; Conor Dooley ; Samuel Holland > > ; David Laight ; > > Wang, Xiao W ; Evan Green ; > > linux-riscv@lists.infradead.org; linux-kernel@vger.kernel.org; linux- > > arch@vger.kernel.org > > Cc: Paul Walmsley ; Albert Ou > > ; Arnd Bergmann ; Conor Dooley > > > > Subject: [PATCH v8 4/5] riscv: Add checksum library > > > > Provide a 32 and 64 bit version of do_csum. When compiled for 32-bit > > will load from the buffer in groups of 32 bits, and when compiled for > > 64-bit will load in groups of 64 bits. > > > > Signed-off-by: Charlie Jenkins > > Acked-by: Conor Dooley > > --- > > arch/riscv/lib/Makefile | 1 + > > arch/riscv/lib/csum.c | 339 > > ++++++++++++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 340 insertions(+) > > > > diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile > > index 26cb2502ecf8..2aa1a4ad361f 100644 > > --- a/arch/riscv/lib/Makefile > > +++ b/arch/riscv/lib/Makefile > > @@ -6,6 +6,7 @@ lib-y += memmove.o > > lib-y += strcmp.o > > lib-y += strlen.o > > lib-y += strncmp.o > > +lib-y += csum.o > > lib-$(CONFIG_MMU) += uaccess.o > > lib-$(CONFIG_64BIT) += tishift.o > > lib-$(CONFIG_RISCV_ISA_ZICBOZ) += clear_page.o > > diff --git a/arch/riscv/lib/csum.c b/arch/riscv/lib/csum.c > > new file mode 100644 > > index 000000000000..f90e73606597 > > --- /dev/null > > +++ b/arch/riscv/lib/csum.c > > @@ -0,0 +1,339 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +/* > > + * IP checksum library > > Same comment as patch 3/5. > > > + * > > + * Influenced by arch/arm64/lib/csum.c > > + * Copyright (C) 2023 Rivos Inc. > > + */ > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#include > > + > > +/* Default version is sufficient for 32 bit */ > > +#ifndef CONFIG_32BIT > > Why not use the same #if macro "#ifdef CONFIG_64BIT" as in checksum.h > > > +__sum16 csum_ipv6_magic(const struct in6_addr *saddr, > > + const struct in6_addr *daddr, > > + __u32 len, __u8 proto, __wsum csum) > > +{ > > + unsigned int ulen, uproto; > > + unsigned long sum = csum; > > + > > + sum += saddr->s6_addr32[0]; > > + sum += saddr->s6_addr32[1]; > > + sum += saddr->s6_addr32[2]; > > + sum += saddr->s6_addr32[3]; > > + > > + sum += daddr->s6_addr32[0]; > > + sum += daddr->s6_addr32[1]; > > + sum += daddr->s6_addr32[2]; > > + sum += daddr->s6_addr32[3]; > > + > > + ulen = htonl((unsigned int)len); > > + sum += ulen; > > + > > + uproto = htonl(proto); > > + sum += uproto; > > + > > + /* > > + * Zbb support saves 4 instructions, so not worth checking without > > + * alternatives if supported > > + */ > > + if (IS_ENABLED(CONFIG_RISCV_ISA_ZBB) && > > + IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) { > > + unsigned long fold_temp; > > + > > + /* > > + * Zbb is likely available when the kernel is compiled with Zbb > > + * support, so nop when Zbb is available and jump when Zbb > > is > > + * not available. > > + */ > > + asm_volatile_goto(ALTERNATIVE("j %l[no_zbb]", "nop", 0, > > + RISCV_ISA_EXT_ZBB, 1) > > + : > > + : > > + : > > + : no_zbb); > > + asm(".option push \n\ > > + .option arch,+zbb \n\ > > + rori %[fold_temp], %[sum], 32 \n\ > > + add %[sum], %[fold_temp], %[sum] > > \n\ > > + srli %[sum], %[sum], 32 \n\ > > + not %[fold_temp], %[sum] \n\ > > + roriw %[sum], %[sum], 16 \n\ > > + subw %[sum], %[fold_temp], %[sum] > > \n\ > > + .option pop" > > + : [sum] "+r" (sum), [fold_temp] "=&r" (fold_temp)); > > + return (__force __sum16)(sum >> 16); > > + } > > +no_zbb: > > + sum += ror64(sum, 32); > > + sum >>= 32; > > + return csum_fold((__force __wsum)sum); > > +} > > +EXPORT_SYMBOL(csum_ipv6_magic); > > +#endif /* !CONFIG_32BIT */ > > + > > +#ifdef CONFIG_32BIT > > +#define OFFSET_MASK 3 > > +#elif CONFIG_64BIT > > +#define OFFSET_MASK 7 > > +#endif > > + > > +/* > > + * Algorithm accounts for buff being misaligned. > > + * If buff is not aligned, will over-read bytes but not use the bytes that it > > + * shouldn't. The same thing will occur on the tail-end of the read. > > + */ > > +static inline __no_sanitize_address unsigned int > > do_csum_with_alignment(const unsigned char *buff, int len) > > +{ > > + unsigned int offset, shift; > > + unsigned long csum = 0, carry = 0, data; > > + const unsigned long *ptr, *end; > > + > > + end = (const unsigned long *)(buff + len); > > + > > + /* > > + * Align address to closest word (double word on rv64) that comes > > before > > + * buff. This should always be in the same page and cache line. > > + * Directly call KASAN with the alignment we will be using. > > + */ > > + offset = (unsigned long)buff & OFFSET_MASK; > > + kasan_check_read(buff, len); > > + ptr = (const unsigned long *)(buff - offset); > > + > > + /* > > + * Clear the most significant bytes that were over-read if buff was not > > + * aligned. > > + */ > > + shift = offset * 8; > > + data = *(ptr++); > > +#ifdef __LITTLE_ENDIAN > > + data = (data >> shift) << shift; > > +#else > > + data = (data << shift) >> shift; > > +#endif > > + /* > > + * Do 32-bit reads on RV32 and 64-bit reads otherwise. This should be > > + * faster than doing 32-bit reads on architectures that support larger > > + * reads. > > + */ > > + while (ptr < end) { > > + csum += data; > > + carry += csum < data; > > + len -= sizeof(long); > > + data = *(ptr++); > > + } > > + > > + /* > > + * Perform alignment (and over-read) bytes on the tail if any bytes > > + * leftover. > > + */ > > + shift = ((long)ptr - (long)end) * 8; > > +#ifdef __LITTLE_ENDIAN > > + data = (data << shift) >> shift; > > +#else > > + data = (data >> shift) << shift; > > +#endif > > + csum += data; > > + carry += csum < data; > > + csum += carry; > > + csum += csum < carry; > > + > > + /* > > + * Zbb support saves 6 instructions, so not worth checking without > > + * alternatives if supported > > + */ > > + if (IS_ENABLED(CONFIG_RISCV_ISA_ZBB) && > > + IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) { > > + unsigned long fold_temp; > > + > > + /* > > + * Zbb is likely available when the kernel is compiled with Zbb > > + * support, so nop when Zbb is available and jump when Zbb > > is > > + * not available. > > + */ > > + asm_volatile_goto(ALTERNATIVE("j %l[no_zbb]", "nop", 0, > > + RISCV_ISA_EXT_ZBB, 1) > > + : > > + : > > + : > > + : no_zbb); > > + > > +#ifdef CONFIG_32BIT > > + asm_volatile_goto(".option push \n\ > > + .option arch,+zbb \n\ > > + rori %[fold_temp], %[csum], 16 \n\ > > + andi %[offset], %[offset], 1 \n\ > > + add %[csum], %[fold_temp], %[csum] \n\ > > + beq %[offset], zero, %l[end] \n\ > > + rev8 %[csum], %[csum] \n\ > > + .option pop" > > + : [csum] "+r" (csum), > > + [fold_temp] "=&r" (fold_temp) > > + : [offset] "r" (offset) > > + : > > + : end); > > + > > + return (unsigned short)csum; > > +#else /* !CONFIG_32BIT */ > > + asm_volatile_goto(".option push \n\ > > + .option arch,+zbb \n\ > > + rori %[fold_temp], %[csum], 32 \n\ > > + add %[csum], %[fold_temp], %[csum] \n\ > > + srli %[csum], %[csum], 32 \n\ > > + roriw %[fold_temp], %[csum], 16 \n\ > > + addw %[csum], %[fold_temp], %[csum] \n\ > > + andi %[offset], %[offset], 1 \n\ > > + beq %[offset], zero, %l[end] \n\ > > + rev8 %[csum], %[csum] \n\ > > + .option pop" > > + : [csum] "+r" (csum), > > + [fold_temp] "=&r" (fold_temp) > > + : [offset] "r" (offset) > > + : > > + : end); > > + > > + return (csum << 16) >> 48; > > +#endif /* !CONFIG_32BIT */ > > +end: > > + return csum >> 16; > > + } > > +no_zbb: > > +#ifndef CONFIG_32BIT > > + csum += ror64(csum, 32); > > + csum >>= 32; > > +#endif > > + csum = (u32)csum + ror32((u32)csum, 16); > > + if (offset & 1) > > + return (u16)swab32(csum); > > + return csum >> 16; > > +} > > + > > +/* > > + * Does not perform alignment, should only be used if machine has fast > > + * misaligned accesses, because buff may be misaligned. > > + */ > > +static inline unsigned int do_csum_no_alignment(const unsigned char *buff, > > int len) > > +{ > > + unsigned int offset, shift; > > + unsigned long csum = 0, carry = 0, data; > > + const unsigned long *ptr, *end; > > + > > + end = (const unsigned long *)(buff + len); > > + > > kasan_check_read() missing in this function. > I had thought it wasn't needed since this is the aligned access case so I removed __no_sanitize_address from the function signature. However, I just realized that on the tail end this function over-reads buff so it is still necessary. > > + ptr = (const unsigned long *)(buff); > > + > > + data = *(ptr++); > > + > > + /* > > + * Do 32-bit reads on RV32 and 64-bit reads otherwise. This should be > > + * faster than doing 32-bit reads on architectures that support larger > > + * reads. > > + */ > > + while (ptr < end) { > > + csum += data; > > + carry += csum < data; > > + len -= sizeof(long); > > + data = *(ptr++); > > + } > > + > > + /* > > + * Perform alignment (and over-read) bytes on the tail if any bytes > > + * leftover. > > + */ > > + shift = ((long)ptr - (long)end) * 8; > > +#ifdef __LITTLE_ENDIAN > > + data = (data << shift) >> shift; > > +#else > > + data = (data >> shift) << shift; > > +#endif > > + csum += data; > > + carry += csum < data; > > + csum += carry; > > + csum += csum < carry; > > + > > + /* > > + * Zbb support saves 6 instructions, so not worth checking without > > + * alternatives if supported > > + */ > > + if (IS_ENABLED(CONFIG_RISCV_ISA_ZBB) && > > + IS_ENABLED(CONFIG_RISCV_ALTERNATIVE)) { > > + unsigned long fold_temp; > > + > > + /* > > + * Zbb is likely available when the kernel is compiled with Zbb > > + * support, so nop when Zbb is available and jump when Zbb > > is > > + * not available. > > + */ > > + asm_volatile_goto(ALTERNATIVE("j %l[no_zbb]", "nop", 0, > > + RISCV_ISA_EXT_ZBB, 1) > > + : > > + : > > + : > > + : no_zbb); > > + > > +#ifdef CONFIG_32BIT > > + asm (".option push \n\ > > + .option arch,+zbb \n\ > > + rori %[fold_temp], %[csum], 16 \n\ > > + andi %[offset], %[offset], 1 \n\ > > + add %[csum], %[fold_temp], %[csum] \n\ > > + .option pop" > > + : [csum] "+r" (csum), > > + [fold_temp] "=&r" (fold_temp) > > It's better to align the indention here, or we can follow the below CONFIG_64BIT case. > > > + : [offset] "r" (offset) > > + : ); > > + > > +#else /* !CONFIG_32BIT */ > > + asm (".option push \n\ > > + .option arch,+zbb \n\ > > + rori %[fold_temp], %[csum], 32 \n\ > > + add %[csum], %[fold_temp], %[csum] \n\ > > + srli %[csum], %[csum], 32 \n\ > > + roriw %[fold_temp], %[csum], 16 \n\ > > + addw %[csum], %[fold_temp], %[csum] \n\ > > + .option pop" > > + : [csum] "+r" (csum), [fold_temp] "=&r" (fold_temp) > > + : [offset] "r" (offset) > > + : ); > > +#endif /* !CONFIG_32BIT */ > > + return csum >> 16; > > + } > > +no_zbb: > > +#ifndef CONFIG_32BIT > > + csum += ror64(csum, 32); > > + csum >>= 32; > > +#endif > > + csum = (u32)csum + ror32((u32)csum, 16); > > + return csum >> 16; > > +} > > + > > +/* > > + * Perform a checksum on an arbitrary memory address. > > + * Will do a light-weight address alignment if buff is misaligned, unless > > + * cpu supports fast misaligned accesses. > > + */ > > +unsigned int do_csum(const unsigned char *buff, int len) > > +{ > > + if (unlikely(len <= 0)) > > + return 0; > > + > > + /* > > + * Very significant performance gains can be seen by not doing > > alignment > > + * on machines with fast misaligned accesses. > > + * > > + * There is some duplicate code between the "with_alignment" and > > + * "no_alignment" implmentations, but the overlap is too awkward to > > be > > + * able to fit in one function without introducing multiple static > > + * branches. > > + */ > > + if (static_branch_likely(&fast_misaligned_access_speed_key)) > > + return do_csum_no_alignment(buff, len); > > When CPU doesn't support fast misaligned access but the buff addr is aligned (checking > by buff & OFFSET_MASK == 0), did it worth adding this check and then possibly calling > do_csum_no_alignment()? I am not sure how common it is for buff to be unaligned. Adding another branch here will be bad for the unaligned access pathway. However, if the unaligned accesses are slow on the hardware, ideally software will prevent calling this function with unaligned buff. With this assumption, I will add a branch here since that will be beneficial for the aligned pathway. - Charlie > > BRs, > Xiao > > > + > > + return do_csum_with_alignment(buff, len); > > +} > > > > -- > > 2.42.0 >