Skip to content

Commit

Permalink
[NET]: Optimize pskb_trim_rcsum()
Browse files Browse the repository at this point in the history
Since packets almost never contain extra garbage at the end, it is
worthwhile to optimize for that case.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Sep 8, 2005
1 parent 1b11d78 commit 0e4e422
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0e4e422

Please sign in to comment.