Skip to contentSkip to conversation

Mixed PCI/ISA device name conflicts

PATCH In review Stephen Hemminger 2 participants 4 messages Dec 22, 2003 – Apr 19, 2004 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Mixed PCI/ISA device name conflicts

PCI is getting initialized before the old ISA probing code, so on mixed ISA/PCI systems a PCI card will get eth0 before the ISA probing starts. Then when the first ISA card is probed it will (unsuccessfully) try and claim eth0.

This fixes it by just having the ISA code skip eth0. It relies on the convention that if the ioaddr is one, the device should be skipped.

Patch against net-drivers-2.5-exp

net/core/dev.c +4 -0
diff -Nru a/net/core/dev.c b/net/core/dev.c
@@ -382,6 +382,7 @@
  *	The found settings are set for the device to be used
  *	later in the device probing.
  *	Returns 0 if no settings found.
+ *	        1 if device already exists
  */
 unsigned long netdev_boot_base(const char *prefix, int unit)
 {
@@ -390,6 +391,9 @@
 	int i;
 
 	sprintf(name, "%s%d", prefix, unit);
+	if (__dev_get_by_name(name))
+		return 1;
+
 	for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++)
 		if (!strcmp(name, s[i].name))
 			return s[i].map.base_addr;
#1 lore raw
Quoted 22 lines · Stephen Hemminger

PCI is getting initialized before the old ISA probing code, so on mixed ISA/PCI systems a PCI card will get eth0 before the ISA probing starts. Then when the first ISA card is probed it will (unsuccessfully) try and claim eth0.

This fixes it by just having the ISA code skip eth0. It relies on the convention that if the ioaddr is one, the device should be skipped.

Patch against net-drivers-2.5-exp

diff -Nru a/net/core/dev.c b/net/core/dev.c

net/core/dev.c +1 -0
@@ -382,6 +382,7 @@
  *	The found settings are set for the device to be used
  *	later in the device probing.
  *	Returns 0 if no settings found.
+ *	        1 if device already exists
  */
 unsigned long netdev_boot_base(const char *prefix, int unit)
 {

net/core/dev.c line 399

Quoted 9 lines
net/core/dev.c +3 -0
@@ -390,6 +391,9 @@
 	int i;
 
 	sprintf(name, "%s%d", prefix, unit);
+	if (__dev_get_by_name(name))
+		return 1;
+
 	for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++)
 		if (!strcmp(name, s[i].name))
 			return s[i].map.base_addr;

Is this patch still needed?

Jeff

A message that is not in the archive (sent off-list or not yet received): 20040329153236.0cf427c9@dell_ss3.pdx.osdl.net

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

PATCH 1/1 Mixed PCI/ISA device name conflicts

In systems with mixed network cards, and all drivers compiled into the kernel; the PCI device (eth0) will get probed first, before the ISA.

The problem is that the ISA device can mistakenly try to probe for eth0. The problem is that the ISA driver will not detect the failure until it goes to call register_netdevice, and not all drivers have perfect error unwind code.

This patch short circuits the device probe, so it won't bother looking for devices that already are registered.

net/core/dev.c +8 -0
diff -Nru a/net/core/dev.c b/net/core/dev.c
@@ -432,6 +432,14 @@
 	int i;
 
 	sprintf(name, "%s%d", prefix, unit);
+
+	/*
+	 * If device already registered then return base of 1
+	 * to indicate not to probe for this interface
+	 */
+	if (__dev_get_by_name(name))
+		return 1;
+
 	for (i = 0; i < NETDEV_BOOT_SETUP_MAX; i++)
 		if (!strcmp(name, s[i].name))
 			return s[i].map.base_addr;