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