[svn-commits] sruffell: branch linux/sruffell/dahdi-linux-cmdqueue r6033 - /linux/team/sruf...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Feb 24 14:13:27 CST 2009


Author: sruffell
Date: Tue Feb 24 14:13:27 2009
New Revision: 6033

URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6033
Log:
Shorten the reglock hold time in the interrupt handler.

Modified:
    linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c
    linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/vpmadt032.c
    linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h

Modified: linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c?view=diff&rev=6033&r1=6032&r2=6033
==============================================================================
--- linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c Tue Feb 24 14:13:27 2009
@@ -1292,9 +1292,7 @@
 
 	/* Calculate Transmission */
 	if (likely(atomic_read(&wc->initialized))) {
-		spin_unlock(&wc->reglock);
 		dahdi_transmit(&wc->span);
-		spin_lock(&wc->reglock);
 	}
 
 	for (x = 0; x < DAHDI_CHUNKSIZE; x++) {
@@ -1309,7 +1307,9 @@
 		}
 #ifdef VPM_SUPPORT
 		if(likely(wc->vpm150m)) {
+			spin_lock(&wc->reglock);
 			vpm150m_cmd_dequeue(wc, writechunk, x);
+			spin_unlock(&wc->reglock);
 		}
 #endif
 
@@ -1345,22 +1345,23 @@
 		}
 		cmd_decipher(wc, readchunk);
 #ifdef VPM_SUPPORT
-		if(wc->vpm150m)
+		if(wc->vpm150m) {
+			spin_lock(&wc->reglock);
 			vpm150m_cmd_decipher(wc, readchunk);
+			spin_unlock(&wc->reglock);
+		}
 #endif
 		readchunk += (EFRAME_SIZE + EFRAME_GAP);
 	}
 	
 	/* echo cancel */
 	if (likely(atomic_read(&wc->initialized))) {
-		spin_unlock(&wc->reglock);
 		for (x = 0; x < wc->span.channels; x++) {
 			dahdi_ec_chunk(wc->chans[x], wc->chans[x]->readchunk, wc->ec_chunk2[x]);
 			memcpy(wc->ec_chunk2[x],wc->ec_chunk1[x],DAHDI_CHUNKSIZE);
 			memcpy(wc->ec_chunk1[x],wc->chans[x]->writechunk,DAHDI_CHUNKSIZE);
 		}
 		dahdi_receive(&wc->span);
-		spin_lock(&wc->reglock);
 	}
 }
 
@@ -1373,11 +1374,8 @@
 	 * safe to grab it without locking interrupt.
 	 */
 	memset(vbb, 0, SFRAME_SIZE);
-	spin_lock(&wc->reglock);
-	wc->txints++;
+	atomic_inc(&wc->txints);
 	t1_transmitprep(wc, vbb);
-	wc->intcount++;
-	spin_unlock(&wc->reglock);
 	voicebus_transmit(wc->vb, vbb);
 }
 
@@ -1385,14 +1383,11 @@
 t1_handle_receive(void* vbb, void* context)
 {
 	struct t1* wc = context;
-	wc->rxints++;
 	/* Either this function is called from within interrupt context, or
 	 * the reglock will never be acquired from interrupt context, so it's
 	 * safe to grab it without locking interrupt.
 	 */
-	spin_lock(&wc->reglock);
 	t1_receiveprep(wc, vbb);
-	spin_unlock(&wc->reglock);
 }
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
@@ -1557,9 +1552,6 @@
 	voicebus_release(wc->vb);
 	wc->vb = NULL;
 
