AP MLD: Support cohosted ML BSS

AP MLD was added with an assumption of only a single BSS per link in the
hostapd configuration. This needs to be extended when a cohosted ML BSS
exist in the same configuration.

Extend the support for cohosted BSSs. This is required for MBSSID MLO
support as well.

Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
This commit is contained in:
Sriram R 2024-03-28 23:46:37 +05:30 committed by Jouni Malinen
parent 9098535ef1
commit 3d0cc612fc
2 changed files with 72 additions and 35 deletions

View file

@ -158,6 +158,9 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
struct hostapd_bss_config *conf = hapd->conf; struct hostapd_bss_config *conf = hapd->conf;
u8 *b = conf->bssid; u8 *b = conf->bssid;
struct wpa_driver_capa capa; struct wpa_driver_capa capa;
#ifdef CONFIG_IEEE80211BE
struct hostapd_data *h_hapd = NULL;
#endif /* CONFIG_IEEE80211BE */
if (hapd->driver == NULL || hapd->driver->hapd_init == NULL) { if (hapd->driver == NULL || hapd->driver->hapd_init == NULL) {
wpa_printf(MSG_ERROR, "No hostapd driver wrapper available"); wpa_printf(MSG_ERROR, "No hostapd driver wrapper available");
@ -165,35 +168,10 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
} }
#ifdef CONFIG_IEEE80211BE #ifdef CONFIG_IEEE80211BE
for (i = 0; conf->mld_ap && i < iface->interfaces->count; i++) { if (conf->mld_ap)
struct hostapd_iface *h = iface->interfaces->iface[i]; h_hapd = hostapd_mld_get_first_bss(hapd);
struct hostapd_data *h_hapd = h->bss[0];
struct hostapd_bss_config *hconf = h_hapd->conf;
if (h == iface) {
wpa_printf(MSG_DEBUG, "MLD: Skip own interface");
continue;
}
if (!hconf->mld_ap) {
wpa_printf(MSG_DEBUG,
"MLD: Skip non-MLD");
continue;
}
if (!hostapd_is_ml_partner(hapd, h_hapd)) {
wpa_printf(MSG_DEBUG,
"MLD: Skip non matching MLD vif name");
continue;
}
wpa_printf(MSG_DEBUG, "MLD: Found matching MLD interface");
if (!h_hapd->drv_priv) {
wpa_printf(MSG_DEBUG,
"MLD: Matching MLD BSS not initialized yet");
continue;
}
if (h_hapd) {
hapd->drv_priv = h_hapd->drv_priv; hapd->drv_priv = h_hapd->drv_priv;
hapd->interface_added = h_hapd->interface_added; hapd->interface_added = h_hapd->interface_added;
@ -214,6 +192,9 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
} }
hostapd_mld_add_link(hapd); hostapd_mld_add_link(hapd);
wpa_printf(MSG_DEBUG,
"Setup of non first link (%d) BSS of MLD %s",
hapd->mld_link_id, hapd->conf->iface);
goto setup_mld; goto setup_mld;
} }
@ -298,6 +279,8 @@ static int hostapd_driver_init(struct hostapd_iface *iface)
os_memcpy(hapd->own_addr, b, ETH_ALEN); os_memcpy(hapd->own_addr, b, ETH_ALEN);
hostapd_mld_add_link(hapd); hostapd_mld_add_link(hapd);
wpa_printf(MSG_DEBUG, "Setup of first link (%d) BSS of MLD %s",
hapd->mld_link_id, hapd->conf->iface);
} }
setup_mld: setup_mld:

View file

@ -1379,6 +1379,23 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first,
} while (mac_in_conf(hapd->iconf, hapd->own_addr)); } while (mac_in_conf(hapd->iconf, hapd->own_addr));
} }
#ifdef CONFIG_IEEE80211BE
if (conf->mld_ap) {
struct hostapd_data *h_hapd;
h_hapd = hostapd_mld_get_first_bss(hapd);
if (h_hapd) {
hapd->drv_priv = h_hapd->drv_priv;
hapd->interface_added = h_hapd->interface_added;
hostapd_mld_add_link(hapd);
wpa_printf(MSG_DEBUG,
"Setup of non first link (%d) BSS of MLD %s",
hapd->mld_link_id, hapd->conf->iface);
goto setup_mld;
}
}
#endif /* CONFIG_IEEE80211BE */
hapd->interface_added = 1; hapd->interface_added = 1;
if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS, if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS,
conf->iface, addr, hapd, conf->iface, addr, hapd,
@ -1393,7 +1410,33 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first,
if (!addr) if (!addr)
os_memcpy(hapd->own_addr, if_addr, ETH_ALEN); os_memcpy(hapd->own_addr, if_addr, ETH_ALEN);
#ifdef CONFIG_IEEE80211BE
if (hapd->conf->mld_ap) {
wpa_printf(MSG_DEBUG,
"Setup of first link (%d) BSS of MLD %s",
hapd->mld_link_id, hapd->conf->iface);
os_memcpy(hapd->mld->mld_addr, hapd->own_addr,
ETH_ALEN);
hostapd_mld_add_link(hapd);
} }
#endif /* CONFIG_IEEE80211BE */
}
#ifdef CONFIG_IEEE80211BE
setup_mld:
if (hapd->conf->mld_ap && !first) {
wpa_printf(MSG_DEBUG,
"MLD: Set link_id=%u, mld_addr=" MACSTR
", own_addr=" MACSTR,
hapd->mld_link_id, MAC2STR(hapd->mld->mld_addr),
MAC2STR(hapd->own_addr));
if (hostapd_drv_link_add(hapd, hapd->mld_link_id,
hapd->own_addr))
return -1;
}
#endif /* CONFIG_IEEE80211BE */
if (conf->wmm_enabled < 0) if (conf->wmm_enabled < 0)
conf->wmm_enabled = hapd->iconf->ieee80211n | conf->wmm_enabled = hapd->iconf->ieee80211n |
@ -4681,17 +4724,28 @@ void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx)
struct hostapd_data * hostapd_mld_get_link_bss(struct hostapd_data *hapd, struct hostapd_data * hostapd_mld_get_link_bss(struct hostapd_data *hapd,
u8 link_id) u8 link_id)
{ {
unsigned int i; struct hostapd_iface *iface;
struct hostapd_data *bss;
unsigned int i, j;
for (i = 0; i < hapd->iface->interfaces->count; i++) { for (i = 0; i < hapd->iface->interfaces->count; i++) {
struct hostapd_iface *h = hapd->iface->interfaces->iface[i]; iface = hapd->iface->interfaces->iface[i];
struct hostapd_data *h_hapd = h->bss[0]; if (!iface)
if (!hostapd_is_ml_partner(hapd, h_hapd))
continue; continue;
if (h_hapd->mld_link_id == link_id) for (j = 0; j < iface->num_bss; j++) {
return h_hapd; bss = iface->bss[j];
if (!bss->conf->mld_ap ||
!hostapd_is_ml_partner(hapd, bss))
continue;
if (!bss->drv_priv)
continue;
if (bss->mld_link_id == link_id)
return bss;
}
} }
return NULL; return NULL;