diff --git a/src/ap/drv_callbacks.c b/src/ap/drv_callbacks.c index 0e1a85027..b7b84cfd3 100644 --- a/src/ap/drv_callbacks.c +++ b/src/ap/drv_callbacks.c @@ -2399,26 +2399,31 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, case EVENT_DFS_RADAR_DETECTED: if (!data) break; + hapd = switch_link_hapd(hapd, data->dfs_event.link_id); hostapd_event_dfs_radar_detected(hapd, &data->dfs_event); break; case EVENT_DFS_PRE_CAC_EXPIRED: if (!data) break; + hapd = switch_link_hapd(hapd, data->dfs_event.link_id); hostapd_event_dfs_pre_cac_expired(hapd, &data->dfs_event); break; case EVENT_DFS_CAC_FINISHED: if (!data) break; + hapd = switch_link_hapd(hapd, data->dfs_event.link_id); hostapd_event_dfs_cac_finished(hapd, &data->dfs_event); break; case EVENT_DFS_CAC_ABORTED: if (!data) break; + hapd = switch_link_hapd(hapd, data->dfs_event.link_id); hostapd_event_dfs_cac_aborted(hapd, &data->dfs_event); break; case EVENT_DFS_NOP_FINISHED: if (!data) break; + hapd = switch_link_hapd(hapd, data->dfs_event.link_id); hostapd_event_dfs_nop_finished(hapd, &data->dfs_event); break; case EVENT_CHANNEL_LIST_CHANGED: @@ -2432,6 +2437,7 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, case EVENT_DFS_CAC_STARTED: if (!data) break; + hapd = switch_link_hapd(hapd, data->dfs_event.link_id); hostapd_event_dfs_cac_started(hapd, &data->dfs_event); break; #endif /* NEED_AP_MLME */ diff --git a/src/drivers/driver.h b/src/drivers/driver.h index d6c490d1c..9e4df1d78 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -6526,6 +6526,7 @@ union wpa_event_data { /** * struct dfs_event - Data for radar detected events * @freq: Frequency of the channel in MHz + * @link_id: If >= 0, Link ID of the MLO link */ struct dfs_event { int freq; @@ -6534,6 +6535,7 @@ union wpa_event_data { enum chan_width chan_width; int cf1; int cf2; + int link_id; } dfs_event; /** diff --git a/src/drivers/driver_nl80211_event.c b/src/drivers/driver_nl80211_event.c index 463cf6e0a..60b4fb51f 100644 --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -2455,14 +2455,23 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv, { union wpa_event_data data; enum nl80211_radar_event event_type; + struct i802_link *mld_link = NULL; if (!tb[NL80211_ATTR_WIPHY_FREQ] || !tb[NL80211_ATTR_RADAR_EVENT]) return; os_memset(&data, 0, sizeof(data)); + data.dfs_event.link_id = NL80211_DRV_LINK_ID_NA; data.dfs_event.freq = nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]); event_type = nla_get_u32(tb[NL80211_ATTR_RADAR_EVENT]); + if (data.dfs_event.freq) { + mld_link = nl80211_get_mld_link_by_freq(drv->first_bss, + data.dfs_event.freq); + if (mld_link) + data.dfs_event.link_id = mld_link->link_id; + } + /* Check HT params */ if (tb[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { data.dfs_event.ht_enabled = 1; @@ -2493,10 +2502,12 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv, if (tb[NL80211_ATTR_CENTER_FREQ2]) data.dfs_event.cf2 = nla_get_u32(tb[NL80211_ATTR_CENTER_FREQ2]); - wpa_printf(MSG_DEBUG, "nl80211: DFS event on freq %d MHz, ht: %d, offset: %d, width: %d, cf1: %dMHz, cf2: %dMHz", + wpa_printf(MSG_DEBUG, + "nl80211: DFS event on freq %d MHz, ht: %d, offset: %d, width: %d, cf1: %dMHz, cf2: %dMHz, link_id=%d", data.dfs_event.freq, data.dfs_event.ht_enabled, data.dfs_event.chan_offset, data.dfs_event.chan_width, - data.dfs_event.cf1, data.dfs_event.cf2); + data.dfs_event.cf1, data.dfs_event.cf2, + data.dfs_event.link_id); switch (event_type) { case NL80211_RADAR_DETECTED: @@ -2817,6 +2828,7 @@ static void qca_nl80211_dfs_offload_radar_event( { union wpa_event_data data; struct nlattr *tb[NL80211_ATTR_MAX + 1]; + struct i802_link *mld_link = NULL; wpa_printf(MSG_DEBUG, "nl80211: DFS offload radar vendor event received"); @@ -2833,9 +2845,17 @@ static void qca_nl80211_dfs_offload_radar_event( os_memset(&data, 0, sizeof(data)); data.dfs_event.freq = nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]); + data.dfs_event.link_id = NL80211_DRV_LINK_ID_NA; - wpa_printf(MSG_DEBUG, "nl80211: DFS event on freq %d MHz", - data.dfs_event.freq); + if (data.dfs_event.freq) { + mld_link = nl80211_get_mld_link_by_freq(drv->first_bss, + data.dfs_event.freq); + if (mld_link) + data.dfs_event.link_id = mld_link->link_id; + } + + wpa_printf(MSG_DEBUG, "nl80211: DFS event on freq %d MHz, link=%d", + data.dfs_event.freq, data.dfs_event.link_id); /* Check HT params */ if (tb[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) {