public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Mh_chen <mh_chen@realtek.com>
To: Ping-Ke Shih <pkshih@realtek.com>,
	Lucid Duck <lucid_duck@justthetip.ca>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	Bitterblue Smith <rtl8821cerfe2@gmail.com>,
	Isaiah <isaiah@realtek.com>
Subject: RE: [PATCH] wifi: rtw89: usb: fix TX flow control by tracking in-flight URBs
Date: Mon, 26 Jan 2026 10:14:04 +0000	[thread overview]
Message-ID: <c628d6935fdf4e0c97f7d7938d996e89@realtek.com> (raw)
In-Reply-To: <290226f1d7144477a668f045cbd8eb56@realtek.com>

+Isaiah for Wi-Fi USB driver,

-----Original Message-----
From: Ping-Ke Shih <pkshih@realtek.com> 
Sent: Monday, January 26, 2026 11:40 AM
To: Lucid Duck <lucid_duck@justthetip.ca>; linux-wireless@vger.kernel.org; Bitterblue Smith <rtl8821cerfe2@gmail.com>; Mh_chen <mh_chen@realtek.com>
Subject: RE: [PATCH] wifi: rtw89: usb: fix TX flow control by tracking in-flight URBs

+ developers of WiFi USB adapters

Lucid Duck <lucid_duck@justthetip.ca> wrote:
> rtw89_usb_ops_check_and_reclaim_tx_resource() currently returns a 
> hardcoded placeholder value of 42, violating mac80211's TX flow 
> control contract. This causes uncontrolled URB accumulation under 
> sustained TX load since mac80211 believes resources are always available.

Then URB becomes exhausted? 

> 
> Fix this by implementing proper TX backpressure:
> 
> - Add per-channel atomic counters (tx_inflight[]) to track URBs between
>   submission and completion
> - Increment counter before usb_submit_urb() with rollback on failure
> - Decrement counter in completion callback
> - Return available slots (max - inflight) to mac80211, or 0 at 
> capacity
> - Exclude firmware command channel (CH12) from flow control
> 
> Tested on D-Link DWA-X1850 (RTL8832AU) with:
> - Sustained high-throughput traffic
> - Module load/unload stress tests
> - Hot-unplug during active transmission
> - 30-minute soak test verifying counters balance at idle
> 
> Signed-off-by: Lucid Duck <lucid_duck@justthetip.ca>

[...]

> diff --git a/drivers/net/wireless/realtek/rtw89/usb.h 
> b/drivers/net/wireless/realtek/rtw89/usb.h
> index 203ec8e99..f72a8b1b2 100644
> --- a/drivers/net/wireless/realtek/rtw89/usb.h
> +++ b/drivers/net/wireless/realtek/rtw89/usb.h
> @@ -20,6 +20,9 @@
>  #define RTW89_MAX_ENDPOINT_NUM         9
>  #define RTW89_MAX_BULKOUT_NUM          7
> 
> +/* TX flow control: max in-flight URBs per channel */
> +#define RTW89_USB_MAX_TX_URBS_PER_CH   32

Curiously. How did you decide this value? Have you tested USB2 and USB3 devices?
How about their throughput before/after this patch?

> +
>  struct rtw89_usb_info {
>         u32 usb_host_request_2;
>         u32 usb_wlan0_1;
> @@ -63,6 +66,9 @@ struct rtw89_usb {
>         struct usb_anchor tx_submitted;
> 
>         struct sk_buff_head tx_queue[RTW89_TXCH_NUM];
> +
> +       /* TX flow control: track in-flight URBs per channel */

I feel we don't need repeatedly adding this comment. If you like it, just keep one.

> +       atomic_t tx_inflight[RTW89_TXCH_NUM];
>  };
> 
>  static inline struct rtw89_usb *rtw89_usb_priv(struct rtw89_dev 
> *rtwdev)
> --
> 2.52.0
> 


  reply	other threads:[~2026-01-26 10:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-25 22:19 [PATCH] wifi: rtw89: usb: fix TX flow control by tracking in-flight URBs Lucid Duck
2026-01-26  3:39 ` Ping-Ke Shih
2026-01-26 10:14   ` Mh_chen [this message]
2026-01-27  5:00   ` Lucid Duck
2026-01-26 14:09 ` Bitterblue Smith
2026-01-27 20:01   ` Lucid Duck
     [not found]   ` <202601291256.60TCusZS3018440@rtits1.realtek.com.tw>
2026-01-29 13:12     ` Mh_chen
2026-03-21  3:37 ` [PATCH v2] " Lucid Duck
2026-03-23  9:31   ` Ping-Ke Shih
2026-03-23 23:33     ` Lucid Duck
2026-03-24  0:38       ` Ping-Ke Shih

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=c628d6935fdf4e0c97f7d7938d996e89@realtek.com \
    --to=mh_chen@realtek.com \
    --cc=isaiah@realtek.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lucid_duck@justthetip.ca \
    --cc=pkshih@realtek.com \
    --cc=rtl8821cerfe2@gmail.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