public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: u_ether: Continue to send skbs if remote wakeup fails
@ 2025-05-02 14:53 zhilin.yang
  2025-05-03 12:30 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: zhilin.yang @ 2025-05-02 14:53 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, linux-kernel, zhilin.yang

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(-)

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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-05-05  8:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-02 14:53 [PATCH] usb: gadget: u_ether: Continue to send skbs if remote wakeup fails zhilin.yang
2025-05-03 12:30 ` Greg KH
2025-05-03 14:19   ` Zhilin Yang
2025-05-05  4:32     ` Prashanth K
     [not found]       ` <9debf9b.86d42.1969ee3e6c8.Coremail.zlyang_001@163.com>
2025-05-05  8:53         ` Prashanth K

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox