summaryrefslogtreecommitdiffstats
path: root/drivers/net/ioc3-eth.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ioc3-eth.c')
-rw-r--r--drivers/net/ioc3-eth.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index aab9422d6..8a3952df4 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -97,6 +97,7 @@ struct ioc3_private {
int rx_pi; /* RX producer index */
int tx_ci; /* TX consumer index */
int tx_pi; /* TX producer index */
+ spinlock_t ioc3_lock;
};
/* We use this to acquire receive skb's that we can DMA directly into. */
@@ -390,6 +391,7 @@ ioc3_tx(struct ioc3_private *ip, struct ioc3 *ioc3)
struct sk_buff *skb;
u32 etcir;
+ spin_lock(&ip->ioc3_lock);
etcir = ioc3->etcir;
tx_entry = (etcir >> 7) & 127;
o_entry = ip->tx_ci;
@@ -410,6 +412,7 @@ ioc3_tx(struct ioc3_private *ip, struct ioc3 *ioc3)
tx_entry = (etcir >> 7) & 127;
}
ip->tx_ci = o_entry;
+ spin_unlock(&ip->ioc3_lock);
}
/*
@@ -602,7 +605,7 @@ ioc3_ssram_disc(struct ioc3_private *ip)
static void ioc3_probe1(struct net_device *dev, struct ioc3 *ioc3)
{
- struct ioc3_private *p;
+ struct ioc3_private *ip;
dev = init_etherdev(dev, 0);
@@ -613,17 +616,19 @@ static void ioc3_probe1(struct net_device *dev, struct ioc3 *ioc3)
*/
netif_device_attach(dev);
- p = (struct ioc3_private *) kmalloc(sizeof(*p), GFP_KERNEL);
- memset(p, 0, sizeof(*p));
- dev->priv = p;
+ ip = (struct ioc3_private *) kmalloc(sizeof(*ip), GFP_KERNEL);
+ memset(ip, 0, sizeof(*ip));
+ dev->priv = ip;
dev->irq = IOC3_ETH_INT;
- p->regs = ioc3;
+ ip->regs = ioc3;
- ioc3_eth_init(dev, p, ioc3);
- ioc3_ssram_disc(p);
+ ioc3_eth_init(dev, ip, ioc3);
+ ioc3_ssram_disc(ip);
ioc3_get_eaddr(dev, ioc3);
- ioc3_init_rings(dev, p, ioc3);
+ ioc3_init_rings(dev, ip, ioc3);
+
+ spin_lock_init(&ip->ioc3_lock);
/* Misc registers */
ioc3->erbar = 0;
@@ -710,6 +715,7 @@ ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
return 1;
}
+ spin_lock_irq(&ip->ioc3_lock);
data = (unsigned long) skb->data;
len = skb->len;
@@ -755,6 +761,7 @@ ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (TX_BUFFS_AVAIL(ip))
netif_wake_queue(dev);
+ spin_unlock_irq(&ip->ioc3_lock);
return 0;
}