]> xenbits.xensource.com Git - xenclient/kernel.git/commitdiff
netfront accel: cleanup accelerators list on netfront unload
authorKeir Fraser <keir@xensource.com>
Tue, 30 Oct 2007 17:34:26 +0000 (17:34 +0000)
committerKeir Fraser <keir@xensource.com>
Tue, 30 Oct 2007 17:34:26 +0000 (17:34 +0000)
Signed-off-by <kmansley@solarflare.com>

drivers/xen/netfront/accel.c
drivers/xen/netfront/netfront.c
drivers/xen/netfront/netfront.h

index f4d271447a90ac2666906607aec467e648e3d679..b5eed16f70132ca346af0bc558dc55f12b7163ac 100644 (file)
@@ -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
index c0c5e32fad74837e7ca99a3f0dddf75acd24c669..f702a42c898b12986b86ded6200e982bb6f3c1a1 100644 (file)
@@ -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);
index 34da635afdec41d41d312971e801dcd620a3f234..d0fcf206fd6a25fb7208be3d399bfbeb3da3ec59 100644 (file)
@@ -293,6 +293,8 @@ int netfront_load_accelerator(struct netfront_info *np,
 
 extern
 void netif_init_accel(void);
+extern
+void netif_exit_accel(void);
 
 extern
 void init_accelerator_vif(struct netfront_info *np,