summaryrefslogtreecommitdiff
path: root/drivers/dahdi/wcb4xxp
diff options
context:
space:
mode:
authorMatthew Fredrickson <creslin@digium.com>2009-11-23 19:41:42 +0000
committerMatthew Fredrickson <creslin@digium.com>2009-11-23 19:41:42 +0000
commitf0b51ddf4d6c3cafcb39b414be115c3cc7e03583 (patch)
tree1c9044dd7d47493006f4894b15756ff54f1974f0 /drivers/dahdi/wcb4xxp
parent2c9a9fe5cea0be98b651d898bc683c43ad3f6745 (diff)
Commit fix for problem frames being received for WCB4XXP_HDLC_BUF_LEN multiple sized frames.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@7640 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/wcb4xxp')
-rw-r--r--drivers/dahdi/wcb4xxp/base.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/dahdi/wcb4xxp/base.c b/drivers/dahdi/wcb4xxp/base.c
index b6d1c8c..d7484a7 100644
--- a/drivers/dahdi/wcb4xxp/base.c
+++ b/drivers/dahdi/wcb4xxp/base.c
@@ -1617,6 +1617,7 @@ static int hdlc_rx_frame(struct b4xxp_span *bspan)
char debugbuf[256];
unsigned long irq_flags;
struct b4xxp *b4 = bspan->parent;
+ unsigned char stat;
fifo = bspan->fifos[2];
@@ -1644,10 +1645,14 @@ static int hdlc_rx_frame(struct b4xxp_span *bspan)
zleft = zlen + 1; /* include STAT byte that the HFC injects after FCS */
do {
- if (zleft > WCB4XXP_HDLC_BUF_LEN)
+ int truncated;
+ if (zleft > WCB4XXP_HDLC_BUF_LEN) {
+ truncated = 1;
j = WCB4XXP_HDLC_BUF_LEN;
- else
+ } else {
+ truncated = 0;
j = zleft;
+ }
spin_lock_irqsave(&b4->fifolock, irq_flags);
hfc_setreg_waitbusy(b4, R_FIFO, (fifo << V_FIFO_NUM_SHIFT) | V_FIFO_DIR);
@@ -1656,8 +1661,8 @@ static int hdlc_rx_frame(struct b4xxp_span *bspan)
spin_unlock_irqrestore(&b4->fifolock, irq_flags);
/* don't send STAT byte to DAHDI */
- if (bspan->sigchan)
- dahdi_hdlc_putbuf(bspan->sigchan, buf, (j == WCB4XXP_HDLC_BUF_LEN) ? j : j - 1);
+ if ((bspan->sigchan) && (j > 1))
+ dahdi_hdlc_putbuf(bspan->sigchan, buf, truncated ? j : j - 1);
zleft -= j;
if (DBG_HDLC && DBG_SPANFILTER) {
@@ -1666,6 +1671,7 @@ static int hdlc_rx_frame(struct b4xxp_span *bspan)
for (i=0; i < j; i++) printk("%02x%c", buf[i], (i < ( j - 1)) ? ' ':'\n');
}
} while (zleft > 0);
+ stat = buf[j - 1];
/* Frame received, increment F2 and get an updated count of frames left */
spin_lock_irqsave(&b4->fifolock, irq_flags);
@@ -1684,7 +1690,6 @@ static int hdlc_rx_frame(struct b4xxp_span *bspan)
dev_notice(b4->dev, "odd, zlen less then 3?\n");
dahdi_hdlc_abort(bspan->sigchan, DAHDI_EVENT_ABORT);
} else {
- unsigned char stat = buf[i - 1];
/* if STAT != 0, indicates bad frame */
if (stat != 0x00) {