fix(btm): Improve BTM scanning effiency by using channel bitmap

- Improve the BTM scanning efficiency by using channel bitmap feature in
  scanning. This sets only the channels we need to scan instead of all.
This commit is contained in:
jgujarathi
2023-08-31 18:21:50 +05:30
committed by BOT
parent c3f1c3fcde
commit 743772fb76
2 changed files with 21 additions and 1 deletions

View File

@@ -166,7 +166,21 @@ int esp_handle_beacon_probe(u8 type, u8 *frame, size_t len, u8 *sender,
return 0;
}
#ifdef CONFIG_WNM
void get_scan_channel_bitmap(struct wpa_supplicant *wpa_s, wifi_scan_config_t *params) {
if (!wpa_s->wnm_num_neighbor_report) {
wpa_printf(MSG_DEBUG, "No Neighbor Report to gather scan channel list");
return;
}
params->channel_bitmap.ghz_2_channels = 0;
for (int i = 0; i < wpa_s->wnm_num_neighbor_report; i++) {
struct neighbor_report *nei;
nei = &wpa_s->wnm_neighbor_report_elements[i];
params->channel_bitmap.ghz_2_channels |= (1 << nei->channel_number);
}
}
#endif /*CONFIG_WNM*/
static int issue_scan(struct wpa_supplicant *wpa_s,
struct wpa_driver_scan_params *scan_params)
{
@@ -217,7 +231,11 @@ static int issue_scan(struct wpa_supplicant *wpa_s,
if (scan_params->channel) {
params->channel = scan_params->channel;
}
#ifdef CONFIG_WNM
else {
get_scan_channel_bitmap(wpa_s, params);
}
#endif /*CONFIG_WNM*/
if (scan_params->duration) {
params->scan_time.passive = scan_params->duration;
params->scan_time.active.min = scan_params->duration;

View File

@@ -479,3 +479,5 @@ void * __hide_aliasing_typecast(void *foo);
#define IANA_SECP384R1 20
#define IANA_SECP521R1 21
#endif /* COMMON_H */
#define GHZ_24_MAX_CHANNEL_COUNT 14