From: Eric Dumazet Date: Wed, 24 Nov 2021 20:24:45 +0000 (-0800) Subject: gro: optimize skb_gro_postpull_rcsum() X-Git-Tag: microblaze-v5.18~173^2~334^2~1 X-Git-Url: http://git.monstr.eu/?a=commitdiff_plain;h=0bd28476f6363c7ccc841fe6a0ab0dd1fdb822f6;p=linux-2.6-microblaze.git gro: optimize skb_gro_postpull_rcsum() We can leverage third argument to csum_partial(): X = csum_sub(X, csum_partial(start, len, 0)); --> X = csum_add(X, ~csum_partial(start, len, 0)); --> X = ~csum_partial(start, len, ~X); This removes one add/adc pair and its dependency against the carry flag. Signed-off-by: Eric Dumazet Signed-off-by: Jakub Kicinski --- diff --git a/include/net/gro.h b/include/net/gro.h index 9c22a010369c..b1139fca7c43 100644 --- a/include/net/gro.h +++ b/include/net/gro.h @@ -173,8 +173,8 @@ static inline void skb_gro_postpull_rcsum(struct sk_buff *skb, const void *start, unsigned int len) { if (NAPI_GRO_CB(skb)->csum_valid) - NAPI_GRO_CB(skb)->csum = csum_sub(NAPI_GRO_CB(skb)->csum, - csum_partial(start, len, 0)); + NAPI_GRO_CB(skb)->csum = ~csum_partial(start, len, + ~NAPI_GRO_CB(skb)->csum); } /* GRO checksum functions. These are logical equivalents of the normal