netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, jakub.kicinski@netronome.com,
	saeedm@mellanox.com, leon@kernel.org, tariqt@mellanox.com,
	ayal@mellanox.com, vladbu@mellanox.com, michaelgur@mellanox.com,
	moshe@mellanox.com, mlxsw@mellanox.com
Subject: [patch net-next 1/4] net: call call_netdevice_unregister_net_notifiers from unregister
Date: Fri, 20 Dec 2019 13:35:39 +0100	[thread overview]
Message-ID: <20191220123542.26315-2-jiri@resnulli.us> (raw)
In-Reply-To: <20191220123542.26315-1-jiri@resnulli.us>

From: Jiri Pirko <jiri@mellanox.com>

The function does the same thing as the existing code, so rather call
call_netdevice_unregister_net_notifiers() instead of code duplication.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 net/core/dev.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 2c277b8aba38..2c90722195f8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1764,7 +1764,6 @@ EXPORT_SYMBOL(register_netdevice_notifier);
 
 int unregister_netdevice_notifier(struct notifier_block *nb)
 {
-	struct net_device *dev;
 	struct net *net;
 	int err;
 
@@ -1775,16 +1774,9 @@ int unregister_netdevice_notifier(struct notifier_block *nb)
 	if (err)
 		goto unlock;
 
-	for_each_net(net) {
-		for_each_netdev(net, dev) {
-			if (dev->flags & IFF_UP) {
-				call_netdevice_notifier(nb, NETDEV_GOING_DOWN,
-							dev);
-				call_netdevice_notifier(nb, NETDEV_DOWN, dev);
-			}
-			call_netdevice_notifier(nb, NETDEV_UNREGISTER, dev);
-		}
-	}
+	for_each_net(net)
+		call_netdevice_unregister_net_notifiers(nb, net);
+
 unlock:
 	rtnl_unlock();
 	up_write(&pernet_ops_rwsem);
-- 
2.21.0


  reply	other threads:[~2019-12-20 12:35 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 ` Jiri Pirko [this message]
2019-12-20 17:59   ` [patch net-next 1/4] net: call call_netdevice_unregister_net_notifiers from unregister 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
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=20191220123542.26315-2-jiri@resnulli.us \
    --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).