From: Prashanth K <prashanth.k@oss.qualcomm.com>
To: Zhilin Yang <zlyang_001@163.com>, gregkh@linuxfoundation.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: u_ether: Continue to send skbs if remote wakeup fails
Date: Mon, 5 May 2025 10:02:05 +0530 [thread overview]
Message-ID: <f177cbd3-dbcd-4487-ae9f-25c656dc1572@oss.qualcomm.com> (raw)
In-Reply-To: <20250503141958.584143-1-zlyang_001@163.com>
On 03-05-25 07:49 pm, 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
> wakeup the host when start to transmit skbs. However, if wakeup fails,
> for example, wakeup is not supported, skbs will never be sent.
>
AFAIK, we shouldn't send any data over the bus until host resumes UDC.
So either the remote wakeup has to be successful here, or we need to
remain suspended until resume signal comes.
And the SKB won't be lost here since we return NETDEV_TX_BUSY, and
gether_resume() calls netif_start_queue() which starts tx again.
> To fix this, stop to queue skbs and return NETDEV_TX_BUSY only if remote
> wakeup operation is successful.
>
> Fixes: 17c2c87c3786 ("usb: gadget: u_ether: Set is_suspend flag if remote wakeup fails")
Is it really "fixing" the above commit?
> 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 f58590bf5e02..9d746ed3f072 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);
Regards,
Prashanth K
next prev parent reply other threads:[~2025-05-05 4:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
[not found] ` <9debf9b.86d42.1969ee3e6c8.Coremail.zlyang_001@163.com>
2025-05-05 8:53 ` Prashanth K
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f177cbd3-dbcd-4487-ae9f-25c656dc1572@oss.qualcomm.com \
--to=prashanth.k@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=zlyang_001@163.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox