Skip to contentSkip to conversation

skb: introduce skb_queue_walk_safe()

PATCH Applied James Chapman 2 participants 2 messages Apr 23, 2007 – Apr 30, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 skb: introduce skb_queue_walk_safe()

[SKB]: Introduce skb_queue_walk_safe()

This patch provides a method for walking skb lists while inserting or removing skbs from the list.

include/linux/skbuff.h +5 -0
Index: linux-2.6.21-rc7/include/linux/skbuff.h
===================================================================
@@ -1299,6 +1299,11 @@ static inline int pskb_trim_rcsum(struct
 		     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));	\