* [PATCH] wifi: ath12k: add support of station average signal strength
@ 2025-01-17 17:28 Nicolas Escande
2025-01-21 8:53 ` Vasanthakumar Thiagarajan
0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Escande @ 2025-01-17 17:28 UTC (permalink / raw)
To: ath12k; +Cc: linux-wireless
This adds support for reporting to the kernel the average rssi. This is
done the same way as it was done in ath11k. A simple ewma (with the same
parameters) is updated with each rssi update.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Signed-off-by: Nicolas Escande <nico.escande@gmail.com>
---
drivers/net/wireless/ath/ath12k/core.h | 5 +++++
drivers/net/wireless/ath/ath12k/dp_mon.c | 2 ++
drivers/net/wireless/ath/ath12k/mac.c | 5 +++++
3 files changed, 12 insertions(+)
diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
index ee595794a7aee..9408d8a528580 100644
--- a/drivers/net/wireless/ath/ath12k/core.h
+++ b/drivers/net/wireless/ath/ath12k/core.h
@@ -1,3 +1,4 @@
+
/* SPDX-License-Identifier: BSD-3-Clause-Clear */
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
@@ -15,6 +16,7 @@
#include <linux/ctype.h>
#include <linux/firmware.h>
#include <linux/panic_notifier.h>
+#include <linux/average.h>
#include "qmi.h"
#include "htc.h"
#include "wmi.h"
@@ -477,6 +479,8 @@ struct ath12k_wbm_tx_stats {
u64 wbm_tx_comp_stats[HAL_WBM_REL_HTT_TX_COMP_STATUS_MAX];
};
+DECLARE_EWMA(avg_rssi, 10, 8)
+
struct ath12k_link_sta {
struct ath12k_link_vif *arvif;
struct ath12k_sta *ahsta;
@@ -496,6 +500,7 @@ struct ath12k_link_sta {
u64 rx_duration;
u64 tx_duration;
u8 rssi_comb;
+ struct ewma_avg_rssi avg_rssi;
u8 link_id;
struct ath12k_rx_peer_stats *rx_stats;
struct ath12k_wbm_tx_stats *wbm_tx_stats;
diff --git a/drivers/net/wireless/ath/ath12k/dp_mon.c b/drivers/net/wireless/ath/ath12k/dp_mon.c
index 5a21961cfd465..e53d5674b4368 100644
--- a/drivers/net/wireless/ath/ath12k/dp_mon.c
+++ b/drivers/net/wireless/ath/ath12k/dp_mon.c
@@ -2157,6 +2157,7 @@ static void ath12k_dp_mon_rx_update_peer_su_stats(struct ath12k *ar,
return;
arsta->rssi_comb = ppdu_info->rssi_comb;
+ ewma_avg_rssi_add(&arsta->avg_rssi, ppdu_info->rssi_comb);
num_msdu = ppdu_info->tcp_msdu_count + ppdu_info->tcp_ack_msdu_count +
ppdu_info->udp_msdu_count + ppdu_info->other_msdu_count;
@@ -2329,6 +2330,7 @@ ath12k_dp_mon_rx_update_user_stats(struct ath12k *ar,
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 2d062b5904a8e..5be8cf0e41279 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -5403,6 +5403,7 @@ static int ath12k_mac_station_add(struct ath12k *ar,
}
}
+ ewma_avg_rssi_init(&arsta->avg_rssi);
return 0;
free_peer:
@@ -10054,6 +10055,10 @@ static void ath12k_mac_op_sta_statistics(struct ieee80211_hw *hw,
/* TODO: Use real NF instead of default one. */
sinfo->signal = arsta->rssi_comb + ATH12K_DEFAULT_NOISE_FLOOR;
sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
+
+ sinfo->signal_avg = ewma_avg_rssi_read(&arsta->avg_rssi) +
+ ATH12K_DEFAULT_NOISE_FLOOR;
+ sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG);
}
static int ath12k_mac_op_cancel_remain_on_channel(struct ieee80211_hw *hw,
--
2.48.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] wifi: ath12k: add support of station average signal strength
2025-01-17 17:28 [PATCH] wifi: ath12k: add support of station average signal strength Nicolas Escande
@ 2025-01-21 8:53 ` Vasanthakumar Thiagarajan
2025-01-21 9:42 ` Nicolas Escande
0 siblings, 1 reply; 3+ messages in thread
From: Vasanthakumar Thiagarajan @ 2025-01-21 8:53 UTC (permalink / raw)
To: Nicolas Escande, ath12k; +Cc: linux-wireless
On 1/17/2025 10:58 PM, Nicolas Escande wrote:
> This adds support for reporting to the kernel the average rssi. This is
> done the same way as it was done in ath11k. A simple ewma (with the same
> parameters) is updated with each rssi update.
>
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
>
> Signed-off-by: Nicolas Escande <nico.escande@gmail.com>
> ---
> drivers/net/wireless/ath/ath12k/core.h | 5 +++++
> drivers/net/wireless/ath/ath12k/dp_mon.c | 2 ++
> drivers/net/wireless/ath/ath12k/mac.c | 5 +++++
> 3 files changed, 12 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
> index ee595794a7aee..9408d8a528580 100644
> --- a/drivers/net/wireless/ath/ath12k/core.h
> +++ b/drivers/net/wireless/ath/ath12k/core.h
> @@ -1,3 +1,4 @@
> +
???
Always ensure a clean checkpatch run.
Vasanth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] wifi: ath12k: add support of station average signal strength
2025-01-21 8:53 ` Vasanthakumar Thiagarajan
@ 2025-01-21 9:42 ` Nicolas Escande
0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Escande @ 2025-01-21 9:42 UTC (permalink / raw)
To: Vasanthakumar Thiagarajan, ath12k; +Cc: linux-wireless
On Tue Jan 21, 2025 at 9:53 AM CET, Vasanthakumar Thiagarajan wrote:
>
>
> On 1/17/2025 10:58 PM, Nicolas Escande wrote:
>> This adds support for reporting to the kernel the average rssi. This is
>> done the same way as it was done in ath11k. A simple ewma (with the same
>> parameters) is updated with each rssi update.
>>
>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
>>
>> Signed-off-by: Nicolas Escande <nico.escande@gmail.com>
>> ---
>> drivers/net/wireless/ath/ath12k/core.h | 5 +++++
>> drivers/net/wireless/ath/ath12k/dp_mon.c | 2 ++
>> drivers/net/wireless/ath/ath12k/mac.c | 5 +++++
>> 3 files changed, 12 insertions(+)
>>
>> diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h
>> index ee595794a7aee..9408d8a528580 100644
>> --- a/drivers/net/wireless/ath/ath12k/core.h
>> +++ b/drivers/net/wireless/ath/ath12k/core.h
>> @@ -1,3 +1,4 @@
>> +
>
> ???
>
> Always ensure a clean checkpatch run.
The worst part is I ran it but failed to understand why it was warning me. I
thought this was due to some existing problem before my changes.
Anyway I was stupid, I reposted v2 to fix this.
>
> Vasanth
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-21 9:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-17 17:28 [PATCH] wifi: ath12k: add support of station average signal strength Nicolas Escande
2025-01-21 8:53 ` Vasanthakumar Thiagarajan
2025-01-21 9:42 ` Nicolas Escande
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).