mirror of https://lore.kernel.org/ath12k/
 help / color / mirror / Atom feed
* [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes
@ 2025-07-22  9:59 Kang Yang
  2025-07-22  9:59 ` [PATCH ath-next 1/3] wifi: ath12k: fix signal in radiotap for WCN7850 Kang Yang
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Kang Yang @ 2025-07-22  9:59 UTC (permalink / raw)
  To: ath12k, kang.yang; +Cc: linux-wireless

This patch-set includes three nit fixes for monitor mode.

Kang Yang (3):
  wifi: ath12k: fix signal in radiotap for WCN7850
  wifi: ath12k: fix HAL_PHYRX_COMMON_USER_INFO handling in monitor mode
  wifi: ath12k: fix the fetching of combined rssi

 drivers/net/wireless/ath/ath12k/dp_mon.c | 49 +++++++++++++++++++-----
 drivers/net/wireless/ath/ath12k/hal_rx.h | 12 +++---
 2 files changed, 46 insertions(+), 15 deletions(-)


base-commit: e4f11ae0c4b29ca0c133f891412afd5dcddc68ff
-- 
2.34.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH ath-next 1/3] wifi: ath12k: fix signal in radiotap for WCN7850
  2025-07-22  9:59 [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes Kang Yang
@ 2025-07-22  9:59 ` Kang Yang
  2025-07-22  9:59 ` [PATCH ath-next 2/3] wifi: ath12k: fix HAL_PHYRX_COMMON_USER_INFO handling in monitor mode Kang Yang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Kang Yang @ 2025-07-22  9:59 UTC (permalink / raw)
  To: ath12k, kang.yang; +Cc: linux-wireless

Currently host will add ATH12K_DEFAULT_NOISE_FLOOR to rssi_comb to
convert RSSI from dB to dBm.

For WCN7850, this conversion is unnecessary because the RSSI value is
already reported in dBm units.

No longer convert for those firmware that already support dBM conversion.

This patch won't affect QCN chips.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
---
 drivers/net/wireless/ath/ath12k/dp_mon.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index 8189e52ed007..ec1587d0b917 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -2154,8 +2154,12 @@ static void ath12k_dp_mon_update_radiotap(struct ath12k *ar,
 	spin_unlock_bh(&ar->data_lock);
 
 	rxs->flag |= RX_FLAG_MACTIME_START;
-	rxs->signal = ppduinfo->rssi_comb + noise_floor;
 	rxs->nss = ppduinfo->nss + 1;
+	if (test_bit(WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT,
+		     ar->ab->wmi_ab.svc_map))
+		rxs->signal = ppduinfo->rssi_comb;
+	else
+		rxs->signal = ppduinfo->rssi_comb + noise_floor;
 
 	if (ppduinfo->userstats[ppduinfo->userid].ampdu_present) {
 		rxs->flag |= RX_FLAG_AMPDU_DETAILS;
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH ath-next 2/3] wifi: ath12k: fix HAL_PHYRX_COMMON_USER_INFO handling in monitor mode
  2025-07-22  9:59 [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes Kang Yang
  2025-07-22  9:59 ` [PATCH ath-next 1/3] wifi: ath12k: fix signal in radiotap for WCN7850 Kang Yang
@ 2025-07-22  9:59 ` Kang Yang
  2025-07-22  9:59 ` [PATCH ath-next 3/3] wifi: ath12k: fix the fetching of combined rssi Kang Yang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Kang Yang @ 2025-07-22  9:59 UTC (permalink / raw)
  To: ath12k, kang.yang; +Cc: linux-wireless

Current monitor mode will parse TLV HAL_PHYRX_OTHER_RECEIVE_INFO with
struct hal_phyrx_common_user_info.

Obviously, they do not match. The original intention here was to parse
HAL_PHYRX_COMMON_USER_INFO. So fix it by correctly parsing
HAL_PHYRX_COMMON_USER_INFO instead.

Also add LTF parsing and report to radiotap along with GI.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1

Fixes: d939919a36f4 ("wifi: ath12k: Add HAL_PHYRX_OTHER_RECEIVE_INFO TLV parsing support")
Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
---
 drivers/net/wireless/ath/ath12k/dp_mon.c | 35 ++++++++++++++++++++----
 drivers/net/wireless/ath/ath12k/hal_rx.h |  3 +-
 2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index ec1587d0b917..e93ede5e6197 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -1440,6 +1440,34 @@ static void ath12k_dp_mon_parse_rx_msdu_end_err(u32 info, u32 *errmap)
 		*errmap |= HAL_RX_MPDU_ERR_MPDU_LEN;
 }
 
