NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/40949: cdce0 does not support suspend/resume



>Number:         40949
>Category:       kern
>Synopsis:       cdce0 does not support suspend/resume
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 04 00:40:00 +0000 2009
>Originator:     Pierre Pronchery
>Release:        5.0_RC2
>Organization:
>Environment:
NetBSD syn.defora.rom 5.0_RC2 NetBSD 5.0_RC2 (GENERIC) #20: Wed Mar  4 01:06:19 
CET 2009  
khorben%syn.defora.rom@localhost:/usr/obj/sys/arch/amd64/compile/GENERIC amd64
>Description:
This is done using an Openmoko Freerunner, connected to my NetBSD laptop 
running 5.0_RC2 with the patch from PR 40049. The laptop is a Lenovo T60 2007 
(using the amd64 port).

With the patch mentioned above and after configuring cdce0 correctly as it 
appears (either manually or via ifwatchd), I am successfully using an SSH 
channel to the Freerunner:

cdce0 at uhub2 port 1 configuration 1 interface 0
cdce0: Linux 2.6.28-20090105.git69b2aa26 with s3c2410_ud RNDIS/Ethernet Gadget, 
rev 2.00/3.12, addr 2
cdce0: faking address
cdce0: address 2a:43:25:00:00:00

cdce0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        address: 2a:43:25:00:00:00
        inet 192.168.0.200 netmask 0xffffff00 broadcast 192.168.0.255

However, after adding a simple call to pmf_device_register(NULL, NULL) to allow 
a suspend/resume cycle (machdep.sleep_state=3), the laptop hangs with these 
messages:

ioapic0 reenabling
cdce0: usb error on rx:IOERROR
[then after a few minutes ugen0 and cdce0 disconnect, cbb0 is interrupting 
again, aps0 fails to wake up, and my patience is exhausted]

Breaking into ddb gives:
lapic_delay() ... +0x6d
cdce_rxeof() ... +0x89
usb_transfer_complete() ... +0x1c4
uhci_softintr() ... +0x1c7

Then upon ddb reboot, cdce0 is automatically detached and the laptop reboots 
mostly normally (recurrent unrelated issue when flushing the cache).

I forced a detach operation on suspend and the laptop resumes correctly, with 
the cdce0 interface being attached again when resuming.
>How-To-Repeat:
- apply the patch from #40049 and pmf_device_register(NULL, NULL)
- plug the Openmoko Freerunner
- configure the interface
- suspend the machine through ACPI
- resume the machine and observe hangup
- patch as pasted below
- suspend and resume should work
>Fix:
Applying this additional patch seems to work:

Index: sys/dev/usb/if_cdce.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/if_cdce.c,v
retrieving revision 1.18
diff -p -u -r1.18 if_cdce.c
--- sys/dev/usb/if_cdce.c       24 Sep 2008 07:19:18 -0000      1.18
+++ sys/dev/usb/if_cdce.c       4 Mar 2009 00:13:49 -0000
@@ -116,6 +116,7 @@ Static void  cdce_init(void *);
 Static void     cdce_watchdog(struct ifnet *);
 Static void     cdce_stop(struct cdce_softc *);
 Static uint32_t         cdce_crc32(const void *, size_t);
+Static bool      cdce_suspend(device_t PMF_FN_PROTO);
 
 Static const struct cdce_type cdce_devs[] = {
   {{ USB_VENDOR_PROLIFIC, USB_PRODUCT_PROLIFIC_PL2501 }, CDCE_NO_UNION },
@@ -267,6 +301,9 @@ USB_ATTACH(cdce)
        sc->cdce_attached = 1;
        splx(s);
 
+       if(!pmf_device_register(self, cdce_suspend, NULL))
+               aprint_error_dev(self, "couldn't establish power handler\n");
+
        usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->cdce_udev,
            USBDEV(sc->cdce_dev));
 
@@ -836,3 +873,11 @@ cdce_crc32(const void *buf, size_t size)
 
        return (crc ^ ~0U);
 }
+
+
+Static bool
+cdce_suspend(device_t dev PMF_FN_ARGS)
+{
+       cdce_detach(dev, 0);
+       return true;
+}



Home | Main Index | Thread Index | Old Index