-	if (debug && atomic_read(&wc->isrreaderrors))
-		debug_printk(1, "isrreaderrors=%d\n", atomic_read(&wc->isrreaderrors));
-
 #ifdef VPM_SUPPORT
 	if(vpm150m) {
 		spin_lock_irqsave(&wc->reglock, flags);

Modified: linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/vpmadt032.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/vpmadt032.c?view=diff&rev=6033&r1=6032&r2=6033
==============================================================================
--- linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/vpmadt032.c (original)
+++ linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/vpmadt032.c Tue Feb 24 14:13:27 2009
@@ -53,7 +53,7 @@
 	struct vpm150m_cmd *curcmd = NULL;
 	struct vpm150m *vpm150m = wc->vpm150m;
 	int x;
-	unsigned char leds = ~((wc->intcount / 1000) % 8) & 0x7;
+	unsigned char leds = ~((atomic_read(&wc->txints) / 1000) % 8) & 0x7;
 
 	/* Skip audio */
 	writechunk += 66;
@@ -225,7 +225,7 @@
 
 	/* Now let's figure out if we need to check for DTMF */
 	/* polling */
-	if (test_bit(VPM150M_ACTIVE, &vpm150m->control) && !whichframe && !(wc->intcount % 100))
+	if (test_bit(VPM150M_ACTIVE, &vpm150m->control) && !whichframe && !(atomic_read(&wc->txints) % 100))
 		queue_work(vpm150m->wq, &vpm150m->work_dtmf);
 
 #if 0
@@ -511,7 +511,7 @@
 
 		if (we->params.tap_length) {
 			/* configure channel for the ulaw/alaw */
-			unsigned int start = wc->intcount;
+			unsigned int start = atomic_read(&wc->txints);
 
 			if (memcmp(&we->params, &vpm150m->chan_params[chan->chanpos - 1], sizeof(we->params))) {
 				/* set parameters */
@@ -534,9 +534,9 @@
 			}
 
 			res = gpakAlgControl(vpm150m->dspid, chan->chanpos - 1, EnableEcanA, &pstatus);
-			debug_printk(2, "Echo can enable took %d ms\n", wc->intcount - start);
+			debug_printk(2, "Echo can enable took %d ms\n", atomic_read(&wc->txints) - start);
 		} else {
-			unsigned int start = wc->intcount;
+			unsigned int start = atomic_read(&wc->txints);
 			debug_printk(1, "Disabling EC on channel %d\n", chan->chanpos);
 			res = gpakAlgControl(vpm150m->dspid, chan->chanpos - 1, BypassSwCompanding, &pstatus);
 			if (res)
@@ -544,7 +544,7 @@
 			res = gpakAlgControl(vpm150m->dspid, chan->chanpos - 1, BypassEcanA, &pstatus);
 			if (res)
 				module_printk("Unable to disable echo can on channel %d (reason %d)\n", chan->chanpos, res);
-			debug_printk(2, "Echocan disable took %d ms\n", wc->intcount - start);
+			debug_printk(2, "Echocan disable took %d ms\n", atomic_read(&wc->txints) - start);
 		}
 		if (res) {
 			module_printk("Unable to toggle echo cancellation on channel %d (reason %d)\n", chan->chanpos, res);
@@ -605,16 +605,16 @@
 			}
 		}
 		if (enable > -1) {
-			unsigned int start = wc->intcount;
+			unsigned int start = atomic_read(&wc->txints); 
 			GPAK_AlgControlStat_t pstatus;
 			int res;
 
 			if (enable) {
 				res = gpakAlgControl(vpm150m->dspid, i, EnableDTMFMuteA, &pstatus);
-				debug_printk(2, "DTMF mute enable took %d ms\n", wc->intcount - start);
+				debug_printk(2, "DTMF mute enable took %d ms\n", atomic_read(&wc->txints) - start);
 			} else {
 				res = gpakAlgControl(vpm150m->dspid, i, DisableDTMFMuteA, &pstatus);
-				debug_printk(2, "DTMF mute disable took %d ms\n", wc->intcount - start);
+				debug_printk(2, "DTMF mute disable took %d ms\n", atomic_read(&wc->txints) - start);
 			}
 			if (!res)
 				change_bit(i, &vpm150m->curdtmfmutestate);
@@ -626,11 +626,11 @@
 		GpakAsyncEventCode_t eventcode;
 		GpakAsyncEventData_t eventdata;
 		gpakReadEventFIFOMessageStat_t  res;
-		unsigned int start = wc->intcount;
+		unsigned int start = atomic_read(&wc->txints);
 
 		do {
 			res = gpakReadEventFIFOMessage(vpm150m->dspid, &channel, &eventcode, &eventdata);
-			debug_printk(3, "ReadEventFIFOMessage took %d ms\n", wc->intcount - start);
+			debug_printk(3, "ReadEventFIFOMessage took %d ms\n", atomic_read(&wc->txints) - start);
 
 			if (res == RefInvalidEvent || res == RefDspCommFailure) {
 				module_printk("Uh oh (%d)\n", res);

Modified: linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h?view=diff&rev=6033&r1=6032&r2=6033
==============================================================================
--- linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h (original)
+++ linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h Tue Feb 24 14:13:27 2009
@@ -122,7 +122,6 @@
 	int alarmdebounce;
 	char *variety;
 	char name[80];
-	unsigned int intcount;
 	int sync;
 	int dead;
 	unsigned long blinktimer;
@@ -141,11 +140,9 @@
 	struct dahdi_chan *chans[32];					/* Channels */
 	struct command dummy;	/* preallocate for dummy noop command */
 	unsigned char ctlreg;
-	unsigned int rxints;
-	unsigned int txints;
 	int usecount;
 	struct voicebus* vb;
-	atomic_t isrreaderrors;
+	atomic_t txints;
 #ifdef VPM_SUPPORT
 	int vpm;
 	struct vpm150m *vpm150m;




More information about the svn-commits mailing list