Author: avos
Date: Tue Oct 27 20:40:57 2015
New Revision: 290058
URL: https://svnweb.freebsd.org/changeset/base/290058

Log:
  net80211: add ieee80211_restart_all() call.
  
  This call may be used when device cannot continue to operate normally
  (e.g., throws firmware error, watchdog timer expires)
  and need to be restarted.
  
  Approved by:  adrian (mentor)
  Differential Revision:        https://reviews.freebsd.org/D3998

Modified:
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_proto.c
  head/sys/net80211/ieee80211_proto.h
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/net80211/ieee80211.c
==============================================================================
--- head/sys/net80211/ieee80211.c       Tue Oct 27 20:40:19 2015        
(r290057)
+++ head/sys/net80211/ieee80211.c       Tue Oct 27 20:40:57 2015        
(r290058)
@@ -356,6 +356,8 @@ ieee80211_ifdetach(struct ieee80211com *
        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.

Modified: head/sys/net80211/ieee80211_proto.c
==============================================================================
--- head/sys/net80211/ieee80211_proto.c Tue Oct 27 20:40:19 2015        
(r290057)
+++ head/sys/net80211/ieee80211_proto.c Tue Oct 27 20:40:57 2015        
(r290058)
@@ -108,6 +108,7 @@ static void update_promisc(void *, int);
 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 @@ ieee80211_proto_attach(struct ieee80211c
        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 @@ update_wme(void *arg, int npending)
        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_resume_all(struct ieee80211com
        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)
 {

Modified: head/sys/net80211/ieee80211_proto.h
==============================================================================
--- head/sys/net80211/ieee80211_proto.h Tue Oct 27 20:40:19 2015        
(r290057)
+++ head/sys/net80211/ieee80211_proto.h Tue Oct 27 20:40:57 2015        
(r290058)
@@ -307,6 +307,7 @@ void        ieee80211_stop(struct ieee80211vap 
 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 *);

Modified: head/sys/net80211/ieee80211_var.h
==============================================================================
--- head/sys/net80211/ieee80211_var.h   Tue Oct 27 20:40:19 2015        
(r290057)
+++ head/sys/net80211/ieee80211_var.h   Tue Oct 27 20:40:57 2015        
(r290058)
@@ -134,6 +134,7 @@ struct ieee80211com {
        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 */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to