2012-03-15 13:59:29

by Cristian Morales Vega

[permalink] [raw]
Subject: signal strength in nl80211 and IEEE80211_HW_SIGNAL_UNSPEC

I don't have a device using a driver with IEEE80211_HW_SIGNAL_UNSPEC
to test, but because of
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=19deffbeba930030cfaf000b920333c6ba99ad52
I guess nl80211 will report the NL80211_STA_INFO_SIGNAL even if the
driver doesn't uses dBm, true?
Looking at http://permalink.gmane.org/gmane.linux.kernel.wireless.general/24814
it seems this wasn't wanted. Bug, the check for
IEEE80211_HW_SIGNAL_DBM is done elsewhere or finally it was decided
that the signal strength should be reported even if the units are
unknown?

Thanks.

--
Cristian Morales Vega

Email [email protected]
Office +44 (0) 20 3111 4330
Direct Line:? +44 (0) 20 3111 4338
Web:? http://www.samknows.com


This email is sent for and on behalf of SamKnows?Limited.

This email and any attachments are confidential,?legally privileged
and protected by copyright. If?you are not the intended recipient
dissemination?or copying of this email is prohibited. If you have
received this in error, please notify the sender by?replying by email
and then delete the email?completely from your system.

SamKnows Limited, Registered Number:?06510477, Registered Office: 25
Harley Street,?London, W1G 9BR. Registered in England and?Wales. Trade
Mark 2507103


2012-03-15 14:46:42

by Johannes Berg

[permalink] [raw]
Subject: Re: signal strength in nl80211 and IEEE80211_HW_SIGNAL_UNSPEC

On Thu, 2012-03-15 at 10:20 -0400, John W. Linville wrote:
> On Thu, Mar 15, 2012 at 03:06:57PM +0100, Johannes Berg wrote:
> > On Thu, 2012-03-15 at 13:59 +0000, Cristian Morales Vega wrote:
> > > I don't have a device using a driver with IEEE80211_HW_SIGNAL_UNSPEC
> > > to test, but because of
> > > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=19deffbeba930030cfaf000b920333c6ba99ad52
> > > I guess nl80211 will report the NL80211_STA_INFO_SIGNAL even if the
> > > driver doesn't uses dBm, true?
> > > Looking at http://permalink.gmane.org/gmane.linux.kernel.wireless.general/24814
> > > it seems this wasn't wanted. Bug, the check for
> > > IEEE80211_HW_SIGNAL_DBM is done elsewhere or finally it was decided
> > > that the signal strength should be reported even if the units are
> > > unknown?
> >
> > Huh, yes, the nl80211 reporting here was intended to be dBm as
> > documented in the header file, so John's commit does look like a bug.
> > John, can you revert that please? The "unspec" signal strength thing is
> > used only in NL80211_BSS_SIGNAL_UNSPEC, i.e. the signal strength
> > reported in scan results. If we want/need it in station information as
> > well we need to add a separate attribute.
>
> Well, that commit fixes this bug:
>
> https://bugzilla.kernel.org/show_bug.cgi?id=14763
>
> sta_set_sinfo is called by ieee80211_get_station, which gets invoked
> by cfg80211_wireless_stats when handling SIOCGIWSTATS ioctls.
> Without that commit, devices that use IEEE80211_HW_SIGNAL_UNSPEC
> report a 0 signal strength through wext.
>
> So, how do we fix this and keep wext working for those devices?
> For that matter, what actual bug is it causing?

This would cause iw (for example) to display

station ...
signal: 80 dBm

To properly fix the reporting in wext you'd have to allow the field to
be filled also for UNSPEC units and then figure out the difference (and
whether to report it in nl80211) in cfg80211 -- like in
nl80211_send_bss().

johannes


2012-03-15 14:15:37

by Johannes Berg

[permalink] [raw]
Subject: [PATCH] mac80211: report only dBm station signal

From: Johannes Berg <[email protected]>

The station signal can currently only be reported
in dBm, so don't report it at all if we only have
unspecified units from the device.

