[dahdi-commits] sruffell: linux/trunk r10562 - /linux/trunk/drivers/dahdi/dahdi_dynamic_eth.c
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Wed Mar 21 13:56:20 CDT 2012
Author: sruffell
Date: Wed Mar 21 13:56:16 2012
New Revision: 10562
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10562
Log:
dahdi_dynamic_eth: Move tx packet flushing to process context.
The masterspan can be, and often is, called with interrupts disabled but
dev_queue_xmit() needs to be called with interrupts enabled. This potentially
fixes a deadlock.
Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Modified:
linux/trunk/drivers/dahdi/dahdi_dynamic_eth.c
Modified: linux/trunk/drivers/dahdi/dahdi_dynamic_eth.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi_dynamic_eth.c?view=diff&rev=10562&r1=10561&r2=10562
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi_dynamic_eth.c (original)
+++ linux/trunk/drivers/dahdi/dahdi_dynamic_eth.c Wed Mar 21 13:56:16 2012
@@ -183,15 +183,44 @@
spin_unlock_irqrestore(&zlock, flags);
}
-
-static int ztdeth_flush(void)
+/**
+ * dahdi_dynamic_flush_work_fn - Flush all pending transactions.
+ *
+ * This function is run in a work queue since we can't guarantee interrupts
+ * will be enabled when we're called, and dev_queue_xmit() requires that
+ * interrupts be enabled.
+ *
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+static void dahdi_dynamic_flush_work_fn(void *data)
+#else
+static void dahdi_dynamic_flush_work_fn(struct work_struct *work)
+#endif
{
struct sk_buff *skb;
-
/* Handle all transmissions now */
while ((skb = skb_dequeue(&skbs))) {
dev_queue_xmit(skb);
}
+}
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
+static DECLARE_WORK(dahdi_dynamic_eth_flush_work,
+ dahdi_dynamic_flush_work_fn, NULL);
+#else
+static DECLARE_WORK(dahdi_dynamic_eth_flush_work,
+ dahdi_dynamic_flush_work_fn);
+#endif
+
+/**
+ * ztdeth_flush - Flush all pending transactions.
+ *
+ * This function is called in interrupt context while processing the master
+ * span.
+ */
+static int ztdeth_flush(void)
+{
+ schedule_work(&dahdi_dynamic_eth_flush_work);
return 0;
}
@@ -414,6 +443,7 @@
static void __exit ztdeth_exit(void)
{
+ cancel_work_sync(&dahdi_dynamic_eth_flush_work);
dev_remove_pack(&ztdeth_ptype);
unregister_netdevice_notifier(&ztdeth_nblock);
dahdi_dynamic_unregister_driver(&ztd_eth);
More information about the dahdi-commits
mailing list