netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.5.70] Add release_netdev -- hook for sysfs/net device cleanup
@ 2003-06-06 21:58 Stephen Hemminger
  2003-06-06 23:07 ` Stephen Hemminger
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Stephen Hemminger @ 2003-06-06 21:58 UTC (permalink / raw)
  To: David S. Miller, Jeff Garzik; +Cc: netdev

This is the first phase of a sequence of patches to resolve network
device reference count issues exposed by the new sysfs interface.

Phase I:  introduces release_netdev which is the hook to allow later
   changes to hold onto the net device after the device has potentially
   unloaded.  Includes patch for the easy to fix devices. 

Phase II: fixes devices that encapsulate network device structure
   inside their own structure, or allocate private data in a way
   that will break later.

Phase III: changes release_netdev to handle the case of delayed freeing
   of the network device, and appropriate state checking.


diff -Nru a/include/linux/netdevice.h b/include/linux/netdevice.h
--- a/include/linux/netdevice.h	Thu Jun  5 14:44:28 2003
+++ b/include/linux/netdevice.h	Thu Jun  5 14:44:28 2003
@@ -491,6 +491,7 @@
 extern int		dev_queue_xmit(struct sk_buff *skb);
 extern int		register_netdevice(struct net_device *dev);
 extern int		unregister_netdevice(struct net_device *dev);
+extern void		release_netdev(struct net_device *dev);
 extern void		synchronize_net(void);
 extern int 		register_netdevice_notifier(struct notifier_block *nb);
 extern int		unregister_netdevice_notifier(struct notifier_block *nb);
diff -Nru a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c	Thu Jun  5 14:44:28 2003
+++ b/net/core/dev.c	Thu Jun  5 14:44:28 2003
@@ -2768,6 +2768,21 @@
 	}
 }
 
+
+/**
+ *	release_netdev - free network device
+ *	@dev: device
+ *
+ *	This function does the last stage of destroying an allocated device 
+ * 	interface. Currently, it just frees the device.
+ *
+ */
+
+void release_netdev(struct net_device *dev)
+{
+	kfree(dev);
+}
+
 /* Synchronize with packet receive processing. */
 void synchronize_net(void) 
 {
diff -Nru a/net/netsyms.c b/net/netsyms.c
--- a/net/netsyms.c	Thu Jun  5 14:44:28 2003
+++ b/net/netsyms.c	Thu Jun  5 14:44:28 2003
@@ -558,6 +558,7 @@
 EXPORT_SYMBOL(loopback_dev);
 EXPORT_SYMBOL(register_netdevice);
 EXPORT_SYMBOL(unregister_netdevice);
+EXPORT_SYMBOL(release_netdev);
 EXPORT_SYMBOL(synchronize_net);
 EXPORT_SYMBOL(netdev_state_change);
 EXPORT_SYMBOL(dev_new_index);

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2003-06-09 18:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-06 21:58 [PATCH 2.5.70] Add release_netdev -- hook for sysfs/net device cleanup Stephen Hemminger
2003-06-06 23:07 ` Stephen Hemminger
2003-06-07  9:05 ` David S. Miller
2003-06-07 15:25   ` Stephen Hemminger
2003-06-07 19:15 ` Jeff Garzik
2003-06-08  6:58   ` David S. Miller
2003-06-09  3:51     ` Jeff Garzik
2003-06-09  5:53       ` David S. Miller
2003-06-09 17:09         ` Jeff Garzik
2003-06-09 17:09           ` David S. Miller
2003-06-09 17:14             ` Jeff Garzik
2003-06-09 17:18               ` David S. Miller
2003-06-09 18:11                 ` Jeff Garzik
2003-06-07 19:16 ` Jeff Garzik

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).