]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Handle nl80211_cqm_event per BSS
authorManish Dharanenthiran <quic_mdharane@quicinc.com>
Fri, 19 Jul 2024 04:16:38 +0000 (09:46 +0530)
committerJouni Malinen <j@w1.fi>
Tue, 6 Aug 2024 17:17:47 +0000 (20:17 +0300)
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 <quic_mdharane@quicinc.com>
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
src/ap/drv_callbacks.c
src/drivers/driver_nl80211_event.c

index c7e43d9d4cb0f4187b756d54de0ed32dc4cdfcdf..fa6e0d76198f1cb1afa2a1c22868d6a8e9aeb6ee 100644 (file)
@@ -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;
index 3d07790e04326d455d1736e8e2811b9c4e8f5061..642b327d10a44da9338a017244fca4cc40378ee2 100644 (file)
@@ -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: