* [PATCH] net: neighbour: add neigh_parms_lookup_dev() helper
@ 2026-06-29 15:57 Paritosh Potukuchi
2026-06-29 18:23 ` Kuniyuki Iwashima
0 siblings, 1 reply; 3+ messages in thread
From: Paritosh Potukuchi @ 2026-06-29 15:57 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, Paritosh Potukuchi, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, Kuniyuki Iwashima,
Ido Schimmel, Petr Machata
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.
The caller is expected to hold rcu_read_lock().
This does not break any existing functionality.
Signed-off-by: Paritosh Potukuchi <paritosh.potukuchi@amd.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: neighbour: add neigh_parms_lookup_dev() helper
2026-06-29 15:57 [PATCH] net: neighbour: add neigh_parms_lookup_dev() helper Paritosh Potukuchi
@ 2026-06-29 18:23 ` Kuniyuki Iwashima
[not found] ` <CAMfiSeZYLF0sa+hga-fiAyqPK1kLKwxJ1HfgbNMOwhuNvZTcbQ@mail.gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Kuniyuki Iwashima @ 2026-06-29 18:23 UTC (permalink / raw)
To: Paritosh Potukuchi
Cc: netdev, linux-kernel, Paritosh Potukuchi, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Ido Schimmel, Petr Machata
On Mon, Jun 29, 2026 at 8:58 AM Paritosh Potukuchi
<paritoshpotukuchi@gmail.com> wrote:
>
> 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.
>
> The caller is expected to hold rcu_read_lock().
>
> This does not break any existing functionality.
>
> Signed-off-by: Paritosh Potukuchi <paritosh.potukuchi@amd.com>
> ---
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: neighbour: add neigh_parms_lookup_dev() helper
[not found] ` <CAMfiSeZYLF0sa+hga-fiAyqPK1kLKwxJ1HfgbNMOwhuNvZTcbQ@mail.gmail.com>
@ 2026-06-29 18:59 ` Kuniyuki Iwashima
0 siblings, 0 replies; 3+ messages in thread
From: Kuniyuki Iwashima @ 2026-06-29 18:59 UTC (permalink / raw)
To: Paritosh Potukuchi
Cc: netdev, linux-kernel, Paritosh Potukuchi, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
Ido Schimmel, Petr Machata
On Mon, Jun 29, 2026 at 11:35 AM Paritosh Potukuchi
<paritoshpotukuchi@gmail.com> wrote:
>
> > 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 <kuniyu@google.com> wrote:
>>
>> On Mon, Jun 29, 2026 at 8:58 AM Paritosh Potukuchi
>> <paritoshpotukuchi@gmail.com> wrote:
>> >
>> > 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.
>>
>>
>> >
>> > The caller is expected to hold rcu_read_lock().
>> >
>> > This does not break any existing functionality.
>> >
>> > Signed-off-by: Paritosh Potukuchi <paritosh.potukuchi@amd.com>
>> > ---
>> > 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
>> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-29 18:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-29 15:57 [PATCH] net: neighbour: add neigh_parms_lookup_dev() helper Paritosh Potukuchi
2026-06-29 18:23 ` Kuniyuki Iwashima
[not found] ` <CAMfiSeZYLF0sa+hga-fiAyqPK1kLKwxJ1HfgbNMOwhuNvZTcbQ@mail.gmail.com>
2026-06-29 18:59 ` Kuniyuki Iwashima
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox