2012-03-05 21:59:50

by Daniel Drake

[permalink] [raw]
Subject: cfg80211 dump_survey - what is it supposed to measure?

Hi,

I'm working on a bug in libertas. It looks like NetworkManager (or
something related) is calling dump_survey, before a connection has
been established.

libertas does:

survey->channel = ieee80211_get_channel(wiphy,
ieee80211_channel_to_frequency(priv->channel,
IEEE80211_BAND_2GHZ));

ret = lbs_get_rssi(priv, &signal, &noise);
if (ret == 0) {
survey->filled = SURVEY_INFO_NOISE_DBM;
survey->noise = noise;
}

return ret;

lbs_get_rssi() only works when the card is associated. It then returns
the signal/noise of the last received beacon from the AP. If the card
is not associated (as is true here), lbs_get_rssi returns error 1,
which is then returned to cfg80211, and this looks to cause userspace
to retry the survey request in a seemingly infinite loop.

I'm wondering if dump_survey is intended to return the RSSI of a
specific network in the way that libertas does it, or if it is
supposed to look more generally at the interference on a channel?

In other words, given that libertas hardware doesn't seem to offer
functionality to measure the overall signal level on a channel, I'm
wondering if the correct solution here is to drop the dump_survey
handler altogether.

Thanks,
Daniel


2012-03-07 14:47:08

by Daniel Drake

[permalink] [raw]
Subject: Re: cfg80211 dump_survey - what is it supposed to measure?

Hi Felix,

Thanks for the response.

On Wed, Mar 7, 2012 at 5:07 AM, Felix Fietkau <[email protected]> wrote:
> The noise level is not specific to a particular network - I don't think
> the libertas hw is measuring it while it's receiving packets. It's
> usually measured while there is no transmission on the channel, so aside
> from the return code issue the code is probably correct.

The docs suggest strongly that the signal is measured based on the
most recent beacon.

"The SNR field in the response provides the SNR in the most recently
received beacon. The NoiseFloor field in the response provides the
absolute value of the noise floor in the most recently received
beacon."

and given that it only gives values when you are associated (i.e. it
only looks at the beacons for the one network that you are connected
to), I think I can believe this.

Does this change your recommendation?

Thanks,
Daniel

2012-03-07 11:07:11

by Felix Fietkau

[permalink] [raw]
Subject: Re: cfg80211 dump_survey - what is it supposed to measure?

On 2012-03-05 10:59 PM, Daniel Drake wrote:
> Hi,
>
> I'm working on a bug in libertas. It looks like NetworkManager (or
> something related) is calling dump_survey, before a connection has
> been established.
>
> libertas does:
>
> survey->channel = ieee80211_get_channel(wiphy,
> ieee80211_channel_to_frequency(priv->channel,
> IEEE80211_BAND_2GHZ));
>
> ret = lbs_get_rssi(priv, &signal, &noise);
> if (ret == 0) {
> survey->filled = SURVEY_INFO_NOISE_DBM;
> survey->noise = noise;
> }
>
> return ret;
>
> lbs_get_rssi() only works when the card is associated. It then returns
> the signal/noise of the last received beacon from the AP. If the card
> is not associated (as is true here), lbs_get_rssi returns error 1,
> which is then returned to cfg80211, and this looks to cause userspace
> to retry the survey request in a seemingly infinite loop.
>
> I'm wondering if dump_survey is intended to return the RSSI of a
> specific network in the way that libertas does it, or if it is
> supposed to look more generally at the interference on a channel?
>
> In other words, given that libertas hardware doesn't seem to offer
> functionality to measure the overall signal level on a channel, I'm
> wondering if the correct solution here is to drop the dump_survey
> handler altogether.
cfg80211 survey is supposed to show the noise value for the current
channel, and - if possible - for other channels as well.

The noise level is not specific to a particular network - I don't think
the libertas hw is measuring it while it's receiving packets. It's
usually measured while there is no transmission on the channel, so aside
from the return code issue the code is probably correct.

- Felix