netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: "David S. Miller" <davem@redhat.com>, Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@oss.sgi.com
Subject: [PATCH 2.5.70] Add release_netdev -- hook for sysfs/net device cleanup
Date: Fri, 6 Jun 2003 14:58:35 -0700	[thread overview]
Message-ID: <20030606145835.3a263df8.shemminger@osdl.org> (raw)

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

             reply	other threads:[~2003-06-06 21:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-06 21:58 Stephen Hemminger [this message]
2003-06-06 23:07 ` [PATCH 2.5.70] Add release_netdev -- hook for sysfs/net device cleanup 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030606145835.3a263df8.shemminger@osdl.org \
    --to=shemminger@osdl.org \
    --cc=davem@redhat.com \
    --cc=jgarzik@pobox.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).