Skip to contentSkip to conversation

(1/4) Support for lots of netdev's -- dev_base move

PATCH Applied Stephen Hemminger 2 participants 2 messages Feb 6, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (1/4) Support for lots of netdev's -- dev_base move

The first patch moves the device list and locks from drivers/net/Space.c to net/core/dev.c. The list used to be in Space.c because we initialized it in 2.4, but now it makes more sense to put it over with the management routines.

Resend of the patchset to support a large number of network devices efficiently with feedback applied, and rediff'd against 2.6.2

drivers/net/Space.c +0 -25
diff -Nru a/drivers/net/Space.c b/drivers/net/Space.c
@@ -430,28 +430,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);
net/core/dev.c +25 -0
diff -Nru a/net/core/dev.c b/net/core/dev.c
@@ -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
  */
 
#1 lore raw
Quoted 4 lines · On Fri, 6 Feb 2004 10:03:10 -0800 Stephen Hemminger <[email protected]> wrote:

The first patch moves the device list and locks from drivers/net/Space.c to net/core/dev.c. The list used to be in Space.c because we initialized it in 2.4, but now it makes more sense to put it over with the management routines.

Applied.

I hope we can eventually mark these two things static somehow. I know there's a lot needed to do that, so not now just eventually.

Thanks Stephen.