[svn-commits] mattf: linux/trunk r7638 - /linux/trunk/drivers/dahdi/wcb4xxp/base.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Nov 23 13:38:30 CST 2009


Author: mattf
Date: Mon Nov 23 13:38:29 2009
New Revision: 7638

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7638
Log:
Commit fix for problem frames being received for WCB4XXP_HDLC_BUF_LEN multiple sized frames.

Modified:
    linux/trunk/drivers/dahdi/wcb4xxp/base.c

Modified: linux/trunk/drivers/dahdi/wcb4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wcb4xxp/base.c?view=diff&rev=7638&r1=7637&r2=7638
==============================================================================
--- linux/trunk/drivers/dahdi/wcb4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcb4xxp/base.c Mon Nov 23 13:38:29 2009
@@ -1617,6 +1617,7 @@
 	char debugbuf[256];
 	unsigned long irq_flags;
 	struct b4xxp *b4 = bspan->parent;
+	unsigned char stat;
 
 	fifo = bspan->fifos[2];
 
@@ -1644,10 +1645,14 @@
 	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 @@
 		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 @@
 			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 @@
 			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) {




More information about the svn-commits mailing list