+static void
+ath12k_parse_cmn_usr_info(const struct hal_phyrx_common_user_info *cmn_usr_info,
+			  struct hal_rx_mon_ppdu_info *ppdu_info)
+{
+	struct hal_rx_radiotap_eht *eht = &ppdu_info->eht_info.eht;
+	u32 known, data, cp_setting, ltf_size;
+
+	known = __le32_to_cpu(eht->known);
+	known |= IEEE80211_RADIOTAP_EHT_KNOWN_GI |
+		IEEE80211_RADIOTAP_EHT_KNOWN_EHT_LTF;
+	eht->known = cpu_to_le32(known);
+
+	cp_setting = le32_get_bits(cmn_usr_info->info0,
+				   HAL_RX_CMN_USR_INFO0_CP_SETTING);
+	ltf_size = le32_get_bits(cmn_usr_info->info0,
+				 HAL_RX_CMN_USR_INFO0_LTF_SIZE);
+
+	data = __le32_to_cpu(eht->data[0]);
+	data |= u32_encode_bits(cp_setting, IEEE80211_RADIOTAP_EHT_DATA0_GI);
+	data |= u32_encode_bits(ltf_size, IEEE80211_RADIOTAP_EHT_DATA0_LTF);
+	eht->data[0] = cpu_to_le32(data);
+
+	if (!ppdu_info->ltf_size)
+		ppdu_info->ltf_size = ltf_size;
+	if (!ppdu_info->gi)
+		ppdu_info->gi = cp_setting;
+}
+
 static void
 ath12k_dp_mon_parse_status_msdu_end(struct ath12k_mon_data *pmon,
 				    const struct hal_rx_msdu_end *msdu_end)
@@ -1641,11 +1669,8 @@ ath12k_dp_mon_rx_parse_status_tlv(struct ath12k *ar,
 					     HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RX_BW);
 		break;
 	}
