diff mbox series

[v3,1/4] wcn36xx: Implement get_snr()

Message ID 20220115001646.3981501-2-bryan.odonoghue@linaro.org
State New
Headers show
Series wcn36xx: Add spectrum survey reporting | expand

Commit Message

Bryan O'Donoghue Jan. 15, 2022, 12:16 a.m. UTC
The wcn36xx BD phy descriptor returns both Received Signal Strength
Information (RSSI) and Signal To Noise Ratio (SNR) with each delivered BD.

The macro to extract this data is a simple-one liner, easily imported from
downstream. This data will be useful to us when implementing
mac80211-ops->get_survey().

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/net/wireless/ath/wcn36xx/txrx.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Kalle Valo Jan. 17, 2022, 12:13 p.m. UTC | #1
Bryan O'Donoghue <bryan.odonoghue@linaro.org> writes:

> The wcn36xx BD phy descriptor returns both Received Signal Strength
> Information (RSSI) and Signal To Noise Ratio (SNR) with each delivered BD.
>
> The macro to extract this data is a simple-one liner, easily imported from
> downstream. This data will be useful to us when implementing
> mac80211-ops->get_survey().

I assume with downstream you mean the prima driver, I'll change that.
Kalle Valo Jan. 19, 2022, 8:49 a.m. UTC | #2
Bryan O'Donoghue <bryan.odonoghue@linaro.org> wrote:

> The wcn36xx BD phy descriptor returns both Received Signal Strength
> Information (RSSI) and Signal To Noise Ratio (SNR) with each delivered BD.
> 
> The macro to extract this data is a simple-one liner, easily imported from
> prima driver. This data will be useful to us when implementing
> mac80211-ops->get_survey().
> 
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Reviewed-by: Loic Poulain <loic.poulain@linaro.org>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

4 patches applied to ath-next branch of ath.git, thanks.

039d5d4db4bc wcn36xx: Implement get_snr()
d6f2746691cb wcn36xx: Track the band and channel we are tuned to
29696e0aa413 wcn36xx: Track SNR and RSSI for each RX frame
51395cf204f2 wcn36xx: Add SNR reporting via get_survey()
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c
index ed4e8f201f510..a3eb476c2cbc4 100644
--- a/drivers/net/wireless/ath/wcn36xx/txrx.c
+++ b/drivers/net/wireless/ath/wcn36xx/txrx.c
@@ -23,6 +23,11 @@  static inline int get_rssi0(struct wcn36xx_rx_bd *bd)
 	return 100 - ((bd->phy_stat0 >> 24) & 0xff);
 }
 
+static inline int get_snr(struct wcn36xx_rx_bd *bd)
+{
+	return ((bd->phy_stat1 >> 24) & 0xff);
+}
+
 struct wcn36xx_rate {
 	u16 bitrate;
 	u16 mcs_or_legacy_index;