Subject: [PATCH 2/4] net: add likely/unlikely to skb_header_pointer

From: Stephen Hemminger <[email-masked]>
Date: Mon, 02 Aug 2010 15:00:32 -0700

The expected case that should be optimized is that the offset is valid
and the data is available.

Signed-off-by: Stephen Hemminger <[email-masked]>

--- a/include/linux/skbuff.h	2010-08-01 11:20:15.872942674 -0700
+++ b/include/linux/skbuff.h	2010-08-01 11:20:59.513693007 -0700
@@ -1853,13 +1853,13 @@ static inline void *skb_header_pointer(c
 {
 	int hlen = skb_headlen(skb);
 
-	if (hlen + offset < 0)
+	if (unlikely(hlen + offset < 0))
 		return NULL;
 
-	if (hlen - offset >= len)
+	if (likely(hlen - offset >= len))
 		return skb->data + offset;
 
-	if (skb_copy_bits(skb, offset, buffer, len) < 0)
+	if (unlikely(skb_copy_bits(skb, offset, buffer, len) < 0))
 		return NULL;
 
 	return buffer;