[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1c4a6601-c484-4ffb-a0c1-ec02bd644a5e@huawei.com>
Date: Thu, 21 Aug 2025 19:54:12 +0800
From: Yue Haibing <yuehaibing@...wei.com>
To: Paolo Abeni <pabeni@...hat.com>, <davem@...emloft.net>,
<dsahern@...nel.org>, <edumazet@...gle.com>, <kuba@...nel.org>,
<horms@...nel.org>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RESEND net-next] ipv6: mcast: Add ip6_mc_find_idev()
helper
On 2025/8/21 17:42, Paolo Abeni wrote:
> On 8/18/25 12:10 PM, Yue Haibing wrote:
>> @@ -302,32 +310,18 @@ int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr)
>> }
>> EXPORT_SYMBOL(ipv6_sock_mc_drop);
>>
>> -static struct inet6_dev *ip6_mc_find_dev(struct net *net,
>> - const struct in6_addr *group,
>> - int ifindex)
>> +static struct inet6_dev *ip6_mc_find_idev(struct net *net,
>> + const struct in6_addr *group,
>> + int ifindex)
>> {
>> - struct net_device *dev = NULL;
>> - struct inet6_dev *idev;
>> -
>> - if (ifindex == 0) {
>> - struct rt6_info *rt;
>> + struct inet6_dev *idev = NULL;
>> + struct net_device *dev;
>>
>> - rcu_read_lock();
>> - rt = rt6_lookup(net, group, NULL, 0, NULL, 0);
>> - if (rt) {
>> - dev = dst_dev(&rt->dst);
>> - dev_hold(dev);
>> - ip6_rt_put(rt);
>> - }
>> - rcu_read_unlock();
>> - } else {
>> - dev = dev_get_by_index(net, ifindex);
>> + dev = ip6_mc_find_dev(net, group, ifindex);
>> + if (dev) {
>> + idev = in6_dev_get(dev);
>> + dev_put(dev);
>> }
>> - if (!dev)
>> - return NULL;
>> -
>> - idev = in6_dev_get(dev);
>> - dev_put(dev);
>
> Not so minor nit: if you omit the last chunk (from 'if (dev) {' onwards,
> unneeded), the patch will be much more obvious and smaller. Also you
> could clarify a bit the commit message.
Thanks, it is indeed more clear, will do this in v2
> You can retain Dawid's ack when posting the next version
>
> /P
>
>
Powered by blists - more mailing lists