skb: Add skb_peek_next helper
authorPavel Emelyanov <xemul@parallels.com>
Tue, 21 Feb 2012 07:31:18 +0000 (07:31 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Feb 2012 19:58:57 +0000 (14:58 -0500)
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h

index f3cf43de3c2a31eaa134a4f3d49472ada01b9a81..c11a44ea1bf4f0b342c5521426f6f0ce5a45f712 100644 (file)
@@ -876,6 +876,24 @@ static inline struct sk_buff *skb_peek(const struct sk_buff_head *list_)
        return list;
 }
 
+/**
+ *     skb_peek_next - peek skb following the given one from a queue
+ *     @skb: skb to start from
+ *     @list_: list to peek at
+ *
+ *     Returns %NULL when the end of the list is met or a pointer to the
+ *     next element. The reference count is not incremented and the
+ *     reference is therefore volatile. Use with caution.
+ */
+static inline struct sk_buff *skb_peek_next(struct sk_buff *skb,
+               const struct sk_buff_head *list_)
+{
+       struct sk_buff *next = skb->next;
+       if (next == (struct sk_buff *)list_)
+               next = NULL;
+       return next;
+}
+
 /**
  *     skb_peek_tail - peek at the tail of an &sk_buff_head
  *     @list_: list to peek at