[dahdi-commits] rmeyerriecks: linux/trunk r7927 - /linux/trunk/drivers/dahdi/wct4xxp/

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Mon Jan 18 15:00:30 CST 2010


Author: rmeyerriecks
Date: Mon Jan 18 15:00:20 2010
New Revision: 7927

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7927
Log:
wct4xxp: Add some protection to prevent latency bumps during load time only
events such as firmware load

Modified:
    linux/trunk/drivers/dahdi/wct4xxp/base.c
    linux/trunk/drivers/dahdi/wct4xxp/wct4xxp.h

Modified: linux/trunk/drivers/dahdi/wct4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct4xxp/base.c?view=diff&rev=7927&r1=7926&r2=7927
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Mon Jan 18 15:00:20 2010
@@ -193,9 +193,9 @@
 /* For 56kbps links, set this module parameter to 0x7f */
 static int hardhdlcmode = 0xff;
 
-static int latency = 15;
-
-static int ms_per_irq = 5;
+static int latency = 1;
+
+static int ms_per_irq = 1;
 
 #ifdef FANCY_ALARM
 static int altab[] = {
@@ -1543,6 +1543,7 @@
 	/* If we're already running, then go ahead and apply the changes */
 	if (span->flags & DAHDI_FLAG_RUNNING)
 		return t4_startup(span);
+
 	printk(KERN_INFO "Done with spanconfig!\n");
 	return 0;
 }
@@ -2174,6 +2175,7 @@
 	struct t4_span *ts = span->pvt;
 	struct t4 *wc = ts->owner;
 
+	set_bit(T4_IGNORE_LATENCY, &wc->checkflag);
 	printk(KERN_INFO "About to enter startup!\n");
 	tspan = span->offset + 1;
 	if (tspan < 0) {
@@ -2268,6 +2270,7 @@
 	}
 #endif
 	printk(KERN_INFO "Completed startup!\n");
+	clear_bit(T4_IGNORE_LATENCY, &wc->checkflag);
 	return 0;
 }
 
@@ -3258,10 +3261,13 @@
 		rxident = (status >> 16) & 0x7f;
 		expected = (wc->rxident + ms_per_irq) % 128;
 	
-		if (rxident != expected) {
+		if ((rxident != expected) && !test_bit(T4_IGNORE_LATENCY, &wc->checkflag)) {
 			int needed_latency;
 
 			printk("!!! Missed interrupt.  Expected ident of %d and got ident of %d\n", expected, rxident);
+			if (test_bit(T4_IGNORE_LATENCY, &wc->checkflag)) {
+				printk("Should have ignored latency\n");
+			}
 			if (rxident > wc->rxident) {
 				needed_latency = rxident - wc->rxident;
 			} else {
@@ -3313,25 +3319,23 @@
 		}
 #else
 #if 1
-		//unsigned int reg12 = __t4_pci_in(wc, 12);
 		unsigned int reg5 = __t4_pci_in(wc, 5);
 
-		unsigned int readoff, writeoff;
-
-		//readoff = ((reg12 >> 16) << 1) & 0xffff;
-		//writeoff = (reg12 & 0xffff) << 1;
 		if (wc->intcount < 20) {
 			printk("Reg 5 is %08x\n", reg5);
-			//printk("Read @ %p and write @ %p\n", wc->readchunk + (readoff>>2), wc->writechunk + (writeoff >> 2));
 		}
 #endif
 
 		if (wc->flags & FLAG_5THGEN) {
 			unsigned int current_index = (reg5 >> 8) & 0x7f;
+#if 0
 			int catchup = 0;
+#endif
 
 			while (((wc->lastindex + 1) % wc->numbufs) != current_index) {
+#if 0
 				catchup++;
+#endif
 				wc->lastindex = (wc->lastindex + 1) % wc->numbufs;
 				setup_chunks(wc, wc->lastindex);
 				t4_prep_gen2(wc);
@@ -3941,10 +3945,6 @@
 	struct devtype *dt;
 	unsigned int x, f;
 	int init_latency;
-#if 0
-	int y;
-	unsigned int *canary;
-#endif
 	
 	if (pci_enable_device(pdev)) {
 		return -EIO;
@@ -3958,21 +3958,6 @@
 	spin_lock_init(&wc->reglock);
 	dt = (struct devtype *) (ent->driver_data);
 
-	/* FIXME */
-	dt->flags |= FLAG_5THGEN;
-	
-	if (dt->flags & FLAG_5THGEN) {
-		if ((ms_per_irq > 1) && (latency <= ((ms_per_irq) << 1)))
-			init_latency = ms_per_irq << 1;
-		else
-			init_latency = latency;
-	} else {
-		if (dt->flags & FLAG_2NDGEN)
-			init_latency = 1;
-		else
-			init_latency = 2;
-	}
-	
 	if (dt->flags & FLAG_2PORT) 
 		wc->numspans = 2;
 	else
@@ -3997,23 +3982,36 @@
 	
 	wc->dev = pdev;
 	
+	/* Enable bus mastering */
+	pci_set_master(pdev);
+
+	/* Keep track of which device we are */
+	pci_set_drvdata(pdev, wc);
+	
+	/* FIXME */
+	dt->flags |= FLAG_5THGEN;
+	
+	if (t4_pci_in(wc, WC_VERSION) >= 0xc01a016d) {
+		wc->flags |= FLAG_5THGEN;
+	}
+
+	if (dt->flags & FLAG_5THGEN) {
+		if ((ms_per_irq > 1) && (latency <= ((ms_per_irq) << 1))) {
+			init_latency = ms_per_irq << 1;
+		} else
+			init_latency = latency;
+		printk(KERN_INFO "5th gen card with initial latency of %d and %d ms per IRQ\n", init_latency, ms_per_irq);
+	} else {
+		if (dt->flags & FLAG_2NDGEN)
+			init_latency = 1;
+		else
+			init_latency = 2;
+	}
+	
 	if (t4_allocate_buffers(wc, init_latency, NULL, NULL)) {
 		return -ENOMEM;
 	}
 
-#if 0
-	memset((void *)wc->readchunk,0xff,DAHDI_MAX_CHUNKSIZE * 2 * 32 * 4);
-	/* Initialize canary */
-	canary = (unsigned int *)(wc->readchunk + DAHDI_CHUNKSIZE * 64 * 4 - 4);
-	*canary = (CANARY << 16) | (0xffff);
-#endif			
-	
-	/* Enable bus mastering */
-	pci_set_master(pdev);
-
-	/* Keep track of which device we are */
-	pci_set_drvdata(pdev, wc);
-	
 	/* Initialize hardware */
 	t4_hardware_init_1(wc, dt->flags);
 	

Modified: linux/trunk/drivers/dahdi/wct4xxp/wct4xxp.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct4xxp/wct4xxp.h?view=diff&rev=7927&r1=7926&r2=7927
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/wct4xxp.h (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/wct4xxp.h Mon Jan 18 15:00:20 2010
@@ -109,6 +109,7 @@
 #define T4_STOP_DMA		2
 #define T4_CHECK_TIMING		3
 #define T4_CHANGE_LATENCY	4
+#define T4_IGNORE_LATENCY	5
 
 #define WCT4_GET_REGS	_IOW (DAHDI_CODE, 60, struct t4_regs)
 




More information about the dahdi-commits mailing list