patch-2.2.8 linux/drivers/net/3c507.c

Next file: linux/drivers/net/3c509.c
Previous file: linux/drivers/misc/parport_pc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.7/linux/drivers/net/3c507.c linux/drivers/net/3c507.c
@@ -40,6 +40,7 @@
 	info that the casual reader might think that it documents the i82586 :-<.
 */
 
+#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/types.h>
@@ -53,6 +54,7 @@
 #include <asm/bitops.h>
 #include <asm/io.h>
 #include <asm/dma.h>
+#include <asm/spinlock.h>
 #include <linux/errno.h>
 
 #include <linux/netdevice.h>
@@ -123,6 +125,7 @@
 	ushort tx_head;
 	ushort tx_cmd_link;
 	ushort tx_reap;
+	spinlock_t lock;
 };
 
 /*
@@ -448,6 +451,7 @@
 	struct net_local *lp = (struct net_local *)dev->priv;
 	int ioaddr = dev->base_addr;
 	unsigned long shmem = dev->mem_start;
+	unsigned long flags;
 
 	if (dev->tbusy) 
 	{
@@ -487,7 +491,13 @@
 		lp->stats.tx_bytes+=length;
 		/* Disable the 82586's input to the interrupt line. */
 		outb(0x80, ioaddr + MISC_CTRL);
+#ifdef CONFIG_SMP
+		spin_lock_irqsave(&lp->lock, flags);
 		hardware_send_packet(dev, buf, length);
+		spin_unlock_irqrestore(&lp->lock, flags);
+#else
+		hardware_send_packet(dev, buf, length);
+#endif		
 		dev->trans_start = jiffies;
 		/* Enable the 82586 interrupt input. */
 		outb(0x84, ioaddr + MISC_CTRL);
@@ -515,11 +525,14 @@
 		return;
 	}
 	dev->interrupt = 1;
+	
 
 	ioaddr = dev->base_addr;
 	lp = (struct net_local *)dev->priv;
 	shmem = dev->mem_start;
 
+	spin_lock(&lp->lock);
+
 	status = readw(shmem+iSCB_STATUS);
 
 	if (net_debug > 4) {
@@ -598,6 +611,7 @@
 
 	/* Enable the 82586's interrupt input. */
 	outb(0x84, ioaddr + MISC_CTRL);
+	spin_unlock(&lp->lock);
 
 	return;
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)