diff mbox series

[3/4] parisc: checksum: Remove folding from csum_partial

Message ID 20240221-parisc_use_generic_checksum-v1-3-ad34d895fd1b@rivosinc.com (mailing list archive)
State Accepted, archived
Headers show
Series parisc: checksum: Use generic implementations and optimize checksum | expand

Commit Message

Charlie Jenkins Feb. 22, 2024, 2:37 a.m. UTC
The parisc implementation of csum_partial previously folded the result
into 16 bits instead of returning all 32 bits and letting consumers like
ip_compute_csum do the folding. Since ip_compute_csum no longer depends
on this requirement, remove the folding so that the parisc
implementation operates the same as other architectures.

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
---
 arch/parisc/lib/checksum.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Guenter Roeck Feb. 22, 2024, 4:04 p.m. UTC | #1
On Wed, Feb 21, 2024 at 06:37:13PM -0800, Charlie Jenkins wrote:
> The parisc implementation of csum_partial previously folded the result
> into 16 bits instead of returning all 32 bits and letting consumers like
> ip_compute_csum do the folding. Since ip_compute_csum no longer depends
> on this requirement, remove the folding so that the parisc
> implementation operates the same as other architectures.
> 
> Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>

Tested-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  arch/parisc/lib/checksum.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/arch/parisc/lib/checksum.c b/arch/parisc/lib/checksum.c
> index 05f5ca4b2f96..eaa660491e24 100644
> --- a/arch/parisc/lib/checksum.c
> +++ b/arch/parisc/lib/checksum.c
> @@ -95,14 +95,11 @@ unsigned int do_csum(const unsigned char *buff, int len)
>  /*
>   * computes a partial checksum, e.g. for TCP/UDP fragments
>   */
> -/*
> - * why bother folding?
> - */
>  __wsum csum_partial(const void *buff, int len, __wsum sum)
>  {
>  	unsigned int result = do_csum(buff, len);
>  	addc(result, sum);
> -	return (__force __wsum)from32to16(result);
> +	return (__force __wsum)result;
>  }
>  
>  EXPORT_SYMBOL(csum_partial);
> 
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/arch/parisc/lib/checksum.c b/arch/parisc/lib/checksum.c
index 05f5ca4b2f96..eaa660491e24 100644
--- a/arch/parisc/lib/checksum.c
+++ b/arch/parisc/lib/checksum.c
@@ -95,14 +95,11 @@  unsigned int do_csum(const unsigned char *buff, int len)
 /*
  * computes a partial checksum, e.g. for TCP/UDP fragments
  */
-/*
- * why bother folding?
- */
 __wsum csum_partial(const void *buff, int len, __wsum sum)
 {
 	unsigned int result = do_csum(buff, len);
 	addc(result, sum);
-	return (__force __wsum)from32to16(result);
+	return (__force __wsum)result;
 }
 
 EXPORT_SYMBOL(csum_partial);