diff mbox series

usb: gadget: u_ether: Continue to send skbs if remote wakeup fails

Message ID 20250502145352.557174-1-zlyang_001@163.com
State Superseded
Headers show
Series usb: gadget: u_ether: Continue to send skbs if remote wakeup fails | expand

Commit Message

Zhilin Yang May 2, 2025, 2:53 p.m. UTC
While UDC suspends, u_ether attempts to remote wakeup
the host if there are any pending transfers. If there are no
pending transfers, the is_suspend flag is set. If the is_suspend
flag is set, it attempts to remote wakeup the host when start to
send skbs. However, if host does not support remote wakeup, skbs
will never be sent.

To fix this, stop to queue skbs and return NETDEV_TX_BUSY only if
remote wakeup operation is successful.

Signed-off-by: zhilin.yang <zlyang_001@163.com>
---
 drivers/usb/gadget/function/u_ether.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Greg Kroah-Hartman May 3, 2025, 12:30 p.m. UTC | #1
On Fri, May 02, 2025 at 10:53:52PM +0800, zhilin.yang wrote:
> While UDC suspends, u_ether attempts to remote wakeup
> the host if there are any pending transfers. If there are no
> pending transfers, the is_suspend flag is set. If the is_suspend
> flag is set, it attempts to remote wakeup the host when start to
> send skbs. However, if host does not support remote wakeup, skbs
> will never be sent.

Please properly wrap your changelog at 72 columns.

> To fix this, stop to queue skbs and return NETDEV_TX_BUSY only if
> remote wakeup operation is successful.
> 
> Signed-off-by: zhilin.yang <zlyang_001@163.com>

Please use your name, which I doubt has a "." in it, right?  :)

Also, what git commit id does this fix?

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
index f58590bf5..9d746ed3f 100644
--- a/drivers/usb/gadget/function/u_ether.c
+++ b/drivers/usb/gadget/function/u_ether.c
@@ -473,10 +473,11 @@  static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
 
 	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);
-		ether_wakeup_host(dev->port_usb);
-		return NETDEV_TX_BUSY;
+		if (!ether_wakeup_host(dev->port_usb)) {
+			netif_stop_queue(net);
+			spin_unlock_irqrestore(&dev->lock, flags);
+			return NETDEV_TX_BUSY;
+		}
 	}
 
 	spin_unlock_irqrestore(&dev->lock, flags);