Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Sep 2009 19:55:11 -0700
From:      Sam Leffler <sam@freebsd.org>
To:        David Horn <dhorn2000@gmail.com>
Cc:        freebsd-net@freebsd.org
Subject:   Re: wpa_supplicant signal quality vs level
Message-ID:  <4ABC310F.7080900@freebsd.org>
In-Reply-To: <25ff90d60909241144i321c39bdj71e1d1b7e0ba51e8@mail.gmail.com>
References:  <25ff90d60909241144i321c39bdj71e1d1b7e0ba51e8@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
David Horn wrote:
> I have noticed that 'wpa_cli scan_results' always reported a signal
> level of 0 for every bssid found during a scan.  I found this a bit
> odd (especially since ifconfig wlan0 list scan reported good signal
> level data)
> 
> FreeBSD 8.0-RC1 r197417 amd64
> 
> Looking at the /usr/src/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
> source, I found:
> 
> in wpa_driver_bsd_get_scan_results()
> 
> wsr->qual = sr->isr_rssi;
> wsr->level = 0;       /* XXX? */
> 
> This hardcodes the signal level to 0, and sets the signal quality to
> the rssi value.
> 
> Looking around at the source, it seems that wpa_supplicant does not
> ever use the quality variable, but instead looks at the level variable
> in wpa_scan_result_compar ().

Correct.  There is no notion of signal _quality_ in freebsd because it's
a nebulous value defined by each vendor using a heuristic algorithm that
reflects their idea of what "good" is.  Because various parts of the
code use qual to compare the signal strength of stations we use the one
suitable value we do have.

> 
> In an attempt to try to figure out what signal level vs signal quality
> in wpa_supplicant context means, I found this:
> http://lists.shmoo.com/pipermail/hostap/2006-December/014831.html, and
> a feb-2009 change to scan_helpers.c (which drivers_freebsd.c seems to
> be partially based upon)
> http://hostap.epitest.fi/gitweb/gitweb.cgi?p=hostap.git;a=commitdiff;h=e1b525c3560614cc56c85b7d060f540900c4da34
> 
> So, it seems that some wpa_supplicant drivers use quality, and some
> use level.  Since quality(wsr->qual) does not seem to be used in
> current wpa_supplicant in freebsd, should it instead look like ?:
> (attached as an SVN diff with some debug as well)
> 
>                 wsr->ssid_len = sr->isr_ssid_len;
>                 wsr->freq = sr->isr_freq;
>                 wsr->noise = sr->isr_noise;
> -               wsr->qual = sr->isr_rssi;
> -               wsr->level = 0;         /* XXX? */
> +               wsr->qual = 0;  /* XXX? */
> +               wsr->level = sr->isr_rssi;
>                 wsr->caps = sr->isr_capinfo;
>                 wsr->maxrate = getmaxrate(sr->isr_rates, sr->isr_nrates);
>                 vp = ((u_int8_t *)sr) + sr->isr_ie_off;
> 
> 
> Should we just set qual to 0,  or should we set qual to
> rssi/rssi_max*100 (if we can determine rssi_max for a particular wlan
> interface)
> 
> In any case, do you want me to file a PR on this ?

I believe this issue is purely cosmetic in that you see 0's in the scan
results display.  If you want to fill that data in with something be my
guest but unless the values correspond to the data actually used to make
decision it's just going to cause confusion.  It might be simpler to
just strip the value from the scan results print out.

	Sam



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4ABC310F.7080900>