mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-21 11:22:50 +00:00
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
Signed-off-by: John Crispin <john@phrozen.org>
268 lines
9.0 KiB
Diff
268 lines
9.0 KiB
Diff
From 51a582a35b5d2d8e624d81bb965729b385644f1d Mon Sep 17 00:00:00 2001
|
|
From: Manish Dharanenthiran <quic_mdharane@quicinc.com>
|
|
Date: Fri, 31 Mar 2023 11:51:38 +0530
|
|
Subject: [PATCH] hostapd: Remove hard-coded DFS CAC time in driver offloaded
|
|
cac
|
|
|
|
During driver offloaded CAC, CAC time is set to 60000
|
|
by default. Because of this, CAC time is wrongly depcited in
|
|
info debug, also getting saved in interface config which
|
|
may lead to wrong CAC time calculation.
|
|
|
|
Fix this by calculating CAC time based on the channel width
|
|
and channel number specified during CAC trigger.
|
|
|
|
Signed-off-by: Manish Dharanenthiran <quic_mdharane@quicinc.com>
|
|
---
|
|
src/ap/dfs.c | 107 ++++++++++++++++++++++++++++++++++++++++++---------
|
|
1 file changed, 88 insertions(+), 19 deletions(-)
|
|
|
|
--- a/src/ap/dfs.c
|
|
+++ b/src/ap/dfs.c
|
|
@@ -21,6 +21,8 @@
|
|
#include "eloop.h"
|
|
#include "ieee802_11.h"
|
|
|
|
+#define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
|
|
+
|
|
enum dfs_channel_type {
|
|
DFS_ANY_CHANNEL,
|
|
DFS_AVAILABLE, /* non-radar or radar-available */
|
|
@@ -40,7 +42,8 @@ static bool dfs_use_radar_background(str
|
|
iface->conf->enable_background_radar;
|
|
}
|
|
|
|
-static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1)
|
|
+static int dfs_get_used_n_chans(struct hostapd_iface *iface, int *seg1,
|
|
+ int chan_width)
|
|
{
|
|
int n_chans = 1;
|
|
|
|
@@ -51,7 +54,7 @@ static int dfs_get_used_n_chans(struct h
|
|
|
|
if (iface->conf->ieee80211ac || iface->conf->ieee80211ax ||
|
|
iface->conf->ieee80211be) {
|
|
- switch (hostapd_get_oper_chwidth(iface->conf)) {
|
|
+ switch (chan_width) {
|
|
case CONF_OPER_CHWIDTH_USE_HT:
|
|
break;
|
|
case CONF_OPER_CHWIDTH_80MHZ:
|
|
@@ -319,7 +322,8 @@ static int dfs_find_channel(struct hosta
|
|
int i, channel_idx = 0, n_chans, n_chans1;
|
|
|
|
mode = iface->current_mode;
|
|
- n_chans = dfs_get_used_n_chans(iface, &n_chans1);
|
|
+ n_chans = dfs_get_used_n_chans(iface, &n_chans1,
|
|
+ hostapd_get_oper_chwidth(iface->conf));
|
|
|
|
wpa_printf(MSG_DEBUG, "DFS new chan checking %d channels", n_chans);
|
|
for (i = 0; i < mode->num_channels; i++) {
|
|
@@ -432,11 +436,11 @@ static void dfs_adjust_center_freq(struc
|
|
|
|
|
|
/* Return start channel idx we will use for mode->channels[idx] */
|
|
-static int dfs_get_start_chan_idx(struct hostapd_iface *iface, int *seg1_start)
|
|
+static int dfs_get_start_chan_idx(struct hostapd_iface *iface, int *seg1_start,
|
|
+ int chan_width, int channel_no, bool is_offloaded_cac)
|
|
{
|
|
struct hostapd_hw_modes *mode;
|
|
struct hostapd_channel_data *chan;
|
|
- int channel_no = iface->conf->channel;
|
|
int res = -1, i;
|
|
int chan_seg1 = -1;
|
|
|
|
@@ -447,9 +451,9 @@ static int dfs_get_start_chan_idx(struct
|
|
channel_no -= 4;
|
|
|
|
/* VHT/HE */
|
|
- if (iface->conf->ieee80211ac || iface->conf->ieee80211ax ||
|
|
- iface->conf->ieee80211be) {
|
|
- switch (hostapd_get_oper_chwidth(iface->conf)) {
|
|
+ if ((iface->conf->ieee80211ac || iface->conf->ieee80211ax ||
|
|
+ iface->conf->ieee80211be) && !is_offloaded_cac) {
|
|
+ switch (chan_width) {
|
|
case CONF_OPER_CHWIDTH_USE_HT:
|
|
break;
|
|
case CONF_OPER_CHWIDTH_80MHZ:
|
|
@@ -836,11 +840,13 @@ static int dfs_are_channels_overlapped(s
|
|
int n_chans, n_chans1, i, j, frequency = freq, radar_n_chans = 1;
|
|
u8 radar_chan;
|
|
int res = 0;
|
|
+ int cur_chan_width = hostapd_get_oper_chwidth(iface->conf);
|
|
|
|
/* Our configuration */
|
|
mode = iface->current_mode;
|
|
- start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1);
|
|
- n_chans = dfs_get_used_n_chans(iface, &n_chans1);
|
|
+ start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1, cur_chan_width,
|
|
+ iface->conf->channel, false);
|
|
+ n_chans = dfs_get_used_n_chans(iface, &n_chans1, cur_chan_width);
|
|
|
|
/* Check we are on DFS channel(s) */
|
|
if (!dfs_check_chans_radar(iface, start_chan_idx, n_chans))
|
|
@@ -928,6 +934,7 @@ int hostapd_handle_dfs(struct hostapd_if
|
|
{
|
|
int res, n_chans, n_chans1, start_chan_idx, start_chan_idx1;
|
|
int skip_radar = 0;
|
|
+ int chan_width = hostapd_get_oper_chwidth(iface->conf);
|
|
|
|
if (is_6ghz_freq(iface->freq))
|
|
return 1;
|
|
@@ -947,12 +954,13 @@ int hostapd_handle_dfs(struct hostapd_if
|
|
do {
|
|
/* Get start (first) channel for current configuration */
|
|
start_chan_idx = dfs_get_start_chan_idx(iface,
|
|
- &start_chan_idx1);
|
|
+ &start_chan_idx1, chan_width,
|
|
+ iface->conf->channel, false);
|
|
if (start_chan_idx == -1)
|
|
return -1;
|
|
|
|
/* Get number of used channels, depend on width */
|
|
- n_chans = dfs_get_used_n_chans(iface, &n_chans1);
|
|
+ n_chans = dfs_get_used_n_chans(iface, &n_chans1, chan_width);
|
|
|
|
/* Setup CAC time */
|
|
iface->dfs_cac_ms = dfs_get_cac_time(iface, start_chan_idx,
|
|
@@ -1047,14 +1055,17 @@ int hostapd_handle_dfs(struct hostapd_if
|
|
int hostapd_is_dfs_chan_available(struct hostapd_iface *iface)
|
|
{
|
|
int n_chans, n_chans1, start_chan_idx, start_chan_idx1;
|
|
+ int chan_width = hostapd_get_oper_chwidth(iface->conf);
|
|
|
|
/* Get the start (first) channel for current configuration */
|
|
- start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1);
|
|
+ start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1,
|
|
+ chan_width,
|
|
+ iface->conf->channel, false);
|
|
if (start_chan_idx < 0)
|
|
return 0;
|
|
|
|
/* Get the number of used channels, depending on width */
|
|
- n_chans = dfs_get_used_n_chans(iface, &n_chans1);
|
|
+ n_chans = dfs_get_used_n_chans(iface, &n_chans1, chan_width);
|
|
|
|
/* Check if all channels are DFS available */
|
|
return dfs_check_chans_available(iface, start_chan_idx, n_chans);
|
|
@@ -1806,6 +1817,7 @@ int hostapd_dfs_nop_finished(struct host
|
|
int hostapd_is_dfs_required(struct hostapd_iface *iface)
|
|
{
|
|
int n_chans, n_chans1, start_chan_idx, start_chan_idx1, res;
|
|
+ int chan_width = hostapd_get_oper_chwidth(iface->conf);
|
|
|
|
if ((!(iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD) &&
|
|
!iface->conf->ieee80211h) ||
|
|
@@ -1814,12 +1826,14 @@ int hostapd_is_dfs_required(struct hosta
|
|
return 0;
|
|
|
|
/* Get start (first) channel for current configuration */
|
|
- start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1);
|
|
+ start_chan_idx = dfs_get_start_chan_idx(iface, &start_chan_idx1,
|
|
+ chan_width,
|
|
+ iface->conf->channel, false);
|
|
if (start_chan_idx == -1)
|
|
return -1;
|
|
|
|
/* Get number of used channels, depend on width */
|
|
- n_chans = dfs_get_used_n_chans(iface, &n_chans1);
|
|
+ n_chans = dfs_get_used_n_chans(iface, &n_chans1, chan_width);
|
|
|
|
/* Check if any of configured channels require DFS */
|
|
res = dfs_check_chans_radar(iface, start_chan_idx, n_chans);
|
|
@@ -1830,12 +1844,16 @@ int hostapd_is_dfs_required(struct hosta
|
|
return res;
|
|
}
|
|
|
|
-
|
|
int hostapd_dfs_start_cac(struct hostapd_iface *iface, int freq,
|
|
int ht_enabled, int chan_offset, int chan_width,
|
|
int cf1, int cf2, bool is_background)
|
|
{
|
|
- if (is_background || hostapd_dfs_is_background_event(iface, freq)) {
|
|
+ int n_chans, n_chans1, ch_idx, ch_idx_1, dfs_cac_ms;
|
|
+ int chwidth;
|
|
+ u8 channel_no, cf1_ch_no;
|
|
+ bool is_background_event = hostapd_dfs_is_background_event(iface, freq);
|
|
+
|
|
+ if (is_background || is_background_event) {
|
|
iface->radar_background.cac_started = 1;
|
|
} else {
|
|
/* This is called when the driver indicates that an offloaded
|
|
@@ -1843,13 +1861,73 @@ int hostapd_dfs_start_cac(struct hostapd
|
|
hostapd_set_state(iface, HAPD_IFACE_DFS);
|
|
iface->cac_started = 1;
|
|
}
|
|
- /* TODO: How to check CAC time for ETSI weather channels? */
|
|
- iface->dfs_cac_ms = 60000;
|
|
+
|
|
+ /* Get channel number */
|
|
+ ieee80211_freq_to_chan(freq, &channel_no);
|
|
+
|
|
+ /* Get seq1 channel number */
|
|
+ ieee80211_freq_to_chan(cf1, &cf1_ch_no);
|
|
+
|
|
+ switch (chan_width) {
|
|
+ case CHAN_WIDTH_80:
|
|
+ chwidth = CONF_OPER_CHWIDTH_80MHZ;
|
|
+ cf1_ch_no -= 6;
|
|
+ break;
|
|
+ case CHAN_WIDTH_80P80:
|
|
+ chwidth = CONF_OPER_CHWIDTH_80P80MHZ;
|
|
+ cf1_ch_no -= 6;
|
|
+ break;
|
|
+ case CHAN_WIDTH_160:
|
|
+ chwidth = CONF_OPER_CHWIDTH_160MHZ;
|
|
+ cf1_ch_no -= 14;
|
|
+ break;
|
|
+ case CHAN_WIDTH_320:
|
|
+ chwidth = CONF_OPER_CHWIDTH_320MHZ;
|
|
+ cf1_ch_no -= 30;
|
|
+ break;
|
|
+ case CHAN_WIDTH_20_NOHT:
|
|
+ case CHAN_WIDTH_20:
|
|
+ case CHAN_WIDTH_40:
|
|
+ default:
|
|
+ chwidth = CONF_OPER_CHWIDTH_USE_HT;
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ /* Get idx */
|
|
+ ch_idx = dfs_get_start_chan_idx(iface,
|
|
+ &ch_idx_1, chwidth,
|
|
+ (chwidth == CHANWIDTH_USE_HT) ? channel_no :
|
|
+ cf1_ch_no, true);
|
|
+ if (ch_idx == -1)
|
|
+ return -1;
|
|
+
|
|
+ /* Get number of used channels, depend on width */
|
|
+ n_chans = dfs_get_used_n_chans(iface, &n_chans1,
|
|
+ chwidth);
|
|
+ if (n_chans == -1)
|
|
+ return -1;
|
|
+
|
|
+ dfs_cac_ms = dfs_get_cac_time(iface, ch_idx, n_chans);
|
|
+ /* Set minimum cac millisecond it it's not configured for
|
|
+ * the given channel from driver.
|
|
+ */
|
|
+ if (!dfs_cac_ms) {
|
|
+ /* TODO: How to check CAC time for ETSI weather channels? */
|
|
+ dfs_cac_ms = IEEE80211_DFS_MIN_CAC_TIME_MS;
|
|
+ }
|
|
+
|
|
+ /* Save dfs cac time to current iface configonly when DFS
|
|
+ * is offloaded and cac event is not a background event
|
|
+ */
|
|
+ if (iface->drv_flags & WPA_DRIVER_FLAGS_DFS_OFFLOAD &&
|
|
+ !is_background_event)
|
|
+ iface->dfs_cac_ms = dfs_cac_ms;
|
|
+
|
|
wpa_msg(iface->bss[0]->msg_ctx, MSG_INFO, DFS_EVENT_CAC_START
|
|
"freq=%d chan=%d chan_offset=%d width=%d seg0=%d "
|
|
"seg1=%d cac_time=%ds%s",
|
|
freq, (freq - 5000) / 5, chan_offset, chan_width, cf1, cf2,
|
|
- iface->dfs_cac_ms / 1000,
|
|
+ dfs_cac_ms / 1000,
|
|
hostapd_dfs_is_background_event(iface, freq) ?
|
|
" (background)" : "");
|
|
|