2.1.131-ac3 3c509 no irq_save in the sender code

Andrea Arcangeli (andrea@e-mind.com)
Sat, 5 Dec 1998 11:46:05 +0100 (CET)


I am merging you tree Alan, and I seen this patch:

diff -u --new-file --recursive --exclude-from ../exclude linux.vanilla/drivers/net/3c509.c linux.ac/drivers/net/3c509.c
--- linux.vanilla/drivers/net/3c509.c Sun Nov 8 15:10:16 1998
+++ linux.ac/drivers/net/3c509.c Thu Dec 3 18:47:54 1998
@@ -63,6 +63,7 @@
#include <asm/spinlock.h>
#include <asm/bitops.h>
#include <asm/io.h>
+#include <asm/irq.h>

#ifdef EL3_DEBUG
int el3_debug = EL3_DEBUG;
@@ -526,10 +527,21 @@
if (test_and_set_bit(0, (void*)&dev->tbusy) != 0)
printk("%s: Transmitter access conflict.\n", dev->name);
else {
- unsigned long flags;
-
- /* Spin on the lock, until we're clear of an IRQ */
- spin_lock_irqsave(&lp->lock, flags);
+ /*
+ * We lock the driver against other processors. Note
+ * we don't need to lock versus the IRQ as we suspended
+ * that. This means that we lose the ability to take
+ * an RX during a TX upload. That sucks a bit with SMP
+ * on an original 3c509 (2K buffer)
+ *
+ * Using disable_irq stops us crapping on other
+ * time sensitive devices.
+ */
+
+#ifdef __SMP__
+ disable_irq(dev->irq);
+ spin_lock(&lp->lock);
+#endif

/* Put out the doubleword header... */
outw(skb->len, ioaddr + TX_FIFO);
@@ -547,8 +559,10 @@
} else
/* Interrupt us when the FIFO has room for max-sized packet. */
outw(SetTxThreshold + 1536, ioaddr + EL3_CMD);
-
- spin_unlock_irqrestore(&lp->lock, flags);
+#ifdef __SMP__
+ spin_unlock(&lp->lock);
+ enable_irq(dev->irq);
+#endif
}

dev_kfree_skb (skb);

Are you sure you are not reinserting a bug? Using the irq_save spinlock
would avoid that an irq handler start playing with the NIC while it was
sending data (outsl(ioaddr + TX_FIFO, skb->data, (skb->len + 3) >>
2);) also in UP. I think this is the reason of the TX timeout errors under
flood. So I think you should reverse the patch above (just done here ;).

Andrea Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/