[v3,04/15] mesh: use setup completion callback to complete mesh join

Message ID 4c67aef809be850fb78abd378154ce3350f761a7.1524027184.git.peter.oh@bowerswilkins.com
State New
Headers show
Series
  • mesh: enable DFS channels in mesh mode
Related show

Commit Message

Peter Oh April 18, 2018, 4:55 a.m.
From: Peter Oh <peter.oh@bowerswilkins.com>

mesh join function is the last function to be called during
mesh join process, but it's been called a bit earlier than
it's supposed to be, so that some mesh parameter values
such as VHT capabilities not applied correct when mesh join
is in process. Moreover current design of mesh join that is called
directly after mesh initialization is not suitable for DFS channels
to use, since mesh join process should be paused until DFS CAC is
done and resumed once it's done.
Using setup completion callback is how AP mode is using for DFS channels
and mesh can use the same way.
The callback will be called by hostapd_setup_interface_complete_sync.

Signed-off-by: Peter Oh <peter.oh@bowerswilkins.com>
---
 wpa_supplicant/mesh.c | 7 +++++--
 wpa_supplicant/mesh.h | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/wpa_supplicant/mesh.c b/wpa_supplicant/mesh.c
index 8bad38d..edf74ae 100644
--- a/wpa_supplicant/mesh.c
+++ b/wpa_supplicant/mesh.c
@@ -217,6 +217,7 @@  static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
 	if (!ifmsh)
 		return -ENOMEM;
 
+	ifmsh->owner = wpa_s;
 	ifmsh->drv_flags = wpa_s->drv_flags;
 	ifmsh->num_bss = 1;
 	ifmsh->bss = os_calloc(wpa_s->ifmsh->num_bss,
@@ -233,6 +234,8 @@  static int wpa_supplicant_mesh_init(struct wpa_supplicant *wpa_s,
 	bss->drv_priv = wpa_s->drv_priv;
 	bss->iface = ifmsh;
 	bss->mesh_sta_free_cb = mesh_mpm_free_sta;
+	bss->setup_complete_cb = wpas_mesh_complete_cb;
+	bss->setup_complete_cb_ctx = wpa_s;
 	frequency = ssid->frequency;
 	if (frequency != freq->freq &&
 	    frequency == freq->freq + freq->sec_channel_offset * 20) {
@@ -374,8 +377,9 @@  void wpa_supplicant_mesh_add_scan_ie(struct wpa_supplicant *wpa_s,
 }
 
 
-void wpas_join_mesh(struct wpa_supplicant *wpa_s)
+void wpas_mesh_complete_cb(void *ctx)
 {
+	struct wpa_supplicant *wpa_s = (struct wpa_supplicant *)ctx;
 	struct wpa_driver_mesh_join_params *params = wpa_s->mesh_params;
 	struct wpa_ssid *ssid = wpa_s->current_ssid;
 	int ret = 0;
@@ -497,7 +501,6 @@  int wpa_supplicant_join_mesh(struct wpa_supplicant *wpa_s,
 		goto out;
 	}
 
-	wpas_join_mesh(wpa_s);
 out:
 	return ret;
 }
diff --git a/wpa_supplicant/mesh.h b/wpa_supplicant/mesh.h
index 9952102..2e2231b 100644
--- a/wpa_supplicant/mesh.h
+++ b/wpa_supplicant/mesh.h
@@ -21,7 +21,7 @@  int wpas_mesh_add_interface(struct wpa_supplicant *wpa_s, char *ifname,
 int wpas_mesh_peer_remove(struct wpa_supplicant *wpa_s, const u8 *addr);
 int wpas_mesh_peer_add(struct wpa_supplicant *wpa_s, const u8 *addr,
 		       int duration);
-void wpas_join_mesh(struct wpa_supplicant *wpa_s);
+void wpas_mesh_complete_cb(void *ctx);
 int wpas_mesh_init_rsn(struct wpa_supplicant *wpa_s);
 
 #ifdef CONFIG_MESH