]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add snr and est_throughput to the BSS entries
authorJouni Malinen <j@w1.fi>
Sun, 22 Feb 2015 08:50:55 +0000 (10:50 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 22 Feb 2015 09:09:54 +0000 (11:09 +0200)
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>
src/common/wpa_ctrl.h
wpa_supplicant/bss.c
wpa_supplicant/bss.h
wpa_supplicant/ctrl_iface.c

index 21f57e67b1bfabd0f70761d8b356569dcdaf38e7..1d19fc550df651e9a0c461a791cb47a9eacc7090 100644 (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 */
index 3b476d54ce34421ec6ee3b5593772adc71f464fd..b4c47e21051d40957089054b2bc263369cd7f73e 100644 (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);
 }
index 1a603f6878fa3a1fd96493bd13292546787a63ea..634aa3cc06d09ff2458bedd8162b0ac6b63e3397 100644 (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) */
index c9ac30b815afbdfbe6f0555a81402581ff275bf8..ec198b2948879d7ee35069296127f6c14e74d61d 100644 (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))