[PATCH net-next] ipv6: mcast: Simplify mld_clear_{report|query}()

Yue Haibing posted 1 patch 2 months, 3 weeks ago
There is a newer version of this series
net/ipv6/mcast.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
[PATCH net-next] ipv6: mcast: Simplify mld_clear_{report|query}()
Posted by Yue Haibing 2 months, 3 weeks ago
Use __skb_queue_purge() instead of re-implementing it.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
---
 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
Re: [PATCH net-next] ipv6: mcast: Simplify mld_clear_{report|query}()
Posted by Simon Horman 2 months, 3 weeks ago
On Mon, Jul 14, 2025 at 10:01:27PM +0800, Yue Haibing wrote:
> Use __skb_queue_purge() instead of re-implementing it.

Hi,

I think some mention of the changed drop reason is
warranted here.

> 
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>

...
Re: [PATCH net-next] ipv6: mcast: Simplify mld_clear_{report|query}()
Posted by Yue Haibing 2 months, 3 weeks ago
On 2025/7/14 23:27, Simon Horman wrote:
> On Mon, Jul 14, 2025 at 10:01:27PM +0800, Yue Haibing wrote:
>> Use __skb_queue_purge() instead of re-implementing it.
> 
> Hi,
> 
> I think some mention of the changed drop reason is
> warranted here.

Sure, thanks.
> 
>>
>> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
> 
> ...