wlan-ap-Telecominfraproject/feeds/ipq95xx/hostapd/patches/q02-013-eht-changes-in-STA-addition-path.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

160 lines
6.0 KiB
Diff

From 4278083ffec33d4f5c74530326eeab62255b140e Mon Sep 17 00:00:00 2001
From: Aloka Dixit <quic_alokad@quicinc.com>
Date: Tue, 6 Jul 2021 11:18:27 -0700
Subject: [PATCH 13/23] eht: changes in STA addition path
Add support for EHT capabilities in the during the addition of
a new station.
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
src/ap/ap_drv_ops.c | 5 ++++-
src/ap/ap_drv_ops.h | 3 ++-
src/ap/ieee802_11.c | 9 +++++++++
src/ap/ieee802_11.h | 4 ++++
src/ap/ieee802_11_eht.c | 16 ++++++++++++++++
src/ap/sta_info.c | 2 +-
src/drivers/driver.h | 2 ++
7 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/src/ap/ap_drv_ops.c b/src/ap/ap_drv_ops.c
index e917736664bd..09378eac72d2 100644
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -417,7 +417,8 @@ int hostapd_sta_add(struct hostapd_data *hapd,
const struct ieee80211_ht_capabilities *ht_capab,
const struct ieee80211_vht_capabilities *vht_capab,
const struct ieee80211_he_capabilities *he_capab,
- size_t he_capab_len,
+ const struct ieee80211_eht_capabilities *eht_capab,
+ size_t he_capab_len, size_t eht_capab_len,
const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
u32 flags, u8 qosinfo, u8 vht_opmode, int supp_p2p_ps,
int set)
@@ -440,6 +441,8 @@ int hostapd_sta_add(struct hostapd_data *hapd,
params.vht_capabilities = vht_capab;
params.he_capab = he_capab;
params.he_capab_len = he_capab_len;
+ params.eht_capab = eht_capab;
+ params.eht_capab_len = eht_capab_len;
params.he_6ghz_capab = he_6ghz_capab;
params.vht_opmode_enabled = !!(flags & WLAN_STA_VHT_OPMODE_ENABLED);
params.vht_opmode = vht_opmode;
diff --git a/src/ap/ap_drv_ops.h b/src/ap/ap_drv_ops.h
index 61c8f64eb471..08f52dfa7390 100644
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -42,7 +42,8 @@ int hostapd_sta_add(struct hostapd_data *hapd,
const struct ieee80211_ht_capabilities *ht_capab,
const struct ieee80211_vht_capabilities *vht_capab,
const struct ieee80211_he_capabilities *he_capab,
- size_t he_capab_len,
+ const struct ieee80211_eht_capabilities *eht_capab,
+ size_t he_capab_len, size_t eht_capab_len,
const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab,
u32 flags, u8 qosinfo, u8 vht_opmode, int supp_p2p_ps,
int set);
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 18eca78f3c84..c8f308b80f67 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4934,6 +4934,7 @@ static int add_associated_sta(struct hostapd_data *hapd,
struct ieee80211_ht_capabilities ht_cap;
struct ieee80211_vht_capabilities vht_cap;
struct ieee80211_he_capabilities he_cap;
+ struct ieee80211_eht_capabilities eht_cap;
int set = 1;
/*
@@ -4990,6 +4991,12 @@ static int add_associated_sta(struct hostapd_data *hapd,
sta->he_capab_len);
}
#endif /* CONFIG_IEEE80211AX */
+#ifdef CONFIG_IEEE80211BE
+ if (sta->flags & WLAN_STA_EXT_EHT) {
+ hostapd_get_eht_capab(hapd, sta->eht_capab, &eht_cap,
+ sta->eht_capab_len);
+ }
+#endif /* CONFIG_IEEE80211BE */
/*
* Add the station with forced WLAN_STA_ASSOC flag. The sta->flags
@@ -5002,7 +5009,9 @@ static int add_associated_sta(struct hostapd_data *hapd,
sta->flags & WLAN_STA_HT ? &ht_cap : NULL,
sta->flags & WLAN_STA_VHT ? &vht_cap : NULL,
sta->flags & WLAN_STA_HE ? &he_cap : NULL,
+ sta->flags_ext & WLAN_STA_EXT_EHT ? &eht_cap : NULL,
sta->flags & WLAN_STA_HE ? sta->he_capab_len : 0,
+ sta->flags_ext & WLAN_STA_EXT_EHT ? sta->eht_capab_len : 0,
sta->he_6ghz_capab,
sta->flags | WLAN_STA_ASSOC, sta->qosinfo,
sta->vht_opmode, sta->p2p_ie ? 1 : 0,
diff --git a/src/ap/ieee802_11.h b/src/ap/ieee802_11.h
index a9be10238afa..338599f7c71c 100644
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -78,6 +78,10 @@ void hostapd_get_he_capab(struct hostapd_data *hapd,
const struct ieee80211_he_capabilities *he_cap,
struct ieee80211_he_capabilities *neg_he_cap,
size_t he_capab_len);
+void hostapd_get_eht_capab(struct hostapd_data *hapd,
+ const struct ieee80211_eht_capabilities *src,
+ struct ieee80211_eht_capabilities *dest,
+ size_t len);
int hostapd_get_aid(struct hostapd_data *hapd, struct sta_info *sta);
u16 copy_sta_ht_capab(struct hostapd_data *hapd, struct sta_info *sta,
const u8 *ht_capab);
diff --git a/src/ap/ieee802_11_eht.c b/src/ap/ieee802_11_eht.c
index dc3dedeffac6..f19af1114005 100644
--- a/src/ap/ieee802_11_eht.c
+++ b/src/ap/ieee802_11_eht.c
@@ -320,3 +320,19 @@ u16 copy_sta_eht_capab(struct hostapd_data *hapd, struct sta_info *sta,
return WLAN_STATUS_SUCCESS;
}
+
+
+void hostapd_get_eht_capab(struct hostapd_data *hapd,
+ const struct ieee80211_eht_capabilities *src,
+ struct ieee80211_eht_capabilities *dest,
+ size_t len)
+{
+ if (!src || !dest)
+ return;
+
+ if (len > sizeof(*dest))
+ len = sizeof(*dest);
+ /* TODO: mask out unsupported features */
+
+ os_memcpy(dest, src, len);
+}
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index 8d880403f347..711680bb8950 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -1554,7 +1554,7 @@ int ap_sta_re_add(struct hostapd_data *hapd, struct sta_info *sta)
if (hostapd_sta_add(hapd, sta->addr, 0, 0,
sta->supported_rates,
sta->supported_rates_len,
- 0, NULL, NULL, NULL, 0, NULL,
+ 0, NULL, NULL, NULL, NULL, 0, 0, NULL,
sta->flags, 0, 0, 0, 0)) {
hostapd_logger(hapd, sta->addr,
HOSTAPD_MODULE_IEEE80211,
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 7dcdd2140f18..34e73b739d25 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -2210,6 +2210,8 @@ struct hostapd_sta_add_params {
const struct ieee80211_he_capabilities *he_capab;
size_t he_capab_len;
const struct ieee80211_he_6ghz_band_cap *he_6ghz_capab;
+ const struct ieee80211_eht_capabilities *eht_capab;
+ size_t eht_capab_len;
u32 flags; /* bitmask of WPA_STA_* flags */
u32 flags_mask; /* unset bits in flags */
#ifdef CONFIG_MESH
--
2.31.1