1 /* 2 * WPA Supplicant - Scanning 3 * Copyright (c) 2003-2014, Jouni Malinen <j@w1.fi> 4 * 5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details. 7 */ 8 9 #ifndef SCAN_H 10 #define SCAN_H 11 12 /* 13 * Noise floor values to use when we have signal strength 14 * measurements, but no noise floor measurements. These values were 15 * measured in an office environment with many APs. 16 */ 17 #define DEFAULT_NOISE_FLOOR_2GHZ (-89) 18 #define DEFAULT_NOISE_FLOOR_5GHZ (-92) 19 #define DEFAULT_NOISE_FLOOR_6GHZ (-92) 20 21 #ifdef CONFIG_NW_SEL_RELIABILITY 22 /* 23 * This basically disables capping the SNR when choosing the best BSS. This 24 * means that the BSS with the highest SNR will be chosen, independent of the 25 * band. This is useful for scenarios where reliability is more important than 26 * throughput. 27 */ 28 #define GREAT_SNR 999 29 #else 30 /* 31 * Channels with a great SNR can operate at full rate. What is a great SNR? 32 * This doc https://supportforums.cisco.com/docs/DOC-12954 says, "the general 33 * rule of thumb is that any SNR above 20 is good." This one 34 * http://www.cisco.com/en/US/tech/tk722/tk809/technologies_q_and_a_item09186a00805e9a96.shtml#qa23 35 * recommends 25 as a minimum SNR for 54 Mbps data rate. The estimates used in 36 * scan_est_throughput() allow even smaller SNR values for the maximum rates 37 * (21 for 54 Mbps, 22 for VHT80 MCS9, 24 for HT40 and HT20 MCS7). Use 25 as a 38 * somewhat conservative value here. 39 */ 40 #define GREAT_SNR 25 41 #endif /* CONFIG_NW_SEL_RELIABILITY */ 42 43 /* 44 * IEEE Sts 802.11ax-2021, 9.4.2.161 (Transmit Power Envelope element) indicates 45 * no max TX power limit if Maximum Transmit Power field is 63.5 dBm. 46 * The default TX power if it is not constrained by Transmit Power Envelope 47 * element. 48 */ 49 #define TX_POWER_NO_CONSTRAINT 64 50 51 int wpa_supplicant_enabled_networks(struct wpa_supplicant *wpa_s); 52 void wpa_supplicant_req_scan(struct wpa_supplicant *wpa_s, int sec, int usec); 53 int wpa_supplicant_delayed_sched_scan(struct wpa_supplicant *wpa_s, 54 int sec, int usec); 55 int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s); 56 void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s); 57 void wpa_supplicant_cancel_delayed_sched_scan(struct wpa_supplicant *wpa_s); 58 void wpa_supplicant_cancel_sched_scan(struct wpa_supplicant *wpa_s); 59 void wpa_supplicant_notify_scanning(struct wpa_supplicant *wpa_s, 60 int scanning); 61 struct wpa_driver_scan_params; 62 int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s, 63 struct wpa_driver_scan_params *params, 64 bool default_ies, bool next); 65 struct wpa_scan_results * 66 wpa_supplicant_get_scan_results(struct wpa_supplicant *wpa_s, 67 struct scan_info *info, int new_scan, 68 const u8 *bssid); 69 int wpa_supplicant_update_scan_results(struct wpa_supplicant *wpa_s, 70 const u8 *bssid); 71 const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie); 72 const u8 * wpa_scan_get_ml_ie(const struct wpa_scan_res *res, u8 type); 73 const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res, 74 u32 vendor_type); 75 const u8 * wpa_scan_get_vendor_ie_beacon(const struct wpa_scan_res *res, 76 u32 vendor_type); 77 struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res, 78 u32 vendor_type); 79 int wpa_supplicant_filter_bssid_match(struct wpa_supplicant *wpa_s, 80 const u8 *bssid); 81 void wpa_supplicant_update_scan_int(struct wpa_supplicant *wpa_s, int sec); 82 void scan_only_handler(struct wpa_supplicant *wpa_s, 83 struct wpa_scan_results *scan_res); 84 int wpas_scan_scheduled(struct wpa_supplicant *wpa_s); 85 struct wpa_driver_scan_params * 86 wpa_scan_clone_params(const struct wpa_driver_scan_params *src); 87 void wpa_scan_free_params(struct wpa_driver_scan_params *params); 88 int wpas_start_pno(struct wpa_supplicant *wpa_s); 89 int wpas_stop_pno(struct wpa_supplicant *wpa_s); 90 void wpas_scan_reset_sched_scan(struct wpa_supplicant *wpa_s); 91 void wpas_scan_restart_sched_scan(struct wpa_supplicant *wpa_s); 92 93 void wpas_mac_addr_rand_scan_clear(struct wpa_supplicant *wpa_s, 94 unsigned int type); 95 int wpas_mac_addr_rand_scan_set(struct wpa_supplicant *wpa_s, 96 unsigned int type, const u8 *addr, 97 const u8 *mask); 98 int wpas_mac_addr_rand_scan_get_mask(struct wpa_supplicant *wpa_s, 99 unsigned int type, u8 *mask); 100 int wpas_abort_ongoing_scan(struct wpa_supplicant *wpa_s); 101 void scan_snr(struct wpa_scan_res *res); 102 void scan_est_throughput(struct wpa_supplicant *wpa_s, 103 struct wpa_scan_res *res); 104 unsigned int wpas_get_est_tpt(const struct wpa_supplicant *wpa_s, 105 const u8 *ies, size_t ies_len, int rate, 106 int snr, int freq, enum chan_width *max_cw); 107 void wpa_supplicant_set_default_scan_ies(struct wpa_supplicant *wpa_s); 108 int wpa_add_scan_freqs_list(struct wpa_supplicant *wpa_s, 109 enum hostapd_hw_mode band, 110 struct wpa_driver_scan_params *params, 111 bool is_6ghz, bool only_6ghz_psc, 112 bool exclude_radar); 113 int wpas_channel_width_rssi_bump(const u8 *ies, size_t ies_len, 114 enum chan_width cw); 115 int wpas_adjust_snr_by_chanwidth(const u8 *ies, size_t ies_len, 116 enum chan_width max_cw, int snr); 117 118 #endif /* SCAN_H */ 119