[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <06864387ba644a58816ab3a82a8b5f82@AcuMS.aculab.com>
Date: Thu, 25 Nov 2021 09:41:55 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Eric Dumazet' <eric.dumazet@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
CC: netdev <netdev@...r.kernel.org>, Eric Dumazet <edumazet@...gle.com>
Subject: RE: [PATCH net-next 2/2] net: optimize skb_postpull_rcsum()
From: Eric Dumazet
> Sent: 24 November 2021 20:25
>
> From: Eric Dumazet <edumazet@...gle.com>
>
> Remove one pair of add/adc instructions and their dependency
> against carry flag.
>
> We can leverage third argument to csum_partial():
>
> X = csum_block_sub(X, csum_partial(start, len, 0), 0);
>
> -->
>
> X = csum_block_add(X, ~csum_partial(start, len, 0), 0);
>
> -->
>
> X = ~csum_partial(start, len, ~X);
That doesn't seem to refer to the change in this file.
David
>
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> ---
> include/linux/skbuff.h | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index eba256af64a577b458998845f2dc01a5ec80745a..eae4bd3237a41cc1b60b44c91fbfe21dfdd8f117 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -3485,7 +3485,11 @@ __skb_postpull_rcsum(struct sk_buff *skb, const void *start, unsigned int len,
> static inline void skb_postpull_rcsum(struct sk_buff *skb,
> const void *start, unsigned int len)
> {
> - __skb_postpull_rcsum(skb, start, len, 0);
> + if (skb->ip_summed == CHECKSUM_COMPLETE)
> + skb->csum = ~csum_partial(start, len, ~skb->csum);
> + else if (skb->ip_summed == CHECKSUM_PARTIAL &&
> + skb_checksum_start_offset(skb) < 0)
> + skb->ip_summed = CHECKSUM_NONE;
> }
>
> static __always_inline void
> --
> 2.34.0.rc2.393.gf8c9666880-goog
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists