netdev
[Top] [All Lists]

[PATCH] (1/4) support large number of network devices

To: "David S. Miller" <davem@xxxxxxxxxx>
Subject: [PATCH] (1/4) support large number of network devices
From: Stephen Hemminger <shemminger@xxxxxxxx>
Date: Fri, 16 Jan 2004 15:46:52 -0800
Cc: netdev@xxxxxxxxxxx
Organization: Open Source Development Lab
Sender: netdev-bounce@xxxxxxxxxxx
In preparation for the other changes to allow large number
of network devices, move the device table head and lock from
over in the network drivers setup code into the core netdev code.


diff -Nru a/drivers/net/Space.c b/drivers/net/Space.c
--- a/drivers/net/Space.c       Thu Jan 15 16:12:02 2004
+++ b/drivers/net/Space.c       Thu Jan 15 16:12:02 2004
@@ -455,28 +455,3 @@
 }
 
 device_initcall(net_olddevs_init);
-
-/*
- * The @dev_base list is protected by @dev_base_lock and the rtln
- * semaphore.
- *
- * Pure readers hold dev_base_lock for reading.
- *
- * Writers must hold the rtnl semaphore while they loop through the
- * dev_base list, and hold dev_base_lock for writing when they do the
- * actual updates.  This allows pure readers to access the list even
- * while a writer is preparing to update it.
- *
- * To put it another way, dev_base_lock is held for writing only to
- * protect against pure readers; the rtnl semaphore provides the
- * protection against other writers.
- *
- * See, for example usages, register_netdevice() and
- * unregister_netdevice(), which must be called with the rtnl
- * semaphore held.
- */
-struct net_device *dev_base;
-rwlock_t dev_base_lock = RW_LOCK_UNLOCKED;
-
-EXPORT_SYMBOL(dev_base);
-EXPORT_SYMBOL(dev_base_lock);
diff -Nru a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c    Thu Jan 15 16:12:02 2004
+++ b/net/core/dev.c    Thu Jan 15 16:12:02 2004
@@ -161,6 +161,31 @@
 #endif
 
 /*
+ * The @dev_base list is protected by @dev_base_lock and the rtln
+ * semaphore.
+ *
+ * Pure readers hold dev_base_lock for reading.
+ *
+ * Writers must hold the rtnl semaphore while they loop through the
+ * dev_base list, and hold dev_base_lock for writing when they do the
+ * actual updates.  This allows pure readers to access the list even
+ * while a writer is preparing to update it.
+ *
+ * To put it another way, dev_base_lock is held for writing only to
+ * protect against pure readers; the rtnl semaphore provides the
+ * protection against other writers.
+ *
+ * See, for example usages, register_netdevice() and
+ * unregister_netdevice(), which must be called with the rtnl
+ * semaphore held.
+ */
+struct net_device *dev_base;
+rwlock_t dev_base_lock = RW_LOCK_UNLOCKED;
+
+EXPORT_SYMBOL(dev_base);
+EXPORT_SYMBOL(dev_base_lock);
+
+/*
  *     Our notifier list
  */
 

<Prev in Thread] Current Thread [Next in Thread>