Skip to contentSkip to conversation

wifi: rtw89: fix injected retry limit and NO_ACK TX status

PATCH Superseded Enver Ikromov 2 participants 8 messages Nov 26 – Nov 30 Realtek wireless driver (rtw89)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover wifi: rtw89: fix injected retry limit and NO_ACK TX status

This two-patch series fixes three follow-up issues in commit 92608bb5f14f ("wifi: rtw89: honor ASSIGN_SEQ, retries, and NO_ACK for injected frames") reported by Luka Gejak and Ahmet Zeren during the rtw88 injection review, along with the matching pre-existing NO_ACK TX status issue on the PCIe completion path.

Patch 1 gates the per-packet retry override in rtw89_core_tx_update_injection() on IEEE80211_TX_CTRL_RATE_INJECT, caps hw->max_rate_tries at IEEE80211_MAX_TX_RETRY (31) so the 5-bit ieee80211_tx_rate::count field does not wrap around, and makes IEEE80211_TX_STAT_NOACK_TRANSMITTED and IEEE80211_TX_STAT_ACK mutually exclusive in rtw89_tx_rpt_tx_status() while accounting for Wi-Fi 6 AX unicast NO_ACK completions (RTW89_TX_RETRY_LIMIT with tx_cnt_lmt = 1) and excluding dropped frames (RTW89_TX_MACID_DROP / RTW89_TX_LIFE_TIME).

Patch 2 applies the same NO_ACK TX status and ring counter handling to rtw89_pci_tx_status() in pci.c, which handles TX completions on PCIe devices.

Tested on RTL8852AE (10ec:8852, firmware 0.13.36.2) at 5 GHz using raw radiotap injection, tracefs kprobes, and hardware RPP completion telemetry across supported/unsupported radiotap rates, retry counts 0..32, and broadcast, QoS No-Ack, and unicast NO_ACK frames.

Enver Ikromov (2):
wifi: rtw89: fix retry limit and NO_ACK status for injected frames
wifi: rtw89: pci: fix TX status and counters for NO_ACK frames

 drivers/net/wireless/realtek/rtw89/core.c |  5 +++--
 drivers/net/wireless/realtek/rtw89/core.h |  1 -
 drivers/net/wireless/realtek/rtw89/mac.h  | 13 ++++++++-----
 drivers/net/wireless/realtek/rtw89/pci.c  |  7 +++++--
 4 files changed, 16 insertions(+), 10 deletions(-)

base-commit: 18d0bedbb5f0538396cb7f763ed9cd1dd69c5b23

Signature · 1 line
2.53.0
#1 lore raw

PATCH 1/2 wifi: rtw89: fix retry limit and NO_ACK status for injected frames

Commit 92608bb5f14f ("wifi: rtw89: honor ASSIGN_SEQ, retries, and NO_ACK for injected frames") has three issues:

1. rtw89_core_tx_update_injection() uses info->control.rates[0].count without checking IEEE80211_TX_CTRL_RATE_INJECT. When a radiotap rate is unsupported on the current band or stream capability, ieee80211_parse_tx_radiotap() clears IEEE80211_TX_CTRL_RATE_INJECT while still populating rates[0].count. Gate the per-packet retry override on IEEE80211_TX_CTRL_RATE_INJECT.

2. hw->max_rate_tries is set to RTW89_TX_DATA_CNT_LMT_MAX (63), which exceeds the 5-bit struct ieee80211_tx_rate::count field and causes radiotap retry counts above 30 to wrap around. Set hw->max_rate_tries to IEEE80211_MAX_TX_RETRY (31) and drop the unused macro.

3. rtw89_tx_rpt_tx_status() sets IEEE80211_TX_STAT_NOACK_TRANSMITTED unconditionally for NO_ACK frames (including RTW89_TX_MACID_DROP and RTW89_TX_LIFE_TIME) and also sets IEEE80211_TX_STAT_ACK when tx_status == RTW89_TX_DONE. Because Wi-Fi 6 AX chips lack a TX descriptor NO_ACK bit and implement NO_ACK via tx_cnt_lmt = 1, unacknowledged unicast NO_ACK frames complete with RTW89_TX_RETRY_LIMIT, whereas broadcast, QoS No-Ack, and Wi-Fi 7 BE NO_ACK frames complete with RTW89_TX_DONE. Clear stale status bits and report IEEE80211_TX_STAT_NOACK_TRANSMITTED exclusively on RTW89_TX_DONE or RTW89_TX_RETRY_LIMIT, reserving IEEE80211_TX_STAT_ACK for frames without IEEE80211_TX_CTL_NO_ACK.

---
 drivers/net/wireless/realtek/rtw89/core.c |  5 +++--
 drivers/net/wireless/realtek/rtw89/core.h |  1 -
 drivers/net/wireless/realtek/rtw89/mac.h  | 13 ++++++++-----
 3 files changed, 11 insertions(+), 8 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +3 -2
index 31d52fb99..8421c78c2 100644
@@ -1274,7 +1274,8 @@ static void rtw89_core_tx_update_injection(struct rtw89_dev *rtwdev,
 		desc_info->no_ack = true;
 		desc_info->tx_cnt_lmt_en = true;
 		desc_info->tx_cnt_lmt = 1;
-	} else if (info->control.rates[0].count) {
+	} else if ((info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT) &&
+		   info->control.rates[0].count) {
 		desc_info->tx_cnt_lmt_en = true;
 		desc_info->tx_cnt_lmt = info->control.rates[0].count;
 	}
@@ -7561,7 +7562,7 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)
 	hw->queues = IEEE80211_NUM_ACS;
 	hw->max_rx_aggregation_subframes = chip->max_rx_agg_num;
 	hw->max_tx_aggregation_subframes = chip->max_tx_agg_num;
-	hw->max_rate_tries = RTW89_TX_DATA_CNT_LMT_MAX;
+	hw->max_rate_tries = IEEE80211_MAX_TX_RETRY;
 	hw->uapsd_max_sp_len = IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL;
 
 	hw->radiotap_mcs_details |= IEEE80211_RADIOTAP_MCS_HAVE_FEC |
