From: Stephen Hemminger Date: Thu, 8 Sep 2005 19:32:03 +0000 (-0700) Subject: [NET]: Optimize pskb_trim_rcsum() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0e4e4220f10bf8f58a8606f0cb28538088c64b1a;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [NET]: Optimize pskb_trim_rcsum() Since packets almost never contain extra garbage at the end, it is worthwhile to optimize for that case. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index da7da9c0ed1b..2741c0c55e83 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -1167,7 +1167,7 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb, static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) { - if (len >= skb->len) + if (likely(len >= skb->len)) return 0; if (skb->ip_summed == CHECKSUM_HW) skb->ip_summed = CHECKSUM_NONE;