aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mv643xx_eth.c
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2008-03-18 14:32:41 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-04-16 20:06:48 -0400
commit4d64e718b46f4eedaf0379e0150de4d28b06b916 (patch)
treec4611a3fcd3011327dda08e8069bf2df38e21ea0 /drivers/net/mv643xx_eth.c
parentdd9e0dda66ba38a2ddd1405ac279894260dc5c36 (diff)
mv643xx_eth: mp->tx_desc_count needs spinlock protection
mv643xx_eth_start_xmit() should check mp->tx_desc_count only inside the mp->lock spinlock. Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Reviewed-by: Tzachi Perelstein <tzachi@marvell.com> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Diffstat (limited to 'drivers/net/mv643xx_eth.c')
-rw-r--r--drivers/net/mv643xx_eth.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index d65cadef4d22..06e024f5d68b 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1741,23 +1741,22 @@ static int mv643xx_eth_start_xmit(struct sk_buff *skb, struct net_device *dev)
1741 BUG_ON(netif_queue_stopped(dev)); 1741 BUG_ON(netif_queue_stopped(dev));
1742 BUG_ON(skb == NULL); 1742 BUG_ON(skb == NULL);
1743 1743
1744 if (has_tiny_unaligned_frags(skb) && __skb_linearize(skb)) {
1745 stats->tx_dropped++;
1746 printk(KERN_DEBUG "%s: failed to linearize tiny "
1747 "unaligned fragment\n", dev->name);
1748 return 1;
1749 }
1750
1751 spin_lock_irqsave(&mp->lock, flags);
1752
1744 if (mp->tx_ring_size - mp->tx_desc_count < MAX_DESCS_PER_SKB) { 1753 if (mp->tx_ring_size - mp->tx_desc_count < MAX_DESCS_PER_SKB) {
1745 printk(KERN_ERR "%s: transmit with queue full\n", dev->name); 1754 printk(KERN_ERR "%s: transmit with queue full\n", dev->name);
1746 netif_stop_queue(dev); 1755 netif_stop_queue(dev);
1756 spin_unlock_irqrestore(&mp->lock, flags);
1747 return 1; 1757 return 1;
1748 } 1758 }
1749 1759
1750 if (has_tiny_unaligned_frags(skb)) {
1751 if (__skb_linearize(skb)) {
1752 stats->tx_dropped++;
1753 printk(KERN_DEBUG "%s: failed to linearize tiny "
1754 "unaligned fragment\n", dev->name);
1755 return 1;
1756 }
1757 }
1758
1759 spin_lock_irqsave(&mp->lock, flags);
1760
1761 eth_tx_submit_descs_for_skb(mp, skb); 1760 eth_tx_submit_descs_for_skb(mp, skb);
1762 stats->tx_bytes += skb->len; 1761 stats->tx_bytes += skb->len;
1763 stats->tx_packets++; 1762 stats->tx_packets++;