[dahdi-commits] sruffell: branch linux/sruffell/dahdi-linux-chainedvb r7327 - /linux/team/sru...

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Fri Oct 2 16:42:39 CDT 2009


Author: sruffell
Date: Fri Oct  2 16:42:29 2009
New Revision: 7327

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7327
Log:
wip: allow the count of how far we're behind to be passed to increase latency

Modified:
    linux/team/sruffell/dahdi-linux-chainedvb/drivers/dahdi/voicebus/voicebus.c

Modified: linux/team/sruffell/dahdi-linux-chainedvb/drivers/dahdi/voicebus/voicebus.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/dahdi-linux-chainedvb/drivers/dahdi/voicebus/voicebus.c?view=diff&rev=7327&r1=7326&r2=7327
==============================================================================
--- linux/team/sruffell/dahdi-linux-chainedvb/drivers/dahdi/voicebus/voicebus.c (original)
+++ linux/team/sruffell/dahdi-linux-chainedvb/drivers/dahdi/voicebus/voicebus.c Fri Oct  2 16:42:29 2009
@@ -229,6 +229,8 @@
 	unsigned int 	min_tx_buffer_count;
 };
 
+DEFINE_RATELIMIT_STATE(voicebus_ratelimit_state, HZ, 100);
+
 /*
  * Use the following macros to lock the VoiceBus interface, and it won't
  * matter if the deferred processing is running inside the interrupt handler,
@@ -813,7 +815,7 @@
 	 * softunderrun condition that wasn't handled.
 	 */
 	if (unlikely(!OWNED(d->desc))) {
-		if (printk_ratelimit())
+		if (__ratelimit(&voicebus_ratelimit_state))
 			dev_err(&vb->pdev->dev, "tx descriptor overrun.\n");
 		voicebus_free(vb, vbb);
 		return -EFAULT;
@@ -926,19 +928,22 @@
 }
 
 /**
- * vb_recover_tx_descriptor_list() -
- *
+ * vb_recover_tx_descriptor_list() - Recovers descriptor list
+ * 
+ * Returns the number of descriptors that we're behind.
+ * 
  * Called if the head pointer points to one of the idle buffers.  This means
  * that the host computer has failed to keep far enough ahead of the voicebus
  * card.  This function acks the completed idle descriptors and gets everything
  * setup for normal operation again.
  *
  */
-static void vb_recover_tx_descriptor_list(struct voicebus *vb)
+static int vb_recover_tx_descriptor_list(struct voicebus *vb)
 {
 	struct voicebus_descriptor_list *const dl = &vb->txd;
 	struct voicebus_chained_descriptor *next;
-	int count = 1;
+	int x = 1;
+	int behind = 0;
 
 	/* next = get_next_descriptor(dl, dl->head); */
 	next = dl->head;
@@ -948,13 +953,11 @@
 		next->pending = vb->idle_vbb;
 		SET_OWNED(next->desc);
 		next = get_next_descriptor(dl, next);
-		++count;
-	}
-
-	dev_info(&vb->pdev->dev, "Behind by %d descriptors.\n", count);
-
-	count = 3;
-	while (--count) {
+		++behind;
+	}
+
+	x = 3;
+	while (--x) {
 		next = get_next_descriptor(dl, next);
 		SET_OWNED(next->desc); /* !!! this shouldn't be necessary */
 	}
@@ -963,6 +966,7 @@
 	vb->txd.head = next;
 
 	WARN_ON(!OWNED(get_prev_descriptor(&vb->txd, next)->desc));
+	return behind;
 }
 
 static void* vb_get_completed_rxb(struct voicebus *vb)
@@ -1357,10 +1361,8 @@
 	if (buffer_count > 2)
 		dev_info(dev, "Stashed %d buffers\n", buffer_count);
 
-	if (unlikely(vb_check_softunderrun(vb))) {
-		vb_recover_tx_descriptor_list(vb);
-		__vb_increase_latency(vb, 1);
-	}
+	if (unlikely(vb_check_softunderrun(vb)))
+		__vb_increase_latency(vb, vb_recover_tx_descriptor_list(vb));
 
 	for (i = 0; i < buffer_count; ++i) {
 		/* After the upper layer is done with the completed buffer, it




More information about the dahdi-commits mailing list