wctc4xxp: Do not need locks on the transcoder buffers.

They are sufficiently protected by the list locks. This also cleans up a case
where the tcp was unlocked after already completing it, which was corrupting the
list.

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
Signed-off-by: Russ Meyerriecks <rmeyerriecks@digium.com>
This commit is contained in:
Shaun Ruffell 2014-05-02 20:37:51 -05:00 committed by Russ Meyerriecks
parent ec9d162344
commit 391ca2b7aa

View File

@ -207,7 +207,6 @@ struct tcb {
struct completion complete; struct completion complete;
/* The number of bytes available in data. */ /* The number of bytes available in data. */
int data_len; int data_len;
spinlock_t lock;
}; };
static inline const struct csm_encaps_hdr * static inline const struct csm_encaps_hdr *
@ -223,7 +222,6 @@ initialize_cmd(struct tcb *cmd, unsigned long cmd_flags)
INIT_LIST_HEAD(&cmd->node); INIT_LIST_HEAD(&cmd->node);
init_completion(&cmd->complete); init_completion(&cmd->complete);
cmd->flags = cmd_flags; cmd->flags = cmd_flags;
spin_lock_init(&cmd->lock);
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20) #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
@ -2248,7 +2246,6 @@ static void do_rx_response_packet(struct wcdte *wc, struct tcb *cmd)
if ((listhdr->function == rxhdr->function) && if ((listhdr->function == rxhdr->function) &&
(listhdr->channel == rxhdr->channel)) { (listhdr->channel == rxhdr->channel)) {
spin_lock(&pos->lock);
list_del_init(&pos->node); list_del_init(&pos->node);
pos->flags &= ~(__WAIT_FOR_RESPONSE); pos->flags &= ~(__WAIT_FOR_RESPONSE);
pos->response = cmd; pos->response = cmd;
@ -2256,7 +2253,6 @@ static void do_rx_response_packet(struct wcdte *wc, struct tcb *cmd)
* be completed in service_tx_ring. */ * be completed in service_tx_ring. */
if (pos->flags & TX_COMPLETE) if (pos->flags & TX_COMPLETE)
complete(&pos->complete); complete(&pos->complete);
spin_unlock(&pos->lock);
handled = true; handled = true;
break; break;
@ -2294,19 +2290,15 @@ do_rx_ack_packet(struct wcdte *wc, struct tcb *cmd)
complete(&pos->complete); complete(&pos->complete);
} else if ((listhdr->seq_num == rxhdr->seq_num) && } else if ((listhdr->seq_num == rxhdr->seq_num) &&
(listhdr->channel == rxhdr->channel)) { (listhdr->channel == rxhdr->channel)) {
spin_lock(&pos->lock);
if (pos->flags & __WAIT_FOR_RESPONSE) { if (pos->flags & __WAIT_FOR_RESPONSE) {
pos->flags &= ~(__WAIT_FOR_ACK); pos->flags &= ~(__WAIT_FOR_ACK);
spin_unlock(&pos->lock);
} else { } else {
list_del_init(&pos->node); list_del_init(&pos->node);
if (pos->flags & DO_NOT_AUTO_FREE) { if (pos->flags & DO_NOT_AUTO_FREE) {
WARN_ON(!(pos->flags & TX_COMPLETE)); WARN_ON(!(pos->flags & TX_COMPLETE));
complete(&pos->complete); complete(&pos->complete);
spin_unlock(&pos->lock);
} else { } else {
spin_unlock(&pos->lock);
free_cmd(pos); free_cmd(pos);
} }
} }
@ -2511,7 +2503,6 @@ static void service_tx_ring(struct wcdte *wc)
struct tcb *cmd; struct tcb *cmd;
unsigned long flags; unsigned long flags;
while ((cmd = wctc4xxp_retrieve(wc->txd))) { while ((cmd = wctc4xxp_retrieve(wc->txd))) {
spin_lock_irqsave(&cmd->lock, flags);
cmd->flags |= TX_COMPLETE; cmd->flags |= TX_COMPLETE;
if (!(cmd->flags & (__WAIT_FOR_ACK | __WAIT_FOR_RESPONSE))) { if (!(cmd->flags & (__WAIT_FOR_ACK | __WAIT_FOR_RESPONSE))) {
/* If we're not waiting for an ACK or Response from /* If we're not waiting for an ACK or Response from
@ -2519,15 +2510,11 @@ static void service_tx_ring(struct wcdte *wc)
* lists. */ * lists. */
WARN_ON(!list_empty(&cmd->node)); WARN_ON(!list_empty(&cmd->node));
if (DO_NOT_AUTO_FREE & cmd->flags) { if (DO_NOT_AUTO_FREE & cmd->flags) {
spin_unlock_irqrestore(&cmd->lock, flags);
WARN_ON(!(cmd->flags & TX_COMPLETE)); WARN_ON(!(cmd->flags & TX_COMPLETE));
complete(&cmd->complete); complete(&cmd->complete);
} else { } else {
spin_unlock_irqrestore(&cmd->lock, flags);
free_cmd(cmd); free_cmd(cmd);
} }
} else {
spin_unlock_irqrestore(&cmd->lock, flags);
} }
/* We've freed up a spot in the hardware ring buffer. If /* We've freed up a spot in the hardware ring buffer. If