2002-03-15 02:30:20

by rob1

[permalink] [raw]
Subject: IP Autoconfig doesn't work for USB network devices

Hi. I'm trying to setup a generic kernel that can be booted from floppy
or flash that will let me setup an nfs-root machine. I have it working
from machine "A", which has a PCI network card. However, machine "B"
doesn't work because the USB network device (D-Link DSB-650) is not
detected until after the IP Autoconfig decides that there aren't any
network cards.

Excerpt from bootup/dmesg:

...
pegasus.c: v0.4.22 (2001/12/07):Pegasus/Pegasus II USB Ethernet driver
usb.c: registered new driver pegasus
...
NET4: Linux TCP/IP 1.0 for NET4.0
...
IP-Config: No network devices available.
...
hub.c: USB new device connect on bus2/1, assigned device number 2
pegasus.c: eth0: D-Link DSB-650
...


And then my bootup script fails to mount the nfs partition, etc since it
can't find the network.

I tried modifying the delay time in net/ipv4/ipconfig.c under the "Give
hardware a chance to settle" comment, but apparently the USB connection
stuff is done after it tries to mount root, etc. (Is that a separate
kernel thread? Can it be started sooner?)

Is there any way to get the USB network device recognized before IP
autoconfig is executed?


Please reply directly, since I'm not subscribed. Thanks.



2002-03-15 23:01:55

by Greg KH

[permalink] [raw]
Subject: Re: IP Autoconfig doesn't work for USB network devices

On Thu, Mar 14, 2002 at 08:29:54PM -0600, [email protected] wrote:
>
> Is there any way to get the USB network device recognized before IP
> autoconfig is executed?

You don't mention which kernel version you are using, what one are you
using?

You might try the patches mentioned in this thread:
http://marc.theaimsgroup.com/?l=linux-usb-devel&m=101501210231463
as it seems that the problem is your device is not seen by the USB
subsystem before the network code starts up.

greg k-h

2002-03-17 00:26:03

by rob1

[permalink] [raw]
Subject: Re: IP Autoconfig doesn't work for USB network devices

> You don't mention which kernel version you are using, what one are you
> using?

2.4.18.

I tried the suggestion in this thread:
http://marc.theaimsgroup.com/?l=linux-kernel&m=100912381726661&w=2

It made no difference. I also looked through the messages on
linux-usb-devel, but they seem to be more related to having USB floppies
or USB hard drives recognized, instead of network cards, which I believe
is my problem. The kernel decides that there aren't any network devices,
so it doesn't do IP autoconfiguration, which is how it does NFS root in my
case.

In the output while booting, after it says:

Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
VFS: Insert root floppy and press ENTER
hub.c: USB new device connect on bus2/1, assigned device number 2
pegasus.c: eth0: D-Link DSB-650


There is no perceptible delay between these messages, so it seems like the
code to detect the USB devices executes after the IP autoconfig section,
which is what is preventing this from working.

Is this a topic that should be discussed on one of the linux-usb lists
instead of linux-kernel?

Thanks.


On Fri, 15 Mar 2002, Greg KH wrote:

> On Thu, Mar 14, 2002 at 08:29:54PM -0600, [email protected] wrote:
> >
> > Is there any way to get the USB network device recognized before IP
> > autoconfig is executed?
>
> You don't mention which kernel version you are using, what one are you
> using?
>
> You might try the patches mentioned in this thread:
> http://marc.theaimsgroup.com/?l=linux-usb-devel&m=101501210231463
> as it seems that the problem is your device is not seen by the USB
> subsystem before the network code starts up.
>
> greg k-h
>

2002-03-19 00:58:07

by Greg KH

[permalink] [raw]
Subject: Re: IP Autoconfig doesn't work for USB network devices

On Sat, Mar 16, 2002 at 06:25:30PM -0600, [email protected] wrote:
>
> There is no perceptible delay between these messages, so it seems like the
> code to detect the USB devices executes after the IP autoconfig section,
> which is what is preventing this from working.

It looks like you need to move the delay section of that patch, possibly
changing the logic in the IP autoconfig section to delay until your
device shows up on the USB bus.

> Is this a topic that should be discussed on one of the linux-usb lists
> instead of linux-kernel?

I think this a good enough place for it, as it isn't very specific to a
USB subsystem problem.

greg k-h

2002-03-19 23:29:35

by Eric Lammerts

[permalink] [raw]
Subject: Re: IP Autoconfig doesn't work for USB network devices


On Sat, 16 Mar 2002 [email protected] wrote:
> I tried the suggestion in this thread:
> http://marc.theaimsgroup.com/?l=linux-kernel&m=100912381726661&w=2
>
> It made no difference. I also looked through the messages on
> linux-usb-devel, but they seem to be more related to having USB floppies
> or USB hard drives recognized, instead of network cards, which I believe
> is my problem.

That's right. I made a separate patch for USB (or other hotplug)
network cards (see below).

Eric


--- linux-2.4.9-ac7/net/ipv4/ipconfig.c.orig Wed May 2 05:59:24 2001
+++ linux-2.4.9-ac7/net/ipv4/ipconfig.c Tue Sep 18 17:16:07 2001
@@ -80,6 +80,8 @@
#define CONF_PRE_OPEN (HZ/2) /* Before opening: 1/2 second */
#define CONF_POST_OPEN (1*HZ) /* After opening: 1 second */

+#define CONF_DEV_WAIT (1*HZ)
+
/* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */
#define CONF_OPEN_RETRIES 2 /* (Re)open devices twice */
#define CONF_SEND_RETRIES 6 /* Send six requests per open */
@@ -1105,8 +1107,20 @@
;

/* Setup all network devices */
- if (ic_open_devs() < 0)
+ while (ic_open_devs() < 0) {
+#ifdef CONFIG_ROOT_NFS
+ if (ROOT_DEV == MKDEV(UNNAMED_MAJOR, 255)) {
+ printk(KERN_ERR
+ "IP-Config: Retrying forever (NFS root)...\n");
+
+ // wait a while and try again
+ current->state = TASK_INTERRUPTIBLE;
+ schedule_timeout(CONF_DEV_WAIT);
+ continue;
+ }
+#endif
return -1;
+ }

/* Give drivers a chance to settle */
jiff = jiffies + CONF_POST_OPEN;