Re: [PATCH] net: usb: r8152: fix transmit queue timeout
From: lu lu
Date: Fri Jan 16 2026 - 02:30:17 EST
Hayes Wang <hayeswang@xxxxxxxxxxx> 于2026年1月16日周五 11:11写道:
>
> lu lu <insyelu@xxxxxxxxx>
> > Sent: Friday, January 16, 2026 10:11 AM
> [...]
> > > netif_tx_lock(tp->netdev);
> > >
> > > - if (netif_queue_stopped(tp->netdev) &&
> > > - skb_queue_len(&tp->tx_queue) < tp->tx_qlen)
> > > + if (netif_queue_stopped(tp->netdev)) {
> > > + if (skb_queue_len(&tp->tx_queue) < tp->tx_qlen)
> > > netif_wake_queue(tp->netdev);
> > > + else
> > > + netif_trans_update(tp->netdev);
> > > + }
> > The queue was stopped because it exceeded the threshold. Attempting to
> > refresh the time at this point is clearly too late.
>
> Why would this be considered too late?
if (netif_queue_stopped(tp->netdev)) {
if (skb_queue_len(&tp->tx_queue) < tp->tx_qlen)
netif_wake_queue(tp->netdev);
else
netif_trans_update(tp->netdev);
}
The first time xmit stops the transmit queue, the queue is not full,
and it is successfully woken up afterward — OK.
The second time xmit stops the transmit queue, the network watchdog
times out immediately because the transmit timestamp was not refreshed
when the queue was last resumed — FAIL.
This scenario is logically possible.
There is no clear evidence that netif_trans_update imposes a
significant CPU load.
Please help me review:
https://patchwork.kernel.org/project/linux-usb/patch/20260116023725.8095-1-insyelu@xxxxxxxxx
> Based on RTL8152_TX_TIMEOUT, there are about 5 seconds to
> wake the queue or update the timestamp before a TX timeout occurs.
> I believe 5 seconds should be sufficient.
>
> If there is no TX submission for 5 seconds after the driver stops the queue,
> then something is already wrong.
>
> Best Regards,
> Hayes
>