From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next v2 4/4] net: inline rollback_registered_many()
Date: Tue, 19 Jan 2021 12:25:21 -0800 [thread overview]
Message-ID: <20210119202521.3108236-5-kuba@kernel.org> (raw)
In-Reply-To: <20210119202521.3108236-1-kuba@kernel.org>
Similar to the change for rollback_registered() -
rollback_registered_many() was a part of unregister_netdevice_many()
minus the net_set_todo(), which is no longer needed.
Functionally this patch moves the list_empty() check back after:
BUG_ON(dev_boot_phase);
ASSERT_RTNL();
but I can't find any reason why that would be an issue.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
net/core/dev.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index a7841d03c910..dee6488f8a31 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5709,7 +5709,7 @@ static void flush_all_backlogs(void)
}
/* we can have in flight packet[s] on the cpus we are not flushing,
- * synchronize_net() in rollback_registered_many() will take care of
+ * synchronize_net() in unregister_netdevice_many() will take care of
* them
*/
for_each_cpu(cpu, &flush_cpus)
@@ -10605,8 +10605,6 @@ void synchronize_net(void)
}
EXPORT_SYMBOL(synchronize_net);
-static void rollback_registered_many(struct list_head *head);
-
/**
* unregister_netdevice_queue - remove device from the kernel
* @dev: device
@@ -10630,8 +10628,7 @@ void unregister_netdevice_queue(struct net_device *dev, struct list_head *head)
LIST_HEAD(single);
list_add(&dev->unreg_list, &single);
- rollback_registered_many(&single);
- list_del(&single);
+ unregister_netdevice_many(&single);
}
}
EXPORT_SYMBOL(unregister_netdevice_queue);
@@ -10644,15 +10641,6 @@ EXPORT_SYMBOL(unregister_netdevice_queue);
* we force a list_del() to make sure stack wont be corrupted later.
*/
void unregister_netdevice_many(struct list_head *head)
-{
- if (!list_empty(head)) {
- rollback_registered_many(head);
- list_del(head);
- }
-}
-EXPORT_SYMBOL(unregister_netdevice_many);
-
-static void rollback_registered_many(struct list_head *head)
{
struct net_device *dev, *tmp;
LIST_HEAD(close_head);
@@ -10660,6 +10648,9 @@ static void rollback_registered_many(struct list_head *head)
BUG_ON(dev_boot_phase);
ASSERT_RTNL();
+ if (list_empty(head))
+ return;
+
list_for_each_entry_safe(dev, tmp, head, unreg_list) {
/* Some devices call without registering
* for initialization unwind. Remove those
@@ -10743,7 +10734,10 @@ static void rollback_registered_many(struct list_head *head)
dev_put(dev);
net_set_todo(dev);
}
+
+ list_del(head);
}
+EXPORT_SYMBOL(unregister_netdevice_many);
/**
* unregister_netdev - remove device from the kernel
--
2.26.2
next prev parent reply other threads:[~2021-01-19 20:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-19 20:25 [PATCH net-next v2 0/4] net: inline rollback_registered() functions Jakub Kicinski
2021-01-19 20:25 ` [PATCH net-next v2 1/4] net: move net_set_todo inside rollback_registered() Jakub Kicinski
2021-01-19 20:25 ` [PATCH net-next v2 2/4] net: inline rollback_registered() Jakub Kicinski
2021-01-19 20:25 ` [PATCH net-next v2 3/4] net: move rollback_registered_many() Jakub Kicinski
2021-01-19 20:25 ` Jakub Kicinski [this message]
2021-01-19 23:18 ` [PATCH net-next v2 0/4] net: inline rollback_registered() functions Edwin Peer
2021-01-21 5:05 ` Jakub Kicinski
2021-01-21 5:10 ` patchwork-bot+netdevbpf
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=20210119202521.3108236-5-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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).