Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Sep 2003 00:42:14 +0100
From:      Ian Dowse <iedowse@maths.tcd.ie>
To:        Andrew Thomas <ath101a@yahoo.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Multiple USB ethernet devices on one usb port (with hub)? 
Message-ID:  <200309250042.aa09623@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Tue, 23 Sep 2003 22:56:42 PDT." <20030924055642.73347.qmail@web20713.mail.yahoo.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20030924055642.73347.qmail@web20713.mail.yahoo.com>, Andrew Thomas 
writes:
>I've got an older Dell Latitude (CPi) laptop that I'm trying to
>setup as a router/firewall/??? machine.  I'm using 5.1-R with a
>compiled kernel that I'm slowly reducing to the minimum I need.
>
>I decided to try using usb ethernet adapters since they seemed
>so easy.  However, the laptop only has one usb port.  So, I
>picked up a cheap 4 port hub so I could connect my two adapters
>(both netgear FA120 devices).
>
>The boot log shows that both devices are recognized.  However,
>only one gets configured properly (it gets an address and
>actually works).  The other adapter can't be configured (at
>boot time or on the command line).  This is whether the devices
>are plugged in before booting or after.  If I try to remove
>either of them after booting I usually get a kernel panic and
>a reboot.
>
>Am I trying to do something that can't be done (do I need two
>physical ports on the machine for this to work)?  Is this
>merely a bug in 5.1 that would be fixed if I go to 'CURRENT'?
>Does anyone have any comments?  For completeness I'm appending
>the relevant lines from my config.
>
>Any help would be appreciated.

There is definitely one problem that stops you from using two
identical USB ethernet devices, but I don't know if it's the only
one: the "axe" driver uses a static (global) stucture for some
per-interface data, so it clobbers this state with two interfaces.

I had said to Bill Paul (cc'd) that I would suggest a patch to fix
this, but I never managed to get my two USB ethernet interfaces in
the same place at the same time to test them! Would you be able to
try out the following patch to see if it helps? Just apply it in
/usr/src and rebuild the kernel.

Thanks,

Ian

Index: sys/dev/usb/if_axe.c
===================================================================
RCS file: /dump/FreeBSD-CVS/src/sys/dev/usb/if_axe.c,v
retrieving revision 1.7
diff -u -r1.7 if_axe.c
--- sys/dev/usb/if_axe.c	24 Aug 2003 17:55:54 -0000	1.7
+++ sys/dev/usb/if_axe.c	24 Sep 2003 23:26:45 -0000
@@ -118,8 +118,6 @@
 	{ 0, 0 }
 };
 
-Static struct usb_qdat axe_qdat;
-
 Static int axe_match(device_ptr_t);
 Static int axe_attach(device_ptr_t);
 Static int axe_detach(device_ptr_t);
@@ -521,8 +519,8 @@
 	ifp->if_baudrate = 10000000;
 	ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
 
-	axe_qdat.ifp = ifp;
-	axe_qdat.if_rxstart = axe_rxstart;
+	sc->axe_qdat.ifp = ifp;
+	sc->axe_qdat.if_rxstart = axe_rxstart;
 
 	if (mii_phy_probe(self, &sc->axe_miibus,
 	    axe_ifmedia_upd, axe_ifmedia_sts)) {
@@ -724,7 +722,7 @@
 	}
 
 	ifp->if_ipackets++;
-	m->m_pkthdr.rcvif = (struct ifnet *)&axe_qdat;
+	m->m_pkthdr.rcvif = (struct ifnet *)&sc->axe_qdat;
 	m->m_pkthdr.len = m->m_len = total_len;
 
 	/* Put the packet on the special USB input queue. */
Index: sys/dev/usb/if_axereg.h
===================================================================
RCS file: /dump/FreeBSD-CVS/src/sys/dev/usb/if_axereg.h,v
retrieving revision 1.2
diff -u -r1.2 if_axereg.h
--- sys/dev/usb/if_axereg.h	15 Jun 2003 21:45:43 -0000	1.2
+++ sys/dev/usb/if_axereg.h	24 Sep 2003 23:25:52 -0000
@@ -168,6 +168,7 @@
 	unsigned char		axe_ipgs[3];
 	unsigned char 		axe_phyaddrs[2];
 	struct timeval		axe_rx_notice;
+	struct usb_qdat		axe_qdat;
 };
 
 #if 0



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200309250042.aa09623>