wlan-ap-Telecominfraproject/feeds/ipq95xx/hostapd/patches/q02-016-eht-additions-in-FILS-discovery-frames.patch
John Crispin b9b03a6e38 ipq95xx: add Qualcomm wifi-7 support
Signed-off-by: John Crispin <john@phrozen.org>
2023-04-10 14:25:48 +02:00

161 lines
4.6 KiB
Diff

From 1405e5078b42f9af4e7caed2803a7ffeecc81f29 Mon Sep 17 00:00:00 2001
From: Aloka Dixit <quic_alokad@quicinc.com>
Date: Mon, 19 Jul 2021 11:21:46 -0700
Subject: [PATCH 16/23] eht: additions in FILS discovery frames
Add support for following as per IEEE P802.11be/D1.4, January 2022,
section 9.6.7.36,
- new EHT phy index
- EHT MCS rates
- support for 320 MHZ
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
src/ap/beacon.c | 85 ++++++++++++++++++++++++------------
src/common/ieee802_11_defs.h | 2 +
2 files changed, 60 insertions(+), 27 deletions(-)
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 72b80f768d93..0a62ef7a1687 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1196,6 +1196,45 @@ void sta_track_del(struct hostapd_sta_info *info)
#ifdef CONFIG_FILS
+static u16 hostapd_fils_discovery_cap_nss(struct hostapd_hw_modes *mode,
+ u16 phy_index, u8 len)
+{
+ u16 nss = 0;
+
+ if (phy_index == FD_CAP_PHY_INDEX_EHT) {
+ u8 rx_nss = 0, tx_nss = 0;
+ u8 *mcs = mode->eht_capab[IEEE80211_MODE_AP].mcs;
+
+ rx_nss = mcs[0] & 0x0F;
+ tx_nss = (mcs[0] & 0xF0) >> 4;
+ nss = (tx_nss < rx_nss ? tx_nss : rx_nss);
+ } else if (phy_index == FD_CAP_PHY_INDEX_HE) {
+ u8 i;
+ u16 *mcs = (u16 *) mode->he_capab[IEEE80211_MODE_AP].mcs;
+
+ for (i = 0; i < HE_NSS_MAX_STREAMS; i++) {
+ u16 mask = 0x3 << (i * 2);
+
+ if (len == 4 && (((mcs[0] & mask) == mask) ||
+ ((mcs[1] & mask) == mask)))
+ continue;
+
+ if (len == 8 && (((mcs[2] & mask) == mask) ||
+ ((mcs[3] & mask) == mask)))
+ continue;
+
+ if (len == 12 && (((mcs[4] & mask) == mask) ||
+ ((mcs[5] & mask) == mask)))
+ continue;
+
+ nss++;
+ }
+ }
+
+ return nss;
+}
+
+
static u16 hostapd_fils_discovery_cap(struct hostapd_data *hapd)
{
u16 cap_info, phy_index = 0;
@@ -1207,9 +1246,19 @@ 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;
+#ifdef CONFIG_IEEE80211BE
+ if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be)
+ phy_index = FD_CAP_PHY_INDEX_EHT;
+#endif /* CONFIG_IEEE80211BE */
+#ifdef CONFIG_IEEE80211AX
+ if (!phy_index &&
+ hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax)
+ phy_index = FD_CAP_PHY_INDEX_HE;
+#endif /* CONFIG_IEEE80211AX */
switch (hapd->iconf->op_class) {
+ case 137:
+ chwidth = FD_CAP_BSS_CHWIDTH_320;
case 135:
mcs_nss_size += 4;
/* fallthrough */
@@ -1244,8 +1293,13 @@ static u16 hostapd_fils_discovery_cap(struct hostapd_data *hapd)
break;
}
+#ifdef CONFIG_IEEE80211BE
+ if (hapd->iconf->ieee80211be && !hapd->conf->disable_11be)
+ phy_index = FD_CAP_PHY_INDEX_EHT;
+#endif /* CONFIG_IEEE80211BE */
#ifdef CONFIG_IEEE80211AX
- if (hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax)
+ if (!phy_index &&
+ hapd->iconf->ieee80211ax && !hapd->conf->disable_11ax)
phy_index = FD_CAP_PHY_INDEX_HE;
#endif /* CONFIG_IEEE80211AX */
#ifdef CONFIG_IEEE80211AC
@@ -1262,31 +1316,8 @@ static u16 hostapd_fils_discovery_cap(struct hostapd_data *hapd)
cap_info |= chwidth << FD_CAP_BSS_CHWIDTH_SHIFT;
if (mode) {
- u16 *mcs = (u16 *) mode->he_capab[IEEE80211_MODE_AP].mcs;
- int i;
- u16 nss = 0;
-
- for (i = 0; i < HE_NSS_MAX_STREAMS; i++) {
- u16 nss_mask = 0x3 << (i * 2);
-
- if (mcs_nss_size == 4 &&
- (((mcs[0] & nss_mask) == nss_mask) ||
- ((mcs[1] & nss_mask) == nss_mask)))
- continue;
-
- if (mcs_nss_size == 8 &&
- (((mcs[2] & nss_mask) == nss_mask) ||
- ((mcs[3] & nss_mask) == nss_mask)))
- continue;
-
- if (mcs_nss_size == 12 &&
- (((mcs[4] & nss_mask) == nss_mask) ||
- ((mcs[5] & nss_mask) == nss_mask)))
- continue;
-
- nss++;
- }
-
+ u16 nss = hostapd_fils_discovery_cap_nss(mode, phy_index,
+ mcs_nss_size);
if (nss > 4)
cap_info |= FD_CAP_NSS_5_8 << FD_CAP_NSS_SHIFT;
else if (nss)
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index 79e14cc90403..b5cb680737d6 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2538,6 +2538,7 @@ enum mscs_description_subelem {
#define FD_CAP_BSS_CHWIDTH_40 1
#define FD_CAP_BSS_CHWIDTH_80 2
#define FD_CAP_BSS_CHWIDTH_160_80_80 3
+#define FD_CAP_BSS_CHWIDTH_320 4
#define FD_CAP_BSS_CHWIDTH_SHIFT 2
#define FD_CAP_NSS_1 0
@@ -2552,6 +2553,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
/*
--
2.31.1