Skip to contentSkip to conversation

fix ether= kernel parameter

PATCH New Andrew Morton 1 participant 1 message Feb 26, 2001

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

PATCH 1/1 fix ether= kernel parameter

A few people have reported that 3c509.c is incorrectly selecting the BNC connector when used non-modularly.

This is due to 2.2-vs-2.4 incompatibility in the handling of the ether=' kernel option. The ether=' option takes up to five args. If any are omitted, they default to zero in kernel 2.2 and to -1 in kernel 2.4. This will break a lot more drivers than just 3c509 - five or six, including natsemi.c and hamachi.c.

This patch restores the 2.2 behaviour.

Notes:

- The netdev=' and ether=' kernel options are identical. So ether_setup()' is removed, and the ether=' option calls netdev_boot_setup() instead. We can re-fork the implementation later if these options become different.

- drivers/net/net_init.c:ether_config() isn't used anywhere. It has been removed.

- In 3c59x.c and starfire.c: remove the recently-added workarounds for dev->mem_start == -1.

Patch is against 2.4.2-ac4. It also applies to 2.4.2 (ignore the rejects).

include/linux/netdevice.h +0 -1
@@ -630,7 +630,6 @@
 extern void		tr_setup(struct net_device *dev);
 extern void		fc_setup(struct net_device *dev);
 extern void		fc_freedev(struct net_device *dev);
-extern int		ether_config(struct net_device *dev, struct ifmap *map);
 /* Support for loadable net-drivers */
 extern int		register_netdev(struct net_device *dev);
 extern void		unregister_netdev(struct net_device *dev);
drivers/net/net_init.c +0 -17
@@ -390,23 +390,6 @@
 
 #endif /* CONFIG_ATALK || CONFIG_ATALK_MODULE */
 
-int ether_config(struct net_device *dev, struct ifmap *map)
-{
-	if (map->mem_start != (u_long)(-1))
-		dev->mem_start = map->mem_start;
-	if (map->mem_end != (u_long)(-1))
-		dev->mem_end = map->mem_end;
-	if (map->base_addr != (u_short)(-1))
-		dev->base_addr = map->base_addr;
-	if (map->irq != (u_char)(-1))
-		dev->irq = map->irq;
-	if (map->dma != (u_char)(-1))
-		dev->dma = map->dma;
-	if (map->port != (u_char)(-1))
-		dev->if_port = map->port;
-	return 0;
-}
-
 int register_netdev(struct net_device *dev)
 {
 	int err;
drivers/net/3c59x.c +1 -1
@@ -1003,7 +1003,7 @@
 		pdev->driver_data = dev;
 
 	/* The lower four bits are the media type. */
-	if (dev->mem_start && dev->mem_start != ~0UL) {
+	if (dev->mem_start) {
 		/*
 		 * AKPM: ewww..  The 'options' param is passed in as the third arg to the
 		 * LILO 'ether=' argument for non-modular use
drivers/net/starfire.c +1 -1
@@ -836,7 +836,7 @@
 	np->pci_dev = pdev;
 	drv_flags = netdrv_tbl[chip_idx].drv_flags;
 
-	if (dev->mem_start && dev->mem_start != ~0UL)
+	if (dev->mem_start)
 		option = dev->mem_start;
 
 	/* The lower four bits are the media type. */
net/ethernet/eth.c +3 -24
@@ -30,6 +30,7 @@
  *		Alan Cox	: Protect against forwarding explosions with
  *				  older network drivers and IFF_ALLMULTI.
  *	Christer Weinigel	: Better rebuild header message.
+ *             Andrew Morton    : 26Feb01: kill ether_setup() - use netdev_boot_setup().
  *
  *		This program is free software; you can redistribute it and/or
  *		modify it under the terms of the GNU General Public License
@@ -60,31 +61,9 @@
 #include <asm/system.h>
 #include <asm/checksum.h>
 
-static int __init eth_setup(char *str)
-{
-	int ints[5];
-	struct ifmap map;
+extern int __init netdev_boot_setup(char *str);
 
-	str = get_options(str, ARRAY_SIZE(ints), ints);
-	if (!str || !*str)
-		return 0;
-
- 	/* Save settings */
- 	memset(&map, -1, sizeof(map));
-	if (ints[0] > 0)
-		map.irq = ints[1];
-	if (ints[0] > 1)
-		map.base_addr = ints[2];
-	if (ints[0] > 2)
-		map.mem_start = ints[3];
-	if (ints[0] > 3)
-		map.mem_end = ints[4];
-
-	/* Add new entry to the list */
-	return netdev_boot_setup_add(str, &map);
-}
-
-__setup("ether=", eth_setup);
+__setup("ether=", netdev_boot_setup);
 
 /*
  *	 Create the Ethernet MAC header for an arbitrary protocol layer 
Documentation/kernel-parameters.txt +9 -3
@@ -188,8 +188,10 @@
 
 	es1371=		[HW,SOUND]
  
-	ether=		[HW,NET] Ethernet cards parameters (iomem, irq,
-			dev_name).
+	ether=		[HW,NET] Ethernet cards parameters (irq,
+			base_io_addr, mem_start, mem_end, name.
+			(mem_start is often overloaded to mean something
+			different and driver-specific).
 
 	fd_mcs=		[HW,SCSI]
 
@@ -328,7 +330,11 @@
 
 	ncr53c8xx=	[HW,SCSI]
 
-	netdev=		[NET]
+	netdev=		[NET] Ethernet cards parameters (irq,
+			base_io_addr, mem_start, mem_end, name.
+			(mem_start is often overloaded to mean something
+			different and driver-specific).
+			(cf: ether=)
  
 	nfsaddrs=	[NFS]
 
net/core/dev.c +2 -2
@@ -351,7 +351,7 @@
 /*
  * Saves at boot time configured settings for any netdevice.
  */
-static int __init netdev_boot_setup(char *str)
+int __init netdev_boot_setup(char *str)
 {
 	int ints[5];
 	struct ifmap map;
@@ -361,7 +361,7 @@
 		return 0;
 
 	/* Save settings */
-	memset(&map, -1, sizeof(map));
+	memset(&map, 0, sizeof(map));
 	if (ints[0] > 0)
 		map.irq = ints[1];
 	if (ints[0] > 1)

-