[zaptel-commits] sruffell: branch 1.4 r4593 - in /branches/1.4/kernel: ./ wctc4xxp/
SVN commits to the Zaptel project
zaptel-commits at lists.digium.com
Thu Dec 4 17:09:28 CST 2008
Author: sruffell
Date: Thu Dec 4 17:09:28 2008
New Revision: 4593
URL: http://svn.digium.com/view/zaptel?view=rev&rev=4593
Log:
Service the transmit descriptor ring before the receive descriptor ring so
that commands that are still sitting on the transmit descriptor ring are not
completed twice.
Modified:
branches/1.4/kernel/wctc4xxp/base.c
branches/1.4/kernel/zttranscode.c
Modified: branches/1.4/kernel/wctc4xxp/base.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/kernel/wctc4xxp/base.c?view=diff&rev=4593&r1=4592&r2=4593
==============================================================================
--- branches/1.4/kernel/wctc4xxp/base.c (original)
+++ branches/1.4/kernel/wctc4xxp/base.c Thu Dec 4 17:09:28 2008
@@ -1977,43 +1977,13 @@
}
}
-static inline void service_dte(struct wcdte *wc)
+static inline void service_tx_ring(struct wcdte *wc)
{
struct tcb *cmd;
-
- /*
- * Process the received packets
- */
- while((cmd = wctc4xxp_retrieve(wc->rxd))) {
- struct tcb *newcmd;
-
- wctc4xxp_net_capture_cmd(wc, cmd);
-
- if(!(newcmd = __alloc_cmd(ALLOC_FLAGS, 0))) {
- DTE_PRINTK(ERR, "Out of memory in %s.\n", __FUNCTION__);
- } else {
- if (newcmd->data_len < MAX_FRAME_SIZE) {
- newcmd->data = kmalloc(MAX_FRAME_SIZE, ALLOC_FLAGS);
- if (!newcmd->data) {
- DTE_PRINTK(ERR, "out of memory in %s " \
- "again.\n", __FUNCTION__);
- }
- newcmd->data_len = MAX_FRAME_SIZE;
- }
- if (wctc4xxp_submit(wc->rxd, newcmd)) {
- DTE_PRINTK(ERR, "Failed submit in %s\n", __FUNCTION__);
- free_cmd(newcmd);
- }
- wctc4xxp_receive_demand_poll(wc);
- }
- wctc4xxp_receiveprep(wc, cmd);
- }
- wctc4xxp_receive_demand_poll(wc);
-
/*
* Process the transmit packets
*/
- while((cmd = wctc4xxp_retrieve(wc->txd))) {
+ while ((cmd = wctc4xxp_retrieve(wc->txd))) {
if (!(cmd->flags & (__WAIT_FOR_ACK | __WAIT_FOR_RESPONSE))) {
/* If we're not waiting for an ACK or Response from
* the DTE, this message should not be sitting on any
@@ -2043,6 +2013,45 @@
}
}
+static inline void service_rx_ring(struct wcdte *wc)
+{
+ struct tcb *cmd;
+ /*
+ * Process the received packets
+ */
+ while ((cmd = wctc4xxp_retrieve(wc->rxd))) {
+ struct tcb *newcmd;
+
+ wctc4xxp_net_capture_cmd(wc, cmd);
+
+ if(!(newcmd = __alloc_cmd(ALLOC_FLAGS, 0))) {
+ DTE_PRINTK(ERR, "Out of memory in %s.\n", __FUNCTION__);
+ } else {
+ if (newcmd->data_len < MAX_FRAME_SIZE) {
+ newcmd->data = kmalloc(MAX_FRAME_SIZE, ALLOC_FLAGS);
+ if (!newcmd->data) {
+ DTE_PRINTK(ERR, "out of memory in %s " \
+ "again.\n", __FUNCTION__);
+ }
+ newcmd->data_len = MAX_FRAME_SIZE;
+ }
+ if (wctc4xxp_submit(wc->rxd, newcmd)) {
+ DTE_PRINTK(ERR, "Failed submit in %s\n", __FUNCTION__);
+ free_cmd(newcmd);
+ }
+ wctc4xxp_receive_demand_poll(wc);
+ }
+ wctc4xxp_receiveprep(wc, cmd);
+ }
+ wctc4xxp_receive_demand_poll(wc);
+}
+
+static inline void service_dte(struct wcdte *wc)
+{
+ service_tx_ring(wc);
+ service_rx_ring(wc);
+}
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
static void deferred_work_func(void *param)
@@ -2833,6 +2842,9 @@
struct tcb *cmd, *temp;
LIST_HEAD(cmds_to_retry);
const int MAX_RETRIES = 5;
+
+ /* Check for any commands that have completed transmission. */
+ service_tx_ring(wc);
spin_lock(&wc->cmd_list_lock);
/* Go through the list of messages that are waiting for responses from
Modified: branches/1.4/kernel/zttranscode.c
URL: http://svn.digium.com/view/zaptel/branches/1.4/kernel/zttranscode.c?view=diff&rev=4593&r1=4592&r2=4593
==============================================================================
--- branches/1.4/kernel/zttranscode.c (original)
+++ branches/1.4/kernel/zttranscode.c Thu Dec 4 17:09:28 2008
@@ -179,8 +179,7 @@
/* Find a free channel on the transcoder and mark it busy. */
static inline struct zt_transcoder_channel *
-get_free_channel(struct zt_transcoder *tc)
-
+get_free_channel(struct zt_transcoder *tc, const struct zt_transcoder_formats *fmts)
{
struct zt_transcoder_channel *chan;
int i;
@@ -225,7 +224,7 @@
/* We found a transcoder that can handle our formats.
* Now look for an available channel. */
match = 1;
- if ((chan = get_free_channel(tc))) {
+ if ((chan = get_free_channel(tc, fmts))) {
/* transcoder tc has a free channel. In order
* to spread the load among available
* transcoders (when there are more than one
More information about the zaptel-commits
mailing list