Repository navigation
Conversation
ncm_wrap_ntb() only starts task_timer when it begins a new NTB, and ncm_tx_timeout() then flushes the pending NTB by calling eth_start_xmit() with a NULL skb. If all IN requests are in flight at that moment, eth_start_xmit() finds tx_reqs empty and returns NETDEV_TX_BUSY; the timer is not restarted, so the partly filled NTB stays queued until enough frames arrive to fill it (TX_MAX_NUM_DPE datagrams or the NTB size). With an NFS root over NCM this happened a few hundred times per boot after traffic bursts and stalled device->host traffic for 0.5-27 s (ping replies held back and delivered together, "nfs: server not responding"); when no further frames arrive, the NTB is never sent. Restart the timer when the flush gets NETDEV_TX_BUSY, unless the port is suspended (eth_start_xmit() then returns busy while waking the host). With this, the same workload shows no stalls: ping p99 0.47 ms, max 0.75 ms. Assisted-By: LLM Signed-off-by: termg <hello@termg.com>
|
Tested on a second machine and controller: MacBook Pro M4 Pro (J616s, T6040), configfs NCM + ACM gadget at high speed to a Mac mini running macOS 26 as host. This is the production fleet75 kernel with the T6040 device-mode modules from #2334, plus Test: 500 pings at 20 ms intervals from the Mac to the J616s, while the J616s sends to the Mac with
The first idle stock run also had a 606 ms p99 with no load. With the change, both idle runs stayed under 3 ms at p99. One idle run lost pings for a few seconds while the Mac was still configuring its freshly created interface; the repeat was 500/500. The suspended-port case ( |
ncm_tx_timeout()flushes a partly filled NTB by callingeth_start_xmit()with a NULL skb. If every IN request is in flight at that moment it returns NETDEV_TX_BUSY and the timer is not restarted, so the NTB stays queued until enough frames arrive to fill it, or forever if none come. With an NFS root over NCM (J704 in gadget mode) this stalled device-to-host traffic for 0.5-27 s a few hundred times per boot ("nfs: server not responding"). Restart the timer when the flush gets NETDEV_TX_BUSY, unless the port is suspended. With it: no stalls, ping p99 0.47 ms, max 0.75 ms.This is a generic USB gadget fix, not Apple-specific; it probably belongs in mainline (linux-usb) too. Sent here first because that is where I tested it.
Written with an AI assistant (noted in the commit) and tested on the hardware by me.