ipv6: Add in6_dev_rcu().

rcu_dereference_rtnl() does not clearly tell whether the caller
is under RCU or RTNL.

Let's add in6_dev_rcu() to make it easy to remove __in6_dev_get()
in the future.

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Guillaume Nault <gnault@redhat.com>
Link: https://patch.msgid.link/20251029173344.2934622-5-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Kuniyuki Iwashima 2025-10-29 17:32:56 +00:00 committed by Jakub Kicinski
parent 451c538ec0
commit d8f9581e1b
1 changed files with 5 additions and 0 deletions

View File

@ -347,6 +347,11 @@ static inline struct inet6_dev *__in6_dev_get(const struct net_device *dev)
return rcu_dereference_rtnl(dev->ip6_ptr); return rcu_dereference_rtnl(dev->ip6_ptr);
} }
static inline struct inet6_dev *in6_dev_rcu(const struct net_device *dev)
{
return rcu_dereference(dev->ip6_ptr);
}
static inline struct inet6_dev *__in6_dev_get_rtnl_net(const struct net_device *dev) static inline struct inet6_dev *__in6_dev_get_rtnl_net(const struct net_device *dev)
{ {
return rtnl_net_dereference(dev_net(dev), dev->ip6_ptr); return rtnl_net_dereference(dev_net(dev), dev->ip6_ptr);