diff mbox

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

Message ID 20100802220113.643085589@vyatta.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

stephen hemminger Aug. 2, 2010, 10 p.m. UTC
The expected case that should be optimized is that the offset is valid
and the data is available.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- 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;