blob: 95be18fae91669344d24b5d69e5341d85dbb425c [file] [log] [blame]
From 7b4363892397c667e65fae9e036c83ac039e308d Mon Sep 17 00:00:00 2001
From: Michael-CY Lee <michael-cy.lee@mediatek.com>
Date: Wed, 17 Apr 2024 13:17:59 +0800
Subject: [PATCH 104/104] mtk: hostapd: ucode: add is_mld_finished check
Add is_mld_finished check for ucode need.
This function returns ture only if all links fromt all MLD APs are
ready.
CR-Id: WCNCR00289305
Signed-off-by: Michael-CY Lee <michael-cy.lee@mediatek.com>
---
src/ap/ucode.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/ap/ucode.c b/src/ap/ucode.c
index 2642e87c7..9f9cc2022 100644
--- a/src/ap/ucode.c
+++ b/src/ap/ucode.c
@@ -734,6 +734,23 @@ uc_hostapd_iface_switch_channel(uc_vm_t *vm, size_t nargs)
return ucv_boolean_new(!ret);
}
+static uc_value_t *
+uc_hostapd_iface_is_mld_finished(uc_vm_t *vm, size_t nargs)
+{
+ struct hostapd_iface *iface = uc_fn_thisval("hostapd.iface");
+ bool finished = true;
+ int i;
+
+ for (i = 0; i < iface->num_bss; i++) {
+ if (iface->bss[i]->conf->mld_ap && !iface->bss[i]->mld->started) {
+ finished = false;
+ break;
+ }
+ }
+
+ return ucv_boolean_new(finished);
+}
+
static uc_value_t *
uc_hostapd_bss_rename(uc_vm_t *vm, size_t nargs)
{
@@ -806,6 +823,7 @@ int hostapd_ucode_init(struct hapd_interfaces *ifaces)
{ "stop", uc_hostapd_iface_stop },
{ "start", uc_hostapd_iface_start },
{ "switch_channel", uc_hostapd_iface_switch_channel },
+ { "is_mld_finished", uc_hostapd_iface_is_mld_finished },
};
uc_value_t *data, *proto;
--
2.39.2