2015-09-10 09:04:53

by Hiroaki Kawai

[permalink] [raw]
Subject: [PATCH] carl9170: fix bad rssi reading

Fix rssi calculation error which was introduced in otus to ar9170
porting.

Signed-off-by: Hiroaki KAWAI <[email protected]>
---
drivers/net/wireless/ath/carl9170/rx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
index 924135b..d66533c 100644
--- a/drivers/net/wireless/ath/carl9170/rx.c
+++ b/drivers/net/wireless/ath/carl9170/rx.c
@@ -453,7 +453,7 @@ static void carl9170_rx_phy_status(struct ar9170 *ar,
/* post-process RSSI */
for (i = 0; i < 7; i++)
if (phy->rssi[i] & 0x80)
- phy->rssi[i] = ((phy->rssi[i] & 0x7f) + 1) & 0x7f;
+ phy->rssi[i] = ((~phy->rssi[i] & 0x7f) + 1) & 0x7f;

/* TODO: we could do something with phy_errors */
status->signal = ar->noise[0] + phy->rssi_combined;
--
2.5.1



2015-09-10 16:43:40

by Hiroaki Kawai

[permalink] [raw]
Subject: Re: [PATCH] carl9170: fix bad rssi reading

That field is union and referenced as rssi_combined at two lines below.

The status->signal will show up in radiotap IEEE80211_RADIOTAP_DBM_ANTSIGNAL
header field at userland finally.

2015-09-10 22:07 GMT+09:00 Christian Lamparter <[email protected]>:
> On Thursday, September 10, 2015 06:04:45 PM Hiroaki KAWAI wrote:
>> Fix rssi calculation error which was introduced in otus to ar9170
>> porting.
>>
>> Signed-off-by: Hiroaki KAWAI <[email protected]>
> Acked-by: Christian Lamparter <[email protected]>
>
> For reference: Here's the line in the original otus code:
> <http://lxr.free-electrons.com/source/drivers/staging/otus/hal/hpusb.c?v=2.6.33#L818>
>
> This value/result isn't used anywhere, so we could also remove it.
>
>> ---
>> drivers/net/wireless/ath/carl9170/rx.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
>> index 924135b..d66533c 100644
>> --- a/drivers/net/wireless/ath/carl9170/rx.c
>> +++ b/drivers/net/wireless/ath/carl9170/rx.c
>> @@ -453,7 +453,7 @@ static void carl9170_rx_phy_status(struct ar9170 *ar,
>> /* post-process RSSI */
>> for (i = 0; i < 7; i++)
>> if (phy->rssi[i] & 0x80)
>> - phy->rssi[i] = ((phy->rssi[i] & 0x7f) + 1) & 0x7f;
>> + phy->rssi[i] = ((~phy->rssi[i] & 0x7f) + 1) & 0x7f;
>>
>> /* TODO: we could do something with phy_errors */
>> status->signal = ar->noise[0] + phy->rssi_combined;
>>
>

2015-09-10 13:07:31

by Christian Lamparter

[permalink] [raw]
Subject: Re: [PATCH] carl9170: fix bad rssi reading

On Thursday, September 10, 2015 06:04:45 PM Hiroaki KAWAI wrote:
> Fix rssi calculation error which was introduced in otus to ar9170
> porting.
>
> Signed-off-by: Hiroaki KAWAI <[email protected]>
Acked-by: Christian Lamparter <[email protected]>

For reference: Here's the line in the original otus code:
<http://lxr.free-electrons.com/source/drivers/staging/otus/hal/hpusb.c?v=2.6.33#L818>

This value/result isn't used anywhere, so we could also remove it.

> ---
> drivers/net/wireless/ath/carl9170/rx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/carl9170/rx.c b/drivers/net/wireless/ath/carl9170/rx.c
> index 924135b..d66533c 100644
> --- a/drivers/net/wireless/ath/carl9170/rx.c
> +++ b/drivers/net/wireless/ath/carl9170/rx.c
> @@ -453,7 +453,7 @@ static void carl9170_rx_phy_status(struct ar9170 *ar,
> /* post-process RSSI */
> for (i = 0; i < 7; i++)
> if (phy->rssi[i] & 0x80)
> - phy->rssi[i] = ((phy->rssi[i] & 0x7f) + 1) & 0x7f;
> + phy->rssi[i] = ((~phy->rssi[i] & 0x7f) + 1) & 0x7f;
>
> /* TODO: we could do something with phy_errors */
> status->signal = ar->noise[0] + phy->rssi_combined;
>


2015-09-10 16:56:11

by Christian Lamparter

[permalink] [raw]
Subject: Re: [PATCH] carl9170: fix bad rssi reading

On Friday, September 11, 2015 01:37:48 AM Hiroaki Kawai wrote:
> That field is union and referenced as rssi_combined at two lines below.
Correct

> The status->signal will show up in radiotap
> IEEE80211_RADIOTAP_DBM_ANTSIGNAL
> header field at userland finally.

so, this patch should go to -stable too.

Cc: [email protected]

Thanks
> > > ---
> > > drivers/net/wireless/ath/carl9170/rx.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/wireless/ath/carl9170/rx.c
> > b/drivers/net/wireless/ath/carl9170/rx.c
> > > index 924135b..d66533c 100644
> > > --- a/drivers/net/wireless/ath/carl9170/rx.c
> > > +++ b/drivers/net/wireless/ath/carl9170/rx.c
> > > @@ -453,7 +453,7 @@ static void carl9170_rx_phy_status(struct ar9170 *ar,
> > > /* post-process RSSI */
> > > for (i = 0; i < 7; i++)
> > > if (phy->rssi[i] & 0x80)
> > > - phy->rssi[i] = ((phy->rssi[i] & 0x7f) + 1) & 0x7f;
> > > + phy->rssi[i] = ((~phy->rssi[i] & 0x7f) + 1) & 0x7f;
> > >
> > > /* TODO: we could do something with phy_errors */
> > > status->signal = ar->noise[0] + phy->rssi_combined;
> > >
> >
> >


2015-09-29 07:38:59

by Kalle Valo

[permalink] [raw]
Subject: Re: carl9170: fix bad rssi reading


> Fix rssi calculation error which was introduced in otus to ar9170
> porting.
>
> Signed-off-by: Hiroaki KAWAI <[email protected]>
> Acked-by: Christian Lamparter <[email protected]>

Thanks, applied to wireless-drivers-next.git.

Kalle Valo