hostapd: avoid unnecessary beacon update for co-location

Michael-CY Lee michael-cy.lee at mediatek.com
Thu Oct 12 22:43:57 PDT 2023


When it comes to set some BSS's beacon, there are two reasons to update
the beacon of co-located hostapd_iface(s) at the same time:
1. 6 GHz out-of-band discovery
2. MLD operational parameters update

BSS load update is unrelated with the above two reasons, and
therefore is not the case to update beacon for co-location.
Moreover, updating beacon for co-location when BSS load update makes
hostapd set beacon too frequently, which makes hostapd busy setting
beacon in a multi-BSS case.

Besides, it is also not necessary to update beacon for co-location when
current BSS is neigher 6 GHz nor MLD.

This patch adds an new function to update beacon only for current BSS
and uses the function during BSS load update.
Also it changes the condition check so that beacon update only works for
6 GHz co-location or MLD.

Signed-off-by: Michael-CY Lee <michael-cy.lee at mediatek.com>
Signed-off-by: Money Wang <money.wang at mediatek.com>
---
 src/ap/beacon.c   | 8 +++++++-
 src/ap/beacon.h   | 1 +
 src/ap/bss_load.c | 2 +-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index d160675..684bdc0 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -2216,6 +2216,12 @@ fail:
 }
 
 
+void ieee802_11_set_beacon_per_bss_only(struct hostapd_data *hapd)
+{
+	__ieee802_11_set_beacon(hapd);
+}
+
+
 int ieee802_11_set_beacon(struct hostapd_data *hapd)
 {
 	struct hostapd_iface *iface = hapd->iface;
@@ -2246,7 +2252,7 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
 			mld_ap = true;
 #endif /* CONFIG_IEEE80211BE */
 
-		if (is_6g == is_6ghz_op_class(other->conf->op_class) &&
+		if ((!is_6g || is_6ghz_op_class(other->conf->op_class)) &&
 		    !mld_ap)
 			continue;
 
diff --git a/src/ap/beacon.h b/src/ap/beacon.h
index c320825..b32b2a7 100644
--- a/src/ap/beacon.h
+++ b/src/ap/beacon.h
@@ -15,6 +15,7 @@ struct ieee80211_mgmt;
 void handle_probe_req(struct hostapd_data *hapd,
 		      const struct ieee80211_mgmt *mgmt, size_t len,
 		      int ssi_signal);
+void ieee802_11_set_beacon_per_bss_only(struct hostapd_data *hapd);
 int ieee802_11_set_beacon(struct hostapd_data *hapd);
 int ieee802_11_set_beacons(struct hostapd_iface *iface);
 int ieee802_11_update_beacons(struct hostapd_iface *iface);
diff --git a/src/ap/bss_load.c b/src/ap/bss_load.c
index 725d3cd..e9baafc 100644
--- a/src/ap/bss_load.c
+++ b/src/ap/bss_load.c
@@ -55,7 +55,7 @@ static void update_channel_utilization(void *eloop_data, void *user_data)
 		return;
 	}
 
-	ieee802_11_set_beacon(hapd);
+	ieee802_11_set_beacon_per_bss_only(hapd);
 
 	if (get_bss_load_update_timeout(hapd, &sec, &usec) < 0)
 		return;
-- 
2.25.1




More information about the Hostap mailing list