[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220517081008.294325-3-imagedong@tencent.com>
Date: Tue, 17 May 2022 16:10:01 +0800
From: menglong8.dong@...il.com
To: edumazet@...gle.com
Cc: rostedt@...dmis.org, mingo@...hat.com, davem@...emloft.net,
yoshfuji@...ux-ipv6.org, dsahern@...nel.org, kuba@...nel.org,
pabeni@...hat.com, imagedong@...cent.com, kafai@...com,
talalahmad@...gle.com, keescook@...omium.org,
dongli.zhang@...cle.com, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, Jiang Biao <benbjiang@...cent.com>,
Hao Peng <flyingpeng@...cent.com>
Subject: [PATCH net-next v2 2/9] net: skb: introduce __skb_queue_purge_reason()
From: Menglong Dong <imagedong@...cent.com>
Introduce __skb_queue_purge_reason() to empty a skb list with drop
reason and make __skb_queue_purge() an inline call to it.
Reviewed-by: Jiang Biao <benbjiang@...cent.com>
Reviewed-by: Hao Peng <flyingpeng@...cent.com>
Signed-off-by: Menglong Dong <imagedong@...cent.com>
---
include/linux/skbuff.h | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index dfc568844df2..e9659a63961a 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3323,18 +3323,24 @@ static inline int skb_orphan_frags_rx(struct sk_buff *skb, gfp_t gfp_mask)
}
/**
- * __skb_queue_purge - empty a list
+ * __skb_queue_purge_reason - empty a list with specific drop reason
* @list: list to empty
+ * @reason: drop reason
*
* Delete all buffers on an &sk_buff list. Each buffer is removed from
* the list and one reference dropped. This function does not take the
* list lock and the caller must hold the relevant locks to use it.
*/
-static inline void __skb_queue_purge(struct sk_buff_head *list)
+static inline void __skb_queue_purge_reason(struct sk_buff_head *list,
+ enum skb_drop_reason reason)
{
struct sk_buff *skb;
while ((skb = __skb_dequeue(list)) != NULL)
- kfree_skb(skb);
+ kfree_skb_reason(skb, reason);
+}
+static inline void __skb_queue_purge(struct sk_buff_head *list)
+{
+ __skb_queue_purge_reason(list, SKB_DROP_REASON_NOT_SPECIFIED);
}
void skb_queue_purge(struct sk_buff_head *list);
--
2.36.1
Powered by blists - more mailing lists