wifi: ath11k: read a station's TX rate under base_lock
PATCH 1/1 wifi: ath11k: read a station's TX rate under base_lock
ath11k_update_per_peer_tx_stats() and ath11k_dp_tx_update_txcompl() rewrite arsta->txrate under ab->base_lock: they clear it, then fill in its fields one by one. ath11k_mac_op_sta_statistics() copies it into the station info without that lock, so a station dump that runs while a TX status updates the rate can copy the HE flag with an nss of 0, and cfg80211 warns:
WARNING: CPU: 3 PID: 30429 at net/wireless/util.c:1581 ieee80211_get_vht_max_nss+0x474/0x868 [cfg80211] Call trace: ieee80211_get_vht_max_nss+0x474/0x868 [cfg80211] (P) cfg80211_calculate_bitrate+0x1e0/0x4f4 [cfg80211] nl80211_put_sta_rate+0x50/0x1230 [cfg80211] nl80211_put_sta_rate+0xa30/0x1230 [cfg80211] nl80211_dump_station+0x4b8/0x7e0 [cfg80211]
(the line is the nss check in the inlined cfg80211_calculate_bitrate_he()). It was seen once in about a day on an IPQ8074 AP whose stations are dumped periodically by a monitoring agent.
Copy the rate under base_lock and report from the copy, as ath12k reads its peer rate info under its DP lock.
The change and this message were written with Claude, an AI coding assistant.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.r4-00683-QCAHKSWPL_SILICONZ-1
Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-03982-QCAHKSWPL_SILICONZ-3
---
Found on an Arista C-360 (IPQ8074 + QCN9074) running OpenWrt, from a warning in its kernel log; the cause was found by reading the code. ath12k already reads its peer rate info under its DP lock.
--- drivers/net/wireless/ath/ath11k/mac.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +16 -10
@@ -9425,6 +9425,7 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, {struct ath11k_sta *arsta =ath11k_sta_to_arsta (sta);struct ath11k *ar = arsta->arvif->ar; +struct rate_info txrate;s8 signal;bool db2dbm =test_bit (WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT , ar->ab->wmi_ab.svc_map);
@@ -9435,18 +9436,23 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, sinfo->tx_duration = arsta->tx_duration; sinfo->filled |=BIT_ULL (NL80211_STA_INFO_TX_DURATION ); -if (arsta->txrate.legacy || arsta->txrate.nss) { -if (arsta->txrate.legacy) { - sinfo->txrate.legacy = arsta->txrate.legacy; +/* The TX status paths clear and refill txrate under base_lock */ +spin_lock_bh (&ar->ab->base_lock); + txrate = arsta->txrate; +spin_unlock_bh (&ar->ab->base_lock); + +if (txrate.legacy || txrate.nss) { +if (txrate.legacy) { + sinfo->txrate.legacy = txrate.legacy; }else { - sinfo->txrate.mcs = arsta->txrate.mcs; - sinfo->txrate.nss = arsta->txrate.nss; - sinfo->txrate.bw = arsta->txrate.bw; - sinfo->txrate.he_gi = arsta->txrate.he_gi; - sinfo->txrate.he_dcm = arsta->txrate.he_dcm; - sinfo->txrate.he_ru_alloc = arsta->txrate.he_ru_alloc; + sinfo->txrate.mcs = txrate.mcs; + sinfo->txrate.nss = txrate.nss; + sinfo->txrate.bw = txrate.bw; + sinfo->txrate.he_gi = txrate.he_gi; + sinfo->txrate.he_dcm = txrate.he_dcm; + sinfo->txrate.he_ru_alloc = txrate.he_ru_alloc; } - sinfo->txrate.flags = arsta->txrate.flags; + sinfo->txrate.flags = txrate.flags; sinfo->filled |=BIT_ULL (NL80211_STA_INFO_TX_BITRATE ); }
---
base-commit: ff4c7359e310744a7abe53cf66d921fa2969eb19
change-id: 20261111-ath11k-sta-txrate-lock-50b530be39c2
Best regards,
Signature · 1 line
Christopher Griffin <[email protected]>
Quoted 54 lines · On 11/14/2026 10:34 PM, Christopher Griffin via B4 Relay wrote:
From: Christopher Griffin <[email protected]>
ath11k_update_per_peer_tx_stats()andath11k_dp_tx_update_txcompl()rewritearsta->txrateunderab->base_lock: they clear it, then fill in its fields one by one.ath11k_mac_op_sta_statistics()copies it into the station info without that lock, so a station dump that runs while a TX status updates the rate can copy the HE flag with an nss of 0, and cfg80211 warns:WARNING: CPU: 3 PID: 30429 at net/wireless/util.c:1581 ieee80211_get_vht_max_nss+0x474/0x868 [cfg80211] Call trace: ieee80211_get_vht_max_nss+0x474/0x868 [cfg80211] (P) cfg80211_calculate_bitrate+0x1e0/0x4f4 [cfg80211] nl80211_put_sta_rate+0x50/0x1230 [cfg80211] nl80211_put_sta_rate+0xa30/0x1230 [cfg80211] nl80211_dump_station+0x4b8/0x7e0 [cfg80211](the line is the nss check in the inlined
cfg80211_calculate_bitrate_he()). It was seen once in about a day on an IPQ8074 AP whose stations are dumped periodically by a monitoring agent.Copy the rate under
base_lockand report from the copy, as ath12k reads its peer rate info under its DP lock.The change and this message were written with Claude, an AI coding assistant.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.r4-00683-QCAHKSWPL_SILICONZ-1
Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-03982-QCAHKSWPL_SILICONZ-3Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")Signed-off-by Christopher Griffin <[email protected]>---
Found on an Arista C-360 (IPQ8074 + QCN9074) running OpenWrt, from a warning in its kernel log; the cause was found by reading the code. ath12k already reads its peer rate info under its DP lock.--- drivers/net/wireless/ath/ath11k/mac.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)drivers/net/wireless/ath/ath11k/mac.c +1
-0@@ -9425,6 +9425,7 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, {struct ath11k_sta *arsta =ath11k_sta_to_arsta (sta);struct ath11k *ar = arsta->arvif->ar; +struct rate_info txrate;s8 signal;bool db2dbm =test_bit (WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT , ar->ab->wmi_ab.svc_map);
drivers/net/wireless/ath/ath11k/mac.c static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, · line 9436
Quoted 1 line
drivers/net/wireless/ath/ath11k/mac.c +0
-0@@ -9435,18 +9436,23 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, sinfo->tx_duration = arsta->tx_duration;
arsta->rx_duration and arsta->tx_duration are u64 and are also only updated under ab->base_lock, so on 32-bit they can tear the same way. Since the lock is taken here anyway, moving those two reads into the same critical section would cost nothing, and is what ath12k_mac_op_link_sta_statistics() does under dp_lock.
Not a blocker, fine to leave it for a separate patch.
Quoted 37 lines
drivers/net/wireless/ath/ath11k/mac.c +15
-11sinfo->filled |=BIT_ULL (NL80211_STA_INFO_TX_DURATION ); -if (arsta->txrate.legacy || arsta->txrate.nss) { -if (arsta->txrate.legacy) { - sinfo->txrate.legacy = arsta->txrate.legacy; +/* The TX status paths clear and refill txrate under base_lock */ +spin_lock_bh (&ar->ab->base_lock); + txrate = arsta->txrate; +spin_unlock_bh (&ar->ab->base_lock); + +if (txrate.legacy || txrate.nss) { +if (txrate.legacy) { + sinfo->txrate.legacy = txrate.legacy; }else { - sinfo->txrate.mcs = arsta->txrate.mcs; - sinfo->txrate.nss = arsta->txrate.nss; - sinfo->txrate.bw = arsta->txrate.bw; - sinfo->txrate.he_gi = arsta->txrate.he_gi; - sinfo->txrate.he_dcm = arsta->txrate.he_dcm; - sinfo->txrate.he_ru_alloc = arsta->txrate.he_ru_alloc; + sinfo->txrate.mcs = txrate.mcs; + sinfo->txrate.nss = txrate.nss; + sinfo->txrate.bw = txrate.bw; + sinfo->txrate.he_gi = txrate.he_gi; + sinfo->txrate.he_dcm = txrate.he_dcm; + sinfo->txrate.he_ru_alloc = txrate.he_ru_alloc; } - sinfo->txrate.flags = arsta->txrate.flags; + sinfo->txrate.flags = txrate.flags; sinfo->filled |=BIT_ULL (NL80211_STA_INFO_TX_BITRATE ); } ---base-commit:
ff4c7359e310744a7abe53cf66d921fa2969eb19
change-id: 20261111-ath11k-sta-txrate-lock-50b530be39c2
Quoted 5 lines
Best regards,
Signature · 1 line
Christopher Griffin <[email protected]>
Quoted 64 lines · Baochen Qiang
Quoted 54 lines · On 11/14/2026 10:34 PM, Christopher Griffin via B4 Relay wrote:
From: Christopher Griffin <[email protected]>
ath11k_update_per_peer_tx_stats()andath11k_dp_tx_update_txcompl()rewritearsta->txrateunderab->base_lock: they clear it, then fill in its fields one by one.ath11k_mac_op_sta_statistics()copies it into the station info without that lock, so a station dump that runs while a TX status updates the rate can copy the HE flag with an nss of 0, and cfg80211 warns:WARNING: CPU: 3 PID: 30429 at net/wireless/util.c:1581 ieee80211_get_vht_max_nss+0x474/0x868 [cfg80211] Call trace: ieee80211_get_vht_max_nss+0x474/0x868 [cfg80211] (P) cfg80211_calculate_bitrate+0x1e0/0x4f4 [cfg80211] nl80211_put_sta_rate+0x50/0x1230 [cfg80211] nl80211_put_sta_rate+0xa30/0x1230 [cfg80211] nl80211_dump_station+0x4b8/0x7e0 [cfg80211](the line is the nss check in the inlined
cfg80211_calculate_bitrate_he()). It was seen once in about a day on an IPQ8074 AP whose stations are dumped periodically by a monitoring agent.Copy the rate under
base_lockand report from the copy, as ath12k reads its peer rate info under its DP lock.The change and this message were written with Claude, an AI coding assistant.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.r4-00683-QCAHKSWPL_SILICONZ-1
Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-03982-QCAHKSWPL_SILICONZ-3Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")Signed-off-by Christopher Griffin <[email protected]>---
Found on an Arista C-360 (IPQ8074 + QCN9074) running OpenWrt, from a warning in its kernel log; the cause was found by reading the code. ath12k already reads its peer rate info under its DP lock.--- drivers/net/wireless/ath/ath11k/mac.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)drivers/net/wireless/ath/ath11k/mac.c +1
-0@@ -9425,6 +9425,7 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, {struct ath11k_sta *arsta =ath11k_sta_to_arsta (sta);struct ath11k *ar = arsta->arvif->ar; +struct rate_info txrate;s8 signal;bool db2dbm =test_bit (WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT , ar->ab->wmi_ab.svc_map);drivers/net/wireless/ath/ath11k/mac.c static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, · line 9436
Quoted 1 line
drivers/net/wireless/ath/ath11k/mac.c +0
-0@@ -9435,18 +9436,23 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, sinfo->tx_duration = arsta->tx_duration;
arsta->rx_durationandarsta->tx_durationare u64 and are also only updated underab->base_lock, so on 32-bit they can tear the same way. Since the lock is taken here anyway, moving those two reads into the same critical section would cost nothing, and is whatath12k_mac_op_link_sta_statistics()does underdp_lock.
Quoted 1 line
Not a blocker, fine to leave it for a separate patch.
I'll incorporate this suggestion into the patch in my pending branch
Quoted 65 lines · Jeff Johnson
Quoted 64 lines · Baochen Qiang
Quoted 54 lines · On 11/14/2026 10:34 PM, Christopher Griffin via B4 Relay wrote:
From: Christopher Griffin <[email protected]>
ath11k_update_per_peer_tx_stats()andath11k_dp_tx_update_txcompl()rewritearsta->txrateunderab->base_lock: they clear it, then fill in its fields one by one.ath11k_mac_op_sta_statistics()copies it into the station info without that lock, so a station dump that runs while a TX status updates the rate can copy the HE flag with an nss of 0, and cfg80211 warns:WARNING: CPU: 3 PID: 30429 at net/wireless/util.c:1581 ieee80211_get_vht_max_nss+0x474/0x868 [cfg80211] Call trace: ieee80211_get_vht_max_nss+0x474/0x868 [cfg80211] (P) cfg80211_calculate_bitrate+0x1e0/0x4f4 [cfg80211] nl80211_put_sta_rate+0x50/0x1230 [cfg80211] nl80211_put_sta_rate+0xa30/0x1230 [cfg80211] nl80211_dump_station+0x4b8/0x7e0 [cfg80211](the line is the nss check in the inlined
cfg80211_calculate_bitrate_he()). It was seen once in about a day on an IPQ8074 AP whose stations are dumped periodically by a monitoring agent.Copy the rate under
base_lockand report from the copy, as ath12k reads its peer rate info under its DP lock.The change and this message were written with Claude, an AI coding assistant.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.r4-00683-QCAHKSWPL_SILICONZ-1
Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-03982-QCAHKSWPL_SILICONZ-3Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")Signed-off-by Christopher Griffin <[email protected]>---
Found on an Arista C-360 (IPQ8074 + QCN9074) running OpenWrt, from a warning in its kernel log; the cause was found by reading the code. ath12k already reads its peer rate info under its DP lock.--- drivers/net/wireless/ath/ath11k/mac.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)drivers/net/wireless/ath/ath11k/mac.c +1
-0@@ -9425,6 +9425,7 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, {struct ath11k_sta *arsta =ath11k_sta_to_arsta (sta);struct ath11k *ar = arsta->arvif->ar; +struct rate_info txrate;s8 signal;bool db2dbm =test_bit (WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT , ar->ab->wmi_ab.svc_map);drivers/net/wireless/ath/ath11k/mac.c static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, · line 9436
Quoted 1 line
drivers/net/wireless/ath/ath11k/mac.c +0
-0@@ -9435,18 +9436,23 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, sinfo->tx_duration = arsta->tx_duration;
arsta->rx_durationandarsta->tx_durationare u64 and are also only updated underab->base_lock, so on 32-bit they can tear the same way. Since the lock is taken here anyway, moving those two reads into the same critical section would cost nothing, and is whatath12k_mac_op_link_sta_statistics()does underdp_lock.
Quoted 3 lines
Quoted 1 line
Not a blocker, fine to leave it for a separate patch.
I'll incorporate this suggestion into the patch in my pending branch
Please check:
Quoted 3 lines · Jeff Johnson
Please check:
Looks good to me, thanks. Reading rx_duration and tx_duration in the same critical section as the txrate copy is right, and the filled bits set after the unlock are fine.
Two notes on the commit as it stands:
- The Tested-on tags are from v1. The two added reads are reviewed only, not run on the boards. I can run the pending version on the IPQ8074, QCN9074 and IPQ6018 units if you want that before it goes to ath-next.
- The sentence saying the change and the message were written with an AI coding assistant is no longer in the changelog. I'm fine either way, I only mention it in case that was not intended.
Thanks to Baochen and Rameshkumar for the reviews.
Christopher
Quoted 89 lines · On 11/14/2026 8:04 PM, Christopher Griffin via B4 Relay wrote:
From: Christopher Griffin <[email protected]>
ath11k_update_per_peer_tx_stats()andath11k_dp_tx_update_txcompl()rewritearsta->txrateunderab->base_lock: they clear it, then fill in its fields one by one.ath11k_mac_op_sta_statistics()copies it into the station info without that lock, so a station dump that runs while a TX status updates the rate can copy the HE flag with an nss of 0, and cfg80211 warns:WARNING: CPU: 3 PID: 30429 at net/wireless/util.c:1581 ieee80211_get_vht_max_nss+0x474/0x868 [cfg80211] Call trace: ieee80211_get_vht_max_nss+0x474/0x868 [cfg80211] (P) cfg80211_calculate_bitrate+0x1e0/0x4f4 [cfg80211] nl80211_put_sta_rate+0x50/0x1230 [cfg80211] nl80211_put_sta_rate+0xa30/0x1230 [cfg80211] nl80211_dump_station+0x4b8/0x7e0 [cfg80211](the line is the nss check in the inlined
cfg80211_calculate_bitrate_he()). It was seen once in about a day on an IPQ8074 AP whose stations are dumped periodically by a monitoring agent.Copy the rate under
base_lockand report from the copy, as ath12k reads its peer rate info under its DP lock.The change and this message were written with Claude, an AI coding assistant.
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.r4-00683-QCAHKSWPL_SILICONZ-1
Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-03982-QCAHKSWPL_SILICONZ-3Fixes d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")Signed-off-by Christopher Griffin <[email protected]>---
Found on an Arista C-360 (IPQ8074 + QCN9074) running OpenWrt, from a warning in its kernel log; the cause was found by reading the code. ath12k already reads its peer rate info under its DP lock.--- drivers/net/wireless/ath/ath11k/mac.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)drivers/net/wireless/ath/ath11k/mac.c +16
-11@@ -9425,6 +9425,7 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, {struct ath11k_sta *arsta =ath11k_sta_to_arsta (sta);struct ath11k *ar = arsta->arvif->ar; +struct rate_info txrate;s8 signal;bool db2dbm =test_bit (WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT , ar->ab->wmi_ab.svc_map);@@ -9435,18 +9436,23 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw, sinfo->tx_duration = arsta->tx_duration; sinfo->filled |=BIT_ULL (NL80211_STA_INFO_TX_DURATION ); -if (arsta->txrate.legacy || arsta->txrate.nss) { -if (arsta->txrate.legacy) { - sinfo->txrate.legacy = arsta->txrate.legacy; +/* The TX status paths clear and refill txrate under base_lock */ +spin_lock_bh (&ar->ab->base_lock); + txrate = arsta->txrate; +spin_unlock_bh (&ar->ab->base_lock); + +if (txrate.legacy || txrate.nss) { +if (txrate.legacy) { + sinfo->txrate.legacy = txrate.legacy; }else { - sinfo->txrate.mcs = arsta->txrate.mcs; - sinfo->txrate.nss = arsta->txrate.nss; - sinfo->txrate.bw = arsta->txrate.bw; - sinfo->txrate.he_gi = arsta->txrate.he_gi; - sinfo->txrate.he_dcm = arsta->txrate.he_dcm; - sinfo->txrate.he_ru_alloc = arsta->txrate.he_ru_alloc; + sinfo->txrate.mcs = txrate.mcs; + sinfo->txrate.nss = txrate.nss; + sinfo->txrate.bw = txrate.bw; + sinfo->txrate.he_gi = txrate.he_gi; + sinfo->txrate.he_dcm = txrate.he_dcm; + sinfo->txrate.he_ru_alloc = txrate.he_ru_alloc; } - sinfo->txrate.flags = arsta->txrate.flags; + sinfo->txrate.flags = txrate.flags; sinfo->filled |=BIT_ULL (NL80211_STA_INFO_TX_BITRATE ); } ---
Quoted 3 lines
base-commit:
ff4c7359e310744a7abe53cf66d921fa2969eb19
change-id: 20261111-ath11k-sta-txrate-lock-50b530be39c2