[dahdi-commits] sruffell: branch linux/sruffell/dahdi-linux-wcte12xp-latency r8798 - /linux/t...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Wed Jun 23 15:38:51 CDT 2010
Author: sruffell
Date: Wed Jun 23 15:38:45 2010
New Revision: 8798
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8798
Log:
voicebus: Add a compile time option to always call the tasklet directly in the interrupt handler
Modified:
linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.c
linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.h
Modified: linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.c?view=diff&rev=8798&r1=8797&r2=8798
==============================================================================
--- linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.c (original)
+++ linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.c Wed Jun 23 15:38:45 2010
@@ -332,6 +332,34 @@
return ret;
}
+#if defined(CONFIG_VOICEBUS_INTERRUPT)
+
+static inline void vb_disable_deferred(struct voicebus *vb)
+{
+ local_irq_disable();
+ spin_lock(&vb->deferred_lock);
+}
+
+static inline void vb_enable_deferred(struct voicebus *vb)
+{
+ spin_unlock(&vb->deferred_lock);
+ local_irq_enable();
+}
+
+#else
+
+static inline void vb_disable_deferred(struct voicebus *vb)
+{
+ tasklet_disable(&vb->tasklet);
+}
+
+static inline void vb_enable_deferred(struct voicebus *vb)
+{
+ tasklet_enable(&vb-tasklet);
+}
+
+#endif
+
static void
vb_cleanup_tx_descriptors(struct voicebus *vb)
{
@@ -340,7 +368,7 @@
struct voicebus_descriptor *d;
struct vbb *vbb;
- tasklet_disable(&vb->tasklet);
+ vb_disable_deferred(vb);
while (!list_empty(&vb->tx_complete)) {
vbb = list_entry(vb->tx_complete.next, struct vbb, entry);
@@ -370,7 +398,7 @@
dl->head = dl->tail = 0;
atomic_set(&dl->count, 0);
- tasklet_enable(&vb->tasklet);
+ vb_enable_deferred(vb);
}
static void vb_cleanup_rx_descriptors(struct voicebus *vb)
@@ -380,7 +408,7 @@
struct voicebus_descriptor *d;
struct vbb *vbb;
- tasklet_disable(&vb->tasklet);
+ vb_disable_deferred(vb);
for (i = 0; i < DRING_SIZE; ++i) {
d = vb_descriptor(dl, i);
if (d->buffer1) {
@@ -397,7 +425,7 @@
dl->head = 0;
dl->tail = 0;
atomic_set(&dl->count, 0);
- tasklet_enable(&vb->tasklet);
+ vb_enable_deferred(vb);
}
static void vb_cleanup_descriptors(struct voicebus *vb,
@@ -667,13 +695,13 @@
list_add_tail(&vbb->entry, &buffers);
}
- tasklet_disable(&vb->tasklet);
+ vb_disable_deferred(vb);
while (!list_empty(&buffers)) {
vbb = list_entry(buffers.next, struct vbb, entry);
list_del(&vbb->entry);
vb_submit_rxb(vb, vbb);
}
- tasklet_enable(&vb->tasklet);
+ vb_enable_deferred(vb);
if (BOOT != vb->mode) {
for (i = 0; i < vb->min_tx_buffer_count; ++i) {
@@ -686,13 +714,13 @@
handle_transmit(vb, &buffers);
- tasklet_disable(&vb->tasklet);
+ vb_disable_deferred(vb);
while (!list_empty(&buffers)) {
vbb = list_entry(buffers.next, struct vbb, entry);
list_del_init(&vbb->entry);
voicebus_transmit(vb, vbb);
}
- tasklet_enable(&vb->tasklet);
+ vb_enable_deferred(vb);
}
}
@@ -1112,6 +1140,17 @@
vb->min_tx_buffer_count += increase;
}
+static void vb_schedule_deferred(struct voicebus *vb)
+{
+#if !defined(CONFIG_VOICEBUS_INTERRUPT)
+ tasklet_hi_schedule(&vb->tasklet);
+#else
+ spin_lock(&vb->deferred_lock);
+ vb->tasklet.func(vb->tasklet.data);
+ spin_unlock(&vb->deferred_lock);
+#endif
+}
+
/**
* vb_tasklet_boot() - When vb->mode == BOOT
*
@@ -1156,8 +1195,10 @@
/* If there may still be buffers in the descriptor rings, reschedule
* ourself to run again. We essentially yield here to allow any other
* cards a chance to run. */
+#if !defined(CONFIG_VOICEBUS_INTERRUPT)
if (unlikely(!count && !test_bit(VOICEBUS_STOP, &vb->flags)))
- tasklet_hi_schedule(&vb->tasklet);
+ vb_schedule_deferred(vb);
+#endif
/* And finally, pass up any receive buffers. */
count = DEFAULT_COUNT;
@@ -1249,11 +1290,13 @@
#endif
}
+#if !defined(CONFIG_VOICEBUS_INTERRUPT)
/* If there may still be buffers in the descriptor rings, reschedule
* ourself to run again. We essentially yield here to allow any other
* cards a chance to run. */
if (unlikely(!count && !test_bit(VOICEBUS_STOP, &vb->flags)))
- tasklet_hi_schedule(&vb->tasklet);
+ vb_schedule_deferred(vb);
+#endif
/* And finally, pass up any receive buffers. */
count = DEFAULT_COUNT;
@@ -1392,11 +1435,13 @@
#endif
}
+#if !defined(CONFIG_VOICEBUS_INTERRUPT)
/* If there may still be buffers in the descriptor rings, reschedule
* ourself to run again. We essentially yield here to allow any other
* cards a chance to run. */
if (unlikely(!count && !test_bit(VOICEBUS_STOP, &vb->flags)))
- tasklet_hi_schedule(&vb->tasklet);
+ vb_schedule_deferred(vb);
+#endif
/* And finally, pass up any receive buffers. */
count = DEFAULT_COUNT;
@@ -1459,10 +1504,10 @@
if (vb->ops->handle_error)
vb->ops->handle_error(vb);
- tasklet_disable(&vb->tasklet);
+ vb_disable_deferred(vb);
setup_descriptors(vb);
start_packet_processing(vb);
- tasklet_enable(&vb->tasklet);
+ vb_enable_deferred(vb);
}
}
@@ -1503,7 +1548,7 @@
schedule_work(&vb->underrun_work);
} else if (HX8 == vb->mode) {
set_bit(VOICEBUS_HARD_UNDERRUN, &vb->flags);
- tasklet_hi_schedule(&vb->tasklet);
+ vb_schedule_deferred(vb);
__vb_setctl(vb, SR_CSR5, int_status);
}
} else if (likely(int_status &
@@ -1511,7 +1556,7 @@
/* ******************************************************** */
/* NORMAL INTERRUPT CASE */
/* ******************************************************** */
- tasklet_hi_schedule(&vb->tasklet);
+ vb_schedule_deferred(vb);
__vb_setctl(vb, SR_CSR5, TX_COMPLETE_INTERRUPT|RX_COMPLETE_INTERRUPT);
} else {
if (int_status & FATAL_BUS_ERROR_INTERRUPT)
@@ -1582,6 +1627,9 @@
vb->max_latency = VOICEBUS_DEFAULT_MAXLATENCY;
spin_lock_init(&vb->lock);
+#if defined(CONFIG_VOICEBUS_INTERRUPT)
+ spin_lock_init(&vb->deferred_lock);
+#endif
set_bit(VOICEBUS_STOP, &vb->flags);
if ((NORMAL != mode) && (BOOT != mode) && (HX8 != mode))
Modified: linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.h?view=diff&rev=8798&r1=8797&r2=8798
==============================================================================
--- linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.h (original)
+++ linux/team/sruffell/dahdi-linux-wcte12xp-latency/drivers/dahdi/voicebus/voicebus.h Wed Jun 23 15:38:45 2010
@@ -57,6 +57,10 @@
/* Define this in order to create a debugging network interface. */
#undef VOICEBUS_NET_DEBUG
+
+/* Define this to only run the processing in an interrupt handler
+ * (and not tasklet). */
+#define CONFIG_VOICEBUS_INTERRUPT
struct voicebus;
@@ -123,6 +127,10 @@
struct tasklet_struct tasklet;
enum voicebus_mode mode;
+#if defined(CONFIG_VOICEBUS_INTERRUPT)
+ spinlock_t deferred_lock;
+#endif
+
#if defined(CONFIG_VOICEBUS_TIMER)
struct timer_list timer;
#endif
More information about the dahdi-commits
mailing list