From 29ecaab5b17d7bd32dfdf37d97fe95cc5b1a6b2e Mon Sep 17 00:00:00 2001 From: Aditya Kumar Singh Date: Wed, 25 Oct 2023 22:29:40 +0530 Subject: [PATCH] hostapd: handle AWGN event for MLO case During MLO operation, appropriate link BSS needs to be identified based on the frequency info present in AWGN event and then the event should be further processed. Add changes to identify link BSS based on freq info in the AWGN event. Signed-off-by: Aditya Kumar Singh --- src/drivers/driver_nl80211_event.c | 41 +++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) --- a/src/drivers/driver_nl80211_event.c +++ b/src/drivers/driver_nl80211_event.c @@ -2510,10 +2510,12 @@ process_radar_event: } } -static void nl80211_awgn_event(struct wpa_driver_nl80211_data *drv, - struct nlattr **tb) +static void nl80211_awgn_event(struct i802_bss *bss, struct nlattr **tb) { + struct wpa_driver_nl80211_data *drv = bss->drv; union wpa_event_data data; + struct i802_link *mld_link = bss->flink; + void *ctx = bss->ctx; os_memset(&data, 0, sizeof(data)); @@ -2534,7 +2536,38 @@ static void nl80211_awgn_event(struct wp data.awgn_event.chan_bw_interference_bitmap = nla_get_u32(tb[NL80211_ATTR_AWGN_INTERFERENCE_BITMAP]); - wpa_supplicant_event(drv->ctx, EVENT_AWGN_DETECTED, &data); + mld_link = nl80211_get_mld_link_by_freq(bss, data.awgn_event.freq); + if (!mld_link) { + /* For non-ML case also, %NULL would be returned. Hence check if + * its for non-ML case, then proceed with first link. + * Non-ML link should have link ID as -1 and freq should be set. + */ + if (bss->n_links == 1 && bss->links[0].link_id == -1 && + bss->links[0].freq) { + mld_link = bss->flink; + goto process_awgn_event; + } + + wpa_printf(MSG_DEBUG, + "nl80211: AWGN event on unknown freq %d", + data.awgn_event.freq); + return; + } + +process_awgn_event: + if (mld_link->link_id != NL80211_DRV_LINK_ID_NA) { + wpa_printf(MSG_DEBUG, "nl80211: AWGN event for link %d", + mld_link->link_id); + ctx = mld_link->ctx; + } + + if (!is_6ghz_freq(mld_link->freq)) { + wpa_printf(MSG_DEBUG, + "nl80211: Ignoring AWGN event on non 6 GHz BSS"); + return; + } + + wpa_supplicant_event(ctx, EVENT_AWGN_DETECTED, &data); } static void nl80211_spurious_frame(struct i802_bss *bss, struct nlattr **tb, @@ -4179,7 +4212,7 @@ static void do_process_drv_event(struct nl80211_update_muedca_params_event(drv, tb); break; case NL80211_CMD_AWGN_DETECT: - nl80211_awgn_event(drv, tb); + nl80211_awgn_event(bss, tb); break; default: wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Ignored unknown event "