@ -84,6 +84,11 @@ static void wpas_conf_ap_vht(struct wpa_supplicant *wpa_s,
/* Use the maximum oper channel width if it's given. */
if ( ssid - > max_oper_chwidth )
hostapd_set_oper_chwidth ( conf , ssid - > max_oper_chwidth ) ;
if ( hostapd_get_oper_chwidth ( conf ) )
ieee80211_freq_to_channel_ext ( ssid - > frequency , 0 ,
hostapd_get_oper_chwidth ( conf ) ,
& conf - > op_class ,
& conf - > channel ) ;
if ( hostapd_get_oper_chwidth ( conf ) = = CHANWIDTH_80P80MHZ ) {
ieee80211_freq_to_chan ( ssid - > vht_center_freq2 ,
@ -191,19 +196,75 @@ wpa_supplicant_find_hw_mode(struct wpa_supplicant *wpa_s,
}
static int get_max_oper_chwidth_6ghz ( int chwidth )
{
switch ( chwidth ) {
case CHANWIDTH_USE_HT :
return 20 ;
case CHANWIDTH_40MHZ_6GHZ :
return 40 ;
case CHANWIDTH_80MHZ :
return 80 ;
case CHANWIDTH_80P80MHZ :
case CHANWIDTH_160MHZ :
return 160 ;
default :
return 0 ;
}
}
static void wpas_conf_ap_he_6ghz ( struct wpa_supplicant * wpa_s ,
struct hostapd_hw_modes * mode ,
struct wpa_ssid * ssid ,
struct hostapd_config * conf )
{
bool is_chanwidth_40_80 , is_chanwidth_160 ;
int he_chanwidth ;
he_chanwidth =
mode - > he_capab [ wpas_mode_to_ieee80211_mode (
ssid - > mode ) ] . phy_cap [ HE_PHYCAP_CHANNEL_WIDTH_SET_IDX ] ;
is_chanwidth_40_80 = he_chanwidth &
HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G ;
is_chanwidth_160 = he_chanwidth &
HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G ;
wpa_printf ( MSG_DEBUG ,
" Enable HE support (p2p_group=%d he_chwidth_cap=%d) " ,
ssid - > p2p_group , he_chanwidth ) ;
if ( mode - > he_capab [ wpas_mode_to_ieee80211_mode (
ssid - > mode ) ] . he_supported & &
ssid - > he )
conf - > ieee80211ax = 1 ;
if ( is_chanwidth_40_80 & & ssid - > p2p_group & &
get_max_oper_chwidth_6ghz ( ssid - > max_oper_chwidth ) > = 40 ) {
conf - > secondary_channel =
wpas_p2p_get_sec_channel_offset_40mhz (
wpa_s , mode , conf - > channel ) ;
wpa_printf ( MSG_DEBUG ,
" Secondary channel offset %d for P2P group " ,
conf - > secondary_channel ) ;
if ( ssid - > max_oper_chwidth = = CHANWIDTH_40MHZ_6GHZ )
ssid - > max_oper_chwidth = CHANWIDTH_USE_HT ;
}
if ( ( is_chanwidth_40_80 | | is_chanwidth_160 ) & & ssid - > p2p_group & &
get_max_oper_chwidth_6ghz ( ssid - > max_oper_chwidth ) > = 80 )
wpas_conf_ap_vht ( wpa_s , ssid , conf , mode ) ;
}
int wpa_supplicant_conf_ap_ht ( struct wpa_supplicant * wpa_s ,
struct wpa_ssid * ssid ,
struct hostapd_config * conf )
{
conf - > hw_mode = ieee80211_freq_to_channel_ext ( ssid - > frequency , 0 ,
ssid - > max_oper_chwidth ,
CHANWIDTH_USE_HT ,
& conf - > op_class ,
& conf - > channel ) ;
/* ssid->max_oper_chwidth is not valid in all cases, so fall back to the
* less specific mechanism , if needed , at least for now */
if ( conf - > hw_mode = = NUM_HOSTAPD_MODES )
conf - > hw_mode = ieee80211_freq_to_chan ( ssid - > frequency ,
& conf - > channel ) ;
if ( conf - > hw_mode = = NUM_HOSTAPD_MODES ) {
wpa_printf ( MSG_ERROR , " Unsupported AP mode frequency: %d MHz " ,
ssid - > frequency ) ;
@ -256,7 +317,10 @@ int wpa_supplicant_conf_ap_ht(struct wpa_supplicant *wpa_s,
no_ht = 1 ;
}
if ( ! no_ht & & mode & & mode - > ht_capab ) {
if ( mode & & is_6ghz_freq ( ssid - > frequency ) & &
conf - > hw_mode = = HOSTAPD_MODE_IEEE80211A ) {
wpas_conf_ap_he_6ghz ( wpa_s , mode , ssid , conf ) ;
} else if ( ! no_ht & & mode & & mode - > ht_capab ) {
wpa_printf ( MSG_DEBUG ,
" Enable HT support (p2p_group=%d 11a=%d ht40_hw_capab=%d ssid->ht40=%d) " ,
ssid - > p2p_group ,