net: add skb_queue_purge_reason and __skb_queue_purge_reason
Subsystems (2)
PATCH 1/1 net: add skb_queue_purge_reason and __skb_queue_purge_reason
skb_queue_purge() and __skb_queue_purge() become wrappers around the new generic functions.
New SKB_DROP_REASON_QUEUE_PURGE drop reason is added, but users can start adding more specific reasons.
--- include/linux/skbuff.h | 23 +++++++++++++++++++---- include/net/dropreason-core.h | 3 +++ net/core/skbuff.c | 11 +++++++---- 3 files changed, 29 insertions(+), 8 deletions(-)
include/linux/skbuff.h +19 -4
@@ -3149,20 +3149,35 @@ 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 * @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_QUEUE_PURGE ); +} + +void skb_queue_purge_reason (struct sk_buff_head *list, +enum skb_drop_reason reason); + +static inline void skb_queue_purge (struct sk_buff_head *list) +{ +skb_queue_purge_reason (list,SKB_DROP_REASON_QUEUE_PURGE ); } -void skb_queue_purge (struct sk_buff_head *list);unsigned int skb_rbtree_purge (struct rb_root *root);
include/net/dropreason-core.h +3 -0
@@ -79,6 +79,7 @@ FN(IPV6_NDISC_BAD_CODE) \ FN(IPV6_NDISC_BAD_OPTIONS) \ FN(IPV6_NDISC_NS_OTHERHOST) \ + FN(QUEUE_PURGE) \ FNe(MAX)/**
@@ -342,6 +343,8 @@ enum skb_drop_reason {* for another host. */ SKB_DROP_REASON_IPV6_NDISC_NS_OTHERHOST , +/** @SKB_DROP_REASON_QUEUE_PURGE: bulk free. */ + SKB_DROP_REASON_QUEUE_PURGE,/** * @SKB_DROP_REASON_MAX: the maximum of core drop reasons, which * shouldn't be used as a real 'reason' - only for tracing code gen
net/core/skbuff.c +7 -4
@@ -3701,20 +3701,23 @@ struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list)EXPORT_SYMBOL (skb_dequeue_tail);/** -* skb_queue_purge - empty a list +* skb_queue_purge_reason - empty a list * @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 takes the list * lock and is atomic with respect to other list locking functions. */ -void skb_queue_purge (struct sk_buff_head *list) +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); } -EXPORT_SYMBOL (skb_queue_purge); +EXPORT_SYMBOL (skb_queue_purge_reason);/** * skb_rbtree_purge - empty a skb rbtree
Signature · 1 line
2.42.0.rc1.204.g551eb34607-goog
Quoted 7 lines · Eric Dumazet
skb_queue_purge()and__skb_queue_purge()become wrappers around the new generic functions.New
SKB_DROP_REASON_QUEUE_PURGEdrop reason is added, but users can start adding more specific reasons.Signed-off-by Eric Dumazet <[email protected]>
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 9 lines · On Fri, 18 Aug 2023 09:40:39 +0000 you wrote:
skb_queue_purge()and__skb_queue_purge()become wrappers around the new generic functions.New
SKB_DROP_REASON_QUEUE_PURGEdrop reason is added, but users can start adding more specific reasons.Signed-off-by Eric Dumazet <[email protected]>[...]
Here is the summary with links:
- [net-next] net: add skb_queue_purge_reason and __skb_queue_purge_reason
https://git.kernel.org/netdev/net-next/c/4025d3e73abd
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html