From owner-svn-src-all@FreeBSD.ORG Thu Feb 12 18:57:19 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AD3E1065673; Thu, 12 Feb 2009 18:57:19 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5EA598FC2C; Thu, 12 Feb 2009 18:57:19 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n1CIvJOE064585; Thu, 12 Feb 2009 18:57:19 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n1CIvJFs064581; Thu, 12 Feb 2009 18:57:19 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200902121857.n1CIvJFs064581@svn.freebsd.org> From: Andrew Thompson Date: Thu, 12 Feb 2009 18:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r188533 - head/sys/net80211 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Feb 2009 18:57:20 -0000 Author: thompsa Date: Thu Feb 12 18:57:18 2009 New Revision: 188533 URL: http://svn.freebsd.org/changeset/base/188533 Log: Add a ieee80211_waitfor_parent() function that will wait for all deferred parent interface tasks to complete. This had been added to the ioctl path but it is also need elsewhere like detach so its safe to teardown. Reported by: Hans Petter Selasky Submitted by: sam Modified: head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_proto.c head/sys/net80211/ieee80211_proto.h Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Thu Feb 12 18:50:27 2009 (r188532) +++ head/sys/net80211/ieee80211.c Thu Feb 12 18:57:18 2009 (r188533) @@ -289,9 +289,9 @@ ieee80211_ifdetach(struct ieee80211com * struct ifnet *ifp = ic->ic_ifp; struct ieee80211vap *vap; - /* XXX ieee80211_stop_all? */ while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL) ieee80211_vap_destroy(vap); + ieee80211_waitfor_parent(ic); ieee80211_sysctl_detach(ic); ieee80211_regdomain_detach(ic); Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Thu Feb 12 18:50:27 2009 (r188532) +++ head/sys/net80211/ieee80211_ioctl.c Thu Feb 12 18:57:18 2009 (r188533) @@ -3265,7 +3265,7 @@ ieee80211_ioctl(struct ifnet *ifp, u_lon } IEEE80211_UNLOCK(ic); /* Wait for parent ioctl handler if it was queued */ - taskqueue_drain(taskqueue_thread, &ic->ic_parent_task); + ieee80211_waitfor_parent(ic); break; case SIOCADDMULTI: case SIOCDELMULTI: Modified: head/sys/net80211/ieee80211_proto.c ============================================================================== --- head/sys/net80211/ieee80211_proto.c Thu Feb 12 18:50:27 2009 (r188532) +++ head/sys/net80211/ieee80211_proto.c Thu Feb 12 18:57:18 2009 (r188533) @@ -1072,6 +1072,17 @@ parent_updown(void *arg, int npending) } /* + * Block until the parent is in a known state. This is + * used after any operations that dispatch a task (e.g. + * to auto-configure the parent device up/down). + */ +void +ieee80211_waitfor_parent(struct ieee80211com *ic) +{ + taskqueue_drain(taskqueue_thread, &ic->ic_parent_task); +} + +/* * Start a vap running. If this is the first vap to be * set running on the underlying device then we * automatically bring the device up. @@ -1258,6 +1269,8 @@ ieee80211_stop_all(struct ieee80211com * ieee80211_stop_locked(vap); } IEEE80211_UNLOCK(ic); + + ieee80211_waitfor_parent(ic); } /* @@ -1278,6 +1291,8 @@ ieee80211_suspend_all(struct ieee80211co } } IEEE80211_UNLOCK(ic); + + ieee80211_waitfor_parent(ic); } /* Modified: head/sys/net80211/ieee80211_proto.h ============================================================================== --- head/sys/net80211/ieee80211_proto.h Thu Feb 12 18:50:27 2009 (r188532) +++ head/sys/net80211/ieee80211_proto.h Thu Feb 12 18:57:18 2009 (r188533) @@ -260,6 +260,7 @@ ieee80211_gettid(const struct ieee80211_ return tid; } +void ieee80211_waitfor_parent(struct ieee80211com *); void ieee80211_start_locked(struct ieee80211vap *); void ieee80211_init(void *); void ieee80211_start_all(struct ieee80211com *);