-	case HAL_PHYRX_OTHER_RECEIVE_INFO: {
-		const struct hal_phyrx_common_user_info *cmn_usr_info = tlv_data;
-
-		ppdu_info->gi = le32_get_bits(cmn_usr_info->info0,
-					      HAL_RX_PHY_CMN_USER_INFO0_GI);
+	case HAL_PHYRX_COMMON_USER_INFO: {
+		ath12k_parse_cmn_usr_info(tlv_data, ppdu_info);
 		break;
 	}
 	case HAL_RX_PPDU_START_USER_INFO:
diff --git a/drivers/net/wireless/ath/ath12k/hal_rx.h b/drivers/net/wireless/ath/ath12k/hal_rx.h
index a3ab588aae19..801a5f6d3458 100644
--- a/drivers/net/wireless/ath/ath12k/hal_rx.h
+++ b/drivers/net/wireless/ath/ath12k/hal_rx.h
@@ -695,7 +695,8 @@ struct hal_rx_resp_req_info {
 #define HAL_RX_MPDU_ERR_MPDU_LEN		BIT(6)
 #define HAL_RX_MPDU_ERR_UNENCRYPTED_FRAME	BIT(7)
 
-#define HAL_RX_PHY_CMN_USER_INFO0_GI		GENMASK(17, 16)
+#define HAL_RX_CMN_USR_INFO0_CP_SETTING			GENMASK(17, 16)
+#define HAL_RX_CMN_USR_INFO0_LTF_SIZE			GENMASK(19, 18)
 
 struct hal_phyrx_common_user_info {
 	__le32 rsvd[2];
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH ath-next 3/3] wifi: ath12k: fix the fetching of combined rssi
  2025-07-22  9:59 [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes Kang Yang
  2025-07-22  9:59 ` [PATCH ath-next 1/3] wifi: ath12k: fix signal in radiotap for WCN7850 Kang Yang
  2025-07-22  9:59 ` [PATCH ath-next 2/3] wifi: ath12k: fix HAL_PHYRX_COMMON_USER_INFO handling in monitor mode Kang Yang
@ 2025-07-22  9:59 ` Kang Yang
  2025-07-24 14:44 ` [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes Vasanthakumar Thiagarajan
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Kang Yang @ 2025-07-22  9:59 UTC (permalink / raw)
  To: ath12k, kang.yang; +Cc: linux-wireless

Currently, host fetches combined rssi from rssi_comb in struct
hal_rx_phyrx_rssi_legacy_info.

rssi_comb is 8th to 15th bits of the second to last variable.
rssi_comb_ppdu is the 0th to 7th of the last variable.

When bandwidth = 20MHz, rssi_comb = rssi_comb_ppdu. But when bandwidth >
20MHz, rssi_comb < rssi_comb_ppdu because rssi_comb only includes power
of primary 20 MHz while rssi_comb_ppdu includes power of active
RUs/subchannels. So should fetch combined rssi from rssi_comb_ppdu.

Also related macro definitions are too long, rename them.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1

Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
Signed-off-by: Kang Yang <kang.yang@oss.qualcomm.com>
---
 drivers/net/wireless/ath/ath12k/dp_mon.c | 8 ++++----
 drivers/net/wireless/ath/ath12k/hal_rx.h | 9 +++++----
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index e93ede5e6197..abd611ac37f0 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -1655,18 +1655,18 @@ ath12k_dp_mon_rx_parse_status_tlv(struct ath12k *ar,
 		const struct hal_rx_phyrx_rssi_legacy_info *rssi = tlv_data;
 
 		info[0] = __le32_to_cpu(rssi->info0);
-		info[1] = __le32_to_cpu(rssi->info1);
+		info[2] = __le32_to_cpu(rssi->info2);
 
 		/* TODO: Please note that the combined rssi will not be accurate
 		 * in MU case. Rssi in MU needs to be retrieved from
 		 * PHYRX_OTHER_RECEIVE_INFO TLV.
 		 */
 		ppdu_info->rssi_comb =
-			u32_get_bits(info[1],
-				     HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB);
+			u32_get_bits(info[2],
+				     HAL_RX_RSSI_LEGACY_INFO_INFO2_RSSI_COMB_PPDU);
 
 		ppdu_info->bw = u32_get_bits(info[0],
-					     HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RX_BW);
+					     HAL_RX_RSSI_LEGACY_INFO_INFO0_RX_BW);
 		break;
 	}
 	case HAL_PHYRX_COMMON_USER_INFO: {
diff --git a/drivers/net/wireless/ath/ath12k/hal_rx.h b/drivers/net/wireless/ath/ath12k/hal_rx.h
index 801a5f6d3458..d1ad7747b82c 100644
--- a/drivers/net/wireless/ath/ath12k/hal_rx.h
+++ b/drivers/net/wireless/ath/ath12k/hal_rx.h
@@ -483,15 +483,16 @@ enum hal_rx_ul_reception_type {
 	HAL_RECEPTION_TYPE_FRAMELESS
 };
 
-#define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RECEPTION	GENMASK(3, 0)
-#define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO0_RX_BW	GENMASK(7, 5)
-#define HAL_RX_PHYRX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB	GENMASK(15, 8)
+#define HAL_RX_RSSI_LEGACY_INFO_INFO0_RECEPTION		GENMASK(3, 0)
+#define HAL_RX_RSSI_LEGACY_INFO_INFO0_RX_BW		GENMASK(7, 5)
+#define HAL_RX_RSSI_LEGACY_INFO_INFO1_RSSI_COMB		GENMASK(15, 8)
+#define HAL_RX_RSSI_LEGACY_INFO_INFO2_RSSI_COMB_PPDU	GENMASK(7, 0)
 
 struct hal_rx_phyrx_rssi_legacy_info {
 	__le32 info0;
 	__le32 rsvd0[39];
 	__le32 info1;
-	__le32 rsvd1;
+	__le32 info2;
 } __packed;
 
 #define HAL_RX_MPDU_START_INFO0_PPDU_ID			GENMASK(31, 16)
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes
  2025-07-22  9:59 [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes Kang Yang
                   ` (2 preceding siblings ...)
  2025-07-22  9:59 ` [PATCH ath-next 3/3] wifi: ath12k: fix the fetching of combined rssi Kang Yang
@ 2025-07-24 14:44 ` Vasanthakumar Thiagarajan
  2025-09-17  2:33 ` Baochen Qiang
  2025-09-18 23:47 ` Jeff Johnson
  5 siblings, 0 replies; 7+ messages in thread
From: Vasanthakumar Thiagarajan @ 2025-07-24 14:44 UTC (permalink / raw)
  To: Kang Yang, ath12k; +Cc: linux-wireless



On 7/22/2025 3:29 PM, Kang Yang wrote:
> This patch-set includes three nit fixes for monitor mode.
> 
> Kang Yang (3):
>    wifi: ath12k: fix signal in radiotap for WCN7850
>    wifi: ath12k: fix HAL_PHYRX_COMMON_USER_INFO handling in monitor mode
>    wifi: ath12k: fix the fetching of combined rssi
> 
>   drivers/net/wireless/ath/ath12k/dp_mon.c | 49 +++++++++++++++++++-----
>   drivers/net/wireless/ath/ath12k/hal_rx.h | 12 +++---
>   2 files changed, 46 insertions(+), 15 deletions(-)
> 

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes
  2025-07-22  9:59 [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes Kang Yang
                   ` (3 preceding siblings ...)
  2025-07-24 14:44 ` [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes Vasanthakumar Thiagarajan
@ 2025-09-17  2:33 ` Baochen Qiang
  2025-09-18 23:47 ` Jeff Johnson
  5 siblings, 0 replies; 7+ messages in thread
From: Baochen Qiang @ 2025-09-17  2:33 UTC (permalink / raw)
  To: Kang Yang, ath12k; +Cc: linux-wireless



On 7/22/2025 5:59 PM, Kang Yang wrote:
> This patch-set includes three nit fixes for monitor mode.
> 
> Kang Yang (3):
>   wifi: ath12k: fix signal in radiotap for WCN7850
>   wifi: ath12k: fix HAL_PHYRX_COMMON_USER_INFO handling in monitor mode
>   wifi: ath12k: fix the fetching of combined rssi
> 
>  drivers/net/wireless/ath/ath12k/dp_mon.c | 49 +++++++++++++++++++-----
>  drivers/net/wireless/ath/ath12k/hal_rx.h | 12 +++---
>  2 files changed, 46 insertions(+), 15 deletions(-)
> 
> 
> base-commit: e4f11ae0c4b29ca0c133f891412afd5dcddc68ff

Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes
  2025-07-22  9:59 [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes Kang Yang
                   ` (4 preceding siblings ...)
  2025-09-17  2:33 ` Baochen Qiang
@ 2025-09-18 23:47 ` Jeff Johnson
  5 siblings, 0 replies; 7+ messages in thread
From: Jeff Johnson @ 2025-09-18 23:47 UTC (permalink / raw)
  To: ath12k, Kang Yang; +Cc: linux-wireless


On Tue, 22 Jul 2025 17:59:31 +0800, Kang Yang wrote:
> This patch-set includes three nit fixes for monitor mode.
> 
> Kang Yang (3):
>   wifi: ath12k: fix signal in radiotap for WCN7850
>   wifi: ath12k: fix HAL_PHYRX_COMMON_USER_INFO handling in monitor mode
>   wifi: ath12k: fix the fetching of combined rssi
> 
> [...]

Applied, thanks!

[1/3] wifi: ath12k: fix signal in radiotap for WCN7850
      commit: cf412ae7b7124e2b3bfe472616ec24b117b6008a
[2/3] wifi: ath12k: fix HAL_PHYRX_COMMON_USER_INFO handling in monitor mode
      commit: 6b46e85129185ec076f9c3bd2813dfd2f968522b
[3/3] wifi: ath12k: fix the fetching of combined rssi
      commit: 7695fa71c1d50a375e54426421acbc8d457bc5a3

Best regards,
-- 
Jeff Johnson <jeff.johnson@oss.qualcomm.com>



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-09-18 23:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-22  9:59 [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes Kang Yang
2025-07-22  9:59 ` [PATCH ath-next 1/3] wifi: ath12k: fix signal in radiotap for WCN7850 Kang Yang
2025-07-22  9:59 ` [PATCH ath-next 2/3] wifi: ath12k: fix HAL_PHYRX_COMMON_USER_INFO handling in monitor mode Kang Yang
2025-07-22  9:59 ` [PATCH ath-next 3/3] wifi: ath12k: fix the fetching of combined rssi Kang Yang
2025-07-24 14:44 ` [PATCH ath-next 0/3] wifi: ath12k: monitor mode fixes Vasanthakumar Thiagarajan
2025-09-17  2:33 ` Baochen Qiang
2025-09-18 23:47 ` Jeff Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox