From: Jouni Malinen Date: Sun, 22 Feb 2015 08:50:55 +0000 (+0200) Subject: Add snr and est_throughput to the BSS entries X-Git-Tag: hostap_2_4~96 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1d747e2a98d5f5084d2b36c5a75cbe45fcf52d45;p=thirdparty%2Fhostap.git 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 --- diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h index 21f57e67b..1d19fc550 100644 --- a/src/common/wpa_ctrl.h +++ b/src/common/wpa_ctrl.h @@ -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 */ diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c index 3b476d54c..b4c47e210 100644 --- a/wpa_supplicant/bss.c +++ b/wpa_supplicant/bss.c @@ -1,6 +1,6 @@ /* * BSS table - * Copyright (c) 2009-2012, Jouni Malinen + * Copyright (c) 2009-2015, Jouni Malinen * * 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); } diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h index 1a603f687..634aa3cc0 100644 --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h @@ -1,6 +1,6 @@ /* * BSS table - * Copyright (c) 2009-2010, Jouni Malinen + * Copyright (c) 2009-2015, Jouni Malinen * * 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) */ diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index c9ac30b81..ec198b294 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -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))