| From 627b60aab19db40260366fae5c711adb2b09554e Mon Sep 17 00:00:00 2001 |
| From: Michael Lee <michael-cy.lee@mediatek.com> |
| Date: Wed, 28 Jun 2023 11:08:12 +0800 |
| Subject: [PATCH] hostapd: mtk: register update_channel_utilization again |
| |
| The update_channel_utilization might be called when the bss is currently |
| stopped by wpa_supplicant. |
| In the original flow, the update_channel_utilization returns without |
| register itself again, and channel utilization will not be updated for |
| this bss anymore. |
| This patch re-registers the update_channel_utilization again when the |
| bss is stopped by wpa_supplicant. |
| |
| Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com> |
| --- |
| src/ap/bss_load.c | 13 ++++++++----- |
| 1 file changed, 8 insertions(+), 5 deletions(-) |
| |
| diff --git a/src/ap/bss_load.c b/src/ap/bss_load.c |
| index ae55521..f2a1a10 100644 |
| --- a/src/ap/bss_load.c |
| +++ b/src/ap/bss_load.c |
| @@ -46,10 +46,12 @@ static void update_channel_utilization(void *eloop_data, void *user_data) |
| int err; |
| struct hostapd_iface *iface = hapd->iface; |
| |
| - if (!(hapd->beacon_set_done && hapd->started && |
| - !hapd->stopped_by_supplicant)) |
| + if (!(hapd->beacon_set_done && hapd->started)) |
| return; |
| |
| + if(!hapd->stopped_by_supplicant) |
| + goto skip_update; |
| + |
| err = hostapd_drv_get_survey(hapd, hapd->iface->freq); |
| if (err) { |
| wpa_printf(MSG_ERROR, "BSS Load: Failed to get survey data"); |
| @@ -58,9 +60,6 @@ static void update_channel_utilization(void *eloop_data, void *user_data) |
| |
| ieee802_11_set_beacon(hapd); |
| |
| - if (get_bss_load_update_timeout(hapd, &sec, &usec) < 0) |
| - return; |
| - |
| if (hapd->conf->chan_util_avg_period) { |
| iface->chan_util_samples_sum += iface->channel_utilization; |
| iface->chan_util_num_sample_periods += |
| @@ -76,6 +75,10 @@ static void update_channel_utilization(void *eloop_data, void *user_data) |
| } |
| } |
| |
| +skip_update: |
| + if (get_bss_load_update_timeout(hapd, &sec, &usec) < 0) |
| + return; |
| + |
| eloop_register_timeout(sec, usec, update_channel_utilization, hapd, |
| NULL); |
| } |
| -- |
| 2.25.1 |
| |