From 24e0938b37b9049f38d9cf8756eab81537a2434f Mon Sep 17 00:00:00 2001 From: Aloka Dixit Date: Mon, 24 Jul 2023 16:16:22 -0700 Subject: [PATCH] FILS: Move phy index determination to new function Move the phy index determination for FILS discovery frames to a new function without changing the functionality. HE support is mandatory for operating in the 6 GHz band hence the phy index will always be set to FD_CAP_PHY_INDEX_HE for this band. Signed-off-by: Aloka Dixit --- src/ap/beacon.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 772825d88..4a0e552ec 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -1375,9 +1375,28 @@ void sta_track_del(struct hostapd_sta_info *info) #ifdef CONFIG_FILS +static u16 hostapd_gen_fils_discovery_phy_index(struct hostapd_data *hapd) +{ +#ifdef CONFIG_IEEE80211AX + if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) + return FD_CAP_PHY_INDEX_HE; +#endif /* CONFIG_IEEE80211AX */ + +#ifdef CONFIG_IEEE80211AC + if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) + return FD_CAP_PHY_INDEX_VHT; +#endif /* CONFIG_IEEE80211AC */ + + if (hapd->iconf->ieee80211n && !hapd->conf->disable_11n) + return FD_CAP_PHY_INDEX_HT; + + return 0; +} + + static u16 hostapd_fils_discovery_cap(struct hostapd_data *hapd) { - u16 cap_info, phy_index = 0; + u16 cap_info, phy_index; u8 chwidth = FD_CAP_BSS_CHWIDTH_20, mcs_nss_size = 4; struct hostapd_hw_modes *mode = hapd->iface->current_mode; @@ -1386,8 +1405,6 @@ static u16 hostapd_fils_discovery_cap(struct hostapd_data *hapd) cap_info |= FD_CAP_PRIVACY; if (is_6ghz_op_class(hapd->iconf->op_class)) { - phy_index = FD_CAP_PHY_INDEX_HE; - switch (hapd->iconf->op_class) { case 137: chwidth = FD_CAP_BSS_CHWIDTH_320; @@ -1427,21 +1444,9 @@ static u16 hostapd_fils_discovery_cap(struct hostapd_data *hapd) default: break; } - -#ifdef CONFIG_IEEE80211AX - if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) - phy_index = FD_CAP_PHY_INDEX_HE; -#endif /* CONFIG_IEEE80211AX */ -#ifdef CONFIG_IEEE80211AC - if (!phy_index && - hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) - phy_index = FD_CAP_PHY_INDEX_VHT; -#endif /* CONFIG_IEEE80211AC */ - if (!phy_index && - hapd->iconf->ieee80211n && !hapd->conf->disable_11n) - phy_index = FD_CAP_PHY_INDEX_HT; } + phy_index = hostapd_gen_fils_discovery_phy_index(hapd); cap_info |= phy_index << FD_CAP_PHY_INDEX_SHIFT; cap_info |= chwidth << FD_CAP_BSS_CHWIDTH_SHIFT;