Skip to content

gadget ecm ether tx failed due to wakeup host failure #6831

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pswarfound opened this issue May 2, 2025 · 0 comments
Open

gadget ecm ether tx failed due to wakeup host failure #6831

pswarfound opened this issue May 2, 2025 · 0 comments

Comments

@pswarfound
Copy link

Describe the bug

file: drivers/usb/gadget/function/u_ether.c
function: eth_start_xmit

if (dev->port_usb && dev->port_usb->is_suspend) {
    DBG(dev, "Port suspended. Triggering wakeup\n");
    netif_stop_queue(net);
    spin_unlock_irqrestore(&dev->lock, flags);
     /*
               if failed to wake up host here, port_usb will always be suspending
              net core will put all packets in queue
              but will never be sent since port_usb is suspending
     */
    ether_wakeup_host(dev->port_usb); 
    return NETDEV_TX_BUSY;
}

according to function 'gether_suspend' in u_ether.c
i think we should handle failure when wakeup host in 'eth_start_xmit' too
may be like this:

if (dev->port_usb && dev->port_usb->is_suspend) {
    DBG(dev, "Port suspended. Triggering wakeup\n");
    if (!ether_wakeup_host(dev->port_usb)) {
        netif_stop_queue(net);
        spin_unlock_irqrestore(&dev->lock, flags);
    	return NETDEV_TX_BUSY;
    }
}

Steps to reproduce the behaviour

  • edit /boot/config.txt, add 'dtoverlay=dwc2,dr_mode=peripheral'
  • modprobe libcomposite
  • create mass storage and ecm network device
  • config ecm network in PI: ifconfig usb0 192.168.254.1 up
  • use bootable image such as ubuntu.iso for mass storage
  • connect type-c from pi to to another PC
  • power on PC and boot from disk emulated by PI
  • a usb network device should be found under PC, like enx******
  • config usb network in PC: ifconfig enx******192.168.254.1
  • check connection between PC and pi: ping 192.168.254.1
  • ping should failed
  • 'ifconfig usb0' in PI, only rx packet counters are increasing, tx counters are all zero

Device (s)

Raspberry Pi CM5

System

Linux raspberrypi 6.12.25

Logs

No response

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant