blob: 77a06b3d55fa46a2892f61e05b887e9fa0f95f91 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From 93ff9ff205e52c9dd5ac582261c5476ff87198ad Mon Sep 17 00:00:00 2001
2From: Michael-CY Lee <michael-cy.lee@mediatek.com>
3Date: Tue, 4 Jun 2024 08:31:29 +0800
4Subject: [PATCH 105/126] mtk: hostapd: sequentially conduct multiple setup ACS
5
6In the single-wiphy architecture, only one scan request is allowed at
7the same time (no matter the AP is legacy or MLD). However, if multiple
8AP interfaces need setup ACS, multiple scan requests are sent to the
9driver and only one can be accept. Other failed requests lead to
10interface setup failure.
11
12A sequentially conducting for multiple ACS is needed to prevent such a
13failure. It is realized by
14 1. A BSS (link) postpones its ACS initializaion if it detects another
15 active ACS.
16 2. Once the ACS is finished, the BSS (link) starts the ACS initizlization
17 for one of those BSSes (links) waiting for it.
18
19Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
20---
21 src/ap/hostapd.c | 18 ++++++++++++++++++
22 src/ap/hw_features.c | 10 ++++++++++
23 2 files changed, 28 insertions(+)
24
25diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
26index f03a6242f..63d89e614 100644
27--- a/src/ap/hostapd.c
28+++ b/src/ap/hostapd.c
29@@ -2860,6 +2860,24 @@ int hostapd_setup_interface_complete(struct hostapd_iface *iface, int err)
30 unsigned int i;
31 int not_ready_in_sync_ifaces = 0;
32
33+ if (iface->state == HAPD_IFACE_ACS) {
34+ int i;
35+
36+ for (i = 0; i < interfaces->count; i++) {
37+ if (!interfaces->iface[i]->freq) {
38+ /* FIXME problems remained
39+ * 1. the return value of acs_init() is
40+ * not check
41+ * 2. if it fails the setup, next acs_init()
42+ * will not be handled
43+ */
44+ wpa_printf(MSG_DEBUG, "mtk: trigger acs_init for %s", interfaces->iface[i]->phy);
45+ acs_init(interfaces->iface[i]);
46+ break;
47+ }
48+ }
49+ }
50+
51 if (!iface->need_to_start_in_sync)
52 return hostapd_setup_interface_complete_sync(iface, err);
53
54diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
55index 2a2832cd4..f35832e2e 100644
56--- a/src/ap/hw_features.c
57+++ b/src/ap/hw_features.c
58@@ -1158,6 +1158,8 @@ int hostapd_determine_mode(struct hostapd_iface *iface)
59 static enum hostapd_chan_status
60 hostapd_check_chans(struct hostapd_iface *iface)
61 {
62+ int i;
63+
64 if (iface->freq) {
65 int err;
66
67@@ -1177,6 +1179,14 @@ hostapd_check_chans(struct hostapd_iface *iface)
68 * which is used to trigger ACS.
69 */
70
71+ /*
72+ * Only allow an ACS at one time.
73+ */
74+ for (i = 0; i < iface->interfaces->count; i++) {
75+ if (iface->interfaces->iface[i]->state == HAPD_IFACE_ACS)
76+ return HOSTAPD_CHAN_ACS;
77+ }
78+
79 switch (acs_init(iface)) {
80 case HOSTAPD_CHAN_ACS:
81 return HOSTAPD_CHAN_ACS;
82--
832.18.0
84