Skip to contentSkip to conversation

Netfront accelerator bug fixes

PATCH New Kieran Mansley 1 participant 1 message Oct 30, 2007 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 6/8 Netfront accelerator bug fixes

cleanup accelerators list on netfront unload

Signed-off-by <[email protected]>

drivers/xen/netfront/accel.c +18 -0
diff -r fdfd708d2ec4 drivers/xen/netfront/accel.c
@@ -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
drivers/xen/netfront/netfront.c +2 -0
diff -r fdfd708d2ec4 drivers/xen/netfront/netfront.c
@@ -2212,6 +2212,8 @@ static void __exit netif_exit(void)
 
 	unregister_inetaddr_notifier(&notifier_inetdev);
 
+	netif_exit_accel();
+
 	return xenbus_unregister_driver(&netfront);
 }
 module_exit(netif_exit);
drivers/xen/netfront/netfront.h +2 -0
diff -r fdfd708d2ec4 drivers/xen/netfront/netfront.h
@@ -306,6 +306,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,

cleanup accelerators list on netfront unload

drivers/xen/netfront/accel.c +18 -0
diff -r fdfd708d2ec4 drivers/xen/netfront/accel.c
@@ -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
drivers/xen/netfront/netfront.c +2 -0
diff -r fdfd708d2ec4 drivers/xen/netfront/netfront.c
@@ -2212,6 +2212,8 @@ static void __exit netif_exit(void)
 
 	unregister_inetaddr_notifier(&notifier_inetdev);
 
+	netif_exit_accel();
+
 	return xenbus_unregister_driver(&netfront);
 }
 module_exit(netif_exit);
drivers/xen/netfront/netfront.h +2 -0
diff -r fdfd708d2ec4 drivers/xen/netfront/netfront.h
@@ -306,6 +306,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-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel