[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] netfront accel: cleanup accelerators list on netfront unload



# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1193765666 0
# Node ID c807b5387fbba317b03bc0e5787edf3b2d4d2c52
# Parent  d85cb3fd1011b1e3e086efc4e682a2b0e1732481
netfront accel: cleanup accelerators list on netfront unload
Signed-off-by <kmansley@xxxxxxxxxxxxxx>
---
 drivers/xen/netfront/accel.c    |   18 ++++++++++++++++++
 drivers/xen/netfront/netfront.c |    2 ++
 drivers/xen/netfront/netfront.h |    2 ++
 3 files changed, 22 insertions(+)

diff -r d85cb3fd1011 -r c807b5387fbb drivers/xen/netfront/accel.c
--- a/drivers/xen/netfront/accel.c      Tue Oct 30 17:33:49 2007 +0000
+++ b/drivers/xen/netfront/accel.c      Tue Oct 30 17:34:26 2007 +0000
@@ -75,6 +75,24 @@ void netif_init_accel(void)
        spin_lock_init(&accelerators_lock);
 }
 
+void netif_exit_accel(void)
+{
+       struct netfront_accelerator *accelerator, *tmp;
+       unsigned flags;
+
+       spin_lock_irqsave(&accelerators_lock, flags);
+
+       list_for_each_entry_safe(accelerator, tmp, &accelerators_list, link) {
+               BUG_ON(!list_empty(&accelerator->vif_states));
+
+               list_del(&accelerator->link);
+               kfree(accelerator->frontend);
+               kfree(accelerator);
+       }
+
+       spin_unlock_irqrestore(&accelerators_lock, flags);
+}
+
 
 /* 
  * Initialise the accel_vif_state field in the netfront state
diff -r d85cb3fd1011 -r c807b5387fbb drivers/xen/netfront/netfront.c
--- a/drivers/xen/netfront/netfront.c   Tue Oct 30 17:33:49 2007 +0000
+++ b/drivers/xen/netfront/netfront.c   Tue Oct 30 17:34:26 2007 +0000
@@ -2210,6 +2210,8 @@ static void __exit netif_exit(void)
 
        unregister_inetaddr_notifier(&notifier_inetdev);
 
+       netif_exit_accel();
+
        return xenbus_unregister_driver(&netfront);
 }
 module_exit(netif_exit);
diff -r d85cb3fd1011 -r c807b5387fbb drivers/xen/netfront/netfront.h
--- a/drivers/xen/netfront/netfront.h   Tue Oct 30 17:33:49 2007 +0000
+++ b/drivers/xen/netfront/netfront.h   Tue Oct 30 17:34:26 2007 +0000
@@ -293,6 +293,8 @@ int netfront_load_accelerator(struct net
 
 extern
 void netif_init_accel(void);
+extern
+void netif_exit_accel(void);
 
 extern
 void init_accelerator_vif(struct netfront_info *np,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.