From b592c1586e0f6502bec7933b47bb482e1a5ada31 Mon Sep 17 00:00:00 2001 From: Manish Dharanenthiran Date: Fri, 19 Jul 2024 09:46:38 +0530 Subject: [PATCH] nl80211: Handle nl80211_cqm_event per BSS During MLO, an nl80211_cqm_event may be received by any BSS. Directing this event to the first BSS may not be suitable as it might not correspond to the link the event is meant for. Hence, there is a need to handle this on per-BSS basis. Therefore, handle nl80211_cqm_event per BSS. The event handler further uses the address information present in the event to fetch the intended link BSS if no matching STA entry was found based on the initial ap_get_sta() call. Signed-off-by: Manish Dharanenthiran Signed-off-by: Aditya Kumar Singh --- src/ap/drv_callbacks.c | 14 ++++++++++++++ src/drivers/driver_nl80211_event.c | 8 ++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index c7e43d9d4..fa6e0d761 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -1090,6 +1090,20 @@ legacy: void hostapd_event_sta_low_ack(struct hostapd_data *hapd, const u8 *addr) { struct sta_info *sta = ap_get_sta(hapd, addr); +#ifdef CONFIG_IEEE80211BE + struct hostapd_data *orig_hapd = hapd; + + if (!sta && hapd->conf->mld_ap) { + hapd = hostapd_find_by_sta(hapd->iface, addr, true, &sta); + if (!hapd) { + wpa_printf(MSG_DEBUG, + "No partner link BSS found for STA " MACSTR + " - fallback to received context", + MAC2STR(addr)); + hapd = orig_hapd; + } + } +#endif /* CONFIG_IEEE80211BE */ if (!sta || !hapd->conf->disassoc_low_ack || sta->agreed_to_steer) return; diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index 3d07790e0..642b327d1 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -2062,9 +2062,9 @@ static void send_scan_event(struct i802_bss *bss, int aborted, } -static void nl80211_cqm_event(struct wpa_driver_nl80211_data *drv, - struct nlattr *tb[]) +static void nl80211_cqm_event(struct i802_bss *bss, struct nlattr *tb[]) { + struct wpa_driver_nl80211_data *drv = bss->drv; static struct nla_policy cqm_policy[NL80211_ATTR_CQM_MAX + 1] = { [NL80211_ATTR_CQM_RSSI_THOLD] = { .type = NLA_U32 }, [NL80211_ATTR_CQM_RSSI_HYST] = { .type = NLA_U8 }, @@ -2099,7 +2099,7 @@ static void nl80211_cqm_event(struct wpa_driver_nl80211_data *drv, wpa_printf(MSG_DEBUG, "nl80211: Packet loss event for " MACSTR " (num_packets %u)", MAC2STR(ed.low_ack.addr), ed.low_ack.num_packets); - wpa_supplicant_event(drv->ctx, EVENT_STATION_LOW_ACK, &ed); + wpa_supplicant_event(bss->ctx, EVENT_STATION_LOW_ACK, &ed); return; } @@ -4051,7 +4051,7 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd, mlme_event_remain_on_channel(drv, 1, tb); break; case NL80211_CMD_NOTIFY_CQM: - nl80211_cqm_event(drv, tb); + nl80211_cqm_event(bss, tb); break; case NL80211_CMD_REG_CHANGE: case NL80211_CMD_WIPHY_REG_CHANGE: