summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/broadcom/bcmsysport.c
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2014-06-05 21:22:15 +0400
committerDavid S. Miller <davem@davemloft.net>2014-06-06 02:36:54 +0400
commitd8498088cf466483093c9a29121e3833e7923287 (patch)
tree04e2c004671adb5d276b7c6d6f7d706b0f889c75 /drivers/net/ethernet/broadcom/bcmsysport.c
parent6934e79ed1221a38f20704bf52ed588a16985fc0 (diff)
downloadlinux-d8498088cf466483093c9a29121e3833e7923287.tar.xz
net: systemport: fix transmit locking scheme
Our transmit locking scheme did not account for the TX ring full interrupt. If a TX ring full interrupt fires while we are attempting to transmit, we will cause a deadlock to occur. Fix this by making sure that we properly disable interrupts while acquiring the spinlock. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bcmsysport.c')
-rw-r--r--drivers/net/ethernet/broadcom/bcmsysport.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 25982b02f0ea..4dfc93fe9744 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -637,10 +637,11 @@ static unsigned int bcm_sysport_tx_reclaim(struct bcm_sysport_priv *priv,
struct bcm_sysport_tx_ring *ring)
{
unsigned int released;
+ unsigned long flags;
- spin_lock(&ring->lock);
+ spin_lock_irqsave(&ring->lock, flags);
released = __bcm_sysport_tx_reclaim(priv, ring);
- spin_unlock(&ring->lock);
+ spin_unlock_irqrestore(&ring->lock, flags);
return released;
}
@@ -822,6 +823,7 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
struct netdev_queue *txq;
struct dma_desc *desc;
unsigned int skb_len;
+ unsigned long flags;
dma_addr_t mapping;
u32 len_status;
u16 queue;
@@ -831,8 +833,8 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
txq = netdev_get_tx_queue(dev, queue);
ring = &priv->tx_rings[queue];
- /* lock against tx reclaim in BH context */
- spin_lock(&ring->lock);
+ /* lock against tx reclaim in BH context and TX ring full interrupt */
+ spin_lock_irqsave(&ring->lock, flags);
if (unlikely(ring->desc_count == 0)) {
netif_tx_stop_queue(txq);
netdev_err(dev, "queue %d awake and ring full!\n", queue);
@@ -914,7 +916,7 @@ static netdev_tx_t bcm_sysport_xmit(struct sk_buff *skb,
ret = NETDEV_TX_OK;
out:
- spin_unlock(&ring->lock);
+ spin_unlock_irqrestore(&ring->lock, flags);
return ret;
}