summaryrefslogtreecommitdiff
path: root/include/net/gro.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2021-11-24 12:24:45 -0800
committerJakub Kicinski <kuba@kernel.org>2021-11-25 21:03:31 -0800
commit0bd28476f6363c7ccc841fe6a0ab0dd1fdb822f6 (patch)
tree8d1bfa9f18c5d8082794f804dea59d21312a88c4 /include/net/gro.h
parent703319094c9c2bf34f65d3496ccb350149fdd14b (diff)
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 <edumazet@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/net/gro.h')
-rw-r--r--include/net/gro.h4
1 files changed, 2 insertions, 2 deletions
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