The Maximum Number Of Simultaneous Links field in MLD Capabilities And
Operations subfield in MLE is currently advertised as `num_links - 1`,
where `num_links` is the number of links added to the AP MLD. However,
when the 5 GHz band link is waiting for CAC timeout, this results in an
incorrect value being advertised for the maximum number of simultaneous
links in MLE, as the 5 GHz link is not active.
For example, an AP MLD with 3 links (2.4 GHz, 5 GHz (waiting for CAC
timeout), and 6 GHz) during bringup has `num_links` set to 3.
Consequently, the maximum number of simultaneous links in MLE is
advertised as 2 according to the current code, despite the 5 GHz link
being in CAC timeout. The field should have been set to 1 to indicate
maximum of 2 links.
Fix this issue by determining the number of currently active links of
the AP MLD (instead of hapd->num_links which may include currently
inactive links) and use it to set the value for the maximum number of
simultaneous links in MLE.
Signed-off-by: Yuvarani V <quic_yuvarani@quicinc.com>
link_bss->drv_priv = NULL;
}
+
+/* Return the number of currently active links, not counting the calling link
+ * (i.e., a value that is suitable to be used as-is in fields that use encoding
+ * of the value minus 1). */
+u8 hostapd_get_active_links(struct hostapd_data *hapd)
+{
+ struct hostapd_data *link_bss;
+ u8 active_links = 0;
+
+ if (!hapd || !hapd->conf->mld_ap)
+ return 0;
+
+ for_each_mld_link(link_bss, hapd) {
+ if (link_bss == hapd || !link_bss->started)
+ continue;
+
+ active_links++;
+ }
+
+ return active_links;
+}
+
#endif /* CONFIG_IEEE80211BE */
u8 hostapd_get_mld_id(struct hostapd_data *hapd);
int hostapd_mld_add_link(struct hostapd_data *hapd);
int hostapd_mld_remove_link(struct hostapd_data *hapd);
+u8 hostapd_get_active_links(struct hostapd_data *hapd);
struct hostapd_data * hostapd_mld_get_first_bss(struct hostapd_data *hapd);
void free_beacon_data(struct beacon_data *beacon);
mld_cap = hapd->iface->mld_mld_capa;
max_simul_links = mld_cap & EHT_ML_MLD_CAPA_MAX_NUM_SIM_LINKS_MASK;
- active_links = hapd->mld->num_links - 1;
+ active_links = hostapd_get_active_links(hapd);
if (active_links > max_simul_links) {
wpa_printf(MSG_ERROR,