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

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 23 18:48:57 CDT 2009


Author: sruffell
Date: Mon Mar 23 18:48:54 2009
New Revision: 6224

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6224
Log:
Do not handle duplicate reponses.

It is possible for system activity to prevent the wctc4xxp driver from
responding the the firmware on the TC400M for a period of time.  If this occurs,
the TC400M will resend a response to a command that we sent.  This duplicate
reponse will then sometimes confuse the driver.  Normally this would manifest
as an attempt to connect the same channel together in a transcoding session.

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

Modified: linux/trunk/drivers/dahdi/wctc4xxp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/trunk/drivers/dahdi/wctc4xxp/base.c?view=diff&rev=6224&r1=6223&r2=6224
==============================================================================
--- linux/trunk/drivers/dahdi/wctc4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctc4xxp/base.c Mon Mar 23 18:48:54 2009
@@ -410,6 +410,7 @@
 	struct list_head rx_list;
 
 	unsigned int seq_num;
+	int last_rx_seq_num;
 	unsigned char numchannels;
 	unsigned char complexname[40];
 
@@ -2111,8 +2112,17 @@
 	const struct csm_encaps_hdr *listhdr, *rxhdr;
 	struct tcb *pos, *temp;
 	unsigned long flags;
-
+	u32 handled = 0;
 	rxhdr = cmd->data;
+	if (0xffff == rxhdr->channel) {
+		/* We received a duplicate response. */
+		if (rxhdr->seq_num == wc->last_rx_seq_num) {
+			free_cmd(cmd);
+			return;
+		}
+		wc->last_rx_seq_num = rxhdr->seq_num;
+	}
+
 	spin_lock_bh(&wc->cmd_list_lock);
 	list_for_each_entry_safe(pos, temp,
 		&wc->waiting_for_response_list, node) {
@@ -2130,11 +2140,17 @@
 				complete(&pos->complete);
 			} 
 			spin_unlock_irqrestore(&pos->lock, flags);
+			handled = 1;
 
 			break;
 		}
 	}
 	spin_unlock_bh(&wc->cmd_list_lock);
+
+	if (!handled) {
+		printk(KERN_INFO "Freeing unhandled response\n");
+		free_cmd(cmd);
+	}
 }
 
 static void
@@ -3277,10 +3293,9 @@
 	 * Setup the pure software constructs internal to this driver.
 	 * --------------------------------------------------------------- */
 
-	wc = kmalloc(sizeof(*wc), GFP_KERNEL);
+	wc = kzalloc(sizeof(*wc), GFP_KERNEL);
 	if (!wc)
 		return -ENOMEM;
-	memset(wc, 0, sizeof(*wc));
 
 	position_on_list = wctc4xxp_add_to_device_list(wc);
 	snprintf(wc->board_name, sizeof(wc->board_name)-1, "%s%d",
@@ -3289,6 +3304,7 @@
 	wc->pdev             = pdev;
 	wc->pos              = position_on_list;
 	wc->variety          = d->long_name;
+	wc->last_rx_seq_num  = -1;
 
 	init_MUTEX(&wc->chansem);
 	spin_lock_init(&wc->reglock);




More information about the svn-commits mailing list