Skip to content

Commit

Permalink
zephyr: Add support of EVENT_SIGNAL_CHANGE for roaming
Browse files Browse the repository at this point in the history
Added EVENT_SIGNAL_CHANGE support to trigger roaming.
Generated events to upload Neighbor Reports to glue layer.

Signed-off-by: Hui Bai <hui.bai@nxp.com>
  • Loading branch information
nxf58150 committed Sep 27, 2024
1 parent 0af01e1 commit 0d71d3a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/drivers/driver_zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,12 @@ static void wpa_drv_zep_event_dfs_cac_finished(struct zep_drv_if_ctx *if_ctx, un
wpa_supplicant_event_wrapper(if_ctx->supp_if_ctx, EVENT_DFS_CAC_FINISHED, event);
}

static void wpa_drv_zep_event_signal_change(struct zep_drv_if_ctx *if_ctx,
union wpa_event_data *event)
{
wpa_supplicant_event_wrapper(if_ctx->supp_if_ctx, EVENT_SIGNAL_CHANGE, event);
}

static struct hostapd_hw_modes *
wpa_driver_wpa_supp_postprocess_modes(struct hostapd_hw_modes *modes,
u16 *num_modes)
Expand Down Expand Up @@ -1231,6 +1237,7 @@ static void *wpa_drv_zep_init(void *ctx,
callbk_fns.chan_list_changed = wpa_drv_zep_event_chan_list_changed;
callbk_fns.mac_changed = wpa_drv_zep_event_mac_changed;
callbk_fns.ecsa_complete = wpa_drv_zep_event_ecsa_complete;
callbk_fns.signal_change = wpa_drv_zep_event_signal_change;

if_ctx->dev_priv = dev_ops->init(if_ctx,
ifname,
Expand Down
3 changes: 3 additions & 0 deletions src/drivers/driver_zephyr.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ struct zep_wpa_supp_dev_callbk_fns {

void (*dfs_cac_finished)(struct zep_drv_if_ctx *if_ctx,
union wpa_event_data *event);

void (*signal_change)(struct zep_drv_if_ctx *if_ctx,
union wpa_event_data *event);
};

struct zep_hostapd_dev_callbk_fns
Expand Down
8 changes: 8 additions & 0 deletions wpa_supplicant/ctrl_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
#include <net/if_ether.h>
#elif defined(__ZEPHYR__)
#include <zephyr/net/ethernet.h>
#include <supp_events.h>
#endif

static int wpa_supplicant_global_iface_list(struct wpa_global *global,
Expand Down Expand Up @@ -10309,6 +10310,13 @@ static void wpas_ctrl_neighbor_rep_cb(void *ctx, struct wpabuf *neighbor_rep)
len -= 2 + nr_len;
}

#ifdef __ZEPHYR__
supplicant_send_wifi_mgmt_event(wpa_s->ifname,
NET_EVENT_WIFI_CMD_NEIGHBOR_REP_COMPLETE,
(void *)wpa_s->current_ssid->ssid,
wpa_s->current_ssid->ssid_len);
#endif

out:
wpabuf_free(neighbor_rep);
}
Expand Down
12 changes: 11 additions & 1 deletion wpa_supplicant/wpa_cli_zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,19 @@ static void wpa_cli_recv_pending(struct wpa_ctrl *ctrl, struct wpa_supplicant *w
if (msg->msg_len > 0) {
/* Only interested in CTRL-EVENTs */
if (strncmp(msg->msg, "CTRL-EVENT", 10) == 0) {
supplicant_send_wifi_mgmt_event(wpa_s->ifname,
if (strncmp(msg->msg, "CTRL-EVENT-SIGNAL-CHANGE", 24) == 0) {
supplicant_send_wifi_mgmt_event(wpa_s->ifname,
NET_EVENT_WIFI_CMD_SIGNAL_CHANGE,
msg->msg, msg->msg_len);
} else {
supplicant_send_wifi_mgmt_event(wpa_s->ifname,
NET_EVENT_SUPPLICANT_CMD_INT_EVENT,
msg->msg, msg->msg_len);
}
} else if (strncmp(msg->msg, "RRM-NEIGHBOR-REP-RECEIVED", 25) == 0) {
supplicant_send_wifi_mgmt_event(wpa_s->ifname,
NET_EVENT_WIFI_CMD_NEIGHBOR_REP_RECEIVED,
msg->msg, msg->msg_len);
}
}
} else {
Expand Down

0 comments on commit 0d71d3a

Please sign in to comment.