Re: [PATCH] net: neighbour: add neigh_parms_lookup_dev() helper
From: Kuniyuki Iwashima <kuniyu@google.com>
Date: 2026-06-29 18:59:48
Also in:
lkml
On Mon, Jun 29, 2026 at 11:35 AM Paritosh Potukuchi [off-list ref] wrote:
quoted
Please post a series of patches with the neigh_parms_lookup_dev()users. Sure. I'll post a series of patches, with the neigh_parms_lookup_dev() users.
Please wait 24h before the next submission. https://docs.kernel.org/7.1/process/maintainer-netdev.html#tl-dr
On Mon, 29 Jun 2026 at 23:53, Kuniyuki Iwashima [off-list ref] wrote:quoted
On Mon, Jun 29, 2026 at 8:58 AM Paritosh Potukuchi [off-list ref] wrote:quoted
Provide a helper to lookup neigh_parms associated with a given (neigh_table, net_device) pair. The existing lookup_neigh_parms() helper is internal to the neighbour subsystem and cannot be used by other subsystems. Some stacked/virtual devices like bond require access to the underlying device's neigh_parms. neigh_parms_lookup_dev() is designed to be a wrapper around lookup_neigh_parms(). The function provides controlled access to per device neigh_parms.Please post a series of patches with the neigh_parms_lookup_dev() users.quoted
The caller is expected to hold rcu_read_lock(). This does not break any existing functionality. Signed-off-by: Paritosh Potukuchi <redacted> --- include/net/neighbour.h | 2 ++ net/core/neighbour.c | 8 ++++++++ 2 files changed, 10 insertions(+)diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 8860cc2175fc..1b3b06eda886 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h@@ -438,6 +438,8 @@ int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p, proc_handler *proc_handler); void neigh_sysctl_unregister(struct neigh_parms *p); +struct neigh_parms *neigh_parms_lookup_dev(struct neigh_table *tbl, struct net_device *dev); + static inline void __neigh_parms_put(struct neigh_parms *parms) { refcount_dec(&parms->refcnt);diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 1349c0eedb64..6d32c2668af3 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c@@ -1757,6 +1757,14 @@ static inline struct neigh_parms *lookup_neigh_parms(struct neigh_table *tbl, return NULL; } +/* Caller must hold rcu_read_lock()*/ + +struct neigh_parms *neigh_parms_lookup_dev(struct neigh_table *tbl, struct net_device *dev) +{ + return lookup_neigh_parms(tbl, dev_net(dev), dev->ifindex); +} +EXPORT_SYMBOL(neigh_parms_lookup_dev); + struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl) { --2.43.0