Linux-Wireless Archive on lore.kernel.org
 help / Atom feed
* [PATCH] libertas_tf: fix signal reporting
@ 2019-02-10 19:48 Lubomir Rintel
  2019-02-11 13:39 ` Steve deRosier
  2019-02-19 15:12 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Lubomir Rintel @ 2019-02-10 19:48 UTC (permalink / raw)
  To: Kalle Valo; +Cc: David S. Miller, linux-wireless, linux-kernel, Lubomir Rintel

Instead of exposing the signal-to-noise ration, calculate the actual signal
level taking the noise floor into account.

Also, flip the SIGNAL_DBM bit on, so that mac80211 exposes the signal
level along with the station info in scan results. This fills
NetworkManager's "nmcli d wifi output" output with colors, bars and joy.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/net/wireless/marvell/libertas_tf/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/libertas_tf/main.c b/drivers/net/wireless/marvell/libertas_tf/main.c
index c71ad87cdc44..f93b400db949 100644
--- a/drivers/net/wireless/marvell/libertas_tf/main.c
+++ b/drivers/net/wireless/marvell/libertas_tf/main.c
@@ -562,7 +562,7 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)
 		stats.flag |= RX_FLAG_FAILED_FCS_CRC;
 	stats.freq = priv->cur_freq;
 	stats.band = NL80211_BAND_2GHZ;
-	stats.signal = prxpd->snr;
+	stats.signal = prxpd->snr - prxpd->nf;
 	priv->noise = prxpd->nf;
 	/* Marvell rate index has a hole at value 4 */
 	if (prxpd->rx_rate > 4)
@@ -626,6 +626,7 @@ struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev)
 
 	hw->queues = 1;
 	ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
+	ieee80211_hw_set(hw, SIGNAL_DBM);
 	hw->extra_tx_headroom = sizeof(struct txpd);
 	memcpy(priv->channels, lbtf_channels, sizeof(lbtf_channels));
 	memcpy(priv->rates, lbtf_rates, sizeof(lbtf_rates));
-- 
2.20.1


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

* Re: [PATCH] libertas_tf: fix signal reporting
  2019-02-10 19:48 [PATCH] libertas_tf: fix signal reporting Lubomir Rintel
@ 2019-02-11 13:39 ` Steve deRosier
  2019-02-19 15:12 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Steve deRosier @ 2019-02-11 13:39 UTC (permalink / raw)
  To: Lubomir Rintel; +Cc: Kalle Valo, David S. Miller, linux-wireless, LKML

On Sun, Feb 10, 2019 at 11:48 AM Lubomir Rintel <lkundrak@v3.sk> wrote:
>
> Instead of exposing the signal-to-noise ration, calculate the actual signal
> level taking the noise floor into account.
>
> Also, flip the SIGNAL_DBM bit on, so that mac80211 exposes the signal
> level along with the station info in scan results. This fills
> NetworkManager's "nmcli d wifi output" output with colors, bars and joy.
>
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---
>  drivers/net/wireless/marvell/libertas_tf/main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/marvell/libertas_tf/main.c b/drivers/net/wireless/marvell/libertas_tf/main.c
> index c71ad87cdc44..f93b400db949 100644
> --- a/drivers/net/wireless/marvell/libertas_tf/main.c
> +++ b/drivers/net/wireless/marvell/libertas_tf/main.c
> @@ -562,7 +562,7 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)
>                 stats.flag |= RX_FLAG_FAILED_FCS_CRC;
>         stats.freq = priv->cur_freq;
>         stats.band = NL80211_BAND_2GHZ;
> -       stats.signal = prxpd->snr;
> +       stats.signal = prxpd->snr - prxpd->nf;
>         priv->noise = prxpd->nf;
>         /* Marvell rate index has a hole at value 4 */
>         if (prxpd->rx_rate > 4)
> @@ -626,6 +626,7 @@ struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev)
>
>         hw->queues = 1;
>         ieee80211_hw_set(hw, HOST_BROADCAST_PS_BUFFERING);
> +       ieee80211_hw_set(hw, SIGNAL_DBM);
>         hw->extra_tx_headroom = sizeof(struct txpd);
>         memcpy(priv->channels, lbtf_channels, sizeof(lbtf_channels));
>         memcpy(priv->rates, lbtf_rates, sizeof(lbtf_rates));
> --
> 2.20.1
>

Reviewed-by: Steve deRosier <derosier@cal-sierra.com>

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

* Re: [PATCH] libertas_tf: fix signal reporting
  2019-02-10 19:48 [PATCH] libertas_tf: fix signal reporting Lubomir Rintel
  2019-02-11 13:39 ` Steve deRosier
@ 2019-02-19 15:12 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2019-02-19 15:12 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: David S. Miller, linux-wireless, linux-kernel, Lubomir Rintel

Lubomir Rintel <lkundrak@v3.sk> wrote:

> Instead of exposing the signal-to-noise ration, calculate the actual signal
> level taking the noise floor into account.
> 
> Also, flip the SIGNAL_DBM bit on, so that mac80211 exposes the signal
> level along with the station info in scan results. This fills
> NetworkManager's "nmcli d wifi output" output with colors, bars and joy.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> Reviewed-by: Steve deRosier <derosier@cal-sierra.com>

Patch applied to wireless-drivers-next.git, thanks.

b723dbb313f0 libertas_tf: fix signal reporting

-- 
https://patchwork.kernel.org/patch/10804879/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-10 19:48 [PATCH] libertas_tf: fix signal reporting Lubomir Rintel
2019-02-11 13:39 ` Steve deRosier
2019-02-19 15:12 ` Kalle Valo

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org linux-wireless@archiver.kernel.org
	public-inbox-index linux-wireless


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/ public-inbox