From 806db174fd9addcd17c629a1b6464e8971c38614 Mon Sep 17 00:00:00 2001 From: Peter Oh Date: Wed, 18 Apr 2018 14:14:18 -0700 Subject: [PATCH] mesh: Add VHT_CHANWIDTH_USE_HT to max_oper_chwidth Channel width in VHT mode refers HT capability when the width goes down to below 80 MHz, hence add checking HT channel width to its max operation channel width. So that mesh has capability to select bandwidth below 80 MHz. Signed-off-by: Peter Oh --- wpa_supplicant/config.c | 1 + wpa_supplicant/config_file.c | 2 +- wpa_supplicant/config_ssid.h | 1 + wpa_supplicant/mesh.c | 3 ++- wpa_supplicant/wpa_supplicant.c | 3 +++ 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 7a95ea49e..bfca69ff7 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -2903,6 +2903,7 @@ void wpa_config_set_network_defaults(struct wpa_ssid *ssid) ssid->mka_priority = DEFAULT_PRIO_NOT_KEY_SERVER; #endif /* CONFIG_MACSEC */ ssid->mac_addr = -1; + ssid->max_oper_chwidth = DEFAULT_MAX_OPER_CHWIDTH; } diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 98aae8740..73fcf2c5a 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -838,7 +838,7 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid) INT(vht); INT_DEF(ht, 1); INT(ht40); - INT(max_oper_chwidth); + INT_DEF(max_oper_chwidth, DEFAULT_MAX_OPER_CHWIDTH); INT(vht_center_freq1); INT(vht_center_freq2); INT(pbss); diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h index 6cf655785..9abecc0ad 100644 --- a/wpa_supplicant/config_ssid.h +++ b/wpa_supplicant/config_ssid.h @@ -39,6 +39,7 @@ #define DEFAULT_AMPDU_FACTOR -1 /* no change */ #define DEFAULT_AMPDU_DENSITY -1 /* no change */ #define DEFAULT_USER_SELECTED_SIM 1 +#define DEFAULT_MAX_OPER_CHWIDTH -1 struct psk_list_entry { struct dl_list list; diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c index f2f09614d..dd6aad6f0 100644 --- a/wpa_supplicant/mesh.c +++ b/wpa_supplicant/mesh.c @@ -332,7 +332,8 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s, if (ssid->ht40) conf->secondary_channel = ssid->ht40; if (conf->hw_mode == HOSTAPD_MODE_IEEE80211A && ssid->vht) { - conf->vht_oper_chwidth = ssid->max_oper_chwidth; + if (ssid->max_oper_chwidth != DEFAULT_MAX_OPER_CHWIDTH) + conf->vht_oper_chwidth = ssid->max_oper_chwidth; switch (conf->vht_oper_chwidth) { case VHT_CHANWIDTH_80MHZ: case VHT_CHANWIDTH_80P80MHZ: diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 9ca2c6b7b..feeafc620 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -2352,6 +2352,9 @@ void ibss_mesh_setup_freq(struct wpa_supplicant *wpa_s, vht_caps |= VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; seg0 = 114; } + } else if (ssid->max_oper_chwidth == VHT_CHANWIDTH_USE_HT) { + chwidth = VHT_CHANWIDTH_USE_HT; + seg0 = vht80[j] + 2; } if (hostapd_set_freq_params(&vht_freq, mode->mode, freq->freq,