[openwrt/openwrt] hostapd: remove unnecessary ucv_gc calls

LEDE Commits lede-commits at lists.infradead.org
Sat Aug 2 08:44:55 PDT 2025


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/be2916b1d45a05094c8ee01f6c9c1c98ba1d16ed

commit be2916b1d45a05094c8ee01f6c9c1c98ba1d16ed
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Thu Jun 26 14:36:10 2025 +0200

    hostapd: remove unnecessary ucv_gc calls
    
    They should not be needed, since the code doesn't use circular references
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 package/network/services/hostapd/src/src/ap/ucode.c         |  8 --------
 package/network/services/hostapd/src/src/utils/ucode.c      | 10 ----------
 package/network/services/hostapd/src/wpa_supplicant/ucode.c |  6 ------
 3 files changed, 24 deletions(-)

diff --git a/package/network/services/hostapd/src/src/ap/ucode.c b/package/network/services/hostapd/src/src/ap/ucode.c
index 5204559d43..d3eadba15a 100644
--- a/package/network/services/hostapd/src/src/ap/ucode.c
+++ b/package/network/services/hostapd/src/src/ap/ucode.c
@@ -78,8 +78,6 @@ hostapd_ucode_update_interfaces(void)
 
 	ucv_object_add(ucv_prototype_get(global), "interfaces", ifs);
 	ucv_object_add(ucv_prototype_get(global), "bss", if_bss);
-
-	ucv_gc(vm);
 }
 
 static uc_value_t *
@@ -331,7 +329,6 @@ uc_hostapd_bss_delete(uc_vm_t *vm, size_t nargs)
 	os_free(hapd);
 
 	hostapd_ucode_update_interfaces();
-	ucv_gc(vm);
 
 	return NULL;
 }
@@ -780,7 +777,6 @@ int hostapd_ucode_sta_auth(struct hostapd_data *hapd, struct sta_info *sta)
 		ret = ucv_int64_get(cur);
 
 	ucv_put(val);
-	ucv_gc(vm);
 
 	return ret;
 }
@@ -906,7 +902,6 @@ int hostapd_ucode_init(struct hapd_interfaces *ifaces)
 
 	if (wpa_ucode_run(HOSTAPD_UC_PATH "hostapd.uc"))
 		goto free_vm;
-	ucv_gc(vm);
 
 	return 0;
 
@@ -940,7 +935,6 @@ void hostapd_ucode_bss_cb(struct hostapd_data *hapd, const char *type)
 	uc_value_push(ucv_get(val));
 	ucv_put(wpa_ucode_call(3));
 	ucv_put(val);
-	ucv_gc(vm);
 }
 
 void hostapd_ucode_free_bss(struct hostapd_data *hapd)
@@ -960,7 +954,6 @@ void hostapd_ucode_free_bss(struct hostapd_data *hapd)
 	ucv_put(wpa_ucode_call(2));
 
 	ucv_put(val);
-	ucv_gc(vm);
 }
 
 #ifdef CONFIG_APUP
@@ -977,6 +970,5 @@ void hostapd_ucode_apup_newpeer(struct hostapd_data *hapd, const char *ifname)
 	uc_value_push(ucv_string_new(ifname)); // APuP peer ifname
 	ucv_put(wpa_ucode_call(2));
 	ucv_put(val);
-	ucv_gc(vm);
 }
 #endif // def CONFIG_APUP
diff --git a/package/network/services/hostapd/src/src/utils/ucode.c b/package/network/services/hostapd/src/src/utils/ucode.c
index a7cc2c7059..b5fdf6676c 100644
--- a/package/network/services/hostapd/src/src/utils/ucode.c
+++ b/package/network/services/hostapd/src/src/utils/ucode.c
@@ -14,7 +14,6 @@
 
 static uc_value_t *registry;
 static uc_vm_t vm;
-static struct uloop_timeout gc_timer;
 static struct udebug ud;
 static struct udebug_buf ud_log, ud_nl[3];
 static const struct udebug_buf_meta meta_log = {
@@ -71,11 +70,6 @@ static struct udebug_ubus_ring udebug_rings[] = {
 char *udebug_service;
 struct udebug_ubus ud_ubus;
 
-static void uc_gc_timer(struct uloop_timeout *timeout)
-{
-	ucv_gc(&vm);
-}
-
 uc_value_t *uc_wpa_printf(uc_vm_t *vm, size_t nargs)
 {
 	uc_value_t *level = uc_fn_arg(0);
@@ -254,7 +248,6 @@ uc_vm_t *wpa_ucode_create_vm(void)
 
 	uc_stdlib_load(uc_vm_scope_get(&vm));
 	eloop_add_uloop();
-	gc_timer.cb = uc_gc_timer;
 
 	return &vm;
 }
@@ -486,9 +479,6 @@ uc_value_t *wpa_ucode_call(size_t nargs)
 	if (uc_vm_call(&vm, true, nargs) != EXCEPTION_NONE)
 		return NULL;
 
-	if (!gc_timer.pending)
-		uloop_timeout_set(&gc_timer, 10);
-
 	return uc_vm_stack_pop(&vm);
 }
 
diff --git a/package/network/services/hostapd/src/wpa_supplicant/ucode.c b/package/network/services/hostapd/src/wpa_supplicant/ucode.c
index 8335a27e89..8ba4db01de 100644
--- a/package/network/services/hostapd/src/wpa_supplicant/ucode.c
+++ b/package/network/services/hostapd/src/wpa_supplicant/ucode.c
@@ -39,7 +39,6 @@ wpas_ucode_update_interfaces(void)
 		ucv_object_add(ifs, wpa_s->ifname, wpas_ucode_iface_get_uval(wpa_s));
 
 	ucv_object_add(ucv_prototype_get(global), "interfaces", ifs);
-	ucv_gc(vm);
 }
 
 void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s)
@@ -52,7 +51,6 @@ void wpas_ucode_add_bss(struct wpa_supplicant *wpa_s)
 	uc_value_push(ucv_string_new(wpa_s->ifname));
 	uc_value_push(wpas_ucode_iface_get_uval(wpa_s));
 	ucv_put(wpa_ucode_call(2));
-	ucv_gc(vm);
 }
 
 void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s)
@@ -71,7 +69,6 @@ void wpas_ucode_free_bss(struct wpa_supplicant *wpa_s)
 	uc_value_push(ucv_get(val));
 	ucv_put(wpa_ucode_call(2));
 	ucv_put(val);
-	ucv_gc(vm);
 }
 
 void wpas_ucode_update_state(struct wpa_supplicant *wpa_s)
@@ -91,7 +88,6 @@ void wpas_ucode_update_state(struct wpa_supplicant *wpa_s)
 	uc_value_push(ucv_get(val));
 	uc_value_push(ucv_string_new(state));
 	ucv_put(wpa_ucode_call(3));
-	ucv_gc(vm);
 }
 
 void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_data *data)
@@ -124,7 +120,6 @@ void wpas_ucode_event(struct wpa_supplicant *wpa_s, int event, union wpa_event_d
 	}
 
 	ucv_put(wpa_ucode_call(4));
-	ucv_gc(vm);
 }
 
 static const char *obj_stringval(uc_value_t *obj, const char *name)
@@ -310,7 +305,6 @@ int wpas_ucode_init(struct wpa_global *gl)
 	if (wpa_ucode_run(HOSTAPD_UC_PATH "wpa_supplicant.uc"))
 		goto free_vm;
 
-	ucv_gc(vm);
 	return 0;
 
 free_vm:




More information about the lede-commits mailing list