public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* ip_forward notification for driver
@ 2022-11-10  7:51 Leonid Komaryanskiy
  2022-11-10  8:15 ` Ido Schimmel
  0 siblings, 1 reply; 4+ messages in thread
From: Leonid Komaryanskiy @ 2022-11-10  7:51 UTC (permalink / raw)
  To: netdev; +Cc: dmytro_firsov

Hello.

I'm working on L3 routing offload for switch device and have a
question about ip_forwarding. I want to disable/enable forwarding on
the hardware side according to changing value in
/proc/sys/net/ipv4/ip_forward. As I see, inet_netconf_notify_devconf
just sends rtnl_notify for userspace. Could I ask you for advice, on
how can I handle updating value via some notifier or some other Linux
mechanism in driver?

Thank you in advance.

Kind Regards, Leonid.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ip_forward notification for driver
  2022-11-10  7:51 ip_forward notification for driver Leonid Komaryanskiy
@ 2022-11-10  8:15 ` Ido Schimmel
  2022-12-01 15:21   ` Leonid Komaryanskiy
  0 siblings, 1 reply; 4+ messages in thread
From: Ido Schimmel @ 2022-11-10  8:15 UTC (permalink / raw)
  To: Leonid Komaryanskiy; +Cc: netdev, dmytro_firsov, petrm

On Thu, Nov 10, 2022 at 09:51:35AM +0200, Leonid Komaryanskiy wrote:
> I'm working on L3 routing offload for switch device and have a
> question about ip_forwarding. I want to disable/enable forwarding on
> the hardware side according to changing value in
> /proc/sys/net/ipv4/ip_forward. As I see, inet_netconf_notify_devconf
> just sends rtnl_notify for userspace. Could I ask you for advice, on
> how can I handle updating value via some notifier or some other Linux
> mechanism in driver?

You can look into netevents. See NETEVENT_IPV4_MPATH_HASH_UPDATE and
NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE, for example.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ip_forward notification for driver
  2022-11-10  8:15 ` Ido Schimmel
@ 2022-12-01 15:21   ` Leonid Komaryanskiy
  2022-12-04  9:05     ` Ido Schimmel
  0 siblings, 1 reply; 4+ messages in thread
From: Leonid Komaryanskiy @ 2022-12-01 15:21 UTC (permalink / raw)
  To: Ido Schimmel, netdev; +Cc: dmytro_firsov, petrm, davem, kuznet, yoshfuji

Ido Schimmel, thank you for your advice.
We checked netevents (NETEVENT_IPV4_MPATH_HASH_UPDATE and
NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE) but unfortunately, netevents
notifier doesn't trigger at all in case of changing value in
/proc/sys/net/ipv4/ip_forward. We see, that these events come in the
case of modifying /proc/sys/net/ipv4/fib_multipath_hash_policy, but
not for ip_forward. Shell we prepare an upstream patch with notifier
for ip_forward modify netevent?

On Thu, Nov 10, 2022 at 10:15 AM Ido Schimmel <idosch@idosch.org> wrote:
>
> On Thu, Nov 10, 2022 at 09:51:35AM +0200, Leonid Komaryanskiy wrote:
> > I'm working on L3 routing offload for switch device and have a
> > question about ip_forwarding. I want to disable/enable forwarding on
> > the hardware side according to changing value in
> > /proc/sys/net/ipv4/ip_forward. As I see, inet_netconf_notify_devconf
> > just sends rtnl_notify for userspace. Could I ask you for advice, on
> > how can I handle updating value via some notifier or some other Linux
> > mechanism in driver?
>
> You can look into netevents. See NETEVENT_IPV4_MPATH_HASH_UPDATE and
> NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE, for example.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ip_forward notification for driver
  2022-12-01 15:21   ` Leonid Komaryanskiy
@ 2022-12-04  9:05     ` Ido Schimmel
  0 siblings, 0 replies; 4+ messages in thread
From: Ido Schimmel @ 2022-12-04  9:05 UTC (permalink / raw)
  To: Leonid Komaryanskiy; +Cc: netdev, dmytro_firsov, petrm, davem, kuznet, yoshfuji

On Thu, Dec 01, 2022 at 05:21:10PM +0200, Leonid Komaryanskiy wrote:
> We checked netevents (NETEVENT_IPV4_MPATH_HASH_UPDATE and
> NETEVENT_IPV4_FWD_UPDATE_PRIORITY_UPDATE) but unfortunately, netevents
> notifier doesn't trigger at all in case of changing value in
> /proc/sys/net/ipv4/ip_forward. We see, that these events come in the
> case of modifying /proc/sys/net/ipv4/fib_multipath_hash_policy, but
> not for ip_forward. Shell we prepare an upstream patch with notifier
> for ip_forward modify netevent?

I believe this is the correct interface to use for this notification,
but if you are going to submit such a patch, then it needs to be
submitted together with a patch for a driver that listens to the event
an acts upon it. New APIs without an upstream user are not allowed.
Also, please make sure you add a test under
tools/testing/selftests/net/forwarding/.

P.S. Please avoid top-posting as explained here:
https://docs.kernel.org/process/2.Process.html#mailing-lists

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-04  9:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-10  7:51 ip_forward notification for driver Leonid Komaryanskiy
2022-11-10  8:15 ` Ido Schimmel
2022-12-01 15:21   ` Leonid Komaryanskiy
2022-12-04  9:05     ` Ido Schimmel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox