1: 79ad7ef98978 ! 1: d044068818b7 wifi: rtw89: fix retry limit and NO_ACK status for injected frames @@ Metadata ## Commit message ## 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: + mac80211 clears IEEE80211_TX_CTRL_RATE_INJECT if the injected rate is + unsupported, but still fills rates[0].count. Check RATE_INJECT before + applying rates[0].count in rtw89_core_tx_update_injection().  - 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. + Cap hw->max_rate_tries at min(RTW89_TX_DATA_CNT_LMT_MAX, + IEEE80211_MAX_TX_RETRY) so radiotap retry counts do not overflow the + 5-bit rates[0].count field.  - 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. + In rtw89_tx_rpt_tx_status(), setting IEEE80211_TX_STAT_NOACK_TRANSMITTED + on dropped NO_ACK skbs (MACID_DROP or LIFE_TIME) makes mac80211 count + them as transmitted instead of failed. Only set NOACK_TRANSMITTED on + RTW89_TX_DONE, or on RTW89_TX_RETRY_LIMIT for AX unicast NO_ACK frames + sent once with tx_cnt_lmt = 1, and do not set IEEE80211_TX_STAT_ACK on + NO_ACK frames.  Fixes: 92608bb5f14f ("wifi: rtw89: honor ASSIGN_SEQ, retries, and NO_ACK for injected frames") Reported-by: Luka Gejak  @@ drivers/net/wireless/realtek/rtw89/core.c: static void rtw89_core_tx_update_inje 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) && ++ } 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; @@ drivers/net/wireless/realtek/rtw89/core.c: static int rtw89_core_register_hw(str 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->max_rate_tries = min(RTW89_TX_DATA_CNT_LMT_MAX, 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 ## -@@ drivers/net/wireless/realtek/rtw89/core.h: 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 ##  @@ drivers/net/wireless/realtek/rtw89/mac.h: void rtw89_tx_rpt_tx_status(struct rtw89_dev *rtwdev, struct sk_buff *skb, info = IEEE80211_SKB_CB(skb); @@ drivers/net/wireless/realtek/rtw89/mac.h: void rtw89_tx_rpt_tx_status(struct rtw  - 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) 2: 46ca6c5fce7f < -: ------------ wifi: rtw89: pci: fix TX status and counters for NO_ACK frames -: ------------ > 2: c8f039302fec wifi: rtw89: pci: fix NO_ACK TX status reporting