From: Kuniyuki Iwashima <kuni1840@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
David Ahern <dsahern@kernel.org>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
Kuniyuki Iwashima <kuniyu@google.com>,
Kuniyuki Iwashima <kuni1840@gmail.com>,
netdev@vger.kernel.org
Subject: [PATCH v3 net-next 01/15] ipv6: ndisc: Remove __in6_dev_get() in pndisc_{constructor,destructor}().
Date: Wed, 2 Jul 2025 16:01:18 -0700 [thread overview]
Message-ID: <20250702230210.3115355-2-kuni1840@gmail.com> (raw)
In-Reply-To: <20250702230210.3115355-1-kuni1840@gmail.com>
From: Kuniyuki Iwashima <kuniyu@google.com>
ipv6_dev_mc_{inc,dec}() has the same check.
Let's remove __in6_dev_get() from pndisc_constructor() and
pndisc_destructor().
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
---
v3: Return the retval of ipv6_dev_mc_inc()
---
net/ipv6/ndisc.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index f2299b61221b..28f35cbb6577 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -377,24 +377,25 @@ static int ndisc_constructor(struct neighbour *neigh)
static int pndisc_constructor(struct pneigh_entry *n)
{
struct in6_addr *addr = (struct in6_addr *)&n->key;
- struct in6_addr maddr;
struct net_device *dev = n->dev;
+ struct in6_addr maddr;
- if (!dev || !__in6_dev_get(dev))
+ if (!dev)
return -EINVAL;
+
addrconf_addr_solict_mult(addr, &maddr);
- ipv6_dev_mc_inc(dev, &maddr);
- return 0;
+ return ipv6_dev_mc_inc(dev, &maddr);
}
static void pndisc_destructor(struct pneigh_entry *n)
{
struct in6_addr *addr = (struct in6_addr *)&n->key;
- struct in6_addr maddr;
struct net_device *dev = n->dev;
+ struct in6_addr maddr;
- if (!dev || !__in6_dev_get(dev))
+ if (!dev)
return;
+
addrconf_addr_solict_mult(addr, &maddr);
ipv6_dev_mc_dec(dev, &maddr);
}
--
2.49.0
next prev parent reply other threads:[~2025-07-02 23:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-02 23:01 [PATCH v3 net-next 00/15] ipv6: Drop RTNL from mcast.c and anycast.c Kuniyuki Iwashima
2025-07-02 23:01 ` Kuniyuki Iwashima [this message]
2025-07-03 7:25 ` [PATCH v3 net-next 01/15] ipv6: ndisc: Remove __in6_dev_get() in pndisc_{constructor,destructor}() Eric Dumazet
2025-07-02 23:01 ` [PATCH v3 net-next 02/15] ipv6: mcast: Replace locking comments with lockdep annotations Kuniyuki Iwashima
2025-07-02 23:01 ` [PATCH v3 net-next 03/15] ipv6: mcast: Check inet6_dev->dead under idev->mc_lock in __ipv6_dev_mc_inc() Kuniyuki Iwashima
2025-07-02 23:01 ` [PATCH v3 net-next 04/15] ipv6: mcast: Remove mca_get() Kuniyuki Iwashima
2025-07-02 23:01 ` [PATCH v3 net-next 05/15] ipv6: mcast: Use in6_dev_get() in ipv6_dev_mc_dec() Kuniyuki Iwashima
2025-07-02 23:01 ` [PATCH v3 net-next 06/15] ipv6: mcast: Don't hold RTNL for IPV6_ADD_MEMBERSHIP and MCAST_JOIN_GROUP Kuniyuki Iwashima
2025-07-02 23:01 ` [PATCH v3 net-next 07/15] ipv6: mcast: Don't hold RTNL for IPV6_DROP_MEMBERSHIP and MCAST_LEAVE_GROUP Kuniyuki Iwashima
2025-11-11 12:44 ` Sverdlin, Alexander
2025-11-12 3:02 ` Kuniyuki Iwashima
2025-11-12 8:02 ` Sverdlin, Alexander
2025-07-02 23:01 ` [PATCH v3 net-next 08/15] ipv6: mcast: Don't hold RTNL in ipv6_sock_mc_close() Kuniyuki Iwashima
2025-07-02 23:01 ` [PATCH v3 net-next 09/15] ipv6: mcast: Don't hold RTNL for MCAST_ socket options Kuniyuki Iwashima
2025-07-02 23:01 ` [PATCH v3 net-next 10/15] ipv6: mcast: Remove unnecessary ASSERT_RTNL and comment Kuniyuki Iwashima
2025-07-02 23:01 ` [PATCH v3 net-next 11/15] ipv6: anycast: Don't use rtnl_dereference() Kuniyuki Iwashima
2025-07-02 23:01 ` [PATCH v3 net-next 12/15] ipv6: anycast: Don't hold RTNL for IPV6_LEAVE_ANYCAST and IPV6_ADDRFORM Kuniyuki Iwashima
2025-07-02 23:01 ` [PATCH v3 net-next 13/15] ipv6: anycast: Unify two error paths in ipv6_sock_ac_join() Kuniyuki Iwashima
2025-07-02 23:01 ` [PATCH v3 net-next 14/15] ipv6: anycast: Don't hold RTNL for IPV6_JOIN_ANYCAST Kuniyuki Iwashima
2025-07-09 1:40 ` Jakub Kicinski
2025-07-09 1:52 ` Kuniyuki Iwashima
2025-07-02 23:01 ` [PATCH v3 net-next 15/15] ipv6: Remove setsockopt_needs_rtnl() Kuniyuki Iwashima
2025-07-09 1:50 ` [PATCH v3 net-next 00/15] ipv6: Drop RTNL from mcast.c and anycast.c patchwork-bot+netdevbpf
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=20250702230210.3115355-2-kuni1840@gmail.com \
--to=kuni1840@gmail.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.