nl80211: AP MLD: Parse link ID to determine the BSS for color event

When an HE BSS color event is received from the driver, the event was
delevered to the first link BSS ctx. To support HE BSS color with MLO,
there is a need to identify the correct link for which the event is
intended.

Add link ID parsing support in the event handler and pass the link ID
(if included) down to the event handler so that appropriate link can be
selected.

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
This commit is contained in:
Aditya Kumar Singh 2024-06-12 19:57:53 +05:30 committed by Jouni Malinen
parent 5d16ad9ab0
commit 61eb89d5fd
3 changed files with 26 additions and 0 deletions

View file

@ -2734,21 +2734,29 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
/* The BSS color is shared amongst all BBSs on a specific phy. /* The BSS color is shared amongst all BBSs on a specific phy.
* Therefore we always start the color change on the primary * Therefore we always start the color change on the primary
* BSS. */ * BSS. */
hapd = switch_link_hapd(hapd,
data->bss_color_collision.link_id);
wpa_printf(MSG_DEBUG, "BSS color collision on %s", wpa_printf(MSG_DEBUG, "BSS color collision on %s",
hapd->conf->iface); hapd->conf->iface);
hostapd_switch_color(hapd->iface->bss[0], hostapd_switch_color(hapd->iface->bss[0],
data->bss_color_collision.bitmap); data->bss_color_collision.bitmap);
break; break;
case EVENT_CCA_STARTED_NOTIFY: case EVENT_CCA_STARTED_NOTIFY:
hapd = switch_link_hapd(hapd,
data->bss_color_collision.link_id);
wpa_printf(MSG_DEBUG, "CCA started on %s", wpa_printf(MSG_DEBUG, "CCA started on %s",
hapd->conf->iface); hapd->conf->iface);
break; break;
case EVENT_CCA_ABORTED_NOTIFY: case EVENT_CCA_ABORTED_NOTIFY:
hapd = switch_link_hapd(hapd,
data->bss_color_collision.link_id);
wpa_printf(MSG_DEBUG, "CCA aborted on %s", wpa_printf(MSG_DEBUG, "CCA aborted on %s",
hapd->conf->iface); hapd->conf->iface);
hostapd_event_color_change(hapd, false); hostapd_event_color_change(hapd, false);
break; break;
case EVENT_CCA_NOTIFY: case EVENT_CCA_NOTIFY:
hapd = switch_link_hapd(hapd,
data->bss_color_collision.link_id);
wpa_printf(MSG_DEBUG, "CCA finished on %s", wpa_printf(MSG_DEBUG, "CCA finished on %s",
hapd->conf->iface); hapd->conf->iface);
hostapd_event_color_change(hapd, true); hostapd_event_color_change(hapd, true);

View file

@ -6799,6 +6799,7 @@ union wpa_event_data {
*/ */
struct bss_color_collision { struct bss_color_collision {
u64 bitmap; u64 bitmap;
int link_id;
} bss_color_collision; } bss_color_collision;
/** /**

View file

@ -3800,6 +3800,7 @@ static void nl80211_obss_color_event(struct i802_bss *bss,
enum wpa_event_type event_type; enum wpa_event_type event_type;
os_memset(&data, 0, sizeof(data)); os_memset(&data, 0, sizeof(data));
data.bss_color_collision.link_id = NL80211_DRV_LINK_ID_NA;
switch (cmd) { switch (cmd) {
case NL80211_CMD_OBSS_COLOR_COLLISION: case NL80211_CMD_OBSS_COLOR_COLLISION:
@ -3830,6 +3831,22 @@ static void nl80211_obss_color_event(struct i802_bss *bss,
return; return;
} }
if (tb[NL80211_ATTR_MLO_LINK_ID]) {
data.bss_color_collision.link_id =
nla_get_u8(tb[NL80211_ATTR_MLO_LINK_ID]);
if (!nl80211_link_valid(bss->valid_links,
data.bss_color_collision.link_id)) {
wpa_printf(MSG_DEBUG,
"nl80211: Invalid BSS color event link ID %d",
data.bss_color_collision.link_id);
return;
}
wpa_printf(MSG_DEBUG, "nl80211: BSS color event - Link ID %d",
data.bss_color_collision.link_id);
}
wpa_supplicant_event(bss->ctx, event_type, &data); wpa_supplicant_event(bss->ctx, event_type, &data);
} }