Add snr and est_throughput to the BSS entries

These values were previously used only for sorting the scan results, but
it may be useful to provide access to the used values through the BSS
entries.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-02-22 10:50:55 +02:00
parent a1b790eb9d
commit 1d747e2a98
4 changed files with 25 additions and 2 deletions

View File

@ -274,6 +274,8 @@ extern "C" {
#define WPA_BSS_MASK_WIFI_DISPLAY BIT(16)
#define WPA_BSS_MASK_DELIM BIT(17)
#define WPA_BSS_MASK_MESH_SCAN BIT(18)
#define WPA_BSS_MASK_SNR BIT(19)
#define WPA_BSS_MASK_EST_THROUGHPUT BIT(20)
/* VENDOR_ELEM_* frame id values */

View File

@ -1,6 +1,6 @@
/*
* BSS table
* Copyright (c) 2009-2012, Jouni Malinen <j@w1.fi>
* Copyright (c) 2009-2015, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@ -286,6 +286,8 @@ static void wpa_bss_copy_res(struct wpa_bss *dst, struct wpa_scan_res *src,
dst->noise = src->noise;
dst->level = src->level;
dst->tsf = src->tsf;
dst->est_throughput = src->est_throughput;
dst->snr = src->snr;
calculate_update_time(fetch_time, src->age, &dst->last_update);
}

View File

@ -1,6 +1,6 @@
/*
* BSS table
* Copyright (c) 2009-2010, Jouni Malinen <j@w1.fi>
* Copyright (c) 2009-2015, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@ -88,6 +88,10 @@ struct wpa_bss {
u64 tsf;
/** Time of the last update (i.e., Beacon or Probe Response RX) */
struct os_reltime last_update;
/** Estimated throughput in kbps */
unsigned int est_throughput;
/** Signal-to-noise ratio in dB */
int snr;
/** ANQP data */
struct wpa_bss_anqp *anqp;
/** Length of the following IE field in octets (from Probe Response) */

View File

@ -4218,6 +4218,21 @@ static int print_bss_info(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
}
#endif /* CONFIG_MESH */
if (mask & WPA_BSS_MASK_SNR) {
ret = os_snprintf(pos, end - pos, "snr=%d\n", bss->snr);
if (os_snprintf_error(end - pos, ret))
return 0;
pos += ret;
}
if (mask & WPA_BSS_MASK_EST_THROUGHPUT) {
ret = os_snprintf(pos, end - pos, "est_throughput=%d\n",
bss->est_throughput);
if (os_snprintf_error(end - pos, ret))
return 0;
pos += ret;
}
if (mask & WPA_BSS_MASK_DELIM) {
ret = os_snprintf(pos, end - pos, "====\n");
if (os_snprintf_error(end - pos, ret))