From: Paolo Abeni <pabeni@redhat.com>
To: Yue Haibing <yuehaibing@huawei.com>,
davem@davemloft.net, dsahern@kernel.org, edumazet@google.com,
kuba@kernel.org, horms@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND net-next] ipv6: mcast: Add ip6_mc_find_idev() helper
Date: Thu, 21 Aug 2025 11:42:32 +0200 [thread overview]
Message-ID: <4ff3b7df-cba0-4446-8411-7b99b5cdce69@redhat.com> (raw)
In-Reply-To: <20250818101051.892443-1-yuehaibing@huawei.com>
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.
You can retain Dawid's ack when posting the next version
/P
next prev parent reply other threads:[~2025-08-21 9:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-18 10:10 Yue Haibing
2025-08-18 13:47 ` Dawid Osuchowski
2025-08-21 9:42 ` Paolo Abeni [this message]
2025-08-21 11:54 ` Yue Haibing
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ff3b7df-cba0-4446-8411-7b99b5cdce69@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®