netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Saeed Mahameed <saeedm@mellanox.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Aya Levin <ayal@mellanox.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	Moshe Shemesh <moshe@mellanox.com>,
	Vlad Buslov <vladbu@mellanox.com>,
	Tariq Toukan <tariqt@mellanox.com>,
	"jakub.kicinski@netronome.com" <jakub.kicinski@netronome.com>,
	Michael Guralnik <michaelgur@mellanox.com>,
	mlxsw <mlxsw@mellanox.com>, "leon@kernel.org" <leon@kernel.org>
Subject: Re: [patch net-next 3/4] net: introduce dev_net notifier register/unregister variants
Date: Sat, 21 Dec 2019 09:21:14 +0100	[thread overview]
Message-ID: <20191221082114.GC2246@nanopsycho.orion> (raw)
In-Reply-To: <2f2b193761ed53f8a529a146e544179864076ce2.camel@mellanox.com>

Fri, Dec 20, 2019 at 08:29:31PM CET, saeedm@mellanox.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.

[...]

  reply	other threads:[~2019-12-21  8:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 12:35 [patch net-next 0/4] net: allow per-net notifier to follow netdev into namespace Jiri Pirko
2019-12-20 12:35 ` [patch net-next 1/4] net: call call_netdevice_unregister_net_notifiers from unregister Jiri Pirko
2019-12-20 17:59   ` David Ahern
2019-12-20 12:35 ` [patch net-next 2/4] net: push code from net notifier reg/unreg into helpers Jiri Pirko
2019-12-20 18:07   ` David Ahern
2019-12-21  8:07     ` Jiri Pirko
2019-12-20 12:35 ` [patch net-next 3/4] net: introduce dev_net notifier register/unregister variants Jiri Pirko
2019-12-20 19:29   ` Saeed Mahameed
2019-12-21  8:21     ` Jiri Pirko [this message]
2019-12-20 12:35 ` [patch net-next 4/4] mlx5: Use dev_net netdevice notifier registrations Jiri Pirko
2019-12-20 18:30 ` [patch net-next 0/4] net: allow per-net notifier to follow netdev into namespace David Ahern
2019-12-21  8:14   ` Jiri Pirko
2019-12-22  4:57     ` David Ahern
2020-01-06  9:15       ` Jiri Pirko
2020-01-06 16:37         ` David Ahern
2020-01-07  9:11           ` Jiri Pirko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191221082114.GC2246@nanopsycho.orion \
    --to=jiri@resnulli.us \
    --cc=ayal@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=jakub.kicinski@netronome.com \
    --cc=leon@kernel.org \
    --cc=michaelgur@mellanox.com \
    --cc=mlxsw@mellanox.com \
    --cc=moshe@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    --cc=tariqt@mellanox.com \
    --cc=vladbu@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).