diff options
author | Shaun Ruffell <sruffell@digium.com> | 2010-02-25 17:33:58 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2010-02-25 17:33:58 +0000 |
commit | 36b4f0072fd8f20a7b3f46f917b7d5af86fceb7b (patch) | |
tree | 91b3cb5df3309772ad6fb9584f73a25d156c4996 /drivers/dahdi/voicebus/voicebus.h | |
parent | 9a449e1df5edc16fda2c47afe68e8e5cf54026ee (diff) |
wctdm24xxp, wcte12xp: Buffer handling improvements.
This patch moves the majority of the buffer processing for the voicebus based
cards out of the interrupt handler and into a tasklet. When multiple cards are
running on the same CPU, and there was a latency condition that would cause them
to get behind, this now allows the tasklet to limit how many buffers are
processed on each card before giving the other card a chance to start working on
it's backlog.
Additionally, when the card detects a hard under run, instead of trying to fix
it up in the handling routine, it will now reschedule a work item that will
completely reset the descriptor rings.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8095 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/voicebus/voicebus.h')
-rw-r--r-- | drivers/dahdi/voicebus/voicebus.h | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/dahdi/voicebus/voicebus.h b/drivers/dahdi/voicebus/voicebus.h index be713c6..ac7e398 100644 --- a/drivers/dahdi/voicebus/voicebus.h +++ b/drivers/dahdi/voicebus/voicebus.h @@ -29,6 +29,8 @@ #ifndef __VOICEBUS_H__ #define __VOICEBUS_H__ +#include <linux/interrupt.h> + #define VOICEBUS_DEFAULT_LATENCY 3 #define VOICEBUS_DEFAULT_MAXLATENCY 25 #define VOICEBUS_MAXLATENCY_BUMP 6 @@ -42,22 +44,21 @@ /* Define CONFIG_VOICEBUS_SYSFS to create some attributes under the pci device. * This is disabled by default because it hasn't been tested on the full range * of supported kernels. */ -#undef CONFIG_VOICEBUS_SYSFS - -#define INTERRUPT 0 /* Run the deferred processing in the ISR. */ -#define TASKLET 1 /* Run in a tasklet. */ -#define TIMER 2 /* Run in a system timer. */ -#define WORKQUEUE 3 /* Run in a workqueue. */ +#define CONFIG_VOICEBUS_SYSFS -#ifndef VOICEBUS_DEFERRED -#define VOICEBUS_DEFERRED INTERRUPT -#endif +/* Do not generate interrupts on this interface, but instead just poll it */ +#undef CONFIG_VOICEBUS_TIMER struct voicebus; +struct vbb { + u8 data[VOICEBUS_SFRAME_SIZE]; + struct list_head entry; +}; + struct voicebus_operations { - void (*handle_receive)(struct voicebus *vb, void *vbb); - void (*handle_transmit)(struct voicebus *vb, void *vbb); + void (*handle_receive)(struct voicebus *vb, struct list_head *buffers); + void (*handle_transmit)(struct voicebus *vb, struct list_head *buffers); void (*handle_error)(struct voicebus *vb); }; @@ -77,41 +78,39 @@ struct voicebus_descriptor_list { /** * struct voicebus - Represents physical interface to voicebus card. * + * @tx_complete: only used in the tasklet to temporarily hold complete tx + * buffers. */ struct voicebus { struct pci_dev *pdev; spinlock_t lock; struct voicebus_descriptor_list rxd; struct voicebus_descriptor_list txd; - void *idle_vbb; + u8 *idle_vbb; dma_addr_t idle_vbb_dma_addr; const int *debug; u32 iobase; -#if VOICEBUS_DEFERRED == WORKQUEUE - struct workqueue_struct *workqueue; - struct work_struct workitem; -#elif VOICEBUS_DEFERRED == TASKLET struct tasklet_struct tasklet; -#elif VOICEBUS_DEFERRED == TIMER + +#if defined(CONFIG_VOICEBUS_TIMER) struct timer_list timer; #endif + struct work_struct underrun_work; const struct voicebus_operations *ops; struct completion stopped_completion; unsigned long flags; unsigned int min_tx_buffer_count; unsigned int max_latency; - void *vbb_stash[DRING_SIZE]; - unsigned int count; + struct list_head tx_complete; }; int voicebus_init(struct voicebus *vb, const char *board_name); void voicebus_release(struct voicebus *vb); int voicebus_start(struct voicebus *vb); int voicebus_stop(struct voicebus *vb); -void *voicebus_alloc(struct voicebus* vb); -void voicebus_free(struct voicebus *vb, void *vbb); -int voicebus_transmit(struct voicebus *vb, void *vbb); +void voicebus_free(struct voicebus *vb, struct vbb *vbb); +int voicebus_transmit(struct voicebus *vb, struct vbb *vbb); int voicebus_set_minlatency(struct voicebus *vb, unsigned int milliseconds); int voicebus_current_latency(struct voicebus *vb); void voicebus_lock_latency(struct voicebus *vb); |