linux/drivers/net/wireless/realtek/rtw89
Lucid Duck 80119a77e5 wifi: rtw89: usb: fix TX flow control by tracking in-flight URBs
rtw89_usb_ops_check_and_reclaim_tx_resource() returns a hardcoded
placeholder value (42) instead of actual TX resource availability.
This violates mac80211's flow control contract, preventing backpressure
and causing uncontrolled URB accumulation under sustained TX load.

Fix by adding per-channel atomic counters (tx_inflight[]) that track
in-flight URBs. Increment before usb_submit_urb() with rollback on
failure, decrement in the completion callback, and return the
remaining capacity to mac80211. The firmware command channel (CH12)
always returns 1 since it has its own flow control.

The pre-increment pattern prevents a race where USB core completes the
URB on another CPU before the submitting code increments the counter.

128 URBs per channel provides headroom for RTL8832CU at 160 MHz
bandwidth. Tested on RTL8852AU (USB3 80 MHz) where 64 and 128 showed
equivalent throughput, and on RTL8832AU where 128 sustained full
throughput under 8-stream parallel load.

Tested on D-Link DWA-X1850 (RTL8832AU), kernel 6.19.8, Fedora 43:

                     Unpatched -> Patched (128 URBs)
  USB3 5GHz UL:      844 -> 837 Mbps (no regression)
  USB3 5GHz retx:    3 -> 0
  USB3 2.4GHz UL:    162 -> 164 Mbps (no regression)
  4-stream UL:       858 -> 826 Mbps (within variance)
  8-stream UL:       872 -> 826 Mbps (within variance)
  UDP flood:         0% loss (690K datagrams)
  60-second soak:    855 Mbps, 0 retransmits

