diff mbox

[3/6] skb: Add skb_peek_next helper

Message ID 4F43D4E6.4060206@parallels.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Pavel Emelyanov Feb. 21, 2012, 5:31 p.m. UTC
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

---
 include/linux/skbuff.h |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

Comments

Eric Dumazet Feb. 21, 2012, 5:43 p.m. UTC | #1
Le mardi 21 février 2012 à 21:31 +0400, Pavel Emelyanov a écrit :
> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
> 
> ---
>  include/linux/skbuff.h |   18 ++++++++++++++++++
>  1 files changed, 18 insertions(+), 0 deletions(-)
> 
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index f3cf43d..c11a44e 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -877,6 +877,24 @@ static inline struct sk_buff *skb_peek(const struct sk_buff_head *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
>   *

Acked-by: Eric Dumazet <eric.dumazet@gmail.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
David Miller Feb. 21, 2012, 8:04 p.m. UTC | #2
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 21 Feb 2012 18:43:53 +0100

> Le mardi 21 février 2012 à 21:31 +0400, Pavel Emelyanov a écrit :
>> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.
--
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

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index f3cf43d..c11a44e 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -877,6 +877,24 @@  static inline struct sk_buff *skb_peek(const struct sk_buff_head *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
  *