[zero v1.3] [dwc2] [g_ether] USB ethernet needs unplugging/replugging: dwc2_hsotg_ep_stop_xfr: timeout

Open
#4,181 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
c, linux

Research direction

Reproduce the Pi Zero setup using the listed Raspberry Pi OS image, dwc2 overlay, and g_ether or g_cdc modules. Start by examining the dwc2_hsotg_ep_stop_xfr timeout messages in dmesg and compare boot-time behavior with unplug/replug behavior. Done means USB ethernet works on initial boot without reconnecting the cable.

Written by the indexing model from the issue text.

Description

Describe the bug
USB gadget ethernet only works after unplugging and replugging. Or when pi zero is solely powered by USB port. This makes it impossible to set up a pi that's e.g. a networked camera, and is only powered using a single USB cable, as to get ethernet working USB needs un/replugging which would restart the pi.

Note: same behaviour with g_cdc instead of g_ether

To reproduce

  • Using 2021-01-11-raspios-buster-armhf-lite.img
  • Add dtoverlay=dwc2 to boot/config.txt, and to rootfs/ect/modules:
    dwc2
    g_ether
    
  • Add to rootfs/etc/dhcpcd.conf
  • interface usb0
    static ip_address=192.168.23.2/24
    
  • Create file boot/ssh
  • Power pi zero either just from USB port, or plug in USB and PWR at roughly the same time
  • Assign static IP 192.168.23.1/24 on host/computer
  • ping 192.168.23.2 or ssh pi@192.168.23.2 doesn't work
  • Unplug and replug USB port (if powering on from PWR also)
  • ping 192.168.23.2 and ssh pi@192.168.23.2 works, and dmesg has the following suspicious lines:
    [  172.392871] dwc2 20980000.usb: dwc2_hsotg_ep_stop_xfr: timeout GINTSTS.GOUTNAKEFF
    [  172.393014] dwc2 20980000.usb: dwc2_hsotg_ep_stop_xfr: timeout DOEPCTL.EPDisable
    [  172.393166] dwc2 20980000.usb: dwc2_hsotg_ep_stop_xfr: timeout GINTSTS.GOUTNAKEFF
    [  172.393297] dwc2 20980000.usb: dwc2_hsotg_ep_stop_xfr: timeout DOEPCTL.EPDisable
    [  172.442725] dwc2 20980000.usb: new device is high-speed
    [  172.556995] dwc2 20980000.usb: new device is high-speed
    [  172.620736] dwc2 20980000.usb: new address 2
    
    (I waited a while before unplug/replug so sure this only happened after, from timestamp)

Expected behaviour
USB ethernet works fine.

Actual behaviour
USB networking hangs.

System
Copy and paste the results of the raspinfo command in to this section. Alternatively, copy and paste a pastebin link, or add answers to the following questions:

  • Pi zero
pi@raspberrypi:~/rpi-mjpg-streamer $ cat /etc/rpi-issue
Raspberry Pi reference 2021-01-11
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 21090519d85bdaa1615d5d5057d37b09368ea5d2, stage2
pi@raspberrypi:~/rpi-mjpg-streamer $ vcgencmd version
Jan 27 2021 22:27:56
Copyright (c) 2012 Broadcom
version 99d9a48302e4553cff3688692bb7e9ac760a03fa (clean) (release) (start_x)
pi@raspberrypi:~/rpi-mjpg-streamer $ uname -a
Linux raspberrypi 5.10.11+ #1399 Thu Jan 28 12:02:28 GMT 2021 armv6l GNU/Linux

Also see logs below

Logs
raspinfo.txt
dmesg-1.txt

The raspinfo.txt is current boot, the dmesg-1.txt is a previous boot

Additional context
https://github.com/raspberrypi/linux/issues/2962 has similar timeout, but @maxnet didn't have problems with g_ether

Also, here is excepts from my computer's dmesg:

