All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@openwrt.org>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH] ath9k_htc: update RSSI values only when the device is associated
Date: Sat, 10 Nov 2012 10:15:51 +0100	[thread overview]
Message-ID: <509E1B47.3050107@openwrt.org> (raw)
In-Reply-To: <1352480966-17462-1-git-send-email-lewurm@gmail.com>

On 2012-11-09 6:09 PM, Bernhard Urban wrote:
> add an if-guard, otherwise iw(8) reports weird signal strengths.
> 
> The behaviour was fine before this commit:
> 7c277349ecbd66e19fad3d949fa6ef6c131a3b62
> This patch is therefore a partially revert of it.
> 
> Tested with "TP-Link TL-WN722N"
> 
> Thanks to indoo.rs http://indoo.rs/ for sponsoring
> 
> Reported-by: Markus Krainz <markus@indoo.rs>
> Tested-by: Markus Krainz <markus@indoo.rs>
> Signed-off-by: Bernhard Urban <lewurm@gmail.com>
> ---
>  drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |   27 ++++++++++++++-----------
>  1 file changed, 15 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
> index 47e61d0..d0d329c 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
> @@ -1060,22 +1060,25 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
>  	ath9k_process_rate(hw, rx_status, rxbuf->rxstatus.rs_rate,
>  			   rxbuf->rxstatus.rs_flags);
>  
> -	if (rxbuf->rxstatus.rs_rssi != ATH9K_RSSI_BAD &&
> -	    !rxbuf->rxstatus.rs_moreaggr)
> -		ATH_RSSI_LPF(priv->rx.last_rssi,
> -			     rxbuf->rxstatus.rs_rssi);
> +	if (priv->num_sta_assoc_vif != 0) {
> +		if (rxbuf->rxstatus.rs_rssi != ATH9K_RSSI_BAD &&
> +		    !rxbuf->rxstatus.rs_moreaggr)
> +			ATH_RSSI_LPF(priv->rx.last_rssi,
> +				     rxbuf->rxstatus.rs_rssi);
>  
> -	last_rssi = priv->rx.last_rssi;
> +		last_rssi = priv->rx.last_rssi;
>  
> -	if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
> -		rxbuf->rxstatus.rs_rssi = ATH_EP_RND(last_rssi,
> -						     ATH_RSSI_EP_MULTIPLIER);
> +		if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) {
> +			s8 rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER);
> +			rxbuf->rxstatus.rs_rssi = rssi;
> +		}
>  
> -	if (rxbuf->rxstatus.rs_rssi < 0)
> -		rxbuf->rxstatus.rs_rssi = 0;
> +		if (rxbuf->rxstatus.rs_rssi < 0)
> +			rxbuf->rxstatus.rs_rssi = 0;
>  
> -	if (ieee80211_is_beacon(fc))
> -		priv->ah->stats.avgbrssi = rxbuf->rxstatus.rs_rssi;
> +		if (ieee80211_is_beacon(fc))
> +			priv->ah->stats.avgbrssi = rxbuf->rxstatus.rs_rssi;
> +	}
>  
>  	rx_status->mactime = be64_to_cpu(rxbuf->rxstatus.rs_tstamp);
>  	rx_status->band = hw->conf.channel->band;
> 
Please check how RSSI is handled in ath9k, and use that as reference.
The per-packet RSSI should not be set from some internal average, it
should contain the real RSSI value of the packet. This change disables
RSSI reporting for anything but station mode, which is not a good idea.

- Felix

WARNING: multiple messages have this Message-ID (diff)
From: Felix Fietkau <nbd@openwrt.org>
To: Bernhard Urban <lewurm@gmail.com>
Cc: linux-wireless@vger.kernel.org, ath9k-devel@lists.ath9k.org,
	c_manoha@qca.qualcomm.com, Sujith.Manoharan@atheros.com,
	linville@tuxdriver.com, markus@indoo.rs
Subject: Re: [PATCH] ath9k_htc: update RSSI values only when the device is associated
Date: Sat, 10 Nov 2012 10:15:51 +0100	[thread overview]
Message-ID: <509E1B47.3050107@openwrt.org> (raw)
In-Reply-To: <1352480966-17462-1-git-send-email-lewurm@gmail.com>

