diff mbox series

[v5,6/9] wifi: ath12k: fix the ampdu id fetch in the HAL_RX_MPDU_START TLV

Message ID 20250127104738.4174862-7-quic_periyasa@quicinc.com
State Superseded
Headers show
Series wifi: ath12k: Add peer extended Rx statistics debugfs support | expand

Commit Message

Karthikeyan Periyasamy Jan. 27, 2025, 10:47 a.m. UTC
From: P Praneesh <quic_ppranees@quicinc.com>

Currently, ampdu id is update with peer id mask which is incorrect.
Therefore, update the ampdu id with PPDU id mask value. Also move
the ampdu_id field inside the user stats since it is a user id based
statistics.

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 <quic_ppranees@quicinc.com>
Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/dp_mon.c | 16 ++++++++++------
 drivers/net/wireless/ath/ath12k/hal_rx.h |  3 ++-
 2 files changed, 12 insertions(+), 7 deletions(-)

Comments

Vasanthakumar Thiagarajan Jan. 29, 2025, 5:48 a.m. UTC | #1
On 1/27/2025 4:17 PM, Karthikeyan Periyasamy wrote:
> From: P Praneesh <quic_ppranees@quicinc.com>
> 
> Currently, ampdu id is update with peer id mask which is incorrect.
> Therefore, update the ampdu id with PPDU id mask value. Also move
> the ampdu_id field inside the user stats since it is a user id based
> statistics.
> 
> 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 <quic_ppranees@quicinc.com>
> Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
> ---
>   drivers/net/wireless/ath/ath12k/dp_mon.c | 16 ++++++++++------
>   drivers/net/wireless/ath/ath12k/hal_rx.h |  3 ++-
>   2 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
> index 8c283e7c7dde..6ba2f0fa39c1 100644
> --- a/drivers/net/wireless/ath/ath12k/dp_mon.c
> +++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
> @@ -1,7 +1,7 @@
>   // SPDX-License-Identifier: BSD-3-Clause-Clear
>   /*
>    * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
> - * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
> + * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
>    */
>   
>   #include "dp_mon.h"
> @@ -1558,6 +1558,11 @@ ath12k_dp_mon_rx_parse_status_tlv(struct ath12k *ar,
>   		if (userid < HAL_MAX_UL_MU_USERS) {
>   			struct hal_rx_user_status *rxuser_stats =
>   				&ppdu_info->userstats[userid];
> +
> +			if (ppdu_info->num_mpdu_fcs_ok > 1 ||
> +			    ppdu_info->num_mpdu_fcs_err > 1)
> +				ppdu_info->userstats[userid].ampdu_present = true;
> +
>   			ppdu_info->num_users += 1;
>   
>   			ath12k_dp_mon_rx_handle_ofdma_info(eu_stats, rxuser_stats);
> @@ -1669,8 +1674,8 @@ ath12k_dp_mon_rx_parse_status_tlv(struct ath12k *ar,
>   		if (userid < HAL_MAX_UL_MU_USERS) {
>   			info[0] = __le32_to_cpu(mpdu_start->info0);
>   			ppdu_info->userid = userid;
> -			ppdu_info->ampdu_id[userid] =
> -				u32_get_bits(info[0], HAL_RX_MPDU_START_INFO1_PEERID);
> +			ppdu_info->userstats[userid].ampdu_id =
> +				u32_get_bits(info[0], HAL_RX_MPDU_START_INFO0_PPDU_ID);
>   		}
>   
>   		break;
> @@ -1888,15 +1893,14 @@ static void ath12k_dp_mon_update_radiotap(struct ath12k *ar,
>   {
>   	struct ieee80211_supported_band *sband;
>   	u8 *ptr = NULL;
> -	u16 ampdu_id = ppduinfo->ampdu_id[ppduinfo->userid];
>   
>   	rxs->flag |= RX_FLAG_MACTIME_START;
>   	rxs->signal = ppduinfo->rssi_comb + ATH12K_DEFAULT_NOISE_FLOOR;
>   	rxs->nss = ppduinfo->nss + 1;
>   
> -	if (ampdu_id) {
> +	if (ppduinfo->userstats[ppduinfo->userid].ampdu_present) {
>   		rxs->flag |= RX_FLAG_AMPDU_DETAILS;
> -		rxs->ampdu_reference = ampdu_id;
> +		rxs->ampdu_reference = ppduinfo->userstats[ppduinfo->userid].ampdu_id;
>   	}
>   
>   	if (ppduinfo->is_eht || ppduinfo->eht_usig) {
> diff --git a/drivers/net/wireless/ath/ath12k/hal_rx.h b/drivers/net/wireless/ath/ath12k/hal_rx.h
> index 445d1c33b41f..163f9235fcf0 100644
> --- a/drivers/net/wireless/ath/ath12k/hal_rx.h
> +++ b/drivers/net/wireless/ath/ath12k/hal_rx.h
> @@ -148,6 +148,8 @@ struct hal_rx_user_status {
>   	u32 mpdu_fcs_ok_bitmap[HAL_RX_NUM_WORDS_PER_PPDU_BITMAP];
>   	u32 mpdu_ok_byte_count;
>   	u32 mpdu_err_byte_count;
> +	bool ampdu_present;
> +	u16 ampdu_id;
>   };
>   
>   #define HAL_MAX_UL_MU_USERS	37
> @@ -263,7 +265,6 @@ struct hal_rx_mon_ppdu_info {
>   	u8 addr4[ETH_ALEN];
>   	struct hal_rx_user_status userstats[HAL_MAX_UL_MU_USERS];
>   	u8 userid;
> -	u16 ampdu_id[HAL_MAX_UL_MU_USERS];
>   	bool first_msdu_in_mpdu;
>   	bool is_ampdu;
>   	u8 medium_prot_type;

Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index 8c283e7c7dde..6ba2f0fa39c1 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -1,7 +1,7 @@ 
 // SPDX-License-Identifier: BSD-3-Clause-Clear
 /*
  * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include "dp_mon.h"
@@ -1558,6 +1558,11 @@  ath12k_dp_mon_rx_parse_status_tlv(struct ath12k *ar,
 		if (userid < HAL_MAX_UL_MU_USERS) {
 			struct hal_rx_user_status *rxuser_stats =
 				&ppdu_info->userstats[userid];
+
+			if (ppdu_info->num_mpdu_fcs_ok > 1 ||
+			    ppdu_info->num_mpdu_fcs_err > 1)
+				ppdu_info->userstats[userid].ampdu_present = true;
+
 			ppdu_info->num_users += 1;
 
 			ath12k_dp_mon_rx_handle_ofdma_info(eu_stats, rxuser_stats);
@@ -1669,8 +1674,8 @@  ath12k_dp_mon_rx_parse_status_tlv(struct ath12k *ar,
 		if (userid < HAL_MAX_UL_MU_USERS) {
 			info[0] = __le32_to_cpu(mpdu_start->info0);
 			ppdu_info->userid = userid;
-			ppdu_info->ampdu_id[userid] =
-				u32_get_bits(info[0], HAL_RX_MPDU_START_INFO1_PEERID);
+			ppdu_info->userstats[userid].ampdu_id =
+				u32_get_bits(info[0], HAL_RX_MPDU_START_INFO0_PPDU_ID);
 		}
 
 		break;
@@ -1888,15 +1893,14 @@  static void ath12k_dp_mon_update_radiotap(struct ath12k *ar,
 {
 	struct ieee80211_supported_band *sband;
 	u8 *ptr = NULL;
-	u16 ampdu_id = ppduinfo->ampdu_id[ppduinfo->userid];
 
 	rxs->flag |= RX_FLAG_MACTIME_START;
 	rxs->signal = ppduinfo->rssi_comb + ATH12K_DEFAULT_NOISE_FLOOR;
 	rxs->nss = ppduinfo->nss + 1;
 
-	if (ampdu_id) {
+	if (ppduinfo->userstats[ppduinfo->userid].ampdu_present) {
 		rxs->flag |= RX_FLAG_AMPDU_DETAILS;
-		rxs->ampdu_reference = ampdu_id;
+		rxs->ampdu_reference = ppduinfo->userstats[ppduinfo->userid].ampdu_id;
 	}
 
 	if (ppduinfo->is_eht || ppduinfo->eht_usig) {
diff --git a/drivers/net/wireless/ath/ath12k/hal_rx.h b/drivers/net/wireless/ath/ath12k/hal_rx.h
index 445d1c33b41f..163f9235fcf0 100644
--- a/drivers/net/wireless/ath/ath12k/hal_rx.h
+++ b/drivers/net/wireless/ath/ath12k/hal_rx.h
@@ -148,6 +148,8 @@  struct hal_rx_user_status {
 	u32 mpdu_fcs_ok_bitmap[HAL_RX_NUM_WORDS_PER_PPDU_BITMAP];
 	u32 mpdu_ok_byte_count;
 	u32 mpdu_err_byte_count;
+	bool ampdu_present;
+	u16 ampdu_id;
 };
 
 #define HAL_MAX_UL_MU_USERS	37
@@ -263,7 +265,6 @@  struct hal_rx_mon_ppdu_info {
 	u8 addr4[ETH_ALEN];
 	struct hal_rx_user_status userstats[HAL_MAX_UL_MU_USERS];
 	u8 userid;
-	u16 ampdu_id[HAL_MAX_UL_MU_USERS];
 	bool first_msdu_in_mpdu;
 	bool is_ampdu;
 	u8 medium_prot_type;