Skip to contentSkip to conversation

wifi: rtw88: move the bmc high queue decision to tx.c

PATCH In review Luka Gejak 2 participants 13 messages Oct 21 – Nov 5 Realtek wireless driver (rtw88)

lore
Share & tools
lore

Luka Gejak

author
#0 lore raw

PATCH v2 1/2 wifi: rtw88: move the bmc high queue decision to tx.c

USB decides in usb.c which broadcast and multicast (bmc) frames may use the high queue. SDIO needs the same decision, so move the helpers to tx.c behind a single exported rtw_tx_bmc_use_hiq() and keep the budget state in struct rtw_dev.

No functional change.

---
 drivers/net/wireless/realtek/rtw88/main.c |  3 ++
 drivers/net/wireless/realtek/rtw88/main.h |  5 ++
 drivers/net/wireless/realtek/rtw88/tx.c   | 59 +++++++++++++++++++++
 drivers/net/wireless/realtek/rtw88/tx.h   |  4 ++
 drivers/net/wireless/realtek/rtw88/usb.c  | 64 ++---------------------
 drivers/net/wireless/realtek/rtw88/usb.h  |  5 --
 6 files changed, 74 insertions(+), 66 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +3 -0
index 0f23498b5c96..b72173964bdd 100644
@@ -2177,6 +2177,9 @@ int rtw_core_init(struct rtw_dev *rtwdev)
 
 	spin_lock_init(&rtwdev->txq_lock);
 	spin_lock_init(&rtwdev->tx_report.q_lock);
+	spin_lock_init(&rtwdev->hiq_lock);
+	rtwdev->hiq_budget = RTW_TX_HIQ_BUDGET_MAX;
+	rtwdev->hiq_refill = jiffies;
 
 	mutex_init(&rtwdev->mutex);
 	mutex_init(&rtwdev->hal.tx_power_mutex);
