提交 0cbe1e57 编写于 作者: J Jakub Kicinski

net: inline rollback_registered_many()

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.
Reviewed-by: NEdwin Peer <edwin.peer@broadcom.com>
Signed-off-by: NJakub Kicinski <kuba@kernel.org>
上级 bcfe2f1a
...@@ -5709,7 +5709,7 @@ static void flush_all_backlogs(void) ...@@ -5709,7 +5709,7 @@ static void flush_all_backlogs(void)
} }
/* we can have in flight packet[s] on the cpus we are not flushing, /* 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 * them
*/ */
for_each_cpu(cpu, &flush_cpus) for_each_cpu(cpu, &flush_cpus)
...@@ -10610,8 +10610,6 @@ void synchronize_net(void) ...@@ -10610,8 +10610,6 @@ void synchronize_net(void)
} }
EXPORT_SYMBOL(synchronize_net); EXPORT_SYMBOL(synchronize_net);
static void rollback_registered_many(struct list_head *head);
/** /**
* unregister_netdevice_queue - remove device from the kernel * unregister_netdevice_queue - remove device from the kernel
* @dev: device * @dev: device
...@@ -10635,8 +10633,7 @@ void unregister_netdevice_queue(struct net_device *dev, struct list_head *head) ...@@ -10635,8 +10633,7 @@ void unregister_netdevice_queue(struct net_device *dev, struct list_head *head)
LIST_HEAD(single); LIST_HEAD(single);
list_add(&dev->unreg_list, &single); list_add(&dev->unreg_list, &single);
rollback_registered_many(&single); unregister_netdevice_many(&single);
list_del(&single);
} }
} }
EXPORT_SYMBOL(unregister_netdevice_queue); EXPORT_SYMBOL(unregister_netdevice_queue);
...@@ -10649,15 +10646,6 @@ EXPORT_SYMBOL(unregister_netdevice_queue); ...@@ -10649,15 +10646,6 @@ EXPORT_SYMBOL(unregister_netdevice_queue);
* we force a list_del() to make sure stack wont be corrupted later. * we force a list_del() to make sure stack wont be corrupted later.
*/ */
void unregister_netdevice_many(struct list_head *head) 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; struct net_device *dev, *tmp;
LIST_HEAD(close_head); LIST_HEAD(close_head);
...@@ -10665,6 +10653,9 @@ static void rollback_registered_many(struct list_head *head) ...@@ -10665,6 +10653,9 @@ static void rollback_registered_many(struct list_head *head)
BUG_ON(dev_boot_phase); BUG_ON(dev_boot_phase);
ASSERT_RTNL(); ASSERT_RTNL();
if (list_empty(head))
return;
list_for_each_entry_safe(dev, tmp, head, unreg_list) { list_for_each_entry_safe(dev, tmp, head, unreg_list) {
/* Some devices call without registering /* Some devices call without registering
* for initialization unwind. Remove those * for initialization unwind. Remove those
...@@ -10748,7 +10739,10 @@ static void rollback_registered_many(struct list_head *head) ...@@ -10748,7 +10739,10 @@ static void rollback_registered_many(struct list_head *head)
dev_put(dev); dev_put(dev);
net_set_todo(dev); net_set_todo(dev);
} }
list_del(head);
} }
EXPORT_SYMBOL(unregister_netdevice_many);
/** /**
* unregister_netdev - remove device from the kernel * unregister_netdev - remove device from the kernel
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册