[14693.813960] cdc_ether 3-1:1.0 enp45s0f3u1: renamed from usb0
[14804.050114] usb 3-1: USB disconnect, device number 30
[14804.050186] cdc_ether 3-1:1.0 enp45s0f3u1: unregister 'cdc_ether' usb-0000:2d:00.3-1, CDC Ethernet Device
[14818.231505] usb 3-1: new full-speed USB device number 31 using xhci_hcd
[14818.782552] usb 3-1: new high-speed USB device number 32 using xhci_hcd
[14818.912355] usb 3-1: New USB device found, idVendor=0525, idProduct=a4a2, bcdDevice= 5.10
[14818.912357] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[14818.912357] usb 3-1: Product: RNDIS/Ethernet Gadget
[14818.912358] usb 3-1: Manufacturer: Linux 5.10.11+ with 20980000.usb
[14818.962691] cdc_ether 3-1:1.0 usb0: register 'cdc_ether' at usb-0000:2d:00.3-1, CDC Ethernet Device, 7e:b0:1d:c8:e8:c9
[14818.975966] cdc_ether 3-1:1.0 enp45s0f3u1: renamed from usb0
[15018.040625] usb 3-1: USB disconnect, device number 32
[15018.040687] cdc_ether 3-1:1.0 enp45s0f3u1: unregister 'cdc_ether' usb-0000:2d:00.3-1, CDC Ethernet Device
[15101.190201] usb 3-1: new full-speed USB device number 33 using xhci_hcd
[15101.910225] usb 3-1: new high-speed USB device number 34 using xhci_hcd
[15102.040228] usb 3-1: New USB device found, idVendor=0525, idProduct=a4a2, bcdDevice= 5.10
[15102.040229] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[15102.040230] usb 3-1: Product: RNDIS/Ethernet Gadget
[15102.040231] usb 3-1: Manufacturer: Linux 5.10.11+ with 20980000.usb
[15102.098841] cdc_ether 3-1:1.0 usb0: register 'cdc_ether' at usb-0000:2d:00.3-1, CDC Ethernet Device, 4a:2c:8a:eb:76:29
[15102.101879] cdc_ether 3-1:1.0 enp45s0f3u1: renamed from usb0
[15263.935632] usb 3-1: USB disconnect, device number 34
[15263.935706] cdc_ether 3-1:1.0 enp45s0f3u1: unregister 'cdc_ether' usb-0000:2d:00.3-1, CDC Ethernet Device
[15265.146075] usb 3-1: new high-speed USB device number 35 using xhci_hcd
[15265.275855] usb 3-1: New USB device found, idVendor=0525, idProduct=a4a2, bcdDevice= 5.10
[15265.275857] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[15265.275858] usb 3-1: Product: RNDIS/Ethernet Gadget
[15265.275859] usb 3-1: Manufacturer: Linux 5.10.11+ with 20980000.usb
[15265.330698] cdc_ether 3-1:1.0 usb0: register 'cdc_ether' at usb-0000:2d:00.3-1, CDC Ethernet Device, 4a:2c:8a:eb:76:29
[15265.333295] cdc_ether 3-1:1.0 enp45s0f3u1: renamed from usb0
[15458.113253] usb 3-1: USB disconnect, device number 35
[15458.113328] cdc_ether 3-1:1.0 enp45s0f3u1: unregister 'cdc_ether' usb-0000:2d:00.3-1, CDC Ethernet Device
[15471.484584] usb 3-1: new full-speed USB device number 36 using xhci_hcd
[15472.124530] usb 3-1: new high-speed USB device number 37 using xhci_hcd
[15472.254338] usb 3-1: New USB device found, idVendor=0525, idProduct=a4a2, bcdDevice= 5.10
[15472.254339] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[15472.254339] usb 3-1: Product: RNDIS/Ethernet Gadget
[15472.254340] usb 3-1: Manufacturer: Linux 5.10.11+ with 20980000.usb
[15472.306699] cdc_ether 3-1:1.0 usb0: register 'cdc_ether' at usb-0000:2d:00.3-1, CDC Ethernet Device, fa:22:94:c1:8b:9d
[15472.309710] cdc_ether 3-1:1.0 enp45s0f3u1: renamed from usb0
[15860.877880] usb 3-1: USB disconnect, device number 37
[15860.877953] cdc_ether 3-1:1.0 enp45s0f3u1: unregister 'cdc_ether' usb-0000:2d:00.3-1, CDC Ethernet Device
[15861.911859] usb 3-1: new high-speed USB device number 38 using xhci_hcd
[15862.041713] usb 3-1: New USB device found, idVendor=0525, idProduct=a4a2, bcdDevice= 5.10
[15862.041715] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[15862.041716] usb 3-1: Product: RNDIS/Ethernet Gadget
[15862.041717] usb 3-1: Manufacturer: Linux 5.10.11+ with 20980000.usb
[15862.098698] cdc_ether 3-1:1.0 usb0: register 'cdc_ether' at usb-0000:2d:00.3-1, CDC Ethernet Device, fa:22:94:c1:8b:9d
[15862.101445] cdc_ether 3-1:1.0 enp45s0f3u1: renamed from usb0
Dominant language
C
Stars
13.2k
Forks
5.5k
Avg merge
2d 21h
Merged PRs (30d)
21

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/linux

All issues in raspberrypi/linux

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.