blob: 77a06b3d55fa46a2892f61e05b887e9fa0f95f91 [file] [log] [blame]
From 93ff9ff205e52c9dd5ac582261c5476ff87198ad Mon Sep 17 00:00:00 2001
From: Michael-CY Lee <michael-cy.lee@mediatek.com>
Date: Tue, 4 Jun 2024 08:31:29 +0800
Subject: [PATCH 105/126] mtk: hostapd: sequentially conduct multiple setup ACS
In the single-wiphy architecture, only one scan request is allowed at
the same time (no matter the AP is legacy or MLD). However, if multiple
AP interfaces need setup ACS, multiple scan requests are sent to the
driver and only one can be accept. Other failed requests lead to
interface setup failure.
A sequentially conducting for multiple ACS is needed to prevent such a
failure. It is realized by
1. A BSS (link) postpones its ACS initializaion if it detects another
active ACS.
2. Once the ACS is finished, the BSS (link) starts the ACS initizlization
for one of those BSSes (links) waiting for it.
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
---
src/ap/hostapd.c | 18 ++++++++++++++++++
src/ap/hw_features.c | 10 ++++++++++
2 files changed, 28 insertions(+)
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index f03a6242f..63d89e614 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -2860,6 +2860,24 @@ int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
unsigned int i;
int not_ready_in_sync_ifaces = 0;
+ if (iface->state == HAPD_IFACE_ACS) {
+ int i;
+
+ for (i = 0; i < interfaces->count; i++) {
+ if (!interfaces->iface[i]->freq) {
+ /* FIXME problems remained
+ * 1. the return value of acs_init() is
+ * not check
+ * 2. if it fails the setup, next acs_init()
+ * will not be handled
+ */
+ wpa_printf(MSG_DEBUG, "mtk: trigger acs_init for %s", interfaces->iface[i]->phy);
+ acs_init(interfaces->iface[i]);
+ break;
+ }
+ }
+ }
+
if (!iface->need_to_start_in_sync)
return hostapd_setup_interface_complete_sync(iface, err);
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 2a2832cd4..f35832e2e 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -1158,6 +1158,8 @@ int hostapd_determine_mode(struct hostapd_iface *iface)
static enum hostapd_chan_status
hostapd_check_chans(struct hostapd_iface *iface)
{
+ int i;
+
if (iface->freq) {
int err;
@@ -1177,6 +1179,14 @@ hostapd_check_chans(struct hostapd_iface *iface)
* which is used to trigger ACS.
*/
+ /*
+ * Only allow an ACS at one time.
+ */
+ for (i = 0; i < iface->interfaces->count; i++) {
+ if (iface->interfaces->iface[i]->state == HAPD_IFACE_ACS)
+ return HOSTAPD_CHAN_ACS;
+ }
+
switch (acs_init(iface)) {
case HOSTAPD_CHAN_ACS:
return HOSTAPD_CHAN_ACS;
--
2.18.0