|
@@ -2858,23 +2858,27 @@ EXPORT_SYMBOL(skb_queue_purge);
|
|
/**
|
|
/**
|
|
* skb_rbtree_purge - empty a skb rbtree
|
|
* skb_rbtree_purge - empty a skb rbtree
|
|
* @root: root of the rbtree to empty
|
|
* @root: root of the rbtree to empty
|
|
|
|
+ * Return value: the sum of truesizes of all purged skbs.
|
|
*
|
|
*
|
|
* Delete all buffers on an &sk_buff rbtree. Each buffer is removed from
|
|
* Delete all buffers on an &sk_buff rbtree. Each buffer is removed from
|
|
* the list and one reference dropped. This function does not take
|
|
* the list and one reference dropped. This function does not take
|
|
* any lock. Synchronization should be handled by the caller (e.g., TCP
|
|
* any lock. Synchronization should be handled by the caller (e.g., TCP
|
|
* out-of-order queue is protected by the socket lock).
|
|
* out-of-order queue is protected by the socket lock).
|
|
*/
|
|
*/
|
|
-void skb_rbtree_purge(struct rb_root *root)
|
|
|
|
|
|
+unsigned int skb_rbtree_purge(struct rb_root *root)
|
|
{
|
|
{
|
|
struct rb_node *p = rb_first(root);
|
|
struct rb_node *p = rb_first(root);
|
|
|
|
+ unsigned int sum = 0;
|
|
|
|
|
|
while (p) {
|
|
while (p) {
|
|
struct sk_buff *skb = rb_entry(p, struct sk_buff, rbnode);
|
|
struct sk_buff *skb = rb_entry(p, struct sk_buff, rbnode);
|
|
|
|
|
|
p = rb_next(p);
|
|
p = rb_next(p);
|
|
rb_erase(&skb->rbnode, root);
|
|
rb_erase(&skb->rbnode, root);
|
|
|
|
+ sum += skb->truesize;
|
|
kfree_skb(skb);
|
|
kfree_skb(skb);
|
|
}
|
|
}
|
|
|
|
+ return sum;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|