Bug#334104: RFC: workaround for dmfe/tulip module problem
Hi,
The issue of dmfe and tulip drivers advertising support for the cards
with the same PCI IDs has popped up recently again [0]. As some of the
cards work with dmfe driver (mostly on x86), and some work with tulip
(on sparc Netra machines, for example), the issue cannot be resolved
by simply removing the duplicate PCI IDs from one of the drivers, as I
initially thought. To provide some kind of workaround for it, I
propose to patch dmfe and tulip drivers, introducing a 'disable'
parameter, which can be used to prevent the particular module from
taking over hardware. d-i currently has a mechanism to supply the
options to the modules using kernel boot parameters, so the user may
disable the unwanted module without starting a shell and manually
mucking with module loading and unloading.
The patch (attached) is really straightforward, and is unlikely to
cause any regression. I don't have access to the dmfe or tulip
hardware, so I would appreciate if you could test it on the
affected machines (particularly, the disabling feature), and report
back.
[0] http://bugs.debian.org/400837
Thanks,
--
Jurij Smakov jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/ KeyID: C99E03CC
diff -aur a/drivers/net/tulip/dmfe.c b/drivers/net/tulip/dmfe.c
--- a/drivers/net/tulip/dmfe.c 2006-09-19 20:42:06.000000000 -0700
+++ b/drivers/net/tulip/dmfe.c 2006-11-29 21:00:45.000000000 -0800
@@ -281,6 +281,7 @@
/* For module input parameter */
static int debug;
+static int disable;
static u32 cr6set;
static unsigned char mode = 8;
static u8 chkmode = 1;
@@ -1987,6 +1988,7 @@
MODULE_VERSION(DRV_VERSION);
module_param(debug, int, 0);
+module_param(disable, int, 0);
module_param(mode, byte, 0);
module_param(cr6set, int, 0);
module_param(chkmode, byte, 0);
@@ -2008,6 +2010,11 @@
{
int rc;
+ if (disable) {
+ printk(KERN_INFO "dmfe: driver disabled, aborting initialization.\n");
+ return 0;
+ }
+
printk(version);
printed_version = 1;
@@ -2055,6 +2062,8 @@
static void __exit dmfe_cleanup_module(void)
{
+ if (disable)
+ return;
DMFE_DBUG(0, "dmfe_clean_module() ", debug);
pci_unregister_driver(&dmfe_driver);
}
diff -aur a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c
--- a/drivers/net/tulip/tulip_core.c 2006-09-19 20:42:06.000000000 -0700
+++ b/drivers/net/tulip/tulip_core.c 2006-11-29 21:01:04.000000000 -0800
@@ -106,6 +106,8 @@
static int csr0 = 0x00A00000 | 0x4800;
#endif
+static int disable;
+
/* Operational parameters that usually are not changed. */
/* Time in jiffies before concluding the transmitter is hung. */
#define TX_TIMEOUT (4*HZ)
@@ -116,6 +118,7 @@
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
module_param(tulip_debug, int, 0);
+module_param(disable, int, 0);
module_param(max_interrupt_work, int, 0);
module_param(rx_copybreak, int, 0);
module_param(csr0, int, 0);
@@ -1840,6 +1843,11 @@
static int __init tulip_init (void)
{
+ if (disable) {
+ printk (KERN_INFO "tulip: driver disabled, aborting initialization\n");
+ return 0;
+ }
+
#ifdef MODULE
printk (KERN_INFO "%s", version);
#endif
@@ -1855,6 +1863,8 @@
static void __exit tulip_cleanup (void)
{
+ if (disable)
+ return;
pci_unregister_driver (&tulip_driver);
}
Reply to: