developer | e35b8e4 | 2023-10-16 11:04:00 +0800 | [diff] [blame^] | 1 | From 401cb8a661c5e7d796a17bb289209663a6c42741 Mon Sep 17 00:00:00 2001 |
| 2 | From: Michael-CY Lee <michael-cy.lee@mediatek.com> |
| 3 | Date: Wed, 4 Oct 2023 11:12:52 +0800 |
| 4 | Subject: [PATCH] hostapd: mtk: avoid unnecessary beacon update for 6 GHz |
| 5 | co-location |
| 6 | |
| 7 | There are two reasons to update beacon for 6 GHz co-location: |
| 8 | 1. 6 GHz out-of-band discovery |
| 9 | 2. MLD operational parameters update |
| 10 | |
| 11 | BSS load update is unrelated with the above two reasons, and therefore is |
| 12 | not a case to update beacon for 6 GHz co-location. |
| 13 | Moreover, updating beacon for 6 GHz co-location when BSS load update |
| 14 | makes hostapd set beacon too frequently in a multiple BSSes case. |
| 15 | |
| 16 | Besides, it is also not necessary to update beacon for 6 GHz BSS when |
| 17 | setting 2/5 GHz beacon. (i.e., no need for 2/5 GHz co-location) |
| 18 | |
| 19 | This patch adds an new function to update beacon only for current BSS, |
| 20 | and uses the function duriong BSS load update. |
| 21 | Also it changes the condition check to make beacon update only for 6 GHz |
| 22 | co-location. |
| 23 | |
| 24 | Signed-off-by: Michael Lee <michael-cy.lee@mediatek.com> |
| 25 | Signed-off-by: Money Wang <money.wang@mediatek.com> |
| 26 | --- |
| 27 | src/ap/beacon.c | 8 +++++++- |
| 28 | src/ap/beacon.h | 1 + |
| 29 | src/ap/bss_load.c | 2 +- |
| 30 | 3 files changed, 9 insertions(+), 2 deletions(-) |
| 31 | |
| 32 | diff --git a/src/ap/beacon.c b/src/ap/beacon.c |
| 33 | index c67d08b..02f4f87 100644 |
| 34 | --- a/src/ap/beacon.c |
| 35 | +++ b/src/ap/beacon.c |
| 36 | @@ -2098,6 +2098,12 @@ fail: |
| 37 | } |
| 38 | |
| 39 | |
| 40 | +void ieee802_11_set_beacon_per_bss_only(struct hostapd_data *hapd) |
| 41 | +{ |
| 42 | + __ieee802_11_set_beacon(hapd); |
| 43 | +} |
| 44 | + |
| 45 | + |
| 46 | int ieee802_11_set_beacon(struct hostapd_data *hapd) |
| 47 | { |
| 48 | struct hostapd_iface *iface = hapd->iface; |
| 49 | @@ -2121,7 +2127,7 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd) |
| 50 | if (colocated == iface || !colocated || !colocated->conf) |
| 51 | continue; |
| 52 | |
| 53 | - if (is_6g == is_6ghz_op_class(colocated->conf->op_class)) |
| 54 | + if (!is_6g || is_6ghz_op_class(colocated->conf->op_class)) |
| 55 | continue; |
| 56 | |
| 57 | for (i = 0; i < colocated->num_bss; i++) { |
| 58 | diff --git a/src/ap/beacon.h b/src/ap/beacon.h |
| 59 | index c320825..b32b2a7 100644 |
| 60 | --- a/src/ap/beacon.h |
| 61 | +++ b/src/ap/beacon.h |
| 62 | @@ -15,6 +15,7 @@ struct ieee80211_mgmt; |
| 63 | void handle_probe_req(struct hostapd_data *hapd, |
| 64 | const struct ieee80211_mgmt *mgmt, size_t len, |
| 65 | int ssi_signal); |
| 66 | +void ieee802_11_set_beacon_per_bss_only(struct hostapd_data *hapd); |
| 67 | int ieee802_11_set_beacon(struct hostapd_data *hapd); |
| 68 | int ieee802_11_set_beacons(struct hostapd_iface *iface); |
| 69 | int ieee802_11_update_beacons(struct hostapd_iface *iface); |
| 70 | diff --git a/src/ap/bss_load.c b/src/ap/bss_load.c |
| 71 | index 78fd9d8..9e247da 100644 |
| 72 | --- a/src/ap/bss_load.c |
| 73 | +++ b/src/ap/bss_load.c |
| 74 | @@ -58,7 +58,7 @@ static void update_channel_utilization(void *eloop_data, void *user_data) |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | - ieee802_11_set_beacon(hapd); |
| 79 | + ieee802_11_set_beacon_per_bss_only(hapd); |
| 80 | |
| 81 | if (hapd->conf->chan_util_avg_period) { |
| 82 | iface->chan_util_samples_sum += iface->channel_utilization; |
| 83 | -- |
| 84 | 2.25.1 |
| 85 | |