[dahdi-commits] sruffell: branch linux/sruffell/chan_list r9343 - /linux/team/sruffell/chan_l...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Fri Sep 17 14:11:51 CDT 2010
Author: sruffell
Date: Fri Sep 17 14:11:41 2010
New Revision: 9343
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9343
Log:
dahdi: Group all conditions for skipping channel receive together.
Streamlines the function a bit by grouping the three conditions that
would cause the channel receive to be completely skipped.
Modified:
linux/team/sruffell/chan_list/drivers/dahdi/dahdi-base.c
Modified: linux/team/sruffell/chan_list/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/chan_list/drivers/dahdi/dahdi-base.c?view=diff&rev=9343&r1=9342&r2=9343
==============================================================================
--- linux/team/sruffell/chan_list/drivers/dahdi/dahdi-base.c (original)
+++ linux/team/sruffell/chan_list/drivers/dahdi/dahdi-base.c Fri Sep 17 14:11:41 2010
@@ -1183,7 +1183,7 @@
/* Pull a DAHDI_CHUNKSIZE piece off the queue. Returns
0 on success or -1 on failure. If failed, provides
silence */
-static int __buf_pull(struct confq *q, u_char *data, struct dahdi_chan *c, char *label)
+static int __buf_pull(struct confq *q, u_char *data, struct dahdi_chan *c)
{
int oldoutbuf = q->outbuf;
/* Ain't nuffin to read */
@@ -1254,7 +1254,7 @@
#endif
/* Push something onto the queue, or assume what
is there is valid if data is NULL */
-static int __buf_push(struct confq *q, u_char *data, char *label)
+static int __buf_push(struct confq *q, u_char *data)
{
int oldinbuf = q->inbuf;
if (q->inbuf < 0) {
@@ -8362,7 +8362,7 @@
#endif
if (chan->confmode) {
/* Pull queued data off the conference */
- __buf_pull(&chan->confout, chan->writechunk, chan, "dahdi_real_transmit");
+ __buf_pull(&chan->confout, chan->writechunk, chan);
} else {
__dahdi_transmit_chunk(chan, chan->writechunk);
}
@@ -8448,7 +8448,7 @@
#endif
if (chan->confmode) {
/* Load into queue if we have space */
- __buf_push(&chan->confin, chan->readchunk, "dahdi_real_receive");
+ __buf_push(&chan->confin, chan->readchunk);
} else {
__dahdi_receive_chunk(chan, chan->readchunk);
}
@@ -8565,10 +8565,8 @@
spin_lock(&chan->lock);
data = __buf_peek(&chan->confin);
__dahdi_receive_chunk(chan, data);
- if (data) {
- __buf_pull(&chan->confin, NULL, chan,
- "confreceive");
- }
+ if (data)
+ __buf_pull(&chan->confin, NULL, chan);
spin_unlock(&chan->lock);
}
}
@@ -8619,10 +8617,8 @@
spin_lock(&chan->lock);
data = __buf_pushpeek(&chan->confout);
__dahdi_transmit_chunk(chan, data);
- if (data) {
- __buf_push(&chan->confout, NULL,
- "conftransmit");
- }
+ if (data)
+ __buf_push(&chan->confout, NULL);
spin_unlock(&chan->lock);
}
#ifdef DAHDI_SYNC_TICK
@@ -8770,6 +8766,13 @@
}
}
+static inline bool should_skip_receive(const struct dahdi_chan *const chan)
+{
+ return (unlikely(chan->flags & DAHDI_FLAG_NOSTDTXRX) ||
+ (chan->master != chan) ||
+ is_chan_dacsed(chan));
+}
+
int dahdi_receive(struct dahdi_span *span)
{
unsigned long flags;
@@ -8780,68 +8783,62 @@
#endif
for (x = 0; x < span->channels; x++) {
struct dahdi_chan *const chan = span->chans[x];
+
spin_lock_irqsave(&chan->lock, flags);
- if (unlikely(chan->flags & DAHDI_FLAG_NOSTDTXRX)) {
+ if (should_skip_receive(chan)) {
spin_unlock_irqrestore(&chan->lock, flags);
continue;
}
- if (chan->master == chan) {
- if (is_chan_dacsed(chan)) {
- /* this channel is in DACS mode, there is nothing to do here */
- spin_unlock_irqrestore(&chan->lock, flags);
- continue;
- } else if (chan->nextslave) {
- __receive_from_slaves(chan);
- } else {
- /* Process a normal channel */
- __dahdi_real_receive(chan);
+
+ if (chan->nextslave) {
+ __receive_from_slaves(chan);
+ } else {
+ /* Process a normal channel */
+ __dahdi_real_receive(chan);
+ }
+ if (chan->itimer) {
+ chan->itimer -= DAHDI_CHUNKSIZE;
+ if (chan->itimer <= 0)
+ rbs_itimer_expire(chan);
+ }
+ if (chan->ringdebtimer)
+ chan->ringdebtimer--;
+ if (chan->sig & __DAHDI_SIG_FXS) {
+ if (chan->rxhooksig == DAHDI_RXSIG_RING)
+ chan->ringtrailer = DAHDI_RINGTRAILER;
+ else if (chan->ringtrailer) {
+ chan->ringtrailer -= DAHDI_CHUNKSIZE;
+ /* See if RING trailer is expired */
+ if (!chan->ringtrailer && !chan->ringdebtimer)
+ __qevent(chan, DAHDI_EVENT_RINGOFFHOOK);
}
- if (chan->itimer) {
- chan->itimer -= DAHDI_CHUNKSIZE;
- if (chan->itimer <= 0)
- rbs_itimer_expire(chan);
- }
- if (chan->ringdebtimer)
- chan->ringdebtimer--;
- if (chan->sig & __DAHDI_SIG_FXS) {
- if (chan->rxhooksig == DAHDI_RXSIG_RING)
- chan->ringtrailer = DAHDI_RINGTRAILER;
- else if (chan->ringtrailer) {
- chan->ringtrailer -= DAHDI_CHUNKSIZE;
- /* See if RING trailer is expired */
- if (!chan->ringtrailer && !chan->ringdebtimer)
- __qevent(chan, DAHDI_EVENT_RINGOFFHOOK);
+ }
+ if (chan->pulsetimer) {
+ chan->pulsetimer--;
+ if (chan->pulsetimer <= 0) {
+ if (chan->pulsecount) {
+ if (chan->pulsecount > 12) {
+
+ module_printk(KERN_NOTICE, "Got pulse digit %d on %s???\n",
+ chan->pulsecount,
+ chan->name);
+ } else if (chan->pulsecount > 11) {
+ __qevent(chan, DAHDI_EVENT_PULSEDIGIT | '#');
+ } else if (chan->pulsecount > 10) {
+ __qevent(chan, DAHDI_EVENT_PULSEDIGIT | '*');
+ } else if (chan->pulsecount > 9) {
+ __qevent(chan, DAHDI_EVENT_PULSEDIGIT | '0');
+ } else {
+ __qevent(chan, DAHDI_EVENT_PULSEDIGIT | ('0' +
+ chan->pulsecount));
+ }
+ chan->pulsecount = 0;
}
}
- if (chan->pulsetimer) {
- chan->pulsetimer--;
- if (chan->pulsetimer <= 0) {
- if (chan->pulsecount) {
- if (chan->pulsecount > 12) {
-
- module_printk(KERN_NOTICE, "Got pulse digit %d on %s???\n",
- chan->pulsecount,
- chan->name);
- } else if (chan->pulsecount > 11) {
- __qevent(chan, DAHDI_EVENT_PULSEDIGIT | '#');
- } else if (chan->pulsecount > 10) {
- __qevent(chan, DAHDI_EVENT_PULSEDIGIT | '*');
- } else if (chan->pulsecount > 9) {
- __qevent(chan, DAHDI_EVENT_PULSEDIGIT | '0');
- } else {
- __qevent(chan, DAHDI_EVENT_PULSEDIGIT | ('0' +
- chan->pulsecount));
- }
- chan->pulsecount = 0;
- }
- }
- }
+ }
#ifdef BUFFER_DEBUG
- chan->statcount -= DAHDI_CHUNKSIZE;
-#endif
- spin_unlock_irqrestore(&chan->lock, flags);
- continue;
- }
+ chan->statcount -= DAHDI_CHUNKSIZE;
+#endif
spin_unlock_irqrestore(&chan->lock, flags);
}
More information about the dahdi-commits
mailing list