wlan-ap-Telecominfraproject/feeds/ipq95xx/hostapd/patches/q02-048-mesh-Enable-80-160MHz-Mesh-DFS-channels.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

77 lines
2.8 KiB
Diff

From 6a7437a8bf48538e26924ca0cb3646fdff698883 Mon Sep 17 00:00:00 2001
From: Hari Chandrakanthan <quic_haric@quicinc.com>
Date: Sun, 17 Jul 2022 12:26:36 +0530
Subject: [PATCH] mesh: Enable 80-160MHz Mesh DFS channels
There are two 80MHz and 160MHz 5G channels are present
in DFS occupied channel list. CAC needs to be performed
before the start of transmission for the DFS channels.
Hostapd CAC check is based on hapd->conf structures.
Hence the center frequency segment index and bandwidth
are added to perform CAC.
Current implementation of DFS channel validatation for
mesh performs DFS check for only primary 80MHz of 160MHz
has DFS channels present or not. But this approach will
fail for channels having Non DFS channel as primary and
DFS channel for secondary 80MHz of 160MHz Eg: channel 36.
To avoid this issue, added DFS check for both primary 80MHz
and secondary 80MHz channels of 160MHz.
Signed-off-by: Hari Chandrakanthan <quic_haric@quicinc.com>
Signed-off-by: P Praneesh <quic_ppranees@quicinc.com>
---
wpa_supplicant/mesh.c | 29 +++++++++++++++++++++++++++--
1 file changed, 27 insertions(+), 2 deletions(-)
diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index bb356a4..951a26c 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -393,6 +393,7 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
int basic_rates_erp[] = { 10, 20, 55, 60, 110, 120, 240, -1 };
int rate_len;
int frequency;
+ bool is_dfs;
if (!wpa_s->conf->user_mpm) {
/* not much for us to do here */
@@ -484,8 +485,32 @@ static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
bss->conf->ap_max_inactivity = wpa_s->conf->mesh_max_inactivity;
bss->conf->mesh_fwding = wpa_s->conf->mesh_fwding;
- if (ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes,
- wpa_s->hw.num_modes) && wpa_s->conf->country[0]) {
+#define WPAS_GET_SEG_IDX(freq) ((freq - 5000)/5)
+ if (wpa_s->mesh_vht_enabled) {
+ if (freq->bandwidth == 80)
+ conf->vht_oper_chwidth = CHANWIDTH_80MHZ;
+ else if (freq->bandwidth == 160)
+ conf->vht_oper_chwidth = CHANWIDTH_160MHZ;
+ conf->vht_oper_centr_freq_seg0_idx = WPAS_GET_SEG_IDX(freq->center_freq1);
+ }
+
+ if (wpa_s->mesh_he_enabled) {
+ if (freq->bandwidth == 80)
+ conf->he_oper_chwidth = CHANWIDTH_80MHZ;
+ else if (freq->bandwidth == 160)
+ conf->he_oper_chwidth = CHANWIDTH_160MHZ;
+ conf->he_oper_centr_freq_seg0_idx = WPAS_GET_SEG_IDX(freq->center_freq1);
+ }
+
+ is_dfs = ieee80211_is_dfs(ssid->frequency, wpa_s->hw.modes,
+ wpa_s->hw.num_modes);
+
+ /* Check secondary 80MHz of 160Mhz has DFS channels */
+ if (!is_dfs && freq->bandwidth == 160)
+ is_dfs = ieee80211_is_dfs((ssid->frequency+80), wpa_s->hw.modes,
+ wpa_s->hw.num_modes);
+
+ if (is_dfs && wpa_s->conf->country[0]) {
conf->ieee80211h = 1;
conf->ieee80211d = 1;
conf->country[0] = wpa_s->conf->country[0];
--
2.7.4