linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next] ipv6: mcast: Simplify mld_clear_{report|query}()
@ 2025-07-15 12:07 Yue Haibing
  2025-07-16 14:05 ` Hangbin Liu
  2025-07-16 23:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Yue Haibing @ 2025-07-15 12:07 UTC (permalink / raw)
  To: davem, dsahern, edumazet, kuba, pabeni, horms
  Cc: netdev, linux-kernel, yuehaibing

Use __skb_queue_purge() instead of re-implementing it. Note that it uses
kfree_skb_reason() instead of kfree_skb() internally, and pass
SKB_DROP_REASON_QUEUE_PURGE drop reason to the kfree_skb tracepoint.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
---
v2: Add drop reason note
---
 net/ipv6/mcast.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
index 8aecdd85a6ae..36ca27496b3c 100644
--- a/net/ipv6/mcast.c
+++ b/net/ipv6/mcast.c
@@ -845,21 +845,15 @@ static void mld_clear_delrec(struct inet6_dev *idev)
 
 static void mld_clear_query(struct inet6_dev *idev)
 {
-	struct sk_buff *skb;
-
 	spin_lock_bh(&idev->mc_query_lock);
-	while ((skb = __skb_dequeue(&idev->mc_query_queue)))
-		kfree_skb(skb);
+	__skb_queue_purge(&idev->mc_query_queue);
 	spin_unlock_bh(&idev->mc_query_lock);
 }
 
 static void mld_clear_report(struct inet6_dev *idev)
 {
-	struct sk_buff *skb;
-
 	spin_lock_bh(&idev->mc_report_lock);
-	while ((skb = __skb_dequeue(&idev->mc_report_queue)))
-		kfree_skb(skb);
+	__skb_queue_purge(&idev->mc_report_queue);
 	spin_unlock_bh(&idev->mc_report_lock);
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 net-next] ipv6: mcast: Simplify mld_clear_{report|query}()
  2025-07-15 12:07 [PATCH v2 net-next] ipv6: mcast: Simplify mld_clear_{report|query}() Yue Haibing
@ 2025-07-16 14:05 ` Hangbin Liu
  2025-07-16 23:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Hangbin Liu @ 2025-07-16 14:05 UTC (permalink / raw)
  To: Yue Haibing
  Cc: davem, dsahern, edumazet, kuba, pabeni, horms, netdev,
	linux-kernel

On Tue, Jul 15, 2025 at 08:07:09PM +0800, Yue Haibing wrote:
> Use __skb_queue_purge() instead of re-implementing it. Note that it uses
> kfree_skb_reason() instead of kfree_skb() internally, and pass
> SKB_DROP_REASON_QUEUE_PURGE drop reason to the kfree_skb tracepoint.
> 
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
> ---
> v2: Add drop reason note
> ---
>  net/ipv6/mcast.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c
> index 8aecdd85a6ae..36ca27496b3c 100644
> --- a/net/ipv6/mcast.c
> +++ b/net/ipv6/mcast.c
> @@ -845,21 +845,15 @@ static void mld_clear_delrec(struct inet6_dev *idev)
>  
>  static void mld_clear_query(struct inet6_dev *idev)
>  {
> -	struct sk_buff *skb;
> -
>  	spin_lock_bh(&idev->mc_query_lock);
> -	while ((skb = __skb_dequeue(&idev->mc_query_queue)))
> -		kfree_skb(skb);
> +	__skb_queue_purge(&idev->mc_query_queue);
>  	spin_unlock_bh(&idev->mc_query_lock);
>  }
>  
>  static void mld_clear_report(struct inet6_dev *idev)
>  {
> -	struct sk_buff *skb;
> -
>  	spin_lock_bh(&idev->mc_report_lock);
> -	while ((skb = __skb_dequeue(&idev->mc_report_queue)))
> -		kfree_skb(skb);
> +	__skb_queue_purge(&idev->mc_report_queue);
>  	spin_unlock_bh(&idev->mc_report_lock);
>  }
>  
> -- 
> 2.34.1
> 

Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 net-next] ipv6: mcast: Simplify mld_clear_{report|query}()
  2025-07-15 12:07 [PATCH v2 net-next] ipv6: mcast: Simplify mld_clear_{report|query}() Yue Haibing
  2025-07-16 14:05 ` Hangbin Liu
@ 2025-07-16 23:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-07-16 23:20 UTC (permalink / raw)
  To: Yue Haibing
  Cc: davem, dsahern, edumazet, kuba, pabeni, horms, netdev,
	linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 15 Jul 2025 20:07:09 +0800 you wrote:
> Use __skb_queue_purge() instead of re-implementing it. Note that it uses
> kfree_skb_reason() instead of kfree_skb() internally, and pass
> SKB_DROP_REASON_QUEUE_PURGE drop reason to the kfree_skb tracepoint.
> 
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
> ---
> v2: Add drop reason note
> 
> [...]

Here is the summary with links:
  - [v2,net-next] ipv6: mcast: Simplify mld_clear_{report|query}()
    https://git.kernel.org/netdev/net-next/c/6c628ed95e1b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-16 23:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-15 12:07 [PATCH v2 net-next] ipv6: mcast: Simplify mld_clear_{report|query}() Yue Haibing
2025-07-16 14:05 ` Hangbin Liu
2025-07-16 23:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).