NetBSD Problem Report #37653
From scotte@intrepid.warped.com Mon Dec 31 17:38:33 2007
Return-Path: <scotte@intrepid.warped.com>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id 4F01163BD92
for <gnats-bugs@gnats.NetBSD.org>; Mon, 31 Dec 2007 17:38:33 +0000 (UTC)
Message-Id: <E1J9Oas-0000du-Kd@intrepid.warped.com>
Date: Mon, 31 Dec 2007 09:38:30 -0800
From: scotte@warped.com
Sender: "Scott Ellis,,," <scotte@intrepid.warped.com>
Reply-To: scotte@warped.com
To: gnats-bugs@NetBSD.org
Subject: cdce fails with iPaq Linux
X-Send-Pr-Version: 3.95
>Number: 37653
>Category: kern
>Synopsis: Using cdce to communicate with an iPaq running iPaq Linux (ala Familiar) fails with llinfo allocation error
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Dec 31 17:40:00 +0000 2007
>Closed-Date: Mon Aug 05 17:41:29 +0000 2019
>Last-Modified: Mon Aug 05 17:41:29 +0000 2019
>Originator: Scott Ellis
>Release: NetBSD 4.99.44
>Organization:
>Environment:
System: NetBSD intrepid 4.99.44 NetBSD 4.99.44 (INTREPID.P5W) #0: Sat Dec 22 09:15:05 PST 2007 scotte@intrepid:/nbu/source/netbsd/src/obj.amd64/nbu/source/netbsd/src/sys/arch/amd64/compile/INTREPID.P5W amd64
Architecture: x86_64
Machine: amd64
>Description:
Attaching an iPaq running the Familiar (handhelds.org) distribution to a NetBSD
system, and attempting to communicate via cdce(4) fails. First, it fails to
attach cdce to the interface, instead getting ugen. This is easily correctable.
Next, when doing an 'ifconfig cdce0 up', the system reports it "can't allocate
llinfo on cdce0". This is less trivial to fix.
The net result is that the device is unable to communicate.
>How-To-Repeat:
Connect iPaq Linux based device (using SA1110 peripheral controller) to a
NetBSD system using USB. Note that cdce is not attached. Change if_cdce.c to
allow attachment, and re-attach iPaq. Note that attempting to use the cdce0
device fails with the aforementioned error.
>Fix:
A partial fix is listen in kern/36592. I've updated it for -current, and added
the correct entries so that cdce will match the SA1110 peripheral controller.
The diff against $NetBSD: if_cdce.c,v 1.14 2007/03/13 13:51:54 drochner Exp $
is shown below:
--- /usr/src/sys/dev/usb/if_cdce.c.orig 2007-12-29 09:48:41.000000000 -0800
+++ if_cdce.c.scotte_ipaqlinux 2007-12-29 11:33:03.000000000 -0800
@@ -109,9 +109,9 @@
Static void cdce_txeof(usbd_xfer_handle, usbd_private_handle, usbd_status);
Static void cdce_start(struct ifnet *);
Static int cdce_ioctl(struct ifnet *, u_long, void *);
-Static void cdce_init(void *);
+Static int cdce_init(struct ifnet *);
Static void cdce_watchdog(struct ifnet *);
-Static void cdce_stop(struct cdce_softc *);
+Static void cdce_stop(struct ifnet *, int);
Static uint32_t cdce_crc32(const void *, size_t);
Static const struct cdce_type cdce_devs[] = {
@@ -450,42 +450,11 @@
s = splnet();
switch(command) {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
- cdce_init(sc);
- switch (ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET:
-#if defined(__NetBSD__)
- arp_ifinit(ifp, ifa);
-#else
- arp_ifinit(&sc->arpcom, ifa);
-#endif
- break;
-#endif /* INET */
- }
- break;
-
- case SIOCSIFMTU:
- if (ifr->ifr_mtu > ETHERMTU)
- error = EINVAL;
- else
- ifp->if_mtu = ifr->ifr_mtu;
- break;
-
- case SIOCSIFFLAGS:
- if (ifp->if_flags & IFF_UP) {
- if (!(ifp->if_flags & IFF_RUNNING))
- cdce_init(sc);
- } else {
- if (ifp->if_flags & IFF_RUNNING)
- cdce_stop(sc);
- }
- error = 0;
- break;
-
default:
- error = EINVAL;
+ error = ether_ioctl(ifp, command, data);
+ if (error == ENETRESET) {
+ error = 0;
+ }
break;
}
@@ -506,30 +475,29 @@
printf("%s: watchdog timeout\n", USBDEVNAME(sc->cdce_dev));
}
-Static void
-cdce_init(void *xsc)
+Static int
+cdce_init(struct ifnet *ifp)
{
- struct cdce_softc *sc = xsc;
- struct ifnet *ifp = GET_IFP(sc);
+ struct cdce_softc *sc = ifp->if_softc;
struct cdce_chain *c;
usbd_status err;
int s, i;
if (ifp->if_flags & IFF_RUNNING)
- return;
+ return (EIO);
s = splnet();
if (cdce_tx_list_init(sc) == ENOBUFS) {
printf("%s: tx list init failed\n", USBDEVNAME(sc->cdce_dev));
splx(s);
- return;
+ return (ENOMEM);
}
if (cdce_rx_list_init(sc) == ENOBUFS) {
printf("%s: rx list init failed\n", USBDEVNAME(sc->cdce_dev));
splx(s);
- return;
+ return (ENOMEM);
}
/* Maybe set multicast / broadcast here??? */
@@ -564,6 +532,8 @@
ifp->if_flags &= ~IFF_OACTIVE;
splx(s);
+
+ return (0);
}
Static int
>Release-Note:
>Audit-Trail:
From: Scott Ellis <scotte@warped.com>
To: gnats-bugs@NetBSD.org
Cc: netbsd-bugs@netbsd.org
Subject: Re: kern/37653: cdce fails with iPaq Linux
Date: Mon, 31 Dec 2007 10:02:40 -0800
This is a multi-part message in MIME format.
--------------030103050502070606030901
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Wrong diff was attahed to the original PR. Attached below is the
correct diff.
--------------030103050502070606030901
Content-Type: text/plain;
name="if_cdce.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="if_cdce.c.diff"
--- if_cdce.c 2007-12-31 10:00:00.000000000 -0800
+++ /home/scotte/if_cdce.c.scotte_ipaqlinux 2007-12-29 11:33:03.000000000 -0800
@@ -109,9 +109,9 @@
Static void cdce_txeof(usbd_xfer_handle, usbd_private_handle, usbd_status);
Static void cdce_start(struct ifnet *);
Static int cdce_ioctl(struct ifnet *, u_long, void *);
-Static void cdce_init(void *);
+Static int cdce_init(struct ifnet *);
Static void cdce_watchdog(struct ifnet *);
-Static void cdce_stop(struct cdce_softc *);
+Static void cdce_stop(struct ifnet *, int);
Static uint32_t cdce_crc32(const void *, size_t);
Static const struct cdce_type cdce_devs[] = {
@@ -121,6 +121,7 @@
{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SL5600 }, CDCE_ZAURUS | CDCE_NO_UNION },
{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_C700 }, CDCE_ZAURUS | CDCE_NO_UNION },
{{ USB_VENDOR_SHARP, USB_PRODUCT_SHARP_C750 }, CDCE_ZAURUS | CDCE_NO_UNION },
+ {{ USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQLINUX }, CDCE_NO_UNION },
};
#define cdce_lookup(v, p) ((const struct cdce_type *)usb_lookup(cdce_devs, v, p))
@@ -272,6 +273,8 @@
ifp->if_ioctl = cdce_ioctl;
ifp->if_start = cdce_start;
ifp->if_watchdog = cdce_watchdog;
+ ifp->if_init = cdce_init;
+ ifp->if_stop = cdce_stop;
strncpy(ifp->if_xname, USBDEVNAME(sc->cdce_dev), IFNAMSIZ);
IFQ_SET_READY(&ifp->if_snd);
@@ -302,7 +305,7 @@
}
if (ifp->if_flags & IFF_RUNNING)
- cdce_stop(sc);
+ cdce_stop(ifp, 1);
ether_ifdetach(ifp);
@@ -368,7 +371,7 @@
m->m_pkthdr.len + extra, USBD_NO_COPY, 10000, cdce_txeof);
err = usbd_transfer(c->cdce_xfer);
if (err != USBD_IN_PROGRESS) {
- cdce_stop(sc);
+ cdce_stop(GET_IFP(sc), 0);
return (EIO);
}
@@ -378,10 +381,10 @@
}
Static void
-cdce_stop(struct cdce_softc *sc)
+cdce_stop(struct ifnet *ifp, int disable)
{
+ struct cdce_softc *sc = ifp->if_softc;
usbd_status err;
- struct ifnet *ifp = GET_IFP(sc);
int i;
ifp->if_timer = 0;
@@ -439,8 +442,6 @@
cdce_ioctl(struct ifnet *ifp, u_long command, void *data)
{
struct cdce_softc *sc = ifp->if_softc;
- struct ifaddr *ifa = (struct ifaddr *)data;
- struct ifreq *ifr = (struct ifreq *)data;
int s, error = 0;
if (sc->cdce_dying)
@@ -449,42 +450,11 @@
s = splnet();
switch(command) {
- case SIOCSIFADDR:
- ifp->if_flags |= IFF_UP;
- cdce_init(sc);
- switch (ifa->ifa_addr->sa_family) {
-#ifdef INET
- case AF_INET:
-#if defined(__NetBSD__)
- arp_ifinit(ifp, ifa);
-#else
- arp_ifinit(&sc->arpcom, ifa);
-#endif
- break;
-#endif /* INET */
- }
- break;
-
- case SIOCSIFMTU:
- if (ifr->ifr_mtu > ETHERMTU)
- error = EINVAL;
- else
- ifp->if_mtu = ifr->ifr_mtu;
- break;
-
- case SIOCSIFFLAGS:
- if (ifp->if_flags & IFF_UP) {
- if (!(ifp->if_flags & IFF_RUNNING))
- cdce_init(sc);
- } else {
- if (ifp->if_flags & IFF_RUNNING)
- cdce_stop(sc);
- }
- error = 0;
- break;
-
default:
- error = EINVAL;
+ error = ether_ioctl(ifp, command, data);
+ if (error == ENETRESET) {
+ error = 0;
+ }
break;
}
@@ -505,30 +475,29 @@
printf("%s: watchdog timeout\n", USBDEVNAME(sc->cdce_dev));
}
-Static void
-cdce_init(void *xsc)
+Static int
+cdce_init(struct ifnet *ifp)
{
- struct cdce_softc *sc = xsc;
- struct ifnet *ifp = GET_IFP(sc);
+ struct cdce_softc *sc = ifp->if_softc;
struct cdce_chain *c;
usbd_status err;
int s, i;
if (ifp->if_flags & IFF_RUNNING)
- return;
+ return (EIO);
s = splnet();
if (cdce_tx_list_init(sc) == ENOBUFS) {
printf("%s: tx list init failed\n", USBDEVNAME(sc->cdce_dev));
splx(s);
- return;
+ return (ENOMEM);
}
if (cdce_rx_list_init(sc) == ENOBUFS) {
printf("%s: rx list init failed\n", USBDEVNAME(sc->cdce_dev));
splx(s);
- return;
+ return (ENOMEM);
}
/* Maybe set multicast / broadcast here??? */
@@ -539,7 +508,7 @@
printf("%s: open rx pipe failed: %s\n", USBDEVNAME(sc->cdce_dev),
usbd_errstr(err));
splx(s);
- return;
+ return (EIO);
}
err = usbd_open_pipe(sc->cdce_data_iface, sc->cdce_bulkout_no,
@@ -548,7 +517,7 @@
printf("%s: open tx pipe failed: %s\n", USBDEVNAME(sc->cdce_dev),
usbd_errstr(err));
splx(s);
- return;
+ return (EIO);
}
for (i = 0; i < CDCE_RX_LIST_CNT; i++) {
@@ -563,6 +532,8 @@
ifp->if_flags &= ~IFF_OACTIVE;
splx(s);
+
+ return (0);
}
Static int
--------------030103050502070606030901--
State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 30 Nov 2008 08:04:50 +0000
State-Changed-Why:
According to 36592, this is fixed in 5.0_BETA and in current, so I have two
questions: (1) does it also work with your HW? and (2) can you find where
the fix was committed?
From: Scott Ellis <scotte@warped.com>
To: gnats-bugs@gnats.netbsd.org
Cc: dholland@NetBSD.org
Subject: Re: kern/37653 - serious low priority sw-bug
Date: Sun, 14 Dec 2008 07:50:42 -0800
Unfortunately, this is still broken in -current. Adding:
{{ USB_VENDOR_COMPAQ, USB_PRODUCT_COMPAQ_IPAQLINUX }, CDCE_NO_UNION }
to if_cdce.c allows the iPaq to be attached:
cdce0: vendor 0x49f SA110 USB NIC, rev 1.00/0.00, addr2
cdce0: faking address
cdce0: address 2a:f6:60:01:00:00
Upon ifconfig'ing an IPv4 address for it, I still get:
cdce0: cannot assign link-local address
Blindly pushing ahead, any attempt to communicate using that NIC (e.g.,
ping the iPaq on the other end of the wire) yields:
cdce0: usb error on rx: STALLED
cdce0: at uhub0 port 1 (addr 2) disconnected
cdce0: detached
So it seems the change doesn't fix my issue.
ScottE
State-Changed-From-To: feedback->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 29 Dec 2008 10:02:09 +0000
State-Changed-Why:
Feedback received; still broken.
State-Changed-From-To: open->feedback
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Sun, 28 Jul 2019 20:38:32 +0000
State-Changed-Why:
others using cdce(4) are successful lately, in netbsd 5.0 and newer,
without the proposed patch in this PR applied (also similar to the one
in PR 36592.)
Scott, if you still have it, can you test the ipaq? :) thanks.
From: Scott Ellis <scotte@warped.com>
To: gnats-bugs@gnats.netbsd.org
Cc:
Subject: Re: kern/37653
Date: Mon, 5 Aug 2019 09:32:27 -0700
Didn't realize this was still open!
I don't have the ipaq anymore to test with.
State-Changed-From-To: feedback->closed
State-Changed-By: maya@NetBSD.org
State-Changed-When: Mon, 05 Aug 2019 17:41:29 +0000
State-Changed-Why:
submitter cannot test, and it works for others - assuming fixed.
thanks for the swift reply.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.