[svn-commits] sruffell: linux/trunk r5060 - /linux/trunk/drivers/dahdi/wctc4xxp/base.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Oct 6 12:48:08 CDT 2008


Author: sruffell
Date: Mon Oct  6 12:48:07 2008
New Revision: 5060

URL: http://svn.digium.com/view/dahdi?view=rev&rev=5060
Log:
Embed room for the complete packet to the DTE in the transcoder buffer
structure.  Simplifies alignment management at the cost of a little wasted
memory, but the end results is that operation is more reliable on more
systems.

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

Modified: linux/trunk/drivers/dahdi/wctc4xxp/base.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/wctc4xxp/base.c?view=diff&rev=5060&r1=5059&r2=5060
==============================================================================
--- linux/trunk/drivers/dahdi/wctc4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctc4xxp/base.c Mon Oct  6 12:48:07 2008
@@ -317,7 +317,8 @@
 	0x00,0x01, s&0x0F, 0x01, ((c&0xFF00)>>8),(c&0x00FF), 0x0A, 0x00, 0x00,0x02,0x5B,0x80, 0x00,0x00, \
 	0x00,0x00, 0x00,0x00 }
 
-#define SFRAME_SIZE 320 
+#define MAX_FRAME_SIZE 1518
+#define SFRAME_SIZE MAX_FRAME_SIZE 
 
 /* Transcoder buffer (tcb) */
 struct tcb {
@@ -1002,9 +1003,9 @@
 
 	WARN_ON(!c);
 	len = (c->data_len < MIN_PACKET_LEN) ? MIN_PACKET_LEN : c->data_len;
-	if (c->data_len > 1518) {
+	if (c->data_len > MAX_FRAME_SIZE) {
 		WARN_ON_ONCE(!"Invalid command length passed\n");
-		c->data_len = 1518;
+		c->data_len = MAX_FRAME_SIZE;
 	}
 
 	spin_lock_bh(&dr->lock);
@@ -1980,12 +1981,14 @@
 		if(!(newcmd = __alloc_cmd(ALLOC_FLAGS, 0))) {
 			DTE_PRINTK(ERR, "Out of memory in %s.\n", __FUNCTION__);
 		} else {
-			newcmd->data = kmalloc(1518, ALLOC_FLAGS);
-			if (!newcmd->data) {
-				DTE_PRINTK(ERR, "out of memory in %s " \
-				    "again.\n", __FUNCTION__);
+			if (newcmd->data_len < MAX_FRAME_SIZE) {
+				newcmd->data = kmalloc(MAX_FRAME_SIZE, ALLOC_FLAGS);
+				if (!newcmd->data) {
+					DTE_PRINTK(ERR, "out of memory in %s " \
+					    "again.\n", __FUNCTION__);
+				}
+				newcmd->data_len = MAX_FRAME_SIZE;
 			}
-			newcmd->data_len = 1518;
 			if (wctc4xxp_submit(wc->rxd, newcmd)) {
 				DTE_PRINTK(ERR, "Failed submit in %s\n", __FUNCTION__);
 				free_cmd(newcmd);
@@ -2001,9 +2004,10 @@
 	 */
 	while((cmd = wctc4xxp_retrieve(wc->txd))) {
 		if (!(cmd->flags & (__WAIT_FOR_ACK | __WAIT_FOR_RESPONSE))) {
-			spin_lock_bh(&wc->cmd_list_lock);
-			list_del_init(&cmd->node);
-			spin_unlock_bh(&wc->cmd_list_lock);
+			/* If we're not waiting for an ACK or Response from
+			 * the DTE, this message should not be sitting on any
+			 * lists. */
+			WARN_ON(!list_empty(&cmd->node));
 			if (DO_NOT_AUTO_FREE & cmd->flags) {
 				complete(&cmd->complete);
 			} else {
@@ -2351,13 +2355,13 @@
 	if (!(cmd = alloc_cmd())) {
 		return -ENOMEM;
 	}	
-	if (1518 > cmd->data_len) {
-		cmd->data = kmalloc(1518, GFP_KERNEL);
+	if (MAX_FRAME_SIZE > cmd->data_len) {
+		cmd->data = kmalloc(MAX_FRAME_SIZE, GFP_KERNEL);
 		if (!(cmd->data)) {
 			free_cmd(cmd);
 			return -ENOMEM;
 		}
-		cmd->data_len = 1518;
+		cmd->data_len = MAX_FRAME_SIZE;
 	}
 	while (byteloc < (firmware->size-20)) {
 		last_byteloc = byteloc;
@@ -2829,7 +2833,8 @@
 					set_bit(DTE_SHUTDOWN, &wc->flags);
 					spin_unlock(&wc->cmd_list_lock);
 					wctc4xxp_stop_dma(wc);
-					DTE_PRINTK(ERR, "Board malfunctioning.  Halting operation.\n");
+					DTE_PRINTK(ERR, "Board malfunctioning.  " \
+					           "Halting operation.\n");
 					return;
 				}
 				/* ERROR:  We've retried the command and haven't




More information about the svn-commits mailing list