Cc: [email protected]
Reported-by: Cristian Morales Vega <[email protected]>
Signed-off-by: Johannes Berg <[email protected]>
---
net/mac80211/cfg.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

--- a/net/mac80211/cfg.c 2012-03-10 09:17:06.000000000 +0100
+++ b/net/mac80211/cfg.c 2012-03-15 15:14:01.000000000 +0100
@@ -385,8 +385,7 @@ static void sta_set_sinfo(struct sta_inf
sinfo->rx_dropped_misc = sta->rx_dropped;
sinfo->beacon_loss_count = sta->beacon_loss_count;

- if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
- (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
+ if (sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
sinfo->filled |= STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG;
sinfo->signal = (s8)sta->last_signal;
sinfo->signal_avg = (s8) -ewma_read(&sta->avg_signal);



2012-03-15 14:32:14

by John W. Linville

[permalink] [raw]
Subject: Re: signal strength in nl80211 and IEEE80211_HW_SIGNAL_UNSPEC

On Thu, Mar 15, 2012 at 03:06:57PM +0100, Johannes Berg wrote:
> On Thu, 2012-03-15 at 13:59 +0000, Cristian Morales Vega wrote:
> > I don't have a device using a driver with IEEE80211_HW_SIGNAL_UNSPEC
> > to test, but because of
> > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=19deffbeba930030cfaf000b920333c6ba99ad52
> > I guess nl80211 will report the NL80211_STA_INFO_SIGNAL even if the
> > driver doesn't uses dBm, true?
> > Looking at http://permalink.gmane.org/gmane.linux.kernel.wireless.general/24814
> > it seems this wasn't wanted. Bug, the check for
> > IEEE80211_HW_SIGNAL_DBM is done elsewhere or finally it was decided
> > that the signal strength should be reported even if the units are
> > unknown?
>
> Huh, yes, the nl80211 reporting here was intended to be dBm as
> documented in the header file, so John's commit does look like a bug.
> John, can you revert that please? The "unspec" signal strength thing is
> used only in NL80211_BSS_SIGNAL_UNSPEC, i.e. the signal strength
> reported in scan results. If we want/need it in station information as
> well we need to add a separate attribute.

Well, that commit fixes this bug:

https://bugzilla.kernel.org/show_bug.cgi?id=14763

sta_set_sinfo is called by ieee80211_get_station, which gets invoked
by cfg80211_wireless_stats when handling SIOCGIWSTATS ioctls.
Without that commit, devices that use IEEE80211_HW_SIGNAL_UNSPEC
report a 0 signal strength through wext.

So, how do we fix this and keep wext working for those devices?
For that matter, what actual bug is it causing?

John
--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2012-03-15 14:06:59

by Johannes Berg

[permalink] [raw]
Subject: Re: signal strength in nl80211 and IEEE80211_HW_SIGNAL_UNSPEC

On Thu, 2012-03-15 at 13:59 +0000, Cristian Morales Vega wrote:
> I don't have a device using a driver with IEEE80211_HW_SIGNAL_UNSPEC
> to test, but because of
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commitdiff;h=19deffbeba930030cfaf000b920333c6ba99ad52
> I guess nl80211 will report the NL80211_STA_INFO_SIGNAL even if the
> driver doesn't uses dBm, true?
> Looking at http://permalink.gmane.org/gmane.linux.kernel.wireless.general/24814
> it seems this wasn't wanted. Bug, the check for
> IEEE80211_HW_SIGNAL_DBM is done elsewhere or finally it was decided
> that the signal strength should be reported even if the units are
> unknown?

Huh, yes, the nl80211 reporting here was intended to be dBm as
documented in the header file, so John's commit does look like a bug.
John, can you revert that please? The "unspec" signal strength thing is
used only in NL80211_BSS_SIGNAL_UNSPEC, i.e. the signal strength
reported in scan results. If we want/need it in station information as
well we need to add a separate attribute.

johannes