nl80211: Handle driver events for BSS coloring

Process the color collision and color change related events.

Tested-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
This commit is contained in:
John Crispin 2022-03-21 12:10:34 +01:00 committed by Jouni Malinen
parent 399d6e64d9
commit 27b4cc712f
3 changed files with 97 additions and 0 deletions

View file

@ -5179,6 +5179,26 @@ enum wpa_event_type {
* non-zero wait time and that has not been explicitly cancelled. * non-zero wait time and that has not been explicitly cancelled.
*/ */
EVENT_TX_WAIT_EXPIRE, EVENT_TX_WAIT_EXPIRE,
/**
* EVENT_BSS_COLOR_COLLISION - Notification of a BSS color collision
*/
EVENT_BSS_COLOR_COLLISION,
/**
* EVENT_CCA_STARTED_NOTIFY - Notification that CCA has started
*/
EVENT_CCA_STARTED_NOTIFY,
/**
* EVENT_CCA_ABORTED_NOTIFY - Notification that CCA has aborted
*/
EVENT_CCA_ABORTED_NOTIFY,
/**
* EVENT_CCA_NOTIFY - Notification that CCA has completed
*/
EVENT_CCA_NOTIFY,
}; };
@ -6071,6 +6091,13 @@ union wpa_event_data {
struct unprot_beacon { struct unprot_beacon {
const u8 *sa; const u8 *sa;
} unprot_beacon; } unprot_beacon;
/**
* struct bss_color_collision - Data for EVENT_BSS_COLOR_COLLISION
*/
struct bss_color_collision {
u64 bitmap;
} bss_color_collision;
}; };
/** /**

View file

@ -91,6 +91,10 @@ const char * event_to_string(enum wpa_event_type event)
E2S(UPDATE_DH); E2S(UPDATE_DH);
E2S(UNPROT_BEACON); E2S(UNPROT_BEACON);
E2S(TX_WAIT_EXPIRE); E2S(TX_WAIT_EXPIRE);
E2S(BSS_COLOR_COLLISION);
E2S(CCA_STARTED_NOTIFY);
E2S(CCA_ABORTED_NOTIFY);
E2S(CCA_NOTIFY);
} }
return "UNKNOWN"; return "UNKNOWN";

View file

@ -2911,6 +2911,58 @@ static void nl80211_assoc_comeback(struct wpa_driver_nl80211_data *drv,
} }
#ifdef CONFIG_IEEE80211AX
static void nl80211_obss_color_collision(struct wpa_driver_nl80211_data *drv,
struct nlattr *tb[])
{
union wpa_event_data data;
if (!tb[NL80211_ATTR_OBSS_COLOR_BITMAP])
return;
os_memset(&data, 0, sizeof(data));
data.bss_color_collision.bitmap =
nla_get_u64(tb[NL80211_ATTR_OBSS_COLOR_BITMAP]);
wpa_printf(MSG_DEBUG, "nl80211: BSS color collision - bitmap %08lx",
data.bss_color_collision.bitmap);
wpa_supplicant_event(drv->ctx, EVENT_BSS_COLOR_COLLISION, &data);
}
static void
nl80211_color_change_announcement_started(struct wpa_driver_nl80211_data *drv)
{
union wpa_event_data data = {};
wpa_printf(MSG_DEBUG, "nl80211: CCA started");
wpa_supplicant_event(drv->ctx, EVENT_CCA_STARTED_NOTIFY, &data);
}
static void
nl80211_color_change_announcement_aborted(struct wpa_driver_nl80211_data *drv)
{
union wpa_event_data data = {};
wpa_printf(MSG_DEBUG, "nl80211: CCA aborted");
wpa_supplicant_event(drv->ctx, EVENT_CCA_ABORTED_NOTIFY, &data);
}
static void
nl80211_color_change_announcement_completed(struct wpa_driver_nl80211_data *drv)
{
union wpa_event_data data = {};
wpa_printf(MSG_DEBUG, "nl80211: CCA completed");
wpa_supplicant_event(drv->ctx, EVENT_CCA_NOTIFY, &data);
}
#endif /* CONFIG_IEEE80211AX */
static void do_process_drv_event(struct i802_bss *bss, int cmd, static void do_process_drv_event(struct i802_bss *bss, int cmd,
struct nlattr **tb) struct nlattr **tb)
{ {
@ -3164,6 +3216,20 @@ static void do_process_drv_event(struct i802_bss *bss, int cmd,
nl80211_assoc_comeback(drv, tb[NL80211_ATTR_MAC], nl80211_assoc_comeback(drv, tb[NL80211_ATTR_MAC],
tb[NL80211_ATTR_TIMEOUT]); tb[NL80211_ATTR_TIMEOUT]);
break; break;
#ifdef CONFIG_IEEE80211AX
case NL80211_CMD_OBSS_COLOR_COLLISION:
nl80211_obss_color_collision(drv, tb);
break;
case NL80211_CMD_COLOR_CHANGE_STARTED:
nl80211_color_change_announcement_started(drv);
break;
case NL80211_CMD_COLOR_CHANGE_ABORTED:
nl80211_color_change_announcement_aborted(drv);
break;
case NL80211_CMD_COLOR_CHANGE_COMPLETED:
nl80211_color_change_announcement_completed(drv);
break;
#endif /* CONFIG_IEEE80211AX */
default: default:
wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Ignored unknown event " wpa_dbg(drv->ctx, MSG_DEBUG, "nl80211: Ignored unknown event "
"(cmd=%d)", cmd); "(cmd=%d)", cmd);