summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsruffell <sruffell@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-10-06 17:48:01 +0000
committersruffell <sruffell@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2008-10-06 17:48:01 +0000
commit6b933494bcdbf5d4b7d68cd95f5b578e6c688cfb (patch)
tree49098ecbbab2fff71c492b54c9b112b2c09a9201
parent4ac9aa7cf119227630008d05a42a0bc569bdfb75 (diff)
Embed room for the complete packet to the DTE in the transcoder buffer
structure. Simplifies alignment management at the cost of a little wasted memory, but the end results is that operation is more reliable on more systems. git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@4560 5390a7c7-147a-4af0-8ec9-7488f05a26cb
-rw-r--r--kernel/wctc4xxp/base.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/kernel/wctc4xxp/base.c b/kernel/wctc4xxp/base.c
index dde7b9d..bfb67fb 100644
--- a/kernel/wctc4xxp/base.c
+++ b/kernel/wctc4xxp/base.c
@@ -317,7 +317,8 @@ struct csm_create_channel_cmd {
0x00,0x01, s&0x0F, 0x01, ((c&0xFF00)>>8),(c&0x00FF), 0x0A, 0x00, 0x00,0x02,0x5B,0x80, 0x00,0x00, \
0x00,0x00, 0x00,0x00 }
-#define SFRAME_SIZE 320
+#define MAX_FRAME_SIZE 1518
+#define SFRAME_SIZE MAX_FRAME_SIZE
/* Transcoder buffer (tcb) */
struct tcb {
@@ -1003,9 +1004,9 @@ wctc4xxp_submit(struct wctc4xxp_descriptor_ring* dr, struct tcb *c)
WARN_ON(!c);
len = (c->data_len < MIN_PACKET_LEN) ? MIN_PACKET_LEN : c->data_len;
- if (c->data_len > 1518) {
+ if (c->data_len > MAX_FRAME_SIZE) {
WARN_ON_ONCE(!"Invalid command length passed\n");
- c->data_len = 1518;
+ c->data_len = MAX_FRAME_SIZE;
}
spin_lock_bh(&dr->lock);
@@ -1981,12 +1982,14 @@ static inline void service_dte(struct wcdte *wc)
if(!(newcmd = __alloc_cmd(ALLOC_FLAGS, 0))) {
DTE_PRINTK(ERR, "Out of memory in %s.\n", __FUNCTION__);
} else {
- newcmd->data = kmalloc(1518, ALLOC_FLAGS);
- if (!newcmd->data) {
- DTE_PRINTK(ERR, "out of memory in %s " \
- "again.\n", __FUNCTION__);
+ 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;
}
- newcmd->data_len = 1518;
if (wctc4xxp_submit(wc->rxd, newcmd)) {
DTE_PRINTK(ERR, "Failed submit in %s\n", __FUNCTION__);
free_cmd(newcmd);
@@ -2002,9 +2005,10 @@ static inline void service_dte(struct wcdte *wc)
*/
while((cmd = wctc4xxp_retrieve(wc->txd))) {
if (!(cmd->flags & (__WAIT_FOR_ACK | __WAIT_FOR_RESPONSE))) {
- spin_lock_bh(&wc->cmd_list_lock);
- list_del_init(&cmd->node);
- spin_unlock_bh(&wc->cmd_list_lock);
+ /* If we're not waiting for an ACK or Response from
+ * the DTE, this message should not be sitting on any
+ * lists. */
+ WARN_ON(!list_empty(&cmd->node));
if (DO_NOT_AUTO_FREE & cmd->flags) {
complete(&cmd->complete);
} else {
@@ -2352,13 +2356,13 @@ wctc4xxp_load_firmware(struct wcdte *wc, const struct firmware *firmware)
if (!(cmd = alloc_cmd())) {
return -ENOMEM;
}
- if (1518 > cmd->data_len) {
- cmd->data = kmalloc(1518, GFP_KERNEL);
+ if (MAX_FRAME_SIZE > cmd->data_len) {
+ cmd->data = kmalloc(MAX_FRAME_SIZE, GFP_KERNEL);
if (!(cmd->data)) {
free_cmd(cmd);
return -ENOMEM;
}
- cmd->data_len = 1518;
+ cmd->data_len = MAX_FRAME_SIZE;
}
while (byteloc < (firmware->size-20)) {
last_byteloc = byteloc;