From acab697c32f7a38ec0e9721ac02febd295e8df74 Mon Sep 17 00:00:00 2001 From: Sarika Sharma Date: Mon, 30 Jun 2025 12:14:31 +0530 Subject: [PATCH] wifi: ath12k: properly set bit for pdev mask for firmware PPDU_STATS request Currently, the HTT_H2T_MSG_TYPE_PPDU_STATS_CFG request uses bits 8 to 15 as the bitmask for HTT_PPDU_STATS_CFG_PDEV_ID for firmware PPDU_STATS. However, bit 8 is reserved for SOC stats, and the actual PDEV ID should be encoded using bits 9 to 15. This leads to incorrect PDEV ID encoding in the request, causing it to either ignore the request or apply it to the wrong PDEV. Additionally, pdev_mask calculation is done as pdev_mask = 1 << (i + 1); (i.e. i= num_rxmda_per_pdev) but this is not valid for multiple pdevs(multi-MAC configurations) with 1 rxdma per pdev, as this will mask the same value for all pdevs. To correctly identify each and exact MAC in multi-MAC configurations, the calculation should include ar->pdev_idx: pdev_mask = 1 << i + ar->pdev_idx; Due to these issues, the firmware does not send PPDU_STATS for the intended PDEV, leading to inaccurate and incomplete statistics on the host. This might trigger certain WARN_ON() conditions in host that rely on these statistics. Hence, change the bitmask for HTT_PPDU_STATS_CFG_PDEV_ID as bit 9 to 15 to properly fill the pdev id in request message and change the pdev_mask calculation to consider ar->pdev_idx to mask pdev correctly. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1 Signed-off-by: Sarika Sharma Reviewed-by: Vasanthakumar Thiagarajan Link: https://patch.msgid.link/20250630064431.3446333-1-quic_sarishar@quicinc.com Signed-off-by: Jeff Johnson --- drivers/net/wireless/ath/ath12k/dp.h | 3 ++- drivers/net/wireless/ath/ath12k/dp_tx.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath12k/dp.h b/drivers/net/wireless/ath/ath12k/dp.h index 0c1fece272649..6df07b23b7053 100644 --- a/drivers/net/wireless/ath/ath12k/dp.h +++ b/drivers/net/wireless/ath/ath12k/dp.h @@ -703,7 +703,8 @@ struct htt_ppdu_stats_cfg_cmd { } __packed; #define HTT_PPDU_STATS_CFG_MSG_TYPE GENMASK(7, 0) -#define HTT_PPDU_STATS_CFG_PDEV_ID GENMASK(15, 8) +#define HTT_PPDU_STATS_CFG_SOC_STATS BIT(8) +#define HTT_PPDU_STATS_CFG_PDEV_ID GENMASK(15, 9) #define HTT_PPDU_STATS_CFG_TLV_TYPE_BITMASK GENMASK(31, 16) enum htt_ppdu_stats_tag_type { diff --git a/drivers/net/wireless/ath/ath12k/dp_tx.c b/drivers/net/wireless/ath/ath12k/dp_tx.c index ca3d97043da04..1fa37cda10463 100644 --- a/drivers/net/wireless/ath/ath12k/dp_tx.c +++ b/drivers/net/wireless/ath/ath12k/dp_tx.c @@ -1257,7 +1257,7 @@ int ath12k_dp_tx_htt_h2t_ppdu_stats_req(struct ath12k *ar, u32 mask) cmd->msg = le32_encode_bits(HTT_H2T_MSG_TYPE_PPDU_STATS_CFG, HTT_PPDU_STATS_CFG_MSG_TYPE); - pdev_mask = 1 << (i + 1); + pdev_mask = 1 << (i + ar->pdev_idx); cmd->msg |= le32_encode_bits(pdev_mask, HTT_PPDU_STATS_CFG_PDEV_ID); cmd->msg |= le32_encode_bits(mask, HTT_PPDU_STATS_CFG_TLV_TYPE_BITMASK); -- 2.47.2