blob: 95be18fae91669344d24b5d69e5341d85dbb425c [file] [log] [blame]
developer617abbd2024-04-23 14:50:01 +08001From 7b4363892397c667e65fae9e036c83ac039e308d Mon Sep 17 00:00:00 2001
2From: Michael-CY Lee <michael-cy.lee@mediatek.com>
3Date: Wed, 17 Apr 2024 13:17:59 +0800
4Subject: [PATCH 104/104] mtk: hostapd: ucode: add is_mld_finished check
5
6Add is_mld_finished check for ucode need.
7This function returns ture only if all links fromt all MLD APs are
8ready.
9
10CR-Id: WCNCR00289305
11Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
12---
13 src/ap/ucode.c | 18 ++++++++++++++++++
14 1 file changed, 18 insertions(+)
15
16diff --git a/src/ap/ucode.c b/src/ap/ucode.c
17index 2642e87c7..9f9cc2022 100644
18--- a/src/ap/ucode.c
19+++ b/src/ap/ucode.c
20@@ -734,6 +734,23 @@ uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs)
21 return ucv_boolean_new(!ret);
22 }
23
24+static uc_value_t *
25+uc_hostapd_iface_is_mld_finished(uc_vm_t *vm, size_t nargs)
26+{
27+ struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
28+ bool finished = true;
29+ int i;
30+
31+ for (i = 0; i < iface->num_bss; i++) {
32+ if (iface->bss[i]->conf->mld_ap && !iface->bss[i]->mld->started) {
33+ finished = false;
34+ break;
35+ }
36+ }
37+
38+ return ucv_boolean_new(finished);
39+}
40+
41 static uc_value_t *
42 uc_hostapd_bss_rename(uc_vm_t *vm, size_t nargs)
43 {
44@@ -806,6 +823,7 @@ int hostapd_ucode_init(struct hapd_interfaces *ifaces)
45 { "stop", uc_hostapd_iface_stop },
46 { "start", uc_hostapd_iface_start },
47 { "switch_channel", uc_hostapd_iface_switch_channel },
48+ { "is_mld_finished", uc_hostapd_iface_is_mld_finished },
49 };
50 uc_value_t *data, *proto;
51
52--
532.39.2
54