drivers/net/wireless/realtek/rtw89/core.h +0 -1
index 87a832b5c..612389f32 100644
@@ -1278,7 +1278,6 @@ struct rtw89_tx_desc_info {
 	bool tx_cnt_lmt_en;
 	u8 sn: 4;
 	u8 tx_cnt_lmt: 6;
-#define RTW89_TX_DATA_CNT_LMT_MAX	0x3f
 	u8 addr_info_nr;
 	u8 sec_keyid;
 	u8 sec_type;
drivers/net/wireless/realtek/rtw89/mac.h +8 -5
index c94b34b92..5c3af59d1 100644
@@ -1896,12 +1896,15 @@ void rtw89_tx_rpt_tx_status(struct rtw89_dev *rtwdev, struct sk_buff *skb,
 	info = IEEE80211_SKB_CB(skb);
 	ieee80211_tx_info_clear_status(info);
 
-	if (info->flags & IEEE80211_TX_CTL_NO_ACK)
-		info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
-	if (tx_status == RTW89_TX_DONE)
+	info->flags &= ~(IEEE80211_TX_STAT_NOACK_TRANSMITTED |
+			 IEEE80211_TX_STAT_ACK);
+	if (info->flags & IEEE80211_TX_CTL_NO_ACK) {
+		if (tx_status == RTW89_TX_DONE ||
+		    tx_status == RTW89_TX_RETRY_LIMIT)
+			info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
+	} else if (tx_status == RTW89_TX_DONE) {
 		info->flags |= IEEE80211_TX_STAT_ACK;
-	else
-		info->flags &= ~IEEE80211_TX_STAT_ACK;
+	}
 
 	ieee80211_tx_status_irqsafe(rtwdev->hw, skb);
 }
Signature · 1 line
2.53.0
maintainer
#2 lore raw

RE: [PATCH rtw-next 1/2] wifi: rtw89: fix retry limit and NO_ACK status for injected frames

Quoted 2 lines · Enver Ikromov

Commit 92608bb5f14f ("wifi: rtw89: honor ASSIGN_SEQ, retries, and NO_ACK for injected frames") has three issues:

Your Fixes tag has said this.

Quoted 14 lines

1. rtw89_core_tx_update_injection() uses info->control.rates[0].count without checking IEEE80211_TX_CTRL_RATE_INJECT. When a radiotap rate is unsupported on the current band or stream capability, ieee80211_parse_tx_radiotap() clears IEEE80211_TX_CTRL_RATE_INJECT while still populating rates[0].count. Gate the per-packet retry override on IEEE80211_TX_CTRL_RATE_INJECT.

2. hw->max_rate_tries is set to RTW89_TX_DATA_CNT_LMT_MAX (63), which exceeds the 5-bit struct ieee80211_tx_rate::count field and causes radiotap retry counts above 30 to wrap around. Set hw->max_rate_tries to IEEE80211_MAX_TX_RETRY (31) and drop the unused macro.

Quoted 3 lines

3. rtw89_tx_rpt_tx_status() sets IEEE80211_TX_STAT_NOACK_TRANSMITTED unconditionally for NO_ACK frames (including RTW89_TX_MACID_DROP and RTW89_TX_LIFE_TIME)

I don't know why there is a problem?

Quoted 9 lines

and also sets IEEE80211_TX_STAT_ACK when
tx_status == RTW89_TX_DONE. Because Wi-Fi 6 AX chips lack a TX descriptor NO_ACK bit and implement NO_ACK via tx_cnt_lmt = 1, unacknowledged unicast NO_ACK frames complete with RTW89_TX_RETRY_LIMIT, whereas broadcast, QoS No-Ack, and Wi-Fi 7 BE NO_ACK frames complete with RTW89_TX_DONE. Clear stale status bits and report IEEE80211_TX_STAT_NOACK_TRANSMITTED exclusively on RTW89_TX_DONE or RTW89_TX_RETRY_LIMIT, reserving IEEE80211_TX_STAT_ACK for frames without IEEE80211_TX_CTL_NO_ACK.

Generated by LLM? Can you reword commit message yourself?

Quoted 20 lines
Fixes 92608bb5f14f ("wifi: rtw89: honor ASSIGN_SEQ, retries, and NO_ACK for injected frames")

Closes:
https://lore.kernel.org/linux-wireless/Qmyu_zaapR7fisQhYB1W9CDM3OG849otNXR4xWRbIaRocvy40VyY4N2Jte4
[email protected]/

---
 drivers/net/wireless/realtek/rtw89/core.c |  5 +++--
 drivers/net/wireless/realtek/rtw89/core.h |  1 -
 drivers/net/wireless/realtek/rtw89/mac.h  | 13 ++++++++-----
 3 files changed, 11 insertions(+), 8 deletions(-)
drivers/net/wireless/realtek/rtw89/core.c +0 -0
index 31d52fb99..8421c78c2 100644

drivers/net/wireless/realtek/rtw89/core.c static void rtw89_core_tx_update_injection(struct rtw89_dev *rtwdev, · line 1277

Quoted 5 lines
drivers/net/wireless/realtek/rtw89/core.c +1 -1
@@ -1274,7 +1274,8 @@ static void rtw89_core_tx_update_injection(struct rtw89_dev *rtwdev,
                desc_info->no_ack = true;
                desc_info->tx_cnt_lmt_en = true;
                desc_info->tx_cnt_lmt = 1;
-       } else if (info->control.rates[0].count) {
+       } else if ((info->control.flags & IEEE80211_TX_CTRL_RATE_INJECT) &&

No need parenthesis for ( & )

Quoted 18 lines
drivers/net/wireless/realtek/rtw89/core.c +2 -1
+                  info->control.rates[0].count) {
                desc_info->tx_cnt_lmt_en = true;
                desc_info->tx_cnt_lmt = info->control.rates[0].count;
        }
@@ -7561,7 +7562,7 @@ static int rtw89_core_register_hw(struct rtw89_dev *rtwdev)
        hw->queues = IEEE80211_NUM_ACS;
        hw->max_rx_aggregation_subframes = chip->max_rx_agg_num;
        hw->max_tx_aggregation_subframes = chip->max_tx_agg_num;
-       hw->max_rate_tries = RTW89_TX_DATA_CNT_LMT_MAX;
+       hw->max_rate_tries = IEEE80211_MAX_TX_RETRY;
        hw->uapsd_max_sp_len = IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL;
 
        hw->radiotap_mcs_details |= IEEE80211_RADIOTAP_MCS_HAVE_FEC |
drivers/net/wireless/realtek/rtw89/core.h +0 -0
index 87a832b5c..612389f32 100644

drivers/net/wireless/realtek/rtw89/core.h struct rtw89_tx_desc_info { · line 1281

Quoted 4 lines
drivers/net/wireless/realtek/rtw89/core.h +0 -1
@@ -1278,7 +1278,6 @@ struct rtw89_tx_desc_info {
        bool tx_cnt_lmt_en;
        u8 sn: 4;
        u8 tx_cnt_lmt: 6;
-#define RTW89_TX_DATA_CNT_LMT_MAX      0x3f

You need to consider min of driver and ieee80211, so maybe

    min(0x3f, IEEE80211_MAX_TX_RETRY)

The logic is clearer.

Quoted 8 lines
drivers/net/wireless/realtek/rtw89/core.h +0 -0
        u8 addr_info_nr;
        u8 sec_keyid;
        u8 sec_type;
drivers/net/wireless/realtek/rtw89/mac.h +0 -0
index c94b34b92..5c3af59d1 100644

drivers/net/wireless/realtek/rtw89/mac.h void rtw89_tx_rpt_tx_status(struct rtw89_dev *rtwdev, struct sk_buff *skb, · line 1900

Quoted 8 lines
drivers/net/wireless/realtek/rtw89/mac.h +2 -3
@@ -1896,12 +1896,15 @@ void rtw89_tx_rpt_tx_status(struct rtw89_dev *rtwdev, struct sk_buff *skb,
        info = IEEE80211_SKB_CB(skb);
        ieee80211_tx_info_clear_status(info);
 
-       if (info->flags & IEEE80211_TX_CTL_NO_ACK)
-               info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
-       if (tx_status == RTW89_TX_DONE)
+       info->flags &= ~(IEEE80211_TX_STAT_NOACK_TRANSMITTED |
+                        IEEE80211_TX_STAT_ACK);

Why do you need to clear these two bits ahead?

drivers/net/wireless/realtek/rtw89/mac.h void rtw89_tx_rpt_tx_status(struct rtw89_dev *rtwdev, struct sk_buff *skb, · line 1904

Quoted 8 lines
drivers/net/wireless/realtek/rtw89/mac.h +5 -2
+       if (info->flags & IEEE80211_TX_CTL_NO_ACK) {
+               if (tx_status == RTW89_TX_DONE ||
+                   tx_status == RTW89_TX_RETRY_LIMIT)
+                       info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
+       } else if (tx_status == RTW89_TX_DONE) {
                info->flags |= IEEE80211_TX_STAT_ACK;
-       else
-               info->flags &= ~IEEE80211_TX_STAT_ACK;

I think the original ~IEEE80211_TX_STAT_ACK is not necessary.

Quoted 6 lines
drivers/net/wireless/realtek/rtw89/mac.h +1 -1
+       }
 
        ieee80211_tx_status_irqsafe(rtwdev->hw, skb);
 }
--

2.53.0

pw-bot: cr

#3 lore raw

Re: [PATCH rtw-next 1/2] wifi: rtw89: fix retry limit and NO_ACK status for injected frames

Quoted 4 lines · Ping-Ke Shih
Quoted 2 lines

Commit 92608bb5f14f ("wifi: rtw89: honor ASSIGN_SEQ, retries, and NO_ACK for injected frames") has three issues:

Your Fixes tag has said this.

[...]

Quoted 5 lines
Quoted 3 lines

3. rtw89_tx_rpt_tx_status() sets IEEE80211_TX_STAT_NOACK_TRANSMITTED unconditionally for NO_ACK frames (including RTW89_TX_MACID_DROP and RTW89_TX_LIFE_TIME)

I don't know why there is a problem?

In mac80211 (status.c), IEEE80211_TX_STAT_NOACK_TRANSMITTED sets noack_success = true, so a dropped skb gets counted in dot11TransmittedFrameCount (and skips retry_failed / lost_packet when sta is present) even though it was never sent.

[...]

Quoted 1 line

Generated by LLM? Can you reword commit message yourself?

Yes, sorry for the noise. English isn't my first language so I used an LLM to polish the commit log and it came out way too verbose. I'll rewrite it plainly myself in v2 and drop the redundant Fixes sentence.

Quoted 1 line

No need parenthesis for ( & )

[...]

Quoted 4 lines

You need to consider min of driver and ieee80211, so maybe

    min(0x3f, IEEE80211_MAX_TX_RETRY)

The logic is clearer.

[...]

Quoted 1 line

Why do you need to clear these two bits ahead?

[...]

Quoted 1 line

I think the original ~IEEE80211_TX_STAT_ACK is not necessary.

Agreed on all of these. The TX_STAT_* bits are already zero on a fresh skb, and min(RTW89_TX_DATA_CNT_LMT_MAX, IEEE80211_MAX_TX_RETRY) is much clearer. Will update in v2.

Thanks,
Enver

maintainer
#4 lore raw

RE: [PATCH rtw-next 1/2] wifi: rtw89: fix retry limit and NO_ACK status for injected frames

Quoted 10 lines · Enver Ikromov
Quoted 4 lines · Ping-Ke Shih
Quoted 2 lines

Commit 92608bb5f14f ("wifi: rtw89: honor ASSIGN_SEQ, retries, and NO_ACK for injected frames") has three issues:

Your Fixes tag has said this.

[...]

Quoted 4 lines
Quoted 3 lines

3. rtw89_tx_rpt_tx_status() sets IEEE80211_TX_STAT_NOACK_TRANSMITTED unconditionally for NO_ACK frames (including RTW89_TX_MACID_DROP and RTW89_TX_LIFE_TIME)

Quoted 6 lines
Quoted 1 line

I don't know why there is a problem?

In mac80211 (status.c), IEEE80211_TX_STAT_NOACK_TRANSMITTED sets noack_success = true, so a dropped skb gets counted in dot11TransmittedFrameCount (and skips retry_failed / lost_packet when sta is present) even though it was never sent.

As I see, it affects the counter only, right?

sta->deflink.status_stats.msdu_failed[tid]++;

Quoted 7 lines

[...]

Quoted 1 line

Generated by LLM? Can you reword commit message yourself?

Yes, sorry for the noise. English isn't my first language so I used an LLM to polish the commit log and it came out way too verbose. I'll rewrite it plainly myself in v2 and drop the redundant Fixes sentence.

Not mine first language either. I think you can tell LLM to explain why at first paragraph of commit message.

#5 lore raw

PATCH 2/2 wifi: rtw89: pci: fix TX status and counters for NO_ACK frames

In reply to Enver Ikromov

In rtw89_pci_tx_status(), IEEE80211_TX_STAT_NOACK_TRANSMITTED is set unconditionally whenever IEEE80211_TX_CTL_NO_ACK is present, even when the frame was dropped (RTW89_TX_MACID_DROP or RTW89_TX_LIFE_TIME) without being transmitted. In addition, when a NO_ACK frame completes with RTW89_TX_DONE (broadcast, QoS No-Ack, or Wi-Fi 7 BE NO_ACK), the subsequent RTW89_TX_DONE branch also sets IEEE80211_TX_STAT_ACK and increments tx_ring->tx_acked, whereas unacknowledged Wi-Fi 6 AX unicast NO_ACK frames (tx_cnt_lmt = 1) complete with RTW89_TX_RETRY_LIMIT and fall into the failure path.

Clear stale TX status bits and set IEEE80211_TX_STAT_NOACK_TRANSMITTED exclusively when a NO_ACK frame completes with RTW89_TX_DONE or RTW89_TX_RETRY_LIMIT, reserving IEEE80211_TX_STAT_ACK and tx_ring->tx_acked for non-NO_ACK completions while still accounting RTW89_TX_LIFE_TIME and RTW89_TX_MACID_DROP as failures.

Fixes e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")
---
 drivers/net/wireless/realtek/rtw89/pci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/pci.c +5 -2
index 76523d057..2204ed8c5 100644
@@ -470,9 +470,12 @@ static void rtw89_pci_tx_status(struct rtw89_dev *rtwdev,
 	info = IEEE80211_SKB_CB(skb);
 	ieee80211_tx_info_clear_status(info);
 
-	if (info->flags & IEEE80211_TX_CTL_NO_ACK)
+	info->flags &= ~(IEEE80211_TX_STAT_NOACK_TRANSMITTED |
+			 IEEE80211_TX_STAT_ACK);
+	if ((info->flags & IEEE80211_TX_CTL_NO_ACK) &&
+	    (tx_status == RTW89_TX_DONE || tx_status == RTW89_TX_RETRY_LIMIT)) {
 		info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
-	if (tx_status == RTW89_TX_DONE) {
+	} else if (tx_status == RTW89_TX_DONE) {
 		info->flags |= IEEE80211_TX_STAT_ACK;
 		tx_ring->tx_acked++;
 	} else {
Signature · 1 line
2.53.0
maintainer
#6 lore raw

RE: [PATCH rtw-next 2/2] wifi: rtw89: pci: fix TX status and counters for NO_ACK frames

Quoted 4 lines · Enver Ikromov

In rtw89_pci_tx_status(), IEEE80211_TX_STAT_NOACK_TRANSMITTED is set unconditionally whenever IEEE80211_TX_CTL_NO_ACK is present, even when the frame was dropped (RTW89_TX_MACID_DROP or RTW89_TX_LIFE_TIME) without being transmitted.

What is the problem?

Set it only if successfully transmit?

Quoted 7 lines

In addition, when a NO_ACK frame completes
with RTW89_TX_DONE (broadcast, QoS No-Ack, or Wi-Fi 7 BE NO_ACK), the subsequent RTW89_TX_DONE branch also sets IEEE80211_TX_STAT_ACK and increments tx_ring->tx_acked, whereas unacknowledged Wi-Fi 6 AX unicast NO_ACK frames (tx_cnt_lmt = 1) complete with RTW89_TX_RETRY_LIMIT and fall into the failure path.

Quoted 5 lines

Clear stale TX status bits and set IEEE80211_TX_STAT_NOACK_TRANSMITTED exclusively when a NO_ACK frame completes with RTW89_TX_DONE or RTW89_TX_RETRY_LIMIT, reserving IEEE80211_TX_STAT_ACK and tx_ring->tx_acked for non-NO_ACK completions while still accounting RTW89_TX_LIFE_TIME and RTW89_TX_MACID_DROP as failures.

I think no need this.

Quoted 3 lines
Fixes e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")

I don't think this a big deal. It looks like we have Fixes/Cc stable everywhere...

Quoted 10 lines
---
 drivers/net/wireless/realtek/rtw89/pci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/pci.c +0 -0
index 76523d057..2204ed8c5 100644

drivers/net/wireless/realtek/rtw89/pci.c static void rtw89_pci_tx_status(struct rtw89_dev *rtwdev, · line 474

Quoted 6 lines
drivers/net/wireless/realtek/rtw89/pci.c +2 -1
@@ -470,9 +470,12 @@ static void rtw89_pci_tx_status(struct rtw89_dev *rtwdev,
        info = IEEE80211_SKB_CB(skb);
        ieee80211_tx_info_clear_status(info);
 
-       if (info->flags & IEEE80211_TX_CTL_NO_ACK)
+       info->flags &= ~(IEEE80211_TX_STAT_NOACK_TRANSMITTED |
+                        IEEE80211_TX_STAT_ACK);

Why should we clear these two bits?

Quoted 10 lines
drivers/net/wireless/realtek/rtw89/pci.c +3 -2
+       if ((info->flags & IEEE80211_TX_CTL_NO_ACK) &&
+           (tx_status == RTW89_TX_DONE || tx_status == RTW89_TX_RETRY_LIMIT)) {
                info->flags |= IEEE80211_TX_STAT_NOACK_TRANSMITTED;
-       if (tx_status == RTW89_TX_DONE) {
+       } else if (tx_status == RTW89_TX_DONE) {
                info->flags |= IEEE80211_TX_STAT_ACK;
                tx_ring->tx_acked++;
        } else {
--

2.53.0

pw-bot: cr

#7 lore raw

Re: [PATCH rtw-next 2/2] wifi: rtw89: pci: fix TX status and counters for NO_ACK frames

Quoted 8 lines · Ping-Ke Shih
Quoted 4 lines

In rtw89_pci_tx_status(), IEEE80211_TX_STAT_NOACK_TRANSMITTED is set unconditionally whenever IEEE80211_TX_CTL_NO_ACK is present, even when the frame was dropped (RTW89_TX_MACID_DROP or RTW89_TX_LIFE_TIME) without being transmitted.

What is the problem?

Set it only if successfully transmit?

Yes, set it only when the frame was actually sent. PCIe chips like RTL8852AE don't enable tx_rpt, so injected NO_ACK frames report TX status through rtw89_pci_tx_status() rather than rtw89_tx_rpt_tx_status(). Setting NOACK_TRANSMITTED on MACID_DROP or LIFE_TIME makes mac80211 count dropped frames as transmitted, and setting STAT_ACK on TX_DONE reports NO_ACK frames as acked. On AX unicast NO_ACK with tx_cnt_lmt = 1, the single TX attempt finishes with RTW89_TX_RETRY_LIMIT, so both TX_DONE and TX_RETRY_LIMIT mean it went out on air.

[...]

Quoted 12 lines
Quoted 5 lines

Clear stale TX status bits and set IEEE80211_TX_STAT_NOACK_TRANSMITTED exclusively when a NO_ACK frame completes with RTW89_TX_DONE or RTW89_TX_RETRY_LIMIT, reserving IEEE80211_TX_STAT_ACK and tx_ring->tx_acked for non-NO_ACK completions while still accounting RTW89_TX_LIFE_TIME and RTW89_TX_MACID_DROP as failures.

I think no need this.

Quoted 2 lines
Fixes e3ec7017f6a2 ("rtw89: add Realtek 802.11ax driver")

I don't think this a big deal. It looks like we have Fixes/Cc stable everywhere...

[...]

Quoted 1 line

Why should we clear these two bits?

Right, tx_ring->tx_acked and the other ring counters should stay as-is, and clearing those two bits ahead is unnecessary. In v2 I'll leave the tx_ring counters untouched, drop the flag clearing and Fixes/Cc: stable tags, and keep the commit message short.

Thanks,
Enver