summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-03-01 08:14:22 +0000
committerShaun Ruffell <sruffell@digium.com>2010-03-01 08:14:22 +0000
commit7eb1d995c2442284e4d6bda3abb3a4381af35d60 (patch)
tree55a8bc79d545dd6a2b5db5561bcd8ba4451d1025
parent79403d0c8eb2f24bdaeb96f4c5bb2e867f7f178d (diff)
wcte12xp: Increase a few timeouts, and cleanup on timeout.
Also, check for good frames as the wctdm24xxp driver does now. git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8178 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/wcte12xp/base.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c
index 09978b1..27a44cf 100644
--- a/drivers/dahdi/wcte12xp/base.c
+++ b/drivers/dahdi/wcte12xp/base.c
@@ -575,8 +575,11 @@ static int t1_getreg(struct t1 *wc, int addr)
cmd->data = 0x00;
cmd->flags = __CMD_RD;
submit_cmd(wc, cmd);
- ret = wait_for_completion_timeout(&cmd->complete, HZ/5);
+ ret = wait_for_completion_timeout(&cmd->complete, HZ*2);
if (unlikely(!ret)) {
+ spin_lock_bh(&wc->cmd_list_lock);
+ list_del(&cmd->node);
+ spin_unlock_bh(&wc->cmd_list_lock);
if (printk_ratelimit()) {
dev_warn(&wc->vb.pdev->dev,
"Timeout in %s\n", __func__);
@@ -615,8 +618,11 @@ static inline int t1_getpins(struct t1 *wc, int inisr)
cmd->data = 0x00;
cmd->flags = __CMD_PINS;
submit_cmd(wc, cmd);
- ret = wait_for_completion_timeout(&cmd->complete, HZ/5);
+ ret = wait_for_completion_timeout(&cmd->complete, HZ*2);
if (unlikely(!ret)) {
+ spin_lock_bh(&wc->cmd_list_lock);
+ list_del(&cmd->node);
+ spin_unlock_bh(&wc->cmd_list_lock);
if (printk_ratelimit()) {
dev_warn(&wc->vb.pdev->dev,
"Timeout in %s\n", __func__);
@@ -1697,11 +1703,25 @@ static inline void t1_transmitprep(struct t1 *wc, u8 *writechunk)
}
}
+/**
+ * is_good_frame() - Whether the SFRAME received was one sent.
+ *
+ */
+static inline bool is_good_frame(const u8 *sframe)
+{
+ const u8 a = sframe[0*(EFRAME_SIZE+EFRAME_GAP) + (EFRAME_SIZE+1)];
+ const u8 b = sframe[1*(EFRAME_SIZE+EFRAME_GAP) + (EFRAME_SIZE+1)];
+ return a != b;
+}
+
static inline void t1_receiveprep(struct t1 *wc, const u8* readchunk)
{
int x,chan;
unsigned char expected;
+ if (!is_good_frame(readchunk))
+ return;
+
for (x = 0; x < DAHDI_CHUNKSIZE; x++) {
if (likely(test_bit(INITIALIZED, &wc->bit_flags))) {
for (chan = 0; chan < wc->span.channels; chan++) {