wlan-ap-Telecominfraproject/feeds/qca/hostapd/patches/m00-001-hostap-Avoid-adjacent-channel-selection-in-DFS-for-q.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

144 lines
4.7 KiB
Diff

From 420852ff044c804a6487ccc060f85c12bbdaac31 Mon Sep 17 00:00:00 2001
From: Seevalamuthu Mariappan <seevalam@codeaurora.org>
Date: Thu, 1 Jul 2021 10:15:29 +0530
Subject: [PATCH] hostap: Avoid selecting UNII-1 channel after DFS switch
Avoid UNII-1 band channel from getting selected after DFS when primary
channel is UNII-2 band with 80Mhz configuration.
To enable this, 'skip_unii1_dfs_switch' config should be enabled
in hostapd config.
Signed-off-by: Seevalamuthu Mariappan <seevalam@codeaurora.org>
---
hostapd/config_file.c | 2 ++
src/ap/ap_config.h | 1 +
src/ap/dfs.c | 25 +++++++++++++++++++++++++
3 files changed, 28 insertions(+)
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 59b9482..19d81a8 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3415,6 +3415,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
conf->require_ht = atoi(pos);
} else if (os_strcmp(buf, "obss_interval") == 0) {
conf->obss_interval = atoi(pos);
+ } else if (os_strcmp(buf, "skip_unii1_dfs_switch") == 0) {
+ conf->skip_unii1_dfs_switch = atoi(pos);
#ifdef CONFIG_IEEE80211AC
} else if (os_strcmp(buf, "ieee80211ac") == 0) {
conf->ieee80211ac = atoi(pos);
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index edf1b31..b4a932f 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -1103,6 +1103,7 @@ struct hostapd_config {
/* Use driver-generated interface addresses when adding multiple BSSs */
u8 use_driver_iface_addr;
+ u8 skip_unii1_dfs_switch;
#ifdef CONFIG_FST
struct fst_iface_cfg fst_cfg;
diff --git a/src/ap/dfs.c b/src/ap/dfs.c
index 1cbca53..08d6fcc 100644
--- a/src/ap/dfs.c
+++ b/src/ap/dfs.c
@@ -231,6 +231,64 @@ static int is_in_chanlist(struct hostapd_iface *iface,
return freq_range_list_includes(&iface->conf->acs_ch_list, chan->chan);
}
+#define HOSTAPD_DFS_UNII2_CHANNELS(chan) (chan >= 52 && chan <= 64)
+
+static bool is_skip_unii1_dfs_switch_applicable(struct hostapd_iface *iface,
+ struct hostapd_channel_data *chan)
+{
+ if (!iface->conf->skip_unii1_dfs_switch)
+ return false;
+
+ /* skip if the selected channel is 52/56/60/64 */
+ if (HOSTAPD_DFS_UNII2_CHANNELS(iface->conf->channel) &&
+ HOSTAPD_DFS_UNII2_CHANNELS(chan->chan))
+ return true;
+
+ /* Skip below mentioned adjacent channels if one of the following
+ * conditions is true
+ * i) The primary channel of the AP is 52/56/60/64 in 80MHz mode and
+ * moves to adjacent channel 36/44/48 in 80MHz
+ * ii) The primary channel of the AP is 36/44/48/52/56/60/64 in 160MHz
+ * and moves to 36/44/48 in 80MHz mode
+ * iii) The primary channel of the AP is 52/56/60/64 in 20MHz or 40MHz mode
+ * and moves to the adjacent channels 40/44/48 in 20MHz mode or 36/40/44/48
+ * in 40MHz mode
+ */
+ switch(hostapd_get_oper_chwidth(iface->conf))
+ {
+ case CONF_OPER_CHWIDTH_160MHZ:
+ if ((iface->conf->channel >= 36) &&
+ (iface->conf->channel <= 64) &&
+ (iface->conf->channel != 40) &&
+ (chan->chan >= 36) && (chan->chan <= 48) &&
+ (chan->chan != 40))
+ return true;
+ break;
+ case CONF_OPER_CHWIDTH_80MHZ:
+ if ((iface->conf->channel >= 52) &&
+ (iface->conf->channel <= 64) &&
+ (chan->chan >= 36) && (chan->chan <= 48) &&
+ (chan->chan != 40))
+ return true;
+ break;
+ case CHANWIDTH_USE_HT:
+ if ((iface->conf->channel >= 52) &&
+ (iface->conf->channel <= 64)) {
+ if (iface->conf->secondary_channel) {
+ if ((chan->chan >= 36) && (chan->chan <= 48))
+ return true;
+ } else {
+ if ((chan->chan >= 40) && (chan->chan <= 48))
+ return true;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ return false;
+}
/*
* The function assumes HT40+ operation.
@@ -280,6 +338,13 @@ static int dfs_find_channel(struct hostapd_iface *iface,
continue;
}
+ if (is_skip_unii1_dfs_switch_applicable(iface, chan)) {
+ wpa_printf(MSG_DEBUG,
+ "DFS: skip_unii1_dfs_switch enabled, skip adjacent channel: %d (%d)",
+ chan->freq, chan->chan);
+ continue;
+ }
+
if (chan->max_tx_power < iface->conf->min_tx_power)
continue;
@@ -1322,8 +1387,14 @@ dfs_downgrade_bandwidth(struct hostapd_iface *iface, int *secondary_channel,
int oper_chwidth;
oper_chwidth = hostapd_get_oper_chwidth(iface->conf);
- if (oper_chwidth == CONF_OPER_CHWIDTH_USE_HT)
- break;
+ if (oper_chwidth == CONF_OPER_CHWIDTH_USE_HT) {
+ /* try finding 20MHz channels if skip_unii1_dfs_switch is enabled */
+ if (!iface->conf->skip_unii1_dfs_switch ||
+ !iface->conf->secondary_channel)
+ break;
+ iface->conf->secondary_channel = 0;
+ continue;
+ }
*channel_type = DFS_AVAILABLE;
hostapd_set_oper_chwidth(iface->conf, oper_chwidth - 1);
}