mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-30 10:02:53 +00:00
345 lines
13 KiB
Diff
345 lines
13 KiB
Diff
From 843ca079462dd394c10d3fced5df85f20cfd5dab Mon Sep 17 00:00:00 2001
|
|
From: Shivani Tambatkar <quic_stambatk@quicinc.com>
|
|
Date: Mon, 4 Dec 2023 12:13:40 -0800
|
|
Subject: [PATCH 1/7] hostapd: add support for device bandwidth parameters
|
|
|
|
Add new parameters to structures hostapd_config and hostapd_freq_params
|
|
to store device bandwidth. Also modify hostapd_set_freq_params() to
|
|
include these parameters.
|
|
|
|
Signed-off-by: Shivani Tambatkar <quic_stambatk@quicinc.com>
|
|
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
|
|
---
|
|
src/ap/ap_config.h | 2 ++
|
|
src/ap/ap_drv_ops.c | 12 ++++++++----
|
|
src/ap/ap_drv_ops.h | 6 ++++--
|
|
src/ap/beacon.c | 4 +++-
|
|
src/ap/dfs.c | 17 ++++++++++++-----
|
|
src/ap/hostapd.c | 12 ++++++++++--
|
|
src/common/hw_features_common.c | 5 ++++-
|
|
src/common/hw_features_common.h | 3 ++-
|
|
src/drivers/driver.h | 12 ++++++++++++
|
|
wpa_supplicant/mesh.c | 12 ++++++++----
|
|
wpa_supplicant/wpa_supplicant.c | 2 +-
|
|
11 files changed, 66 insertions(+), 21 deletions(-)
|
|
|
|
--- a/src/ap/ap_config.h
|
|
+++ b/src/ap/ap_config.h
|
|
@@ -1226,6 +1226,8 @@ struct hostapd_config {
|
|
} mbssid;
|
|
int use_ru_puncture_dfs;
|
|
int ccfs;
|
|
+ int bandwidth_device;
|
|
+ int center_freq_device;
|
|
};
|
|
|
|
|
|
--- a/src/ap/ap_drv_ops.c
|
|
+++ b/src/ap/ap_drv_ops.c
|
|
@@ -658,7 +658,8 @@ int hostapd_set_freq(struct hostapd_data
|
|
int he_enabled, bool eht_enabled,
|
|
int sec_channel_offset, int oper_chwidth,
|
|
int center_segment0, int center_segment1,
|
|
- u16 ru_punct_bitmap, u8 ru_punct_ofdma)
|
|
+ u16 ru_punct_bitmap, u8 ru_punct_ofdma,
|
|
+ int bandwidth_device, int center_freq_device)
|
|
{
|
|
struct hostapd_freq_params data;
|
|
struct hostapd_hw_modes *cmode = hapd->iface->current_mode;
|
|
@@ -675,7 +676,8 @@ int hostapd_set_freq(struct hostapd_data
|
|
&cmode->eht_capab[IEEE80211_MODE_AP] :
|
|
NULL,
|
|
hapd->iconf->he_6ghz_reg_pwr_type,
|
|
- ru_punct_bitmap, ru_punct_ofdma))
|
|
+ ru_punct_bitmap, ru_punct_ofdma,
|
|
+ bandwidth_device, center_freq_device))
|
|
return -1;
|
|
|
|
if (hapd->driver == NULL)
|
|
@@ -991,7 +993,8 @@ int hostapd_start_dfs_cac(struct hostapd
|
|
int sec_channel_offset, int oper_chwidth,
|
|
int center_segment0, int center_segment1,
|
|
bool radar_background,
|
|
- u16 ru_punct_bitmap, u8 ru_punct_ofdma)
|
|
+ u16 ru_punct_bitmap, u8 ru_punct_ofdma,
|
|
+ int bandwidth_device, int center_freq_device)
|
|
{
|
|
struct hostapd_data *hapd = iface->bss[0];
|
|
struct hostapd_freq_params data;
|
|
@@ -1017,7 +1020,8 @@ int hostapd_start_dfs_cac(struct hostapd
|
|
&cmode->he_capab[IEEE80211_MODE_AP],
|
|
&cmode->eht_capab[IEEE80211_MODE_AP],
|
|
hapd->iconf->he_6ghz_reg_pwr_type,
|
|
- ru_punct_bitmap, ru_punct_ofdma)) {
|
|
+ ru_punct_bitmap, ru_punct_ofdma,
|
|
+ bandwidth_device, center_freq_device)) {
|
|
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
|
|
@@ -73,7 +73,8 @@ int hostapd_set_freq(struct hostapd_data
|
|
int ht_enabled, int vht_enabled, int he_enabled,
|
|
bool eht_enabled, int sec_channel_offset, int oper_chwidth,
|
|
int center_segment0, int center_segment1,
|
|
- u16 ru_punct_bitmap, u8 ru_punct_ofdma);
|
|
+ u16 ru_punct_bitmap, u8 ru_punct_ofdma,
|
|
+ int bandwidth_device, int center_freq_device);
|
|
int hostapd_set_rts(struct hostapd_data *hapd, int rts);
|
|
int hostapd_set_frag(struct hostapd_data *hapd, int frag);
|
|
int hostapd_sta_set_flags(struct hostapd_data *hapd, u8 *addr,
|
|
@@ -139,7 +140,8 @@ int hostapd_start_dfs_cac(struct hostapd
|
|
int sec_channel_offset, int oper_chwidth,
|
|
int center_segment0, int center_segment1,
|
|
bool radar_background,
|
|
- u16 ru_punct_bitmap, u8 ru_punct_ofdma);
|
|
+ u16 ru_punct_bitmap, u8 ru_punct_ofdma,
|
|
+ int bandwidth_device, int center_freq_device);
|
|
int hostapd_drv_do_acs(struct hostapd_data *hapd);
|
|
int hostapd_drv_update_dh_ie(struct hostapd_data *hapd, const u8 *peer,
|
|
u16 reason_code, const u8 *ie, size_t ielen);
|
|
--- a/src/ap/beacon.c
|
|
+++ b/src/ap/beacon.c
|
|
@@ -2656,7 +2656,9 @@ static int __ieee802_11_set_beacon(struc
|
|
&cmode->eht_capab[IEEE80211_MODE_AP],
|
|
iconf->he_6ghz_reg_pwr_type,
|
|
iconf->ru_punct_bitmap,
|
|
- iconf->ru_punct_ofdma) == 0)
|
|
+ iconf->ru_punct_ofdma,
|
|
+ iconf->bandwidth_device,
|
|
+ iconf->center_freq_device) == 0)
|
|
params.freq = &freq;
|
|
|
|
for (i = 0; i < hapd->iface->num_hw_features; i++) {
|
|
--- a/src/ap/dfs.c
|
|
+++ b/src/ap/dfs.c
|
|
@@ -1046,7 +1046,8 @@ int hostapd_handle_dfs(struct hostapd_if
|
|
hostapd_get_oper_centr_freq_seg0_idx(iface->conf),
|
|
hostapd_get_oper_centr_freq_seg1_idx(iface->conf),
|
|
dfs_use_radar_background(iface),
|
|
- iface->conf->ru_punct_bitmap, iface->conf->ru_punct_ofdma);
|
|
+ iface->conf->ru_punct_bitmap, iface->conf->ru_punct_ofdma,
|
|
+ iface->conf->bandwidth_device, iface->conf->center_freq_device);
|
|
|
|
if (res) {
|
|
wpa_printf(MSG_ERROR, "DFS start_dfs_cac() failed, %d", res);
|
|
@@ -1148,7 +1149,9 @@ static int hostapd_dfs_request_channel_s
|
|
iface->conf->he_6ghz_reg_pwr_type,
|
|
iface->conf->ru_punct_bitmap |
|
|
iface->radar_bit_pattern,
|
|
- iface->conf->ru_punct_ofdma);
|
|
+ iface->conf->ru_punct_ofdma,
|
|
+ iface->conf->bandwidth_device,
|
|
+ iface->conf->center_freq_device);
|
|
|
|
if (err) {
|
|
wpa_printf(MSG_ERROR,
|
|
@@ -1226,7 +1229,7 @@ static void hostpad_dfs_update_backgroun
|
|
oper_centr_freq_seg0_idx,
|
|
oper_centr_freq_seg1_idx, true,
|
|
iface->conf->ru_punct_bitmap,
|
|
- iface->conf->ru_punct_ofdma)) {
|
|
+ iface->conf->ru_punct_ofdma, 0, 0)) {
|
|
wpa_printf(MSG_ERROR, "DFS failed to start CAC offchannel");
|
|
iface->radar_background.channel = -1;
|
|
return;
|
|
@@ -1309,7 +1312,9 @@ static int hostapd_dfs_testmode_set_beac
|
|
&iface->current_mode->eht_capab[IEEE80211_MODE_AP],
|
|
iface->conf->he_6ghz_reg_pwr_type,
|
|
iface->conf->ru_punct_bitmap,
|
|
- iface->conf->ru_punct_ofdma);
|
|
+ iface->conf->ru_punct_ofdma,
|
|
+ iface->conf->bandwidth_device,
|
|
+ iface->conf->center_freq_device);
|
|
|
|
if (err) {
|
|
wpa_printf(MSG_ERROR, "DFS failed to calculate CSA freq params");
|
|
@@ -1786,7 +1791,9 @@ int hostapd_dfs_radar_detected(struct ho
|
|
dfs_use_radar_background(iface),
|
|
iface->conf->ru_punct_bitmap |
|
|
iface->radar_bit_pattern,
|
|
- iface->conf->ru_punct_ofdma);
|
|
+ iface->conf->ru_punct_ofdma,
|
|
+ iface->conf->bandwidth_device,
|
|
+ iface->conf->center_freq_device);
|
|
}
|
|
|
|
return hostapd_dfs_request_channel_switch(
|
|
--- a/src/ap/hostapd.c
|
|
+++ b/src/ap/hostapd.c
|
|
@@ -159,7 +159,9 @@ static void hostapd_reload_bss(struct ho
|
|
hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf),
|
|
hostapd_get_oper_centr_freq_seg1_idx(hapd->iconf),
|
|
hapd->iconf->ru_punct_bitmap,
|
|
- hapd->iconf->ru_punct_ofdma);
|
|
+ hapd->iconf->ru_punct_ofdma,
|
|
+ hapd->iconf->bandwidth_device,
|
|
+ hapd->iconf->center_freq_device);
|
|
|
|
|
|
if (hapd->iface->current_mode) {
|
|
@@ -2568,7 +2570,9 @@ static int hostapd_setup_interface_compl
|
|
hostapd_get_oper_centr_freq_seg1_idx(
|
|
hapd->iconf),
|
|
hapd->iconf->ru_punct_bitmap,
|
|
- hapd->iconf->ru_punct_ofdma)) {
|
|
+ hapd->iconf->ru_punct_ofdma,
|
|
+ hapd->iconf->bandwidth_device,
|
|
+ hapd->iconf->center_freq_device)) {
|
|
wpa_printf(MSG_ERROR, "Could not set channel for "
|
|
"kernel driver");
|
|
goto fail;
|
|
@@ -4212,7 +4216,9 @@ static int hostapd_change_config_freq(st
|
|
NULL,
|
|
hapd->iconf->he_6ghz_reg_pwr_type,
|
|
conf->ru_punct_bitmap,
|
|
- conf->ru_punct_ofdma))
|
|
+ conf->ru_punct_ofdma,
|
|
+ conf->bandwidth_device,
|
|
+ conf->center_freq_device))
|
|
return -1;
|
|
|
|
switch (params->bandwidth) {
|
|
@@ -4260,6 +4266,8 @@ static int hostapd_change_config_freq(st
|
|
conf->secondary_channel = params->sec_channel_offset;
|
|
conf->ru_punct_bitmap = params->ru_punct_bitmap;
|
|
conf->ru_punct_ofdma= params->ru_punct_ofdma;
|
|
+ conf->bandwidth_device = params->bandwidth_device;
|
|
+ conf->center_freq_device = params->center_freq_device;
|
|
ieee80211_freq_to_chan(params->center_freq1,
|
|
&seg0);
|
|
ieee80211_freq_to_chan(params->center_freq2,
|
|
@@ -4576,6 +4584,8 @@ hostapd_switch_channel_fallback(struct h
|
|
hostapd_set_oper_chwidth(iface->conf, bw);
|
|
iface->conf->ru_punct_bitmap = freq_params->ru_punct_bitmap;
|
|
iface->conf->ru_punct_ofdma = freq_params->ru_punct_ofdma;
|
|
+ iface->conf->center_freq_device = freq_params->center_freq_device;
|
|
+ iface->conf->bandwidth_device = freq_params->bandwidth_device;
|
|
|
|
/*
|
|
* Resetting operating class to avoid referring previous values
|
|
--- a/src/common/hw_features_common.c
|
|
+++ b/src/common/hw_features_common.c
|
|
@@ -390,7 +390,8 @@ int hostapd_set_freq_params(struct hosta
|
|
struct he_capabilities *he_cap,
|
|
struct eht_capabilities *eht_cap,
|
|
u8 reg_6g_pwr_mode, u16 ru_punct_bitmap,
|
|
- u8 ru_punct_ofdma)
|
|
+ u8 ru_punct_ofdma, int bandwidth_device,
|
|
+ int center_freq_device)
|
|
{
|
|
if (!he_cap || !he_cap->he_supported)
|
|
he_enabled = 0;
|
|
@@ -409,6 +410,8 @@ int hostapd_set_freq_params(struct hosta
|
|
data->center_freq2 = 0;
|
|
data->ru_punct_bitmap = ru_punct_bitmap;
|
|
data->ru_punct_ofdma = ru_punct_ofdma;
|
|
+ data->bandwidth_device = bandwidth_device;
|
|
+ data->center_freq_device = center_freq_device;
|
|
if (oper_chwidth == CONF_OPER_CHWIDTH_80MHZ)
|
|
data->bandwidth = 80;
|
|
else if (oper_chwidth == CONF_OPER_CHWIDTH_160MHZ ||
|
|
--- a/src/common/hw_features_common.h
|
|
+++ b/src/common/hw_features_common.h
|
|
@@ -47,7 +47,8 @@ int hostapd_set_freq_params(struct hosta
|
|
struct he_capabilities *he_caps,
|
|
struct eht_capabilities *eht_cap,
|
|
u8 reg_6g_pwr_mode, u16 ru_punct_bitmap,
|
|
- u8 ru_punct_ofdma);
|
|
+ u8 ru_punct_ofdma, int bandwidth_device,
|
|
+ int center_freq_device);
|
|
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
|
|
@@ -920,6 +920,18 @@ struct hostapd_freq_params {
|
|
* link_id: If >=0 indicates the link of the AP MLD to configure
|
|
*/
|
|
int link_id;
|
|
+
|
|
+ /**
|
|
+ * bandwidth_device - Device bandwidth in MHz, minimum 40 MHz.
|
|
+ * The member 'bandwidth' corresponds to the operating bandwidth.
|
|
+ */
|
|
+ int bandwidth_device;
|
|
+
|
|
+ /**
|
|
+ * freq_device - Device center frequency in MHz, must coincide with
|
|
+ * one edge of the operating bandwidth.
|
|
+ */
|
|
+ int center_freq_device;
|
|
};
|
|
|
|
/**
|
|
@@ -6689,6 +6701,8 @@ union wpa_event_data {
|
|
u16 punct_bitmap;
|
|
u16 ru_punct_bitmap;
|
|
u8 ru_punct_ofdma;
|
|
+ u32 ch_width_device;
|
|
+ u32 cf_device;
|
|
} ch_switch;
|
|
|
|
/**
|
|
--- a/wpa_supplicant/mesh.c
|
|
+++ b/wpa_supplicant/mesh.c
|
|
@@ -235,7 +235,9 @@ static int wpas_mesh_update_freq_params(
|
|
he_capab, NULL,
|
|
ifmsh->conf->he_6ghz_reg_pwr_type,
|
|
ifmsh->conf->ru_punct_bitmap,
|
|
- ifmsh->conf->ru_punct_ofdma)) {
|
|
+ ifmsh->conf->ru_punct_ofdma,
|
|
+ ifmsh->conf->bandwidth_device,
|
|
+ ifmsh->conf->center_freq_device)) {
|
|
wpa_printf(MSG_ERROR, "Error updating mesh frequency params");
|
|
wpa_supplicant_mesh_deinit(wpa_s, true);
|
|
return -1;
|
|
@@ -519,9 +521,11 @@ static int wpa_supplicant_mesh_init(stru
|
|
wpa_s->mesh_params->handle_dfs = true;
|
|
}
|
|
|
|
- if (ssid->eht)
|
|
- conf->ru_punct_bitmap = freq->ru_punct_bitmap;
|
|
-
|
|
+ if (ssid->eht) {
|
|
+ conf->ru_punct_bitmap = freq->ru_punct_bitmap;
|
|
+ conf->bandwidth_device = freq->bandwidth_device;
|
|
+ conf->center_freq_device = freq->center_freq_device;
|
|
+ }
|
|
bss->iconf = conf;
|
|
ifmsh->conf = conf;
|
|
|
|
--- a/wpa_supplicant/wpa_supplicant.c
|
|
+++ b/wpa_supplicant/wpa_supplicant.c
|
|
@@ -3206,6 +3206,8 @@ skip_to_6ghz:
|
|
#endif /* CONFIG_EHT_OVERRIDES */
|
|
freq->ru_punct_bitmap = ssid->ru_punct_bitmap;
|
|
freq->ru_punct_ofdma = 0; /* Default to disabled for mesh. */
|
|
+ freq->bandwidth_device = 0;
|
|
+ freq->center_freq_device = 0;
|
|
|
|
if (ssid->ru_punct_bitmap && wpa_s->drv_capa_known) {
|
|
switch (chwidth) {
|
|
@@ -3235,7 +3237,9 @@ skip_to_6ghz:
|
|
&mode->he_capab[ieee80211_mode],
|
|
&mode->eht_capab[ieee80211_mode], 0,
|
|
freq->ru_punct_bitmap,
|
|
- freq->ru_punct_ofdma) != 0)
|
|
+ freq->ru_punct_ofdma,
|
|
+ freq->bandwidth_device,
|
|
+ freq->center_freq_device) != 0)
|
|
return;
|
|
|
|
*freq = vht_freq;
|
|
--- a/src/ap/ubus.c
|
|
+++ b/src/ap/ubus.c
|
|
@@ -876,7 +876,7 @@ hostapd_switch_chan(struct ubus_context
|
|
NULL,
|
|
hapd->iconf->he_6ghz_reg_pwr_type,
|
|
iconf->ru_punct_bitmap,
|
|
- iconf->ru_punct_ofdma);
|
|
+ iconf->ru_punct_ofdma, 0, 0);
|
|
|
|
for (i = 0; i < hapd->iface->num_bss; i++) {
|
|
struct hostapd_data *bss = hapd->iface->bss[i];
|