Optimize 40 MHz HT co-ex scan on AP
Only scan the affected channels instead of all enabled channels when determining whether the primary and secondary channel for HT40 needs to be swapped. This speed up HT40 setup considerably on 5 GHz band. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
7d6d73701e
commit
afadaff976
1 changed files with 43 additions and 0 deletions
|
@ -532,6 +532,47 @@ static void ieee80211n_scan_channels_2g4(struct hostapd_iface *iface,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void ieee80211n_scan_channels_5g(struct hostapd_iface *iface,
|
||||||
|
struct wpa_driver_scan_params *params)
|
||||||
|
{
|
||||||
|
/* Scan only the affected frequency range */
|
||||||
|
int pri_freq;
|
||||||
|
int affected_start, affected_end;
|
||||||
|
int i, pos;
|
||||||
|
struct hostapd_hw_modes *mode;
|
||||||
|
|
||||||
|
if (iface->current_mode == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pri_freq = hostapd_hw_get_freq(iface->bss[0], iface->conf->channel);
|
||||||
|
if (iface->conf->secondary_channel > 0) {
|
||||||
|
affected_start = pri_freq - 10;
|
||||||
|
affected_end = pri_freq + 30;
|
||||||
|
} else {
|
||||||
|
affected_start = pri_freq - 30;
|
||||||
|
affected_end = pri_freq + 10;
|
||||||
|
}
|
||||||
|
wpa_printf(MSG_DEBUG, "40 MHz affected channel range: [%d,%d] MHz",
|
||||||
|
affected_start, affected_end);
|
||||||
|
|
||||||
|
mode = iface->current_mode;
|
||||||
|
params->freqs = os_calloc(mode->num_channels + 1, sizeof(int));
|
||||||
|
if (params->freqs == NULL)
|
||||||
|
return;
|
||||||
|
pos = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < mode->num_channels; i++) {
|
||||||
|
struct hostapd_channel_data *chan = &mode->channels[i];
|
||||||
|
if (chan->flag & HOSTAPD_CHAN_DISABLED)
|
||||||
|
continue;
|
||||||
|
if (chan->freq < affected_start ||
|
||||||
|
chan->freq > affected_end)
|
||||||
|
continue;
|
||||||
|
params->freqs[pos++] = chan->freq;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int ieee80211n_check_40mhz(struct hostapd_iface *iface)
|
static int ieee80211n_check_40mhz(struct hostapd_iface *iface)
|
||||||
{
|
{
|
||||||
struct wpa_driver_scan_params params;
|
struct wpa_driver_scan_params params;
|
||||||
|
@ -545,6 +586,8 @@ static int ieee80211n_check_40mhz(struct hostapd_iface *iface)
|
||||||
os_memset(¶ms, 0, sizeof(params));
|
os_memset(¶ms, 0, sizeof(params));
|
||||||
if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G)
|
if (iface->current_mode->mode == HOSTAPD_MODE_IEEE80211G)
|
||||||
ieee80211n_scan_channels_2g4(iface, ¶ms);
|
ieee80211n_scan_channels_2g4(iface, ¶ms);
|
||||||
|
else
|
||||||
|
ieee80211n_scan_channels_5g(iface, ¶ms);
|
||||||
if (hostapd_driver_scan(iface->bss[0], ¶ms) < 0) {
|
if (hostapd_driver_scan(iface->bss[0], ¶ms) < 0) {
|
||||||
wpa_printf(MSG_ERROR, "Failed to request a scan of "
|
wpa_printf(MSG_ERROR, "Failed to request a scan of "
|
||||||
"neighboring BSSes");
|
"neighboring BSSes");
|
||||||
|
|
Loading…
Reference in a new issue