From 6ab7988dbd6f5cf378688fb388ddc92db42696d5 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Sat, 3 Apr 2010 00:03:58 +0000 Subject: wcte12xp: Resend both framer and VPM commands when reads may have been lost. Latency conditions could cause the driver to misconfigure the VPM which would result in one way audio. DAHDI-572. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8454 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/voicebus/GpakCust.h | 23 ++++++++++++++++++++++- drivers/dahdi/wctdm24xxp/base.c | 22 +--------------------- drivers/dahdi/wcte12xp/base.c | 2 ++ 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/drivers/dahdi/voicebus/GpakCust.h b/drivers/dahdi/voicebus/GpakCust.h index 70704b0..549922e 100644 --- a/drivers/dahdi/voicebus/GpakCust.h +++ b/drivers/dahdi/voicebus/GpakCust.h @@ -161,11 +161,32 @@ static inline struct vpmadt032_cmd *vpmadt032_get_ready_cmd(struct vpmadt032 *vp return NULL; } cmd = list_entry(vpm->pending_cmds.next, struct vpmadt032_cmd, node); - list_move_tail(&cmd->node, &vpm->active_cmds); + if (cmd->desc & __VPM150M_WR) + list_move_tail(&cmd->node, &vpm->active_cmds); + else + list_del_init(&cmd->node); spin_unlock_irqrestore(&vpm->list_lock, flags); return cmd; } +static inline void vpmadt032_resend(struct vpmadt032 *vpm) +{ + unsigned long flags; + struct vpmadt032_cmd *cmd, *temp; + + BUG_ON(!vpm); + + /* By moving the commands back to the pending list, they will be + * transmitted when room is available */ + spin_lock_irqsave(&vpm->list_lock, flags); + list_for_each_entry_safe(cmd, temp, &vpm->active_cmds, node) { + cmd->desc &= ~(__VPM150M_TX); + list_move_tail(&cmd->node, &vpm->pending_cmds); + } + spin_unlock_irqrestore(&vpm->list_lock, flags); +} + + int vpmadt032_module_init(void); typedef __u16 DSP_WORD; /* 16 bit DSP word */ diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index 2d040f6..59ec4be 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -1088,26 +1088,6 @@ static inline void wctdm_vpm_out(struct wctdm *wc, int unit, const unsigned int wctdm_setreg(wc, unit + NUM_MODULES, addr, val); } -/* TODO: this should go in the dahdi_voicebus module... */ -static inline void cmd_vpmadt032_retransmit(struct wctdm *wc) -{ - unsigned long flags; - struct vpmadt032 *vpmadt032 = wc->vpmadt032; - struct vpmadt032_cmd *cmd, *temp; - - BUG_ON(!vpmadt032); - - /* By moving the commands back to the pending list, they will be - * transmitted when room is available */ - spin_lock_irqsave(&vpmadt032->list_lock, flags); - list_for_each_entry_safe(cmd, temp, &vpmadt032->active_cmds, node) { - cmd->desc &= ~(__VPM150M_TX); - list_move_tail(&cmd->node, &vpmadt032->pending_cmds); - } - spin_unlock_irqrestore(&vpmadt032->list_lock, flags); - -} - static inline void cmd_retransmit(struct wctdm *wc) { int x,y; @@ -1125,7 +1105,7 @@ static inline void cmd_retransmit(struct wctdm *wc) spin_unlock_irqrestore(&wc->reglock, flags); #ifdef VPM_SUPPORT if (wc->vpmadt032) - cmd_vpmadt032_retransmit(wc); + vpmadt032_resend(wc->vpmadt032); #endif } diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index b63c6dc..294a0f8 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -150,6 +150,8 @@ static void resend_cmds(struct t1 *wc) spin_lock_irqsave(&wc->cmd_list_lock, flags); list_splice_init(&wc->active_cmds, &wc->pending_cmds); spin_unlock_irqrestore(&wc->cmd_list_lock, flags); + if (wc->vpmadt032) + vpmadt032_resend(wc->vpmadt032); } static void cmd_dequeue(struct t1 *wc, unsigned char *writechunk, int eframe, int slot) -- cgit v1.2.3