From 1dfcafff36e5972dce3b28d70d741d680a80c68e Mon Sep 17 00:00:00 2001 From: Aloka Dixit Date: Mon, 24 Jul 2023 16:16:26 -0700 Subject: [PATCH] FILS: EHT additions Add support for EHT phy index and maximum NSS as per IEEE P802.11be/D4.0, 9.6.7.36 and 9.4.2.313.4. Signed-off-by: Aloka Dixit --- src/ap/beacon.c | 35 ++++++++++++++++++++++++++++++++++- src/common/ieee802_11_defs.h | 1 + 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index 8bda7c323..1d3b96ac7 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -1377,6 +1377,11 @@ void sta_track_del(struct hostapd_sta_info *info) static u16 hostapd_gen_fils_discovery_phy_index(struct hostapd_data *hapd) { +#ifdef CONFIG_IEEE80211BE + if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be) + return FD_CAP_PHY_INDEX_EHT; +#endif /* CONFIG_IEEE80211BE */ + #ifdef CONFIG_IEEE80211AX if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax) return FD_CAP_PHY_INDEX_HE; @@ -1399,7 +1404,10 @@ static u16 hostapd_gen_fils_discovery_nss(struct hostapd_hw_modes *mode, { u16 nss = 0; - if (mode && phy_index == FD_CAP_PHY_INDEX_HE) { + if (!mode) + return 0; + + if (phy_index == FD_CAP_PHY_INDEX_HE) { const u8 *he_mcs = mode->he_capab[IEEE80211_MODE_AP].mcs; int i; u16 mcs[6]; @@ -1449,6 +1457,31 @@ static u16 hostapd_gen_fils_discovery_nss(struct hostapd_hw_modes *mode, continue; } } + } else if (phy_index == FD_CAP_PHY_INDEX_EHT) { + u8 rx_nss, tx_nss, max_nss = 0, i; + u8 *mcs = mode->eht_capab[IEEE80211_MODE_AP].mcs; + + /* + * The Supported EHT-MCS And NSS Set field for the AP contains + * one to three EHT-MCS Map fields based on the supported + * bandwidth. Check the first byte (max NSS for Rx/Tx that + * supports EHT-MCS 0-9) for each bandwidth (<= 80, + * 160, 320) to find the maximum NSS. This assumes that + * the lowest MCS rates support the largest number of spatial + * streams. If values are different between Tx, Rx or the + * bandwidths, choose the highest value. + */ + for (i = 0; i < 3; i++) { + rx_nss = mcs[3 * i] & 0x0F; + if (rx_nss > max_nss) + max_nss = rx_nss; + + tx_nss = (mcs[3 * i] & 0xF0) >> 4; + if (tx_nss > max_nss) + max_nss = tx_nss; + } + + nss = max_nss; } if (nss > 4) diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index f7123acc1..1dafba93a 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -2848,6 +2848,7 @@ enum mscs_description_subelem { #define FD_CAP_PHY_INDEX_HT 2 #define FD_CAP_PHY_INDEX_VHT 3 #define FD_CAP_PHY_INDEX_HE 4 /* P802.11ax */ +#define FD_CAP_PHY_INDEX_EHT 5 /* P802.11be */ #define FD_CAP_PHY_INDEX_SHIFT 10 /*