wlan-ap-Telecominfraproject/feeds/ipq95xx/hostapd/patches/q02-017-eht-additions-to-hostapd_set_freq_params.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

309 lines
12 KiB
Diff

From bcbde623ce398a9f3503db3756c2c5acaafcad91 Mon Sep 17 00:00:00 2001
From: Muna Sinada <quic_msinada@quicinc.com>
Date: Thu, 15 Jul 2021 09:35:12 -0700
Subject: [PATCH 17/23] eht: additions to hostapd_set_freq_params()
Modify hostapd_set_freq_params to include EHT parameters and the calling
functions.
Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
src/ap/ap_drv_ops.c | 14 +++++++++-----
src/ap/ap_drv_ops.h | 6 +++---
src/ap/beacon.c | 2 ++
src/ap/dfs.c | 6 +++++-
src/ap/hostapd.c | 5 ++++-
src/common/hw_features_common.c | 24 ++++++++++++++++++------
src/common/hw_features_common.h | 6 ++++--
src/drivers/driver.h | 5 +++++
wpa_supplicant/mesh.c | 8 ++++++--
wpa_supplicant/wpa_supplicant.c | 6 ++++--
10 files changed, 60 insertions(+), 22 deletions(-)
--- a/src/ap/ap_drv_ops.c
+++ b/src/ap/ap_drv_ops.c
@@ -550,7 +550,7 @@ int hostapd_flush(struct hostapd_data *h
int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
int freq, int channel, int edmg, u8 edmg_channel,
int ht_enabled, int vht_enabled,
- int he_enabled,
+ int he_enabled, int eht_enabled,
int sec_channel_offset, int oper_chwidth,
int center_segment0, int center_segment1)
{
@@ -559,12 +559,14 @@ int hostapd_set_freq(struct hostapd_data
if (hostapd_set_freq_params(&data, mode, freq, channel, edmg,
edmg_channel, ht_enabled,
- vht_enabled, he_enabled, sec_channel_offset,
- oper_chwidth,
+ vht_enabled, he_enabled, eht_enabled,
+ sec_channel_offset, oper_chwidth,
center_segment0, center_segment1,
cmode ? cmode->vht_capab : 0,
cmode ?
&cmode->he_capab[IEEE80211_MODE_AP] : NULL,
+ cmode ?
+ &cmode->eht_capab[IEEE80211_MODE_AP] : NULL,
hapd->iconf->he_6ghz_reg_pwr_type))
return -1;
@@ -815,7 +817,7 @@ int hostapd_drv_send_action_addr3_ap(str
int hostapd_start_dfs_cac(struct hostapd_iface *iface,
enum hostapd_hw_mode mode, int freq,
int channel, int ht_enabled, int vht_enabled,
- int he_enabled,
+ int he_enabled, int eht_enabled,
int sec_channel_offset, int oper_chwidth,
int center_segment0, int center_segment1)
{
@@ -835,11 +837,13 @@ int hostapd_start_dfs_cac(struct hostapd
if (hostapd_set_freq_params(&data, mode, freq, channel, 0, 0,
ht_enabled,
- vht_enabled, he_enabled, sec_channel_offset,
+ vht_enabled, he_enabled, eht_enabled,
+ sec_channel_offset,
oper_chwidth, center_segment0,
center_segment1,
cmode->vht_capab,
&cmode->he_capab[IEEE80211_MODE_AP],
+ &cmode->eht_capab[IEEE80211_MODE_AP],
hapd->iconf->he_6ghz_reg_pwr_type)) {
wpa_printf(MSG_ERROR, "Can't set freq params");
return -1;
--- a/src/ap/ap_drv_ops.h
+++ b/src/ap/ap_drv_ops.h
@@ -65,8 +65,8 @@ int hostapd_get_seqnum(const char *ifnam
int hostapd_flush(struct hostapd_data *hapd);
int hostapd_set_freq(struct hostapd_data *hapd, enum hostapd_hw_mode mode,
int freq, int channel, int edmg, u8 edmg_channel,
- int ht_enabled, int vht_enabled,
- int he_enabled, int sec_channel_offset, int oper_chwidth,
+ int ht_enabled, int vht_enabled, int he_enabled,
+ int eht_enabled, int sec_channel_offset, int oper_chwidth,
int center_segment0, int center_segment1);
int hostapd_set_rts(struct hostapd_data *hapd, int rts);
int hostapd_set_frag(struct hostapd_data *hapd, int frag);
@@ -129,7 +129,7 @@ int hostapd_add_tspec(struct hostapd_dat
int hostapd_start_dfs_cac(struct hostapd_iface *iface,
enum hostapd_hw_mode mode, int freq,
int channel, int ht_enabled, int vht_enabled,
- int he_enabled,
+ int he_enabled, int eht_enabled,
int sec_channel_offset, int oper_chwidth,
int center_segment0, int center_segment1);
int hostapd_drv_do_acs(struct hostapd_data *hapd);
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -2162,12 +2162,14 @@ static int __ieee802_11_set_beacon(struc
iconf->channel, iconf->enable_edmg,
iconf->edmg_channel, iconf->ieee80211n,
iconf->ieee80211ac, iconf->ieee80211ax,
+ iconf->ieee80211be,
iconf->secondary_channel,
hostapd_get_oper_chwidth(iconf),
hostapd_get_oper_centr_freq_seg0_idx(iconf),
hostapd_get_oper_centr_freq_seg1_idx(iconf),
cmode->vht_capab,
&cmode->he_capab[IEEE80211_MODE_AP],
+ &cmode->eht_capab[IEEE80211_MODE_AP],
iconf->he_6ghz_reg_pwr_type) == 0)
params.freq = &freq;
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -871,7 +871,7 @@ int hostapd_handle_dfs(struct hostapd_if
res = hostapd_start_dfs_cac(
iface, iface->conf->hw_mode, iface->freq, iface->conf->channel,
iface->conf->ieee80211n, iface->conf->ieee80211ac,
- iface->conf->ieee80211ax,
+ iface->conf->ieee80211ax, iface->conf->ieee80211be,
iface->conf->secondary_channel,
hostapd_get_oper_chwidth(iface->conf),
hostapd_get_oper_centr_freq_seg0_idx(iface->conf),
@@ -1084,12 +1084,14 @@ static int hostapd_dfs_testmode_set_beac
iface->conf->ieee80211n,
iface->conf->ieee80211ac,
iface->conf->ieee80211ax,
+ iface->conf->ieee80211be,
secondary_channel,
hostapd_get_oper_chwidth(iface->conf),
vht_oper_centr_freq_seg0_idx,
vht_oper_centr_freq_seg1_idx,
iface->current_mode->vht_capab,
&iface->current_mode->he_capab[IEEE80211_MODE_AP],
+ &iface->current_mode->eht_capab[IEEE80211_MODE_AP],
hapd->iconf->he_6ghz_reg_pwr_type);
if (err) {
@@ -1226,12 +1228,14 @@ static int hostapd_dfs_start_channel_swi
iface->conf->ieee80211n,
iface->conf->ieee80211ac,
iface->conf->ieee80211ax,
+ iface->conf->ieee80211be,
secondary_channel,
new_vht_oper_chwidth,
oper_centr_freq_seg0_idx,
oper_centr_freq_seg1_idx,
cmode->vht_capab,
&cmode->he_capab[ieee80211_mode],
+ &cmode->eht_capab[ieee80211_mode],
iface->conf->he_6ghz_reg_pwr_type);
if (err) {
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2117,6 +2117,7 @@ static int hostapd_setup_interface_compl
hapd->iconf->ieee80211n,
hapd->iconf->ieee80211ac,
hapd->iconf->ieee80211ax,
+ hapd->iconf->ieee80211be,
hapd->iconf->secondary_channel,
hostapd_get_oper_chwidth(hapd->iconf),
hostapd_get_oper_centr_freq_seg0_idx(
@@ -3524,12 +3525,14 @@ static int hostapd_change_config_freq(st
conf->channel, conf->enable_edmg,
conf->edmg_channel, conf->ieee80211n,
conf->ieee80211ac, conf->ieee80211ax,
- conf->secondary_channel,
+ conf->ieee80211be, conf->secondary_channel,
hostapd_get_oper_chwidth(conf),
hostapd_get_oper_centr_freq_seg0_idx(conf),
hostapd_get_oper_centr_freq_seg1_idx(conf),
conf->vht_capab,
mode ? &mode->he_capab[IEEE80211_MODE_AP] :
+ NULL,
+ mode ? &mode->eht_capab[IEEE80211_MODE_AP] :
NULL, hapd->iconf->he_6ghz_reg_pwr_type))
return -1;
--- a/src/common/hw_features_common.c
+++ b/src/common/hw_features_common.c
@@ -383,10 +383,12 @@ int hostapd_set_freq_params(struct hosta
int freq, int channel, int enable_edmg,
u8 edmg_channel, int ht_enabled,
int vht_enabled, int he_enabled,
- int sec_channel_offset,
+ int eht_enabled, int sec_channel_offset,
int oper_chwidth, int center_segment0,
int center_segment1, u32 vht_caps,
- struct he_capabilities *he_cap, u8 reg_6g_pwr_mode)
+ struct he_capabilities *he_cap,
+ struct eht_capabilities *eht_cap,
+ u8 reg_6g_pwr_mode)
{
if (!he_cap || !he_cap->he_supported)
he_enabled = 0;
@@ -397,6 +399,7 @@ int hostapd_set_freq_params(struct hosta
data->ht_enabled = ht_enabled;
data->vht_enabled = vht_enabled;
data->he_enabled = he_enabled;
+ data->eht_enabled = eht_enabled;
data->sec_channel_offset = sec_channel_offset;
data->center_freq1 = freq + sec_channel_offset * 10;
data->center_freq2 = 0;
@@ -415,9 +418,9 @@ int hostapd_set_freq_params(struct hosta
&data->edmg);
if (is_6ghz_freq(freq)) {
- if (!data->he_enabled) {
+ if (!data->he_enabled && !data->eht_enabled) {
wpa_printf(MSG_ERROR,
- "Can't set 6 GHz mode - HE isn't enabled");
+ "Can't set 6 GHz mode - HE and EHT aren't enabled");
return -1;
}
@@ -482,7 +485,16 @@ int hostapd_set_freq_params(struct hosta
return 0;
}
- if (data->he_enabled) switch (oper_chwidth) {
+ if (data->eht_enabled) switch (oper_chwidth) {
+ case CHANWIDTH_320MHZ:
+ if (!(eht_cap->phy_cap[EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_IDX] &
+ EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_MASK)) {
+ wpa_printf(MSG_ERROR,
+ "320 MHz channel width is not supported in 5 / 6GHz");
+ return -1;
+ }
+ break;
+ } else if (data->he_enabled) switch (oper_chwidth) {
case CHANWIDTH_USE_HT:
if (sec_channel_offset == 0)
break;
@@ -545,7 +557,7 @@ int hostapd_set_freq_params(struct hosta
break;
}
- if (data->he_enabled || data->vht_enabled) switch (oper_chwidth) {
+ if (data->eht_enabled || data->he_enabled || data->vht_enabled) switch (oper_chwidth) {
case CHANWIDTH_USE_HT:
if (center_segment1 ||
(center_segment0 != 0 &&
--- a/src/common/hw_features_common.h
+++ b/src/common/hw_features_common.h
@@ -40,10 +40,12 @@ int hostapd_set_freq_params(struct hosta
int freq, int channel, int edmg, u8 edmg_channel,
int ht_enabled,
int vht_enabled, int he_enabled,
- int sec_channel_offset,
+ int eht_enabled, int sec_channel_offset,
int oper_chwidth, int center_segment0,
int center_segment1, u32 vht_caps,
- struct he_capabilities *he_caps, u8 reg_6g_pwr_mode);
+ struct he_capabilities *he_caps,
+ struct eht_capabilities *eht_cap,
+ u8 reg_6g_pwr_mode);
void set_disable_ht40(struct ieee80211_ht_capabilities *htcaps,
int disabled);
int ieee80211ac_cap_check(u32 hw, u32 conf);
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -814,6 +814,11 @@ struct hostapd_freq_params {
* 2 - VLP_AP
*/
u8 he_6ghz_reg_pwr_type;
+
+ /**
+ * eht_enabled - Whether EHT is enabled
+ */
+ int eht_enabled;
};
/**
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -227,12 +227,13 @@ static int wpas_mesh_update_freq_params(
ifmsh->conf->ieee80211n,
ifmsh->conf->ieee80211ac,
ifmsh->conf->ieee80211ax,
+ 0,
ifmsh->conf->secondary_channel,
hostapd_get_oper_chwidth(ifmsh->conf),
hostapd_get_oper_centr_freq_seg0_idx(ifmsh->conf),
hostapd_get_oper_centr_freq_seg1_idx(ifmsh->conf),
ifmsh->conf->vht_capab,
- he_capab, ifmsh->conf->he_6ghz_reg_pwr_type)) {
+ he_capab, NULL, ifmsh->conf->he_6ghz_reg_pwr_type)) {
wpa_printf(MSG_ERROR, "Error updating mesh frequency params");
wpa_supplicant_mesh_deinit(wpa_s, true);
return -1;
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2849,9 +2849,10 @@ skip_to_6ghz:
freq->channel, ssid->enable_edmg,
ssid->edmg_channel, freq->ht_enabled,
vht_freq.vht_enabled, vht_freq.he_enabled,
- freq->sec_channel_offset,
+ 0, freq->sec_channel_offset,
chwidth, seg0, seg1, vht_caps,
- &mode->he_capab[ieee80211_mode], 0) != 0)
+ &mode->he_capab[ieee80211_mode], NULL,
+ 0) != 0)
return;
*freq = vht_freq;