Tulip driver overhaul (was Re: SMP deadlock in drivers/net/tulip.c
kernel ver 2.3.47 -- here's a patch.)
Jeff Garzik
jgarzik@mandrakesoft.com
Thu Feb 24 01:10:25 2000
This is a multi-part message in MIME format.
--------------9B88D245D6C4382A920AC226
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
As many of the PCI net drivers in the 2.3.x kernel are unmaintained, I
started hacking on the tulip driver. The driver in the 2.3.x kernel
(and eventually the 2.4.0 stable kernel) is getting a big overhaul.
Here's what has happened so far:
1) Take tulip from 2.2.15pre9, the most stable tulip according to most
2) Re-integrate PCI DMA and PCI driver interface updates from 2.3.x
kernels
3) Move driver into drivers/net/tulip, split up into multiple files for
easier maintenance (in 2.3.48-pre1)
You need the attached patch (see below) to get 2.3.48-pre1 working.
Here are the planned changes, in no particular order:
1) Death to magic numbers. Look up every damn bitmask and make it a
series of or'd constants.
2) Integrate tulip changes on vendor websites (linksys, netgear, ...)
3) Integrate tulip changes from Becker drivers
4) Re-integrate any changes lost when 2.3.x tulip was dropped in favor
of 2.2.x stable tulip.
5) Test test test, and get ready for 2.4.0.
Patches for any of these tasks are very welcome, _especially_ any help
on task #1.
Jeff
--
Jeff Garzik |
Building 1024 | Viva la open source!
MandrakeSoft, Inc. |
--------------9B88D245D6C4382A920AC226
Content-Type: text/plain; charset=us-ascii;
name="tulip-fixes-n-cleanup-2.3.48.1.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="tulip-fixes-n-cleanup-2.3.48.1.patch"
diff -urN linux-2.3.48-pre1/drivers/net/Makefile linux/drivers/net/Makefile
--- linux-2.3.48-pre1/drivers/net/Makefile Thu Feb 24 00:19:18 2000
+++ linux/drivers/net/Makefile Wed Feb 23 23:54:52 2000
@@ -18,7 +18,7 @@
MOD_SUB_DIRS :=
MOD_IN_SUB_DIRS :=
ALL_SUB_DIRS := $(SUB_DIRS) fc hamradio irda pcmcia tokenring wan sk98lin \
- arcnet skfp
+ arcnet skfp tulip
O_TARGET := net.o
MOD_LIST_NAME := NET_MODULES
@@ -40,6 +40,7 @@
ifeq ($(CONFIG_TULIP),y)
SUB_DIRS += tulip
+ obj-y += tulip/tulip.o
else
ifeq ($(CONFIG_TULIP),m)
MOD_SUB_DIRS += tulip
diff -urN linux-2.3.48-pre1/drivers/net/tulip/tulip_core.c linux/drivers/net/tulip/tulip_core.c
--- linux-2.3.48-pre1/drivers/net/tulip/tulip_core.c Thu Feb 24 00:19:18 2000
+++ linux/drivers/net/tulip/tulip_core.c Thu Feb 24 00:00:49 2000
@@ -18,7 +18,7 @@
*/
-static const char version[] = "Linux Tulip driver version 0.9.2 (Feb 15, 2000)\n";
+static const char version[] = "Linux Tulip driver version 0.9.3 (Feb 23, 2000)\n";
#include <linux/module.h>
#include "tulip.h"
@@ -237,7 +237,7 @@
/* now it is safe to change csr6 */
outl (newcsr6, ioaddr + CSR6);
- spin_unlock_irqrestore (&tp->lock, flags);
+ spin_unlock_irqrestore (&tp->tx_lock, flags);
}
@@ -978,22 +978,24 @@
ioaddr = pci_resource_start (pdev, 0);
irq = pdev->irq;
- /* Make certain the data structures are quadword aligned. */
+ /* init_etherdev ensures qword aligned structures */
dev = init_etherdev (NULL, sizeof (*tp));
if (!dev) {
- printk (KERN_ERR PFX "unable to allocate ether device, aborting\n");
+ printk (KERN_ERR PFX "ether device alloc failed, aborting\n");
return -ENOMEM;
}
/* We do a request_region() only to register /proc/ioports info. */
/* Note that proper size is tulip_tbl[chip_idx].chip_name, but... */
if (!request_region (ioaddr, tulip_tbl[chip_idx].io_size, dev->name)) {
- printk (KERN_ERR PFX "unable to allocate ether device, aborting\n");
+ printk (KERN_ERR PFX "I/O ports (0x%x@0x%lx) unavailable, "
+ "aborting\n", tulip_tbl[chip_idx].io_size, ioaddr);
goto err_out_free_netdev;
}
if (pci_enable_device(pdev)) {
- printk (KERN_ERR PFX "cannot enable PCI device (id %04x:%04x, bus %d, devfn %d), aborting\n",
+ printk (KERN_ERR PFX "cannot enable PCI device (id %04x:%04x, "
+ "bus %d, devfn %d), aborting\n",
pdev->vendor, pdev->device,
pdev->bus->number, pdev->devfn);
goto err_out_free_netdev;
@@ -1001,10 +1003,17 @@
pci_set_master(pdev);
+ pci_read_config_byte (pdev, PCI_REVISION_ID, &chip_rev);
+
+ /* tp/dev->priv zeroed in init_etherdev */
tp = dev->priv;
- memset(tp, 0, sizeof(*tp));
- pci_read_config_byte (pdev, PCI_REVISION_ID, &chip_rev);
+ tp->chip_id = chip_idx;
+ tp->flags = tulip_tbl[chip_idx].flags;
+ tp->pdev = pdev;
+ tp->base_addr = ioaddr;
+ tp->revision = chip_rev;
+ spin_lock_init(&tp->tx_lock);
printk(KERN_INFO "%s: %s rev %d at %#3lx,",
dev->name, tulip_tbl[chip_idx].chip_name, chip_rev, ioaddr);
@@ -1106,13 +1115,7 @@
pdev->driver_data = dev;
dev->base_addr = ioaddr;
dev->irq = irq;
-
- tp->chip_id = chip_idx;
- tp->revision = chip_rev;
- tp->flags = tulip_tbl[chip_idx].flags;
tp->csr0 = csr0;
- tp->pdev = pdev;
- tp->base_addr = dev->base_addr;
/* BugFixes: The 21143-TD hangs with PCI Write-and-Invalidate cycles.
And the ASIX must have a burst limit or horrible things happen. */
--------------9B88D245D6C4382A920AC226--
-------------------------------------------------------------------
To unsubscribe send a message body containing "unsubscribe"
to linux-tulip-request@beowulf.org