wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/r08-02-hostapd-add-device-bandwidth-to-chan_switch-command.patch
John Crispin 008ca9618d
Some checks failed
Build OpenWrt/uCentral images / build (cig_wf186h) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf186w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf188n) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf189) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf196) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-a1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-b1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap102) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap104) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap105) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap111) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap112) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_3) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xe) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (indio_um-305ax) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sercomm_ap72tip) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630c-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-211g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-id2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-od2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr5018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018-v4) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax820) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax840) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap640) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap650) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap655) (push) Has been cancelled
Build OpenWrt/uCentral images / trigger-testing (push) Has been cancelled
Build OpenWrt/uCentral images / create-x64_vm-ami (push) Has been cancelled
ipq95xx: import ath12.4-cs kernel and drivers
Signed-off-by: John Crispin <john@phrozen.org>
2024-10-20 09:25:13 +02:00

146 lines
4.7 KiB
Diff

From ac54a8d0a5a7c074e32278b90abfd9d533ad57dc Mon Sep 17 00:00:00 2001
From: Shivani Tambatkar <quic_stambatk@quicinc.com>
Date: Fri, 1 Dec 2023 15:19:46 -0800
Subject: [PATCH 2/7] hostapd: add device bandwidth to chan_switch command
Add new parameters bandwidth_device and center_freq_device to the
channel switch cli command. Parse, validate and configure the parameters
during channel switch.
Signed-off-by: Shivani Tambatkar <quic_stambatk@quicinc.com>
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
hostapd/ctrl_iface.c | 72 ++++++++++++++++++++++++++++++++++++++++++
hostapd/hostapd_cli.c | 6 ++--
src/ap/beacon.c | 1 -
src/ap/ctrl_iface_ap.c | 2 ++
src/ap/hostapd.c | 1 -
5 files changed, 77 insertions(+), 5 deletions(-)
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -2529,6 +2529,77 @@ static bool hostapd_ctrl_is_freq_in_cmod
return false;
}
+
+static int hostapd_check_validity_device_params(struct hostapd_freq_params *params)
+{
+ int freq_section = 0;
+
+ if (params->bandwidth_device == 0 && params->center_freq_device == 0)
+ return 0;
+ else if (params->bandwidth_device == 0 || params->center_freq_device == 0)
+ return -EINVAL;
+
+ if ((params->center_freq1 == params->center_freq_device) &&
+ (params->bandwidth == params->bandwidth_device)) {
+ params->bandwidth_device = 0;
+ params->center_freq_device = 0;
+ return 0;
+ }
+
+ if (params->bandwidth_device != 2*params->bandwidth) {
+ wpa_printf(MSG_ERROR,
+ "Device bandwidth is not set to twice the operating bandwidth\n");
+ return -EINVAL;
+ }
+
+ if (params->center_freq1 > params->center_freq_device)
+ freq_section = 1;
+
+ switch (params->bandwidth_device) {
+ case 320:
+ if (freq_section) {
+ if (params->center_freq_device != params->center_freq1 - 80)
+ return -EINVAL;
+ } else {
+ if (params->center_freq_device != params->center_freq1 + 80)
+ return -EINVAL;
+ }
+ break;
+ case 160:
+ if (freq_section) {
+ if (params->center_freq_device != params->center_freq1 - 40)
+ return -EINVAL;
+ } else {
+ if (params->center_freq_device != params->center_freq1 + 40)
+ return -EINVAL;
+ }
+ break;
+ case 80:
+ if (freq_section) {
+ if (params->center_freq_device != params->center_freq1 - 20)
+ return -EINVAL;
+ } else {
+ if (params->center_freq_device != params->center_freq1 + 20)
+ return -EINVAL;
+ }
+ break;
+ case 40:
+ if (freq_section) {
+ if (params->center_freq_device != params->center_freq1 - 10)
+ return -EINVAL;
+ } else {
+ if (params->center_freq_device != params->center_freq1 + 10)
+ return -EINVAL;
+ }
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+
static int hostapd_ctrl_check_freq_params(struct hostapd_freq_params *params,
u16 punct_bitmap)
{
@@ -2861,6 +2932,14 @@ static int hostapd_ctrl_iface_chan_switc
return ret;
}
+ ret = hostapd_check_validity_device_params(&settings.freq_params);
+ if (ret) {
+ wpa_printf(MSG_ERROR, "chanswitch: invalid device parameters provided %d %d",
+ settings.freq_params.bandwidth_device,
+ settings.freq_params.center_freq_device);
+ return ret;
+ }
+
switch (settings.freq_params.bandwidth) {
case 40:
bandwidth = CHAN_WIDTH_40;
--- a/hostapd/hostapd_cli.c
+++ b/hostapd/hostapd_cli.c
@@ -1209,6 +1209,7 @@ static int hostapd_cli_cmd_chan_switch(s
"arguments (count and freq)\n"
"usage: <cs_count> <freq> [sec_channel_offset=] "
"[center_freq1=] [center_freq2=] [bandwidth=] "
+ "[bandwidth_device =] [center_freq_device=] "
"[blocktx] [ht|vht|he|eht]\n");
return -1;
}
@@ -1731,7 +1732,8 @@ static const struct hostapd_cli_cmd host
"<channel_width> = 0 - 20 MHz, 1 - 40 MHz, 2 - 80 MHz, 3 - 160 MHz" },
{ "chan_switch", hostapd_cli_cmd_chan_switch, NULL,
"<cs_count> <freq> [sec_channel_offset=] [center_freq1=]\n"
- " [center_freq2=] [bandwidth=] [blocktx] [ht|vht]\n"
+ " [center_freq2=] [bandwidth=] [bandwidth_device=] \n"
+ " [center_freq_device=] [blocktx] [ht|vht|he|eht] \n"
" = initiate channel switch announcement" },
{ "color_change", hostapd_cli_cmd_color_change, NULL,
"<color> = initiate bss color change to set user color if value between 1-63\n"
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -1354,6 +1354,8 @@ int hostapd_parse_csa_settings(const cha
SET_CSA_SETTING(sec_channel_offset);
SET_CSA_SETTING(ru_punct_bitmap);
SET_CSA_SETTING_EXT(punct_bitmap);
+ SET_CSA_SETTING(bandwidth_device);
+ SET_CSA_SETTING(center_freq_device);
settings->freq_params.ht_enabled = !!os_strstr(pos, " ht");
settings->freq_params.vht_enabled = !!os_strstr(pos, " vht");
settings->freq_params.he_enabled = !!os_strstr(pos, " he");