Re: [PATCH] usb: gadget: f_ncm: restart the TX timer if the TX freelist is empty
From: Vladyslav Tymoshchuk
Date: Mon Oct 26 2026 - 08:50:50 EST
On Mon, Aug 17, 2026 at 10:26:38PM +0300, Cosmin Tanislav wrote:
> Under sustained TX saturation the request freelist is empty most of the
> time. Since the timer is never restarted, small packets keep getting
> accumulated into the NTB, until either TX_MAX_NUM_DPE packets are stored
> or NTB_DEFAULT_IN_SIZE is reached, which is an unknown amount of time.
I hit this on a OnePlus Pad 3 (SM8750, dwc3, high speed to a Windows 11
host, qmult 5). Pulling 20 MB from the gadget over ssh stalled for 40 s
or more in 2 of 24 runs, and most of the other runs took ~6 s instead of
~1 s. During a stall the sender kept retransmitting, the qdisc backlog
was empty, tx_packets did not move and the ep1in TRB ring had nothing
owned by the controller, so the frames were sitting in the pending NTB.
With this patch on top of v7.3-rc5: 24 of 24 runs at ~0.9 s, no stalls.
Host to gadget is unchanged.
Francesco Lavra posted the same fix in July [1], but without the
hrtimer_forward_now(), so the timer would fire again right away.
[1] https://lore.kernel.org/linux-usb/20260727165441.1969927-1-flavra@xxxxxxxxxxxx/
Tested-by: Vladyslav Tymoshchuk <tvlad744@xxxxxxxxx>