[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z_keORW4OWc8i5Vz@krikkit>
Date: Fri, 11 Apr 2025 15:50:49 +0200
From: Sabrina Dubroca <sd@...asysnail.net>
To: Antonio Quartulli <antonio@...nvpn.net>
Cc: Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Donald Hunter <donald.hunter@...il.com>,
Shuah Khan <shuah@...nel.org>, ryazanov.s.a@...il.com,
Andrew Lunn <andrew+netdev@...n.ch>,
Simon Horman <horms@...nel.org>, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, Xiao Liang <shaw.leon@...il.com>,
steffen.klassert@...unet.com, antony.antony@...unet.com
Subject: Re: [PATCH net-next v25 01/23] net: introduce OpenVPN Data Channel
Offload (ovpn)
2025-04-11, 10:04:10 +0200, Antonio Quartulli wrote:
> Hi Jakub,
>
> thanks for taking the time to go through my patchset :)
>
> On 11/04/2025 04:54, Jakub Kicinski wrote:
> > On Mon, 07 Apr 2025 21:46:09 +0200 Antonio Quartulli wrote:
> > > +static int ovpn_netdev_notifier_call(struct notifier_block *nb,
> > > + unsigned long state, void *ptr)
> > > +{
> > > + struct net_device *dev = netdev_notifier_info_to_dev(ptr);
> > > +
> > > + if (!ovpn_dev_is_valid(dev))
> > > + return NOTIFY_DONE;
> > > +
> > > + switch (state) {
> > > + case NETDEV_REGISTER:
> > > + /* add device to internal list for later destruction upon
> > > + * unregistration
> > > + */
> > > + break;
> > > + case NETDEV_UNREGISTER:
> > > + /* can be delivered multiple times, so check registered flag,
> > > + * then destroy the interface
> > > + */
> > > + break;
> > > + case NETDEV_POST_INIT:
> > > + case NETDEV_GOING_DOWN:
> > > + case NETDEV_DOWN:
> > > + case NETDEV_UP:
> > > + case NETDEV_PRE_UP:
> > > + default:
> > > + return NOTIFY_DONE;
> > > + }
> >
> > Why are you using a notifier to get events for your own device?
>
> My understanding is that this is the standard approach to:
> 1) hook in the middle of registration/deregistration;
> 2) handle events generated by other components/routines.
>
> I see in /drivers/net/ almost every driver registers a notifier for their
> own device.
I think most of them register a notifier for their lower device
(bridge port, real device under a vlan, or similar).
I've mentioned at some point that it would be more usual to replace
this notifier with a custom dellink, and that ovpn->registered could
likely be replaced with checking for NETREG_REGISTERED. I just thought
it could be cleaned up a bit later, but it seems Jakub wants it done
before taking the patches :)
--
Sabrina
Powered by blists - more mailing lists