diff mbox series

wifi: ath12k: support average ack rssi in station dump

Message ID 20240514124949.2197384-1-quic_ssreeela@quicinc.com
State New
Headers show
Series wifi: ath12k: support average ack rssi in station dump | expand

Commit Message

Sowmiya Sree Elavalagan May 14, 2024, 12:49 p.m. UTC
From: Sivashankari Madhavan <quic_sivamadh@quicinc.com>

Currently, the ACK RSSI value is not shown in station dump. Enable WMI
resource flag for ACK RSSI in WMI INIT command to add ACK RSSI value in
management TX completion event from WMI. Update ACK RSSI value obtained
in management and data frame completion path to ieee80211_tx_info. Also
advertise NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT flag during hardware
register to mac80211 layer so that ACK RSSI is added to station dump
message.

Example output :
Station 00:03:7f:12:cc:cc (on wlo1)
        inactive time:  600 ms
        rx bytes:       288106
        rx packets:     1446
        tx bytes:       41818
        tx packets:     342
        tx retries:     64
        tx failed:      0
        beacon loss:    0
        beacon rx:      602
        rx drop misc:   51
        signal:         0 dBm
        beacon signal avg:      -44 dBm
        tx duration:    0 us
        rx bitrate:     1441.1 MBit/s 80MHz HE-MCS 9 HE-NSS 3 HE-GI 0 HE-DCM 0
        rx duration:    0 us
        last ack signal:-51 dBm
        avg ack signal: -50 dBm
        authorized:     yes
        .......

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-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: Sivashankari Madhavan <quic_sivamadh@quicinc.com>
Signed-off-by: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>

Depends-On: wifi: ath12k: fix the issue that calculation of ack signal strength
 https://patchwork.kernel.org/project/linux-wireless/patch/20240511030917.65811-1-quic_lingbok@quicinc.com/
---
 drivers/net/wireless/ath/ath12k/dp_tx.c |  2 ++
 drivers/net/wireless/ath/ath12k/mac.c   |  1 +
 drivers/net/wireless/ath/ath12k/wmi.c   | 15 +++++++++++----
 drivers/net/wireless/ath/ath12k/wmi.h   |  3 +++
 4 files changed, 17 insertions(+), 4 deletions(-)

Comments

Sowmiya Sree Elavalagan May 15, 2024, 5 a.m. UTC | #1
On 5/14/2024 10:32 PM, Jeff Johnson wrote:
> On 5/14/2024 5:49 AM, Sowmiya Sree Elavalagan wrote:
>> From: Sivashankari Madhavan <quic_sivamadh@quicinc.com>
>>
>> Currently, the ACK RSSI value is not shown in station dump. Enable WMI
>> resource flag for ACK RSSI in WMI INIT command to add ACK RSSI value in
>> management TX completion event from WMI. Update ACK RSSI value obtained
>> in management and data frame completion path to ieee80211_tx_info. Also
>> advertise NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT flag during hardware
>> register to mac80211 layer so that ACK RSSI is added to station dump
>> message.
>>
>> Example output :
>> Station 00:03:7f:12:cc:cc (on wlo1)
>>         inactive time:  600 ms
>>         rx bytes:       288106
>>         rx packets:     1446
>>         tx bytes:       41818
>>         tx packets:     342
>>         tx retries:     64
>>         tx failed:      0
>>         beacon loss:    0
>>         beacon rx:      602
>>         rx drop misc:   51
>>         signal:         0 dBm
>>         beacon signal avg:      -44 dBm
>>         tx duration:    0 us
>>         rx bitrate:     1441.1 MBit/s 80MHz HE-MCS 9 HE-NSS 3 HE-GI 0 HE-DCM 0
>>         rx duration:    0 us
>>         last ack signal:-51 dBm
>>         avg ack signal: -50 dBm
>>         authorized:     yes
>>         .......
>>
>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-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: Sivashankari Madhavan <quic_sivamadh@quicinc.com>
>> Signed-off-by: Sowmiya Sree Elavalagan <quic_ssreeela@quicinc.com>
>>
>> Depends-On: wifi: ath12k: fix the issue that calculation of ack signal strength
>>  https://patchwork.kernel.org/project/linux-wireless/patch/20240511030917.65811-1-quic_lingbok@quicinc.com/
> 
> Does your patch not need to consider whether or not
> WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT is enabled?
> 

WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT flag is used to decide whether we need to add noise 
floor (ATH12K_DEFAULT_NOISE_FLOOR) or not to the ack_rssi value we receive in data path. In this patch we do 
not add noise floor anywhere. The ack rssi received in WMI completion path includes the noise 
floor computation before sending to driver.

>> ---
>>  drivers/net/wireless/ath/ath12k/dp_tx.c |  2 ++
>>  drivers/net/wireless/ath/ath12k/mac.c   |  1 +
>>  drivers/net/wireless/ath/ath12k/wmi.c   | 15 +++++++++++----
>>  drivers/net/wireless/ath/ath12k/wmi.h   |  3 +++
>>  4 files changed, 17 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath12k/dp_tx.c b/drivers/net/wireless/ath/ath12k/dp_tx.c
>> index 32496015cf9a..43bdb49d08e2 100644
>> --- a/drivers/net/wireless/ath/ath12k/dp_tx.c
>> +++ b/drivers/net/wireless/ath/ath12k/dp_tx.c
>> @@ -541,6 +541,8 @@ static void ath12k_dp_tx_status_parse(struct ath12k_base *ab,
>>  
>>  	ts->ppdu_id = le32_get_bits(desc->info1,
>>  				    HAL_WBM_COMPL_TX_INFO1_TQM_STATUS_NUMBER);
>> +	ts->ack_rssi = le32_get_bits(desc->info2,
>> +				     HAL_WBM_COMPL_TX_INFO2_ACK_FRAME_RSSI);
>>  	if (le32_to_cpu(desc->rate_stats.info0) & HAL_TX_RATE_STATS_INFO0_VALID)
>>  		ts->rate_stats = le32_to_cpu(desc->rate_stats.info0);
>>  	else
>> diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
>> index 96dc5c2e096f..1f4739269544 100644
>> --- a/drivers/net/wireless/ath/ath12k/mac.c
>> +++ b/drivers/net/wireless/ath/ath12k/mac.c
>> @@ -8733,6 +8733,7 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
>>  
>>  	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
>>  	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_STA_TX_PWR);
>> +	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);
>>  
>>  	wiphy->cipher_suites = cipher_suites;
>>  	wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
>> diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
>> index 3004c7463be9..fe909d866539 100644
>> --- a/drivers/net/wireless/ath/ath12k/wmi.c
>> +++ b/drivers/net/wireless/ath/ath12k/wmi.c
>> @@ -3468,7 +3468,8 @@ ath12k_wmi_copy_resource_config(struct ath12k_wmi_resource_config_params *wmi_cf
>>  	wmi_cfg->max_bssid_rx_filters = cpu_to_le32(tg_cfg->max_bssid_rx_filters);
>>  	wmi_cfg->use_pdev_id = cpu_to_le32(tg_cfg->use_pdev_id);
>>  	wmi_cfg->flag1 = cpu_to_le32(tg_cfg->atf_config |
>> -				     WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64);
>> +				     WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 |
>> +				     WMI_RSRC_CFG_FLAG1_ACK_RSSI);
>>  	wmi_cfg->peer_map_unmap_version = cpu_to_le32(tg_cfg->peer_map_unmap_version);
>>  	wmi_cfg->sched_params = cpu_to_le32(tg_cfg->sched_params);
>>  	wmi_cfg->twt_ap_pdev_count = cpu_to_le32(tg_cfg->twt_ap_pdev_count);
>> @@ -5134,7 +5135,7 @@ static int ath12k_pull_mgmt_rx_params_tlv(struct ath12k_base *ab,
>>  }
>>  
>>  static int wmi_process_mgmt_tx_comp(struct ath12k *ar, u32 desc_id,
>> -				    u32 status)
>> +				    u32 status, u32 ack_rssi)
>>  {
>>  	struct sk_buff *msdu;
>>  	struct ieee80211_tx_info *info;
>> @@ -5158,8 +5159,11 @@ static int wmi_process_mgmt_tx_comp(struct ath12k *ar, u32 desc_id,
>>  	dma_unmap_single(ar->ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
>>  
>>  	info = IEEE80211_SKB_CB(msdu);
>> -	if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) && !status)
>> +	if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) && !status) {
>>  		info->flags |= IEEE80211_TX_STAT_ACK;
>> +		info->status.ack_signal = ack_rssi;
>> +		info->status.flags |= IEEE80211_TX_STATUS_ACK_SIGNAL_VALID;
>> +	}
>>  
>>  	ieee80211_tx_status_irqsafe(ath12k_ar_to_hw(ar), msdu);
>>  
>> @@ -5200,6 +5204,8 @@ static int ath12k_pull_mgmt_tx_compl_param_tlv(struct ath12k_base *ab,
>>  	param->pdev_id = ev->pdev_id;
>>  	param->desc_id = ev->desc_id;
>>  	param->status = ev->status;
>> +	param->ppdu_id = ev->ppdu_id;
>> +	param->ack_rssi = ev->ack_rssi;
>>  
>>  	kfree(tb);
>>  	return 0;
>> @@ -6110,7 +6116,8 @@ static void ath12k_mgmt_tx_compl_event(struct ath12k_base *ab, struct sk_buff *s
>>  	}
>>  
>>  	wmi_process_mgmt_tx_comp(ar, le32_to_cpu(tx_compl_param.desc_id),
>> -				 le32_to_cpu(tx_compl_param.status));
>> +				 le32_to_cpu(tx_compl_param.status),
>> +				 le32_to_cpu(tx_compl_param.ack_rssi));
>>  
>>  	ath12k_dbg(ab, ATH12K_DBG_MGMT,
>>  		   "mgmt tx compl ev pdev_id %d, desc_id %d, status %d",
>> diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
>> index 496866673aea..7ebd52a7ebb8 100644
>> --- a/drivers/net/wireless/ath/ath12k/wmi.h
>> +++ b/drivers/net/wireless/ath/ath12k/wmi.h
>> @@ -2410,6 +2410,7 @@ struct wmi_init_cmd {
>>  #define WMI_RSRC_CFG_HOST_SVC_FLAG_REG_CC_EXT_SUPPORT_BIT 4
>>  #define WMI_RSRC_CFG_FLAGS2_RX_PEER_METADATA_VERSION		GENMASK(5, 4)
>>  #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64	BIT(5)
>> +#define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18)
>>  
>>  struct ath12k_wmi_resource_config_params {
>>  	__le32 tlv_header;
>> @@ -4180,6 +4181,8 @@ struct wmi_mgmt_tx_compl_event {
>>  	__le32 desc_id;
>>  	__le32 status;
>>  	__le32 pdev_id;
>> +	__le32 ppdu_id;
>> +	__le32 ack_rssi;
>>  } __packed;
>>  
>>  struct wmi_scan_event {
> 

Hi jeff, 

Please find my response inline.

Thanks,
Sowmiya Sree
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/dp_tx.c b/drivers/net/wireless/ath/ath12k/dp_tx.c
index 32496015cf9a..43bdb49d08e2 100644
--- a/drivers/net/wireless/ath/ath12k/dp_tx.c
+++ b/drivers/net/wireless/ath/ath12k/dp_tx.c
@@ -541,6 +541,8 @@  static void ath12k_dp_tx_status_parse(struct ath12k_base *ab,
 
 	ts->ppdu_id = le32_get_bits(desc->info1,
 				    HAL_WBM_COMPL_TX_INFO1_TQM_STATUS_NUMBER);
+	ts->ack_rssi = le32_get_bits(desc->info2,
+				     HAL_WBM_COMPL_TX_INFO2_ACK_FRAME_RSSI);
 	if (le32_to_cpu(desc->rate_stats.info0) & HAL_TX_RATE_STATS_INFO0_VALID)
 		ts->rate_stats = le32_to_cpu(desc->rate_stats.info0);
 	else
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 96dc5c2e096f..1f4739269544 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -8733,6 +8733,7 @@  static int ath12k_mac_hw_register(struct ath12k_hw *ah)
 
 	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
 	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_STA_TX_PWR);
+	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT);
 
 	wiphy->cipher_suites = cipher_suites;
 	wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
diff --git a/drivers/net/wireless/ath/ath12k/wmi.c b/drivers/net/wireless/ath/ath12k/wmi.c
index 3004c7463be9..fe909d866539 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.c
+++ b/drivers/net/wireless/ath/ath12k/wmi.c
@@ -3468,7 +3468,8 @@  ath12k_wmi_copy_resource_config(struct ath12k_wmi_resource_config_params *wmi_cf
 	wmi_cfg->max_bssid_rx_filters = cpu_to_le32(tg_cfg->max_bssid_rx_filters);
 	wmi_cfg->use_pdev_id = cpu_to_le32(tg_cfg->use_pdev_id);
 	wmi_cfg->flag1 = cpu_to_le32(tg_cfg->atf_config |
-				     WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64);
+				     WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64 |
+				     WMI_RSRC_CFG_FLAG1_ACK_RSSI);
 	wmi_cfg->peer_map_unmap_version = cpu_to_le32(tg_cfg->peer_map_unmap_version);
 	wmi_cfg->sched_params = cpu_to_le32(tg_cfg->sched_params);
 	wmi_cfg->twt_ap_pdev_count = cpu_to_le32(tg_cfg->twt_ap_pdev_count);
@@ -5134,7 +5135,7 @@  static int ath12k_pull_mgmt_rx_params_tlv(struct ath12k_base *ab,
 }
 
 static int wmi_process_mgmt_tx_comp(struct ath12k *ar, u32 desc_id,
-				    u32 status)
+				    u32 status, u32 ack_rssi)
 {
 	struct sk_buff *msdu;
 	struct ieee80211_tx_info *info;
@@ -5158,8 +5159,11 @@  static int wmi_process_mgmt_tx_comp(struct ath12k *ar, u32 desc_id,
 	dma_unmap_single(ar->ab->dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE);
 
 	info = IEEE80211_SKB_CB(msdu);
-	if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) && !status)
+	if ((!(info->flags & IEEE80211_TX_CTL_NO_ACK)) && !status) {
 		info->flags |= IEEE80211_TX_STAT_ACK;
+		info->status.ack_signal = ack_rssi;
+		info->status.flags |= IEEE80211_TX_STATUS_ACK_SIGNAL_VALID;
+	}
 
 	ieee80211_tx_status_irqsafe(ath12k_ar_to_hw(ar), msdu);
 
@@ -5200,6 +5204,8 @@  static int ath12k_pull_mgmt_tx_compl_param_tlv(struct ath12k_base *ab,
 	param->pdev_id = ev->pdev_id;
 	param->desc_id = ev->desc_id;
 	param->status = ev->status;
+	param->ppdu_id = ev->ppdu_id;
+	param->ack_rssi = ev->ack_rssi;
 
 	kfree(tb);
 	return 0;
@@ -6110,7 +6116,8 @@  static void ath12k_mgmt_tx_compl_event(struct ath12k_base *ab, struct sk_buff *s
 	}
 
 	wmi_process_mgmt_tx_comp(ar, le32_to_cpu(tx_compl_param.desc_id),
-				 le32_to_cpu(tx_compl_param.status));
+				 le32_to_cpu(tx_compl_param.status),
+				 le32_to_cpu(tx_compl_param.ack_rssi));
 
 	ath12k_dbg(ab, ATH12K_DBG_MGMT,
 		   "mgmt tx compl ev pdev_id %d, desc_id %d, status %d",
diff --git a/drivers/net/wireless/ath/ath12k/wmi.h b/drivers/net/wireless/ath/ath12k/wmi.h
index 496866673aea..7ebd52a7ebb8 100644
--- a/drivers/net/wireless/ath/ath12k/wmi.h
+++ b/drivers/net/wireless/ath/ath12k/wmi.h
@@ -2410,6 +2410,7 @@  struct wmi_init_cmd {
 #define WMI_RSRC_CFG_HOST_SVC_FLAG_REG_CC_EXT_SUPPORT_BIT 4
 #define WMI_RSRC_CFG_FLAGS2_RX_PEER_METADATA_VERSION		GENMASK(5, 4)
 #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64	BIT(5)
+#define WMI_RSRC_CFG_FLAG1_ACK_RSSI BIT(18)
 
 struct ath12k_wmi_resource_config_params {
 	__le32 tlv_header;
@@ -4180,6 +4181,8 @@  struct wmi_mgmt_tx_compl_event {
 	__le32 desc_id;
 	__le32 status;
 	__le32 pdev_id;
+	__le32 ppdu_id;
+	__le32 ack_rssi;
 } __packed;
 
 struct wmi_scan_event {