[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191221082114.GC2246@nanopsycho.orion>
Date: Sat, 21 Dec 2019 09:21:14 +0100
From: Jiri Pirko <jiri@...nulli.us>
To: Saeed Mahameed <saeedm@...lanox.com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Aya Levin <ayal@...lanox.com>,
"davem@...emloft.net" <davem@...emloft.net>,
Moshe Shemesh <moshe@...lanox.com>,
Vlad Buslov <vladbu@...lanox.com>,
Tariq Toukan <tariqt@...lanox.com>,
"jakub.kicinski@...ronome.com" <jakub.kicinski@...ronome.com>,
Michael Guralnik <michaelgur@...lanox.com>,
mlxsw <mlxsw@...lanox.com>, "leon@...nel.org" <leon@...nel.org>
Subject: Re: [patch net-next 3/4] net: introduce dev_net notifier
register/unregister variants
Fri, Dec 20, 2019 at 08:29:31PM CET, saeedm@...lanox.com wrote:
>On Fri, 2019-12-20 at 13:35 +0100, Jiri Pirko wrote:
[...]
>> +int register_netdevice_notifier_dev_net(struct net_device *dev,
>> + struct notifier_block *nb,
>> + struct netdev_net_notifier *nn)
>> +{
>> + int err;
>> +
>> + rtnl_lock();
>> + err = __register_netdevice_notifier_net(dev_net(dev), nb,
>> false);
>> + if (!err) {
>> + nn->nb = nb;
>
>looks like there is 1 to 1 mapping between nn and nb,
>to save the driver developers the headache of dealing with two objects
>just embed the nb object into the nn object and let the driver deal
>with nn objects only.
Sure. That was my thinking too. The problem is that in event handler,
the arg is struct notifier_block *nb.
So the user would have to know the struct netdev_net_notifier internals
in order to extract the container of struct notifier_block.
I think is is better to not to hide this.
[...]
Powered by blists - more mailing lists