aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-10-27 07:03:04 +0000
committerDavid S. Miller <davem@davemloft.net>2009-10-28 02:22:06 -0700
commit44a0873d52282f24b1894c58c0f157e0f626ddc9 (patch)
tree2d913650b6c9474f135546cf06fe5e8d174ef478 /net/core/dev.c
parentigb: cleanup "todo" code found in igb_ethtool.c (diff)
downloadlinux-dev-44a0873d52282f24b1894c58c0f157e0f626ddc9.tar.xz
linux-dev-44a0873d52282f24b1894c58c0f157e0f626ddc9.zip
net: Introduce unregister_netdevice_queue()
This patchs adds an unreg_list anchor to struct net_device, and introduces an unregister_netdevice_queue() function, able to queue a net_device to a list instead of immediately unregister it. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 950c13fa60d2..ff94e2b8df7f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5245,25 +5245,31 @@ void synchronize_net(void)
EXPORT_SYMBOL(synchronize_net);
/**
- * unregister_netdevice - remove device from the kernel
+ * unregister_netdevice_queue - remove device from the kernel
* @dev: device
- *
+ * @head: list
+
* This function shuts down a device interface and removes it
* from the kernel tables.
+ * If head not NULL, device is queued to be unregistered later.
*
* Callers must hold the rtnl semaphore. You may want
* unregister_netdev() instead of this.
*/
-void unregister_netdevice(struct net_device *dev)
+void unregister_netdevice_queue(struct net_device *dev, struct list_head *head)
{
ASSERT_RTNL();
- rollback_registered(dev);
- /* Finish processing unregister after unlock */
- net_set_todo(dev);
+ if (head) {
+ list_add_tail(&dev->unreg_list, head);
+ } else {
+ rollback_registered(dev);
+ /* Finish processing unregister after unlock */
+ net_set_todo(dev);
+ }
}
-EXPORT_SYMBOL(unregister_netdevice);
+EXPORT_SYMBOL(unregister_netdevice_queue);
/**
* unregister_netdev - remove device from the kernel