Index: head/sys/net80211/ieee80211.c =================================================================== --- head/sys/net80211/ieee80211.c +++ head/sys/net80211/ieee80211.c @@ -356,6 +356,8 @@ LIST_REMOVE(ic, ic_next); mtx_unlock(&ic_list_mtx); + taskqueue_drain(taskqueue_thread, &ic->ic_restart_task); + /* * The VAP is responsible for setting and clearing * the VIMAGE context. Index: head/sys/net80211/ieee80211_proto.h =================================================================== --- head/sys/net80211/ieee80211_proto.h +++ head/sys/net80211/ieee80211_proto.h @@ -307,6 +307,7 @@ void ieee80211_stop_all(struct ieee80211com *); void ieee80211_suspend_all(struct ieee80211com *); void ieee80211_resume_all(struct ieee80211com *); +void ieee80211_restart_all(struct ieee80211com *); void ieee80211_dturbo_switch(struct ieee80211vap *, int newflags); void ieee80211_swbmiss(void *arg); void ieee80211_beacon_miss(struct ieee80211com *); Index: head/sys/net80211/ieee80211_proto.c =================================================================== --- head/sys/net80211/ieee80211_proto.c +++ head/sys/net80211/ieee80211_proto.c @@ -108,6 +108,7 @@ static void update_channel(void *, int); static void update_chw(void *, int); static void update_wme(void *, int); +static void restart_vaps(void *, int); static void ieee80211_newstate_cb(void *, int); static int @@ -146,6 +147,7 @@ TASK_INIT(&ic->ic_bmiss_task, 0, beacon_miss, ic); TASK_INIT(&ic->ic_chw_task, 0, update_chw, ic); TASK_INIT(&ic->ic_wme_task, 0, update_wme, ic); + TASK_INIT(&ic->ic_restart_task, 0, restart_vaps, ic); ic->ic_wme.wme_hipri_switch_hysteresis = AGGRESSIVE_MODE_SWITCH_HYSTERESIS; @@ -1212,6 +1214,15 @@ ic->ic_wme.wme_update(ic); } +static void +restart_vaps(void *arg, int npending) +{ + struct ieee80211com *ic = arg; + + ieee80211_suspend_all(ic); + ieee80211_resume_all(ic); +} + /* * Block until the parent is in a known state. This is * used after any operations that dispatch a task (e.g. @@ -1486,6 +1497,19 @@ IEEE80211_UNLOCK(ic); } +/* + * Restart all vap's running on a device. + */ +void +ieee80211_restart_all(struct ieee80211com *ic) +{ + /* + * NB: do not use ieee80211_runtask here, we will + * block & drain net80211 taskqueue. + */ + taskqueue_enqueue(taskqueue_thread, &ic->ic_restart_task); +} + void ieee80211_beacon_miss(struct ieee80211com *ic) { Index: head/sys/net80211/ieee80211_var.h =================================================================== --- head/sys/net80211/ieee80211_var.h +++ head/sys/net80211/ieee80211_var.h @@ -134,6 +134,7 @@ struct task ic_bmiss_task; /* deferred beacon miss hndlr */ struct task ic_chw_task; /* deferred HT CHW update */ struct task ic_wme_task; /* deferred WME update */ + struct task ic_restart_task; /* deferred device restart */ counter_u64_t ic_ierrors; /* input errors */ counter_u64_t ic_oerrors; /* output errors */