On 2012-11-09 6:09 PM, Bernhard Urban wrote:
> add an if-guard, otherwise iw(8) reports weird signal strengths.
> 
> The behaviour was fine before this commit:
> 7c277349ecbd66e19fad3d949fa6ef6c131a3b62
> This patch is therefore a partially revert of it.
> 
> Tested with "TP-Link TL-WN722N"
> 
> Thanks to indoo.rs http://indoo.rs/ for sponsoring
> 
> Reported-by: Markus Krainz <markus@indoo.rs>
> Tested-by: Markus Krainz <markus@indoo.rs>
> Signed-off-by: Bernhard Urban <lewurm@gmail.com>
> ---
>  drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |   27 ++++++++++++++-----------
>  1 file changed, 15 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
> index 47e61d0..d0d329c 100644
> --- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
> +++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
> @@ -1060,22 +1060,25 @@ static bool ath9k_rx_prepare(struct ath9k_htc_priv *priv,
>  	ath9k_process_rate(hw, rx_status, rxbuf->rxstatus.rs_rate,
>  			   rxbuf->rxstatus.rs_flags);
>  
> -	if (rxbuf->rxstatus.rs_rssi != ATH9K_RSSI_BAD &&
> -	    !rxbuf->rxstatus.rs_moreaggr)
> -		ATH_RSSI_LPF(priv->rx.last_rssi,
> -			     rxbuf->rxstatus.rs_rssi);
> +	if (priv->num_sta_assoc_vif != 0) {
> +		if (rxbuf->rxstatus.rs_rssi != ATH9K_RSSI_BAD &&
> +		    !rxbuf->rxstatus.rs_moreaggr)
> +			ATH_RSSI_LPF(priv->rx.last_rssi,
> +				     rxbuf->rxstatus.rs_rssi);
>  
> -	last_rssi = priv->rx.last_rssi;
> +		last_rssi = priv->rx.last_rssi;
>  
> -	if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER))
> -		rxbuf->rxstatus.rs_rssi = ATH_EP_RND(last_rssi,
> -						     ATH_RSSI_EP_MULTIPLIER);
> +		if (likely(last_rssi != ATH_RSSI_DUMMY_MARKER)) {
> +			s8 rssi = ATH_EP_RND(last_rssi, ATH_RSSI_EP_MULTIPLIER);
> +			rxbuf->rxstatus.rs_rssi = rssi;
> +		}
>  
> -	if (rxbuf->rxstatus.rs_rssi < 0)
> -		rxbuf->rxstatus.rs_rssi = 0;
> +		if (rxbuf->rxstatus.rs_rssi < 0)
> +			rxbuf->rxstatus.rs_rssi = 0;
>  
> -	if (ieee80211_is_beacon(fc))
> -		priv->ah->stats.avgbrssi = rxbuf->rxstatus.rs_rssi;
> +		if (ieee80211_is_beacon(fc))
> +			priv->ah->stats.avgbrssi = rxbuf->rxstatus.rs_rssi;
> +	}
>  
>  	rx_status->mactime = be64_to_cpu(rxbuf->rxstatus.rs_tstamp);
>  	rx_status->band = hw->conf.channel->band;
> 
Please check how RSSI is handled in ath9k, and use that as reference.
The per-packet RSSI should not be set from some internal average, it
should contain the real RSSI value of the packet. This change disables
RSSI reporting for anything but station mode, which is not a good idea.

- Felix

  parent reply	other threads:[~2012-11-10  9:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-09 17:09 [ath9k-devel] [PATCH] ath9k_htc: update RSSI values only when the device is associated Bernhard Urban
2012-11-09 17:09 ` Bernhard Urban
2012-11-10  8:42 ` [ath9k-devel] " Sujith
2012-11-10  8:42   ` Sujith
2012-11-10  9:15 ` Felix Fietkau [this message]
2012-11-10  9:15   ` Felix Fietkau
2012-11-17 19:12   ` [ath9k-devel] " Bernhard Urban
2012-11-17 19:12     ` Bernhard Urban
  -- strict thread matches above, loose matches on Subject: below --
2012-12-01 20:21 [ath9k-devel] " Bernhard Urban
2012-12-01 20:26 ` Bernhard Urban
2012-12-03  6:41   ` Mohammed Shafi
2012-12-04 17:02     ` Holger Schurig
2012-12-04 17:02       ` Holger Schurig
2012-12-05 22:27       ` Bernhard Urban
2012-12-05 22:27         ` Bernhard Urban
2012-12-05 22:13     ` Bernhard Urban
2013-02-01 12:50 Bernhard Urban
2013-02-05 22:05 ` Felix Fietkau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=509E1B47.3050107@openwrt.org \
    --to=nbd@openwrt.org \
    --cc=ath9k-devel@lists.ath9k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.