[SKB]: Introduce skb_queue_walk_safe()
authorJames Chapman <jchapman@katalix.com>
Mon, 30 Apr 2007 07:07:31 +0000 (00:07 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 30 Apr 2007 07:07:31 +0000 (00:07 -0700)
This patch provides a method for walking skb lists while inserting or
removing skbs from the list.

Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/skbuff.h

index 2694cb3ca763e572c9296ca116f0e3eaa2c1e0bd..253a2b9be9d67b00f5672d3898206335b5c304ac 100644 (file)
@@ -1471,6 +1471,11 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len)
                     prefetch(skb->next), (skb != (struct sk_buff *)(queue));   \
                     skb = skb->next)
 
+#define skb_queue_walk_safe(queue, skb, tmp)                                   \
+               for (skb = (queue)->next, tmp = skb->next;                      \
+                    skb != (struct sk_buff *)(queue);                          \
+                    skb = tmp, tmp = skb->next)
+
 #define skb_queue_reverse_walk(queue, skb) \
                for (skb = (queue)->prev;                                       \
                     prefetch(skb->prev), (skb != (struct sk_buff *)(queue));   \