diff mbox

problem with kernel ipconfig over usb ethernet on v.2.6.33-rc3

Message ID cabda6421001100027u1ca339a6ka46470431caa21ba@mail.gmail.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Christian Pellegrin Jan. 10, 2010, 8:27 a.m. UTC
Hi,

I noticed that kernel IP auto-configuration is not usable for
USB-ethenet dongles on newer kernel because it starts before the USB
devices are found (perhaps as a consequence of parallelization of
kernel boot; the built-in delay of 500ms is not enough).I'm using the
following patch (with a command line parameter ipconfigdelay=10) to
solve this situation, but it's a shameless cut & paste from rootdelay.
Is there any better solution or I'm just missing something?

Subject: [PATCH] introduced ipconfigdelay

this is needed for using ipconfig on usb ethernet devices

Signed-off-by: Christian Pellegrin <chripell@fsfe.org>
---
 net/ipv4/ipconfig.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

 	struct ic_device *d, **last;
@@ -1325,8 +1332,16 @@ static int __init ip_auto_config(void)
 #ifdef IPCONFIG_DYNAMIC
  try_try_again:
 #endif
+
 	/* Give hardware a chance to settle */
-	msleep(CONF_PRE_OPEN);
+	if (ipconfig_delay) {
+		printk(KERN_INFO "Waiting %dsec before auto-configuring device...\n",
+		       ipconfig_delay);
+		ssleep(ipconfig_delay);
+	}
+	else {
+		msleep(CONF_PRE_OPEN);
+	}

 	/* Setup all network devices */
 	if (ic_open_devs() < 0)
@@ -1576,3 +1591,4 @@ static int __init
vendor_class_identifier_setup(char *addrs)
 __setup("ip=", ip_auto_config_setup);
 __setup("nfsaddrs=", nfsaddrs_config_setup);
 __setup("dhcpclass=", vendor_class_identifier_setup);
+__setup("ipconfigdelay=", ipconfig_delay_setup);

Comments

David Miller Jan. 10, 2010, 9:38 p.m. UTC | #1
From: christian pellegrin <chripell@gmail.com>
Date: Sun, 10 Jan 2010 09:27:48 +0100

> Hi,
> 
> I noticed that kernel IP auto-configuration is not usable for
> USB-ethenet dongles on newer kernel because it starts before the USB
> devices are found (perhaps as a consequence of parallelization of
> kernel boot; the built-in delay of 500ms is not enough).I'm using the
> following patch (with a command line parameter ipconfigdelay=10) to
> solve this situation, but it's a shameless cut & paste from rootdelay.
> Is there any better solution or I'm just missing something?

How long does it actually take for the USB ethernet device
to become visible at this point?

Is 2 seconds enough?  For example.

If so, let's just change CONF_PRE_OPEN to "2" and change
msleep() to ssleep().

It's rediculious to require that users learn about obscure
kernel command line options in order for basic functionality
to work properly.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christian Pellegrin Jan. 11, 2010, 7:18 a.m. UTC | #2
On Sun, Jan 10, 2010 at 10:38 PM, David Miller <davem@davemloft.net> wrote:
>
> How long does it actually take for the USB ethernet device
> to become visible at this point?
>
> Is 2 seconds enough?  For example.

no, it's around 8-9 seconds

>
> It's rediculious to require that users learn about obscure
> kernel command line options in order for basic functionality
> to work properly.
>

I agree with you, unfortunately rootdelay is there and it's rather
difficult to boot from USB mass storage or even SCSI arrays without
it. If you think it's worth the hassle (maybe this is not a common
user case: I have to develop on embedded systems where the hardware
designers try to save every possible euro by not including proper
ethernet MACs; on desktop systems having initrd/initramfs setting up
the device and waiting for them via udevd solved the problem (but they
don't use kernel ipconfig either in this case)) I can try more
elaborate schemes like: if the ethX specified by ip= is not present at
the first try just wait 10 seconds and try again (perhaps repeat this
two time just to be sure).
diff mbox

Patch

diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 10a6a60..8108a8c 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -187,6 +187,13 @@  struct ic_device {
 static struct ic_device *ic_first_dev __initdata = NULL;/* List of
open device */
 static struct net_device *ic_dev __initdata = NULL;	/* Selected device */

+static unsigned int __initdata ipconfig_delay;
+static int __init ipconfig_delay_setup(char *str)
+{
+	ipconfig_delay = simple_strtoul(str, NULL, 0);
+	return 1;
+}
+
 static int __init ic_open_devs(void)
 {