drivers/net/wireless/realtek/rtw88/main.h +5 -0
index d59f6e323adf..c14c834c27fd 100644
@@ -2104,6 +2104,11 @@ struct rtw_dev {
 
 	struct rtw_tx_report tx_report;
 
+	/* protects hiq_budget and hiq_refill */
+	spinlock_t hiq_lock;
+	u32 hiq_budget;
+	unsigned long hiq_refill;
+
 	struct {
 		/* indicate the mail box to use with fw */
 		u8 last_box_num;
drivers/net/wireless/realtek/rtw88/tx.c +59 -0

68 lines not on this page · raw message

drivers/net/wireless/realtek/rtw88/tx.h +4 -0
index 168f48e87853..a68ba3b12159 100644
@@ -10,6 +10,9 @@
 #define RTW_TX_PROBE_TIMEOUT_SHORT	msecs_to_jiffies(500)
 #define RTW_TX_PROBE_TIMEOUT_LONG	msecs_to_jiffies(2500)
 
+#define RTW_TX_HIQ_REFILL_INTERVAL	(HZ / 10)
+#define RTW_TX_HIQ_BUDGET_MAX		16
+
 struct rtw_tx_desc {
 	__le32 w0;
 	__le32 w1;
@@ -115,6 +118,7 @@ rtw_tx_write_data_h2c_get(struct rtw_dev *rtwdev,
 
 enum rtw_tx_queue_type rtw_tx_ac_to_hwq(enum ieee80211_ac_numbers ac);
 enum rtw_tx_queue_type rtw_tx_queue_mapping(struct sk_buff *skb);
+bool rtw_tx_bmc_use_hiq(struct rtw_dev *rtwdev, struct sk_buff *skb);
 
 static inline
 void fill_txdesc_checksum_common(u8 *txdesc, size_t words)
drivers/net/wireless/realtek/rtw88/usb.c +3 -61

99 lines not on this page · raw message

drivers/net/wireless/realtek/rtw88/usb.h +0 -5
index 94ff21dd0846..9b695b688b24 100644
@@ -75,11 +75,6 @@ struct rtw_usb {
 	u8 out_ep[RTW_USB_EP_MAX];
 	int qsel_to_ep[TX_DESC_QSEL_MAX];
 
-	/* protects hiq_budget and hiq_refill */
-	spinlock_t hiq_lock;
-	u32 hiq_budget;
-	unsigned long hiq_refill;
-
 	struct workqueue_struct *txwq, *rxwq;
 
 	struct sk_buff_head tx_queue[RTW_USB_EP_MAX];
Signature · 1 line
2.53.0
author
#1 lore raw

PATCH v2 2/2 wifi: rtw88: sdio: limit the high queue to DTIM delivery

In AP mode every broadcast and multicast (bmc) frame is sent through the high queue, which the hardware only drains after a DTIM beacon. Only a few frames leave per DTIM, so steady multicast traffic builds a backlog that holds the TX pages the other queues need. Unicast traffic then stalls for seconds and clients can no longer renew their DHCP lease.

USB had the same problem and was fixed by commit c710c7c2e038 ("wifi:
rtw88: usb: route bmc frames via the high queue only for DTIM delivery") and the two commits that followed it. Use the same rule for SDIO. A bmc frame goes to the high queue only when mac80211 asks for DTIM delivery because a station is dozing, the frame is ARP, EAPOL or DHCP, and the budget allows it. All other bmc frames go out on their access category queue.

Tested on RTL8723BS with an ath9k client.

---
 drivers/net/wireless/realtek/rtw88/sdio.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/wireless/realtek/rtw88/sdio.c +3 -0
index dc2fd0f8f9ff..83e9b301ae9b 100644
@@ -1308,6 +1308,9 @@ static int rtw_sdio_tx_write(struct rtw_dev *rtwdev,
 	u16 q_map = skb_get_queue_mapping(skb);
 	struct rtw_sdio_tx_data *tx_data;
 
+	if (queue == RTW_TX_QUEUE_HI0 && !rtw_tx_bmc_use_hiq(rtwdev, skb))
+		queue = rtw_tx_ac_to_hwq(q_map);
+
 	rtw_sdio_tx_skb_prepare(rtwdev, pkt_info, skb, queue);
 
 	tx_data = rtw_sdio_get_tx_data(skb);
Signature · 1 line
2.53.0
maintainer Acked-by on v2 2/2
#2 lore raw

RE: [PATCH rtw-next v2 2/2] wifi: rtw88: sdio: limit the high queue to DTIM delivery

Quoted 6 lines · Luka Gejak

In AP mode every broadcast and multicast (bmc) frame is sent through the high queue, which the hardware only drains after a DTIM beacon. Only a few frames leave per DTIM, so steady multicast traffic builds a backlog that holds the TX pages the other queues need. Unicast traffic then stalls for seconds and clients can no longer renew their DHCP lease.

Quoted 7 lines

USB had the same problem and was fixed by commit c710c7c2e038 ("wifi:
rtw88: usb: route bmc frames via the high queue only for DTIM delivery") and the two commits that followed it. Use the same rule for SDIO. A bmc frame goes to the high queue only when mac80211 asks for DTIM delivery because a station is dozing, the frame is ARP, EAPOL or DHCP, and the budget allows it. All other bmc frames go out on their access category queue.

I'd remove second paragraph since it just describes the patch 1/2 does.

Quoted 4 lines

Tested on RTL8723BS with an ath9k client.

author
#3 lore raw

Re: [PATCH rtw-next v2 2/2] wifi: rtw88: sdio: limit the high queue to DTIM delivery

Quoted 18 lines · Ping-Ke Shih
Quoted 7 lines · Luka Gejak

In AP mode every broadcast and multicast (bmc) frame is sent through the
high queue, which the hardware only drains after a DTIM beacon. Only a few frames leave per DTIM, so steady multicast traffic builds a backlog that holds the TX pages the other queues need. Unicast traffic then stalls for seconds and clients can no longer renew their DHCP lease.

Quoted 8 lines

USB had the same problem and was fixed by commit c710c7c2e038 ("wifi:
rtw88: usb: route bmc frames via the high queue only for DTIM delivery") and the two commits that followed it. Use the same rule for SDIO. A bmc frame goes to the high queue only when mac80211 asks for DTIM delivery because a station is dozing, the frame is ARP, EAPOL or DHCP, and the budget allows it. All other bmc frames go out on their access category queue.

Quoted 2 lines

I'd remove second paragraph since it just describes the patch 1/2 does.

Would you be willing to drop it your when applying?

Best regards,
Luka Gejak

maintainer
#4 lore raw

RE: [PATCH rtw-next v2 2/2] wifi: rtw88: sdio: limit the high queue to DTIM delivery

Quoted 21 lines · Luka Gejak
Quoted 18 lines · Ping-Ke Shih
Quoted 15 lines · Luka Gejak

In AP mode every broadcast and multicast (bmc) frame is sent through the
high queue, which the hardware only drains after a DTIM beacon. Only a few frames leave per DTIM, so steady multicast traffic builds a backlog that holds the TX pages the other queues need. Unicast traffic then stalls for seconds and clients can no longer renew their DHCP lease.

USB had the same problem and was fixed by commit c710c7c2e038 ("wifi:
rtw88: usb: route bmc frames via the high queue only for DTIM delivery") and the two commits that followed it. Use the same rule for SDIO. A bmc frame goes to the high queue only when mac80211 asks for DTIM delivery because a station is dozing, the frame is ARP, EAPOL or DHCP, and the budget allows it. All other bmc frames go out on their access category queue.

Quoted 4 lines
Quoted 2 lines

I'd remove second paragraph since it just describes the patch 1/2 does.

Would you be willing to drop it your when applying?

Sure. I'll do it.

maintainer Acked-by on v2 1/2
#5 lore raw
In reply to Luka Gejak
Quoted 6 lines · Luka Gejak

USB decides in usb.c which broadcast and multicast (bmc) frames may use the high queue. SDIO needs the same decision, so move the helpers to tx.c behind a single exported rtw_tx_bmc_use_hiq() and keep the budget state in struct rtw_dev.

No functional change.

By my review, I think it doesn't change logic at all, but I hope if someone can help to test USB devices to confirm it still works well.

Quoted 2 lines
author
#6 lore raw
Quoted 9 lines · Ping-Ke Shih
Quoted 6 lines · Luka Gejak

USB decides in usb.c which broadcast and multicast (bmc) frames may use
the high queue. SDIO needs the same decision, so move the helpers to tx.c behind a single exported rtw_tx_bmc_use_hiq() and keep the budget state in struct rtw_dev.

Quoted 5 lines
Quoted 2 lines

No functional change.

By my review, I think it doesn't change logic at all, but I hope if someone can help to test USB devices to confirm it still works well.

I ran the same test with rtl8723du and there is no regression.

Best regards,
Luka Gejak

author
#7 lore raw

Hi Ping-Ke,

Quoted 14 lines · Luka Gejak
Quoted 11 lines · Ping-Ke Shih

Luka Gejak <[email protected]> wrote:

USB decides in usb.c which broadcast and multicast (bmc) frames may use the high queue. SDIO needs the same decision, so move the helpers to tx.c behind a single exported rtw_tx_bmc_use_hiq() and keep the budget state in struct rtw_dev.

No functional change.

Quoted 8 lines
Quoted 3 lines

By my review, I think it doesn't change logic at all, but I hope if someone can help to test USB devices to confirm it still works well.

I ran the same test with rtl8723du and there is no regression.

Best regards,
Luka Gejak

I was thinking, as staging got removed, for 10-ish weeks(until 7.5) users of RTL8723BS won't have AP mode. So I was wondering if these two patches could pass as fixes into rc2 release(or whatever is the first rc into which rtw tree is merged), as this would be DHCP stall fix. To
elaborate: when this driver was merged it, was exposingAP mode to userspace, due to RTW88 doing it globally. Therefore AP mode existed, but wasn't working properly. So maybe it's a bit of a stretch, but I think it's a valid proposal to send it as a fix into next rc release.

Best regards,
Luka Gejak

maintainer
#8 lore raw
Quoted 8 lines · Luka Gejak

I was thinking, as staging got removed, for 10-ish weeks(until 7.5) users of RTL8723BS won't have AP mode. So I was wondering if these two patches could pass as fixes into rc2 release(or whatever is the first rc into which rtw tree is merged), as this would be DHCP stall fix. To
elaborate: when this driver was merged it, was exposingAP mode to userspace, due to RTW88 doing it globally. Therefore AP mode existed, but wasn't working properly. So maybe it's a bit of a stretch, but I think it's a valid proposal to send it as a fix into next rc release.

Did you think people use staging driver with AP mode?

Personally, I want this goes to rtw-next, but if you have strong opinion that people need this. I can pick them and let it goes to -rc.

Ping-Ke

author
#9 lore raw
Quoted 13 lines · Ping-Ke Shih
Quoted 10 lines · Luka Gejak

I was thinking, as staging got removed, for 10-ish weeks(until 7.5)
users of RTL8723BS won't have AP mode. So I was wondering if these two patches could pass as fixes into rc2 release(or whatever is the first rc into which rtw tree is merged), as this would be DHCP stall fix. To
elaborate: when this driver was merged it, was exposingAP mode to userspace, due to RTW88 doing it globally. Therefore AP mode existed, but wasn't working properly. So maybe it's a bit of a stretch, but I think it's a valid proposal to send it as a fix into next rc release.

Quoted 1 line

Did you think people use staging driver with AP mode?

It appears so. I saw on forums and articles about the new driver that some people were complaining because only station mode is working because they exclusively or mostly use it as an AP point.

Quoted 3 lines

Personally, I want this goes to rtw-next, but if you have strong opinion that people need this. I can pick them and let it goes to -rc.

I think it would be better to pick these into rc, especially since the feature exists right now but is broken.

Best regards,
Luka Gejak

maintainer
#10 lore raw
Quoted 14 lines · Luka Gejak
Quoted 13 lines · Ping-Ke Shih
Quoted 10 lines · Luka Gejak

I was thinking, as staging got removed, for 10-ish weeks(until 7.5)
users of RTL8723BS won't have AP mode. So I was wondering if these two patches could pass as fixes into rc2 release(or whatever is the first rc into which rtw tree is merged), as this would be DHCP stall fix. To
elaborate: when this driver was merged it, was exposingAP mode to userspace, due to RTW88 doing it globally. Therefore AP mode existed, but wasn't working properly. So maybe it's a bit of a stretch, but I think it's a valid proposal to send it as a fix into next rc release.

Quoted 5 lines
Quoted 1 line

Did you think people use staging driver with AP mode?

It appears so. I saw on forums and articles about the new driver that some people were complaining because only station mode is working because they exclusively or mostly use it as an AP point.

This lets me think if I merge RTL8723BS to rtw88 and delete rtl8723bs from staging too early. The staging rtl8723bs is a vendor driver which mostly implements "full" functions, but rtw88 should be not. To smoothly migrate from staging to rtw88, we should implement equivalent functions before merging, at least functions people are using.

But I really don't want to go back to staging driver. Let's pick the fixes of AP mode. I hope no more functions needed to be picked.

Quoted 7 lines
Quoted 4 lines

Personally, I want this goes to rtw-next, but if you have strong opinion that people need this. I can pick them and let it goes to -rc.

I think it would be better to pick these into rc, especially since the feature exists right now but is broken.

Comparing to staging rtl8723bs, it might be seen as broken, but for rtw88 I consider this as a new feature.

Ping-Ke

author
#11 lore raw
Quoted 24 lines · Ping-Ke Shih
Quoted 15 lines · Luka Gejak

October 25, 2026 at 3:49 AM, "Ping-Ke Shih" <[email protected]> wrote:

Quoted 10 lines · Luka Gejak

I was thinking, as staging got removed, for 10-ish weeks(until 7.5) users of RTL8723BS won't have AP mode. So I was wondering if these two patches could pass as fixes into rc2 release(or whatever is the first rc into which rtw tree is merged), as this would be DHCP stall fix. To
elaborate: when this driver was merged it, was exposingAP mode to userspace, due to RTW88 doing it globally. Therefore AP mode existed, but wasn't working properly. So maybe it's a bit of a stretch, but I think it's a valid proposal to send it as a fix into next rc release.

Quoted 6 lines

Did you think people use staging driver with AP mode?

It appears so. I saw on forums and articles about the new driver that some people were complaining because only station mode is working because they exclusively or mostly use it as an AP point.

Quoted 8 lines

This lets me think if I merge RTL8723BS to rtw88 and delete rtl8723bs from staging too early. The staging rtl8723bs is a vendor driver which mostly implements "full" functions, but rtw88 should be not. To smoothly migrate from staging to rtw88, we should implement equivalent functions before merging, at least functions people are using.

But I really don't want to go back to staging driver. Let's pick the fixes of AP mode. I hope no more functions needed to be picked.

That is the only thing needed to pick. Other things are already implemented.

Best regards,
Luka Gejak

maintainer
#12 lore raw
In reply to Luka Gejak
Quoted 9 lines · Luka Gejak

USB decides in usb.c which broadcast and multicast (bmc) frames may use the high queue. SDIO needs the same decision, so move the helpers to tx.c behind a single exported rtw_tx_bmc_use_hiq() and keep the budget state in struct rtw_dev.

No functional change.

2 patch(es) applied to rtw branch of rtw.git, thanks.

0bc4a591d152 wifi: rtw88: move the bmc high queue decision to tx.c ff4d3699bf38 wifi: rtw88: sdio: limit the high queue to DTIM delivery

---
https://github.com/pkshih/rtw.git