[svn-commits] sruffell: linux/trunk r8010 - /linux/trunk/drivers/dahdi/voicebus/voicebus.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Feb 8 17:22:27 CST 2010


Author: sruffell
Date: Mon Feb  8 17:22:25 2010
New Revision: 8010

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8010
Log:
voicebus: Reset own bits when a soft underrun is detected.

If a combination of softunderun results in descriptors that aren't owned being
skipped in the vb_recover_tx_descriptor_list, it's possible for processing to
stop on a descriptor that isn't owned.

Modified:
    linux/trunk/drivers/dahdi/voicebus/voicebus.c

Modified: linux/trunk/drivers/dahdi/voicebus/voicebus.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/voicebus.c?view=diff&rev=8010&r1=8009&r2=8010
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/voicebus.c (original)
+++ linux/trunk/drivers/dahdi/voicebus/voicebus.c Mon Feb  8 17:22:25 2010
@@ -1131,6 +1131,27 @@
 static inline void vb_set_all_tx_owned(struct voicebus *vb)
 {
 	vb_set_all_owned(vb, &vb->txd);
+}
+
+/**
+ * vb_reset_tx_owned() - Reset the OWN bits on descriptors from tail to head.
+ *
+ * When there is a softunderun, this function will cleanup what should be the
+ * idle buffers that we do not expect to be in progress.
+ *
+ */
+static void vb_reset_tx_owned(struct voicebus *vb)
+{
+	struct voicebus_descriptor_list *dl = &vb->txd;
+	struct voicebus_descriptor *d;
+	unsigned int tail = dl->tail;
+
+	while (tail != dl->head) {
+		d = vb_descriptor(dl, tail);
+		SET_OWNED(d);
+		++tail;
+		tail &= DRING_MASK;
+	}
 }
 
 /**
@@ -1336,16 +1357,21 @@
 	 * descriptor ring. Otherwise it's possible to take so much time
 	 * printing the dmesg output that we lose the lead that we got on the
 	 * hardware, resulting in a hard underrun condition. */
-	if (unlikely(softunderrun &&
-	    !test_bit(LATENCY_LOCKED, &vb->flags) && printk_ratelimit())) {
-		if (vb->max_latency != vb->min_tx_buffer_count) {
-			dev_info(&vb->pdev->dev, "Missed interrupt. "
-				 "Increasing latency to %d ms in order to "
-				 "compensate.\n", vb->min_tx_buffer_count);
-		} else {
-			dev_info(&vb->pdev->dev, "ERROR: Unable to service "
-				 "card within %d ms and unable to further "
-				 "increase latency.\n", vb->max_latency);
+	if (unlikely(softunderrun)) {
+		vb_reset_tx_owned(vb);
+		if (!test_bit(LATENCY_LOCKED, &vb->flags) &&
+		    printk_ratelimit()) {
+			if (vb->max_latency != vb->min_tx_buffer_count) {
+				dev_info(&vb->pdev->dev, "Missed interrupt. "
+					 "Increasing latency to %d ms in "
+					 "order to compensate.\n",
+					 vb->min_tx_buffer_count);
+			} else {
+				dev_info(&vb->pdev->dev, "ERROR: Unable to "
+					 "service card within %d ms and "
+					 "unable to further increase "
+					 "latency.\n", vb->max_latency);
+			}
 		}
 	}
 




More information about the svn-commits mailing list