From owner-svn-src-head@freebsd.org Tue Oct 27 20:40:59 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5206D8A44; Tue, 27 Oct 2015 20:40:59 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2719019FB; Tue, 27 Oct 2015 20:40:59 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t9RKewD9053827; Tue, 27 Oct 2015 20:40:58 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t9RKevBs053823; Tue, 27 Oct 2015 20:40:57 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201510272040.t9RKevBs053823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Tue, 27 Oct 2015 20:40:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r290058 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2015 20:40:59 -0000 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 */