From: Ping-Ke Shih <pkshih@realtek.com>
To: Mehmet Fide <mehmet.fide@gmail.com>
Cc: Bitterblue Smith <rtl8821cerfe2@gmail.com>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Mehmet Fide <mehmet.fide@screeningeagle.com>
Subject: RE: [PATCH rtw-next 1/2] wifi: rtw88: usb: bound what the driver feeds the after-DTIM queue
Date: Sun, 6 Sep 2026 03:41:35 +0000 [thread overview]
Message-ID: <05f0cbfc6a744053863e3d7233e3ea15@realtek.com> (raw)
In-Reply-To: <20260902104146.3853102-2-mehmet.fide@gmail.com>
Mehmet Fide <mehmet.fide@gmail.com> wrote:
[...]
> --- a/drivers/net/wireless/realtek/rtw88/usb.c
> +++ b/drivers/net/wireless/realtek/rtw88/usb.c
> @@ -562,7 +562,38 @@ static int rtw_usb_write_data_h2c(struct rtw_dev *rtwdev, u8 *buf, u32 size)
> return rtw_usb_write_data(rtwdev, &pkt_info, buf);
> }
>
> -static u8 rtw_usb_tx_queue_mapping_to_qsel(struct sk_buff *skb)
> +#define RTW_USB_HIQ_RATE 10
> +#define RTW_USB_HIQ_BURST 16
> +
> +static bool rtw_usb_hiq_take(struct rtw_usb *rtwusb)
> +{
> + unsigned long flags, delta;
> + bool ok;
> + u32 add;
> +
> + spin_lock_irqsave(&rtwusb->hiq_lock, flags);
nit: a blank line
> + delta = jiffies - rtwusb->hiq_refill;
> + if (delta >= HZ / RTW_USB_HIQ_RATE) {
> + add = delta / (HZ / RTW_USB_HIQ_RATE);
The pattern ' HZ / RTW_USB_HIQ_RATE' repeat many times. Can you just define
the it as a part of macro? (The macro name should change as well.)
> + if (add >= RTW_USB_HIQ_BURST) {
> + rtwusb->hiq_tokens = RTW_USB_HIQ_BURST;
> + rtwusb->hiq_refill = jiffies;
> + } else {
> + rtwusb->hiq_tokens = min_t(u32, rtwusb->hiq_tokens + add,
> + RTW_USB_HIQ_BURST);
Will 'quota' or 'budget' be clearer than 'token'?
> + rtwusb->hiq_refill += add * (HZ / RTW_USB_HIQ_RATE);
It looks like you shift refill jiffies according to the tokens you are adding.
How can I understand '+= add * (HZ / RTW_USB_HIQ_RATE)'?
> + }
> + }
> + ok = rtwusb->hiq_tokens > 0;
> + if (ok)
> + rtwusb->hiq_tokens--;
nit: a blank line
> + spin_unlock_irqrestore(&rtwusb->hiq_lock, flags);
> +
> + return ok;
> +}
> +
> +static u8 rtw_usb_tx_queue_mapping_to_qsel(struct rtw_usb *rtwusb,
> + struct sk_buff *skb)
> {
> struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
> struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
next prev parent reply other threads:[~2026-09-06 3:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 10:41 [PATCH rtw-next 0/2] wifi: rtw88: usb: keep bmc traffic from exhausting the TX page pool Mehmet Fide
2026-09-02 10:41 ` [PATCH rtw-next 1/2] wifi: rtw88: usb: bound what the driver feeds the after-DTIM queue Mehmet Fide
2026-09-06 3:41 ` Ping-Ke Shih [this message]
2026-09-06 8:20 ` Mehmet Fide
2026-09-02 10:41 ` [PATCH rtw-next 2/2] wifi: rtw88: usb: only let the frames a dozing station needs use " Mehmet Fide
2026-09-06 3:51 ` Ping-Ke Shih
2026-09-06 8:20 ` Mehmet Fide
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=05f0cbfc6a744053863e3d7233e3ea15@realtek.com \
--to=pkshih@realtek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=mehmet.fide@gmail.com \
--cc=mehmet.fide@screeningeagle.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