Message ID | 20250409052647.81955-1-praneesh.p@oss.qualcomm.com |
---|---|
State | New |
Headers | show |
Series | [ath-next] wifi: ath12k: Avoid allocating rx_stats when ext_rx_stats is disabled | expand |
On 4/9/2025 10:56 AM, P Praneesh wrote: > Currently, driver allocates the struct ath12k_rx_peer_stats for each > station regardless of whether ext_rx_stats is enabled. This structure > is populated by the monitor destination ring for both single-user and > multi-user scenarios when ext_rx_stats is enabled. However, when > ext_rx_stats is disabled, this allocation is unnecessary and results in > additional memory consumption. > > To address this issue, allocate the struct ath12k_rx_peer_stats only when > ext_rx_stats is enabled through debugfs. This change prevents unnecessary > memory allocation. Additionally, ensure that the station dump RSSI is > updated irrespective of the ext_rx_stats enablement. > > Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 > Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 > > Signed-off-by: P Praneesh <praneesh.p@oss.qualcomm.com> Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
On Wed, 09 Apr 2025 10:56:47 +0530, P Praneesh wrote: > Currently, driver allocates the struct ath12k_rx_peer_stats for each > station regardless of whether ext_rx_stats is enabled. This structure > is populated by the monitor destination ring for both single-user and > multi-user scenarios when ext_rx_stats is enabled. However, when > ext_rx_stats is disabled, this allocation is unnecessary and results in > additional memory consumption. > > [...] Applied, thanks! [1/1] wifi: ath12k: Avoid allocating rx_stats when ext_rx_stats is disabled commit: 25be5d1d1e050f45f4d52b2cf9c8e4b6382075cf Best regards,
diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c index 6df04920a0c6..64647136620d 100644 --- a/drivers/net/wireless/ath/ath12k/dp_mon.c +++ b/drivers/net/wireless/ath/ath12k/dp_mon.c @@ -3203,11 +3203,10 @@ static void ath12k_dp_mon_rx_update_peer_su_stats(struct ath12k *ar, struct ath12k_rx_peer_stats *rx_stats = arsta->rx_stats; u32 num_msdu; - if (!rx_stats) - return; - arsta->rssi_comb = ppdu_info->rssi_comb; ewma_avg_rssi_add(&arsta->avg_rssi, ppdu_info->rssi_comb); + if (!rx_stats) + return; num_msdu = ppdu_info->tcp_msdu_count + ppdu_info->tcp_ack_msdu_count + ppdu_info->udp_msdu_count + ppdu_info->other_msdu_count; @@ -3380,14 +3379,12 @@ ath12k_dp_mon_rx_update_user_stats(struct ath12k *ar, ahsta = ath12k_sta_to_ahsta(peer->sta); arsta = &ahsta->deflink; + arsta->rssi_comb = ppdu_info->rssi_comb; + ewma_avg_rssi_add(&arsta->avg_rssi, ppdu_info->rssi_comb); rx_stats = arsta->rx_stats; - if (!rx_stats) return; - arsta->rssi_comb = ppdu_info->rssi_comb; - ewma_avg_rssi_add(&arsta->avg_rssi, ppdu_info->rssi_comb); - num_msdu = user_stats->tcp_msdu_count + user_stats->tcp_ack_msdu_count + user_stats->udp_msdu_count + user_stats->other_msdu_count; diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index b19e30d95560..9a8f3f3cc19d 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -5578,7 +5578,7 @@ static int ath12k_mac_station_add(struct ath12k *ar, goto exit; } - if (!arsta->rx_stats) { + if (ath12k_debugfs_is_extd_rx_stats_enabled(ar) && !arsta->rx_stats) { arsta->rx_stats = kzalloc(sizeof(*arsta->rx_stats), GFP_KERNEL); if (!arsta->rx_stats) { ret = -ENOMEM;
Currently, driver allocates the struct ath12k_rx_peer_stats for each station regardless of whether ext_rx_stats is enabled. This structure is populated by the monitor destination ring for both single-user and multi-user scenarios when ext_rx_stats is enabled. However, when ext_rx_stats is disabled, this allocation is unnecessary and results in additional memory consumption. To address this issue, allocate the struct ath12k_rx_peer_stats only when ext_rx_stats is enabled through debugfs. This change prevents unnecessary memory allocation. Additionally, ensure that the station dump RSSI is updated irrespective of the ext_rx_stats enablement. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Signed-off-by: P Praneesh <praneesh.p@oss.qualcomm.com> --- drivers/net/wireless/ath/ath12k/dp_mon.c | 11 ++++------- drivers/net/wireless/ath/ath12k/mac.c | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) base-commit: 12b93f7c6d101d22e0ea3bf4a240699746c79117