Reported-by: morrownr <morrownr@gmail.com>
Signed-off-by: Lucid Duck <lucid_duck@justthetip.ca>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20260402052216.207858-1-lucid_duck@justthetip.ca
2026-04-02 14:06:53 +08:00
..
acpi.c Convert 'alloc_flex' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
acpi.h wifi: rtw89: regd/acpi: support 6 GHz VLP policy via ACPI DSM 2025-07-15 09:13:32 +08:00
cam.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cam.h wifi: rtw89: fw: add DMAC v3 H2C command for RTL8922D 2026-01-09 13:41:52 +08:00
chan.c wifi: rtw89: chan: recalc MLO DBCC mode based on current entity mode 2026-03-16 14:18:19 +08:00
chan.h wifi: rtw89: pre-handle RF calibration on link when needed 2026-01-07 15:44:32 +08:00
coex.c wifi: rtw89: coex: Limit Wi-Fi scan slot cost to avoid A2DP glitch 2025-08-26 09:16:05 +08:00
coex.h wifi: rtw89: coex: Implement Wi-Fi MLO related logic 2025-06-16 13:51:18 +08:00
core.c wifi: rtw89: fix typo "frome" -> "from" in rx_freq_frome_ie 2026-04-02 10:55:40 +08:00
core.h wifi: rtw89: 8922d: add ops related to BT coexistence mechanism 2026-04-02 11:20:07 +08:00
debug.c wifi: rtw89: mac: add specific case to dump mac memory for RTL8922D 2026-03-30 10:26:49 +08:00
debug.h wifi: rtw89: phy: handle C2H event for PS mode report 2026-01-22 10:11:15 +08:00
efuse_be.c wifi: rtw89: efuse: read hardware version from efuse for WiFi 7 chips 2025-12-31 16:20:38 +08:00
efuse.c wifi: rtw89: retry efuse physical map dump on transient failure 2026-03-30 09:43:51 +08:00
efuse.h wifi: rtw89: efuse: read hardware version from efuse for WiFi 7 chips 2025-12-31 16:20:38 +08:00
fw.c wifi: rtw89: Fill fw_version member of struct wiphy 2026-04-02 10:45:46 +08:00
fw.h wifi: rtw89: 8922d: add chip_info and chip_ops struct 2026-04-02 11:21:40 +08:00
Kconfig wifi: rtw89: Enable the new rtw89_8852au module 2025-11-11 10:04:13 +08:00
mac_be.c wifi: rtw89: phy: limit AMPDU number for RA try rate 2026-03-16 14:13:26 +08:00
mac.c wifi: rtw89: mac: add specific case to dump mac memory for RTL8922D 2026-03-30 10:26:49 +08:00
mac.h wifi: rtw89: mac: disable pre-load function for RTL8922DE 2026-03-30 10:27:56 +08:00
mac80211.c wifi: rtw89: Drop malformed AMPDU frames with abnormal PN 2026-03-16 14:21:16 +08:00
Makefile wifi: rtw89: Enable the new rtw89_8852au module 2025-11-11 10:04:13 +08:00
pci_be.c wifi: rtw89: pci: clear SER ISR when initial and leaving WoWLAN for WiFi 7 chips 2026-03-30 10:26:15 +08:00
pci.c wifi: rtw89: pci: warn if SPS OCP happens for RTL8922DE 2026-01-30 13:56:19 +08:00
pci.h wifi: rtw89: 8922d: add PCI ID of RTL8922DE and RTL8922DE-VS 2026-04-02 11:23:15 +08:00
phy_be.c wifi: rtw89: phy: expand PHY page for RTL8922D 2026-03-30 10:29:05 +08:00
phy.c wifi: rtw89: phy: load RF parameters relying on ACV for RTL8922D 2026-03-30 10:29:25 +08:00
phy.h wifi: rtw89: phy: limit AMPDU number for RA try rate 2026-03-16 14:13:26 +08:00
ps.c wifi: rtw89: add H2C command to protect TX/RX for unused PHY 2026-03-03 10:36:20 +08:00
ps.h wifi: rtw89: mcc: clear normal flow NoA when MCC start 2025-06-16 13:35:06 +08:00
reg.h wifi: rtw89: 8922d: add chip_info and chip_ops struct 2026-04-02 11:21:40 +08:00
regd.c wifi: rtw89: regd: update regulatory map to R73-R54 2026-01-28 11:20:58 +08:00
rtw8851b_rfk_table.c wifi: rtw89: 8851b: rfk: update IQK to 0x14 2025-07-04 10:29:43 +08:00
rtw8851b_rfk_table.h wifi: rtw89: 8851b: rfk: update IQK to 0x14 2025-07-04 10:29:43 +08:00
rtw8851b_rfk.c wifi: rtw89: Replace hardcoded strings with helper functions 2025-10-21 13:51:40 +08:00
rtw8851b_rfk.h wifi: rtw89: 8851b: use right chanctx whenever possible in RFK flow 2024-08-27 10:54:41 +08:00
rtw8851b_table.c wifi: rtw89: 8851b: update NCTL 0xB 2025-07-04 10:25:19 +08:00
rtw8851b_table.h wifi: rtw89: indicate TX power by rate table inside RFE parameter 2023-09-22 10:43:58 +03:00
rtw8851b.c wifi: rtw89: 8922d: add ops related to BT coexistence mechanism 2026-04-02 11:20:07 +08:00
rtw8851b.h wifi: rtw89: 8851b: add to parse efuse content 2023-05-17 11:05:58 +03:00
rtw8851be.c wifi: rtw89: pci: abstract RPP parser 2025-09-01 10:54:15 +08:00
rtw8851bu.c wifi: rtw89: usb: Rx aggregation for RTL8832CU/RTL8851BU 2026-03-19 14:59:25 +08:00
rtw8852a_rfk_table.c
rtw8852a_rfk_table.h
rtw8852a_rfk.c wifi: rtw89: 8852a: correct field mask of reset DAC/ADC FIFO 2025-11-21 11:53:51 +08:00
rtw8852a_rfk.h wifi: rtw89: 8852a: use right chanctx whenever possible in RFK flow 2024-08-27 10:54:52 +08:00
rtw8852a_table.c wifi: rtw89: 8852a: move DIG tables to rtw8852a.c 2026-03-03 10:33:15 +08:00
rtw8852a_table.h wifi: rtw89: 8852a: move DIG tables to rtw8852a.c 2026-03-03 10:33:15 +08:00
rtw8852a.c wifi: rtw89: 8922d: add ops related to BT coexistence mechanism 2026-04-02 11:20:07 +08:00
rtw8852a.h wifi: rtw89: 8852a: use right chanctx whenever possible in RFK flow 2024-08-27 10:54:52 +08:00
rtw8852ae.c wifi: rtw89: pci: abstract RPP parser 2025-09-01 10:54:15 +08:00
rtw8852au.c wifi: rtw89: usb: Rx aggregation for RTL8832CU/RTL8851BU 2026-03-19 14:59:25 +08:00
rtw8852b_common.c wifi: rtw89: read chip ID for RTL8922D variants 2025-12-31 16:21:57 +08:00
rtw8852b_common.h wifi: rtw89: use frequency domain RSSI 2024-09-05 08:55:02 +08:00
rtw8852b_rfk_table.c
rtw8852b_rfk_table.h
rtw8852b_rfk.c wifi: rtw89: Replace hardcoded strings with helper functions 2025-10-21 13:51:40 +08:00
rtw8852b_rfk.h wifi: rtw89: 8852b: implement RFK multi-channel handling and support chanctx up to 2 2025-07-15 09:51:44 +08:00
rtw8852b_table.c wifi: rtw89: 8852b: update TX power tables to R36 2024-01-10 16:49:41 +02:00
rtw8852b_table.h wifi: rtw89: indicate TX power by rate table inside RFE parameter 2023-09-22 10:43:58 +03:00
rtw8852b.c wifi: rtw89: 8922d: add ops related to BT coexistence mechanism 2026-04-02 11:20:07 +08:00
rtw8852b.h wifi: rtw89: 8852bx: move common code from 8852b to 8852b_common 2024-06-17 10:12:26 +08:00
rtw8852be.c wifi: rtw89: pci: abstract RPP parser 2025-09-01 10:54:15 +08:00
rtw8852bt_rfk_table.c wifi: rtw89: 8852bt: rfk: add TSSI 2024-06-27 09:42:11 +08:00
rtw8852bt_rfk_table.h wifi: rtw89: 8852bt: rfk: add TSSI 2024-06-27 09:42:11 +08:00
rtw8852bt_rfk.c wifi: rtw89: 8852bt: Remove redundant off_reverse variables 2025-09-01 11:41:23 +08:00
rtw8852bt_rfk.h wifi: rtw89: 8852bt: implement RFK multi-channel handling and support chanctx up to 2 2025-07-15 09:51:18 +08:00
rtw8852bt.c wifi: rtw89: 8922d: add ops related to BT coexistence mechanism 2026-04-02 11:20:07 +08:00
rtw8852bt.h wifi: rtw89: 8852bt: add chip_info of RTL8852BT 2024-07-31 13:48:21 +08:00
rtw8852bte.c wifi: rtw89: pci: abstract RPP parser 2025-09-01 10:54:15 +08:00
rtw8852bu.c wifi: rtw89: usb: Rx aggregation for RTL8832CU/RTL8851BU 2026-03-19 14:59:25 +08:00
rtw8852c_rfk_table.c wifi: rtw89: 8852c: Fix TSSI causes transmit power inaccuracy 2023-09-04 20:34:00 +03:00
rtw8852c_rfk_table.h
rtw8852c_rfk.c wifi: rtw89: 8852c: fix ADC oscillation in 160MHz affecting RX performance 2025-10-28 09:51:16 +08:00
rtw8852c_rfk.h wifi: rtw89: 8852c: use right chanctx whenever possible in RFK flow 2024-08-27 10:55:22 +08:00
rtw8852c_table.c wifi: rtw89: 8852c: update TX power tables to R69.1 (2 of 2) 2024-04-18 09:09:43 +08:00
rtw8852c_table.h wifi: rtw89: indicate TX power by rate table inside RFE parameter 2023-09-22 10:43:58 +03:00
rtw8852c.c wifi: rtw89: 8922d: add ops related to BT coexistence mechanism 2026-04-02 11:20:07 +08:00
rtw8852c.h wifi: rtw89: 8852c: Accept USB devices and load their MAC address 2025-11-04 09:36:16 +08:00
rtw8852ce.c wifi: rtw89: pci: abstract RPP parser 2025-09-01 10:54:15 +08:00
rtw8852cu.c wifi: rtw89: Add support for Elecom WDC-XE2402TU3-B 2026-04-02 11:57:16 +08:00
rtw8922a_rfk.c wifi: rtw89: rfk: update rtw89_fw_h2c_rf_pre_ntfy_mcc format 2026-01-07 15:51:26 +08:00
rtw8922a_rfk.h wifi: rtw89: 8922a: add helper of set_channel 2024-02-19 18:21:00 +02:00
rtw8922a.c wifi: rtw89: 8922d: add ops related to BT coexistence mechanism 2026-04-02 11:20:07 +08:00
rtw8922a.h wifi: rtw89: 8922ae: add variant info to support RTL8922AE-VS 2025-01-12 09:36:49 +08:00
rtw8922ae.c wifi: rtw89: pci: abstract RPP parser 2025-09-01 10:54:15 +08:00
rtw8922d_rfk.c wifi: rtw89: 8922d: add RF ops of init hardware and get thermal 2026-04-02 11:18:40 +08:00
rtw8922d_rfk.h wifi: rtw89: 8922d: add RF ops of init hardware and get thermal 2026-04-02 11:18:40 +08:00
rtw8922d.c wifi: rtw89: 8922d: add chip_info and chip_ops struct 2026-04-02 11:21:40 +08:00
rtw8922d.h wifi: rtw89: 8922d: add chip_info and chip_ops struct 2026-04-02 11:21:40 +08:00
rtw8922de.c wifi: rtw89: 8922d: add PCI ID of RTL8922DE and RTL8922DE-VS 2026-04-02 11:23:15 +08:00
sar.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
sar.h wifi: rtw89: 8922a: add TAS feature support 2025-09-18 09:20:11 +08:00
ser.c wifi: rtw89: mac: add specific case to dump mac memory for RTL8922D 2026-03-30 10:26:49 +08:00
ser.h
txrx.h wifi: rtw89: update query RXDESC v3 for RTL8922D 2026-01-09 13:40:16 +08:00
usb.c wifi: rtw89: usb: fix TX flow control by tracking in-flight URBs 2026-04-02 14:06:53 +08:00
usb.h wifi: rtw89: usb: fix TX flow control by tracking in-flight URBs 2026-04-02 14:06:53 +08:00
util.c wifi: rtw89: add support for negative values of dBm to linear conversion 2025-03-13 08:40:00 +08:00
util.h wifi: rtw89: Drop malformed AMPDU frames with abnormal PN 2026-03-16 14:21:16 +08:00
wow.c wifi: rtw89: Drop malformed AMPDU frames with abnormal PN 2026-03-16 14:21:16 +08:00
wow.h wifi: rtw89: Drop malformed AMPDU frames with abnormal PN 2026-03-16 14:21:16 +08:00