From owner-p4-projects@FreeBSD.ORG Fri Apr 18 18:44:04 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6F97E1065674; Fri, 18 Apr 2008 18:44:04 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30EBD106566B for ; Fri, 18 Apr 2008 18:44:04 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 1D2898FC17 for ; Fri, 18 Apr 2008 18:44:04 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m3IIi4wI061963 for ; Fri, 18 Apr 2008 18:44:04 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m3IIi3XV061961 for perforce@freebsd.org; Fri, 18 Apr 2008 18:44:03 GMT (envelope-from sam@freebsd.org) Date: Fri, 18 Apr 2008 18:44:03 GMT Message-Id: <200804181844.m3IIi3XV061961@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 140220 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Apr 2008 18:44:04 -0000 http://perforce.freebsd.org/chv.cgi?CH=140220 Change 140220 by sam@sam_ebb on 2008/04/18 18:43:38 Cleanup stop handling the same way as init: defer the parent ioctl op to the taskq so we can avoid dropping the com lock. This also eliminates the bogus futzing of the parent's running flag to avoid problems. Also move taskq ops to run in a thread instead of a swi so the driver has a blocking context. We're likely to add our own thread to help with other issues at which point we can do these operations there. Affected files ... .. //depot/projects/vap/sys/net80211/ieee80211_proto.c#29 edit Differences ... ==== //depot/projects/vap/sys/net80211/ieee80211_proto.c#29 (text+ko) ==== @@ -96,7 +96,7 @@ "WME_UPSD", }; -static void parent_up(void *, int); +static void parent_updown(void *, int); static int ieee80211_new_state_locked(struct ieee80211vap *, enum ieee80211_state, int); @@ -130,7 +130,7 @@ } ic->ic_protmode = IEEE80211_PROT_CTSONLY; - TASK_INIT(&ic->ic_parent_task, 0, parent_up, ifp); + TASK_INIT(&ic->ic_parent_task, 0, parent_updown, ifp); ic->ic_wme.wme_hipri_switch_hysteresis = AGGRESSIVE_MODE_SWITCH_HYSTERESIS; @@ -1064,7 +1064,7 @@ } static void -parent_up(void *arg, int npending) +parent_updown(void *arg, int npending) { struct ifnet *parent = arg; @@ -1109,7 +1109,7 @@ IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, "%s: up parent %s\n", __func__, parent->if_xname); parent->if_flags |= IFF_UP; - taskqueue_enqueue(taskqueue_swi, &ic->ic_parent_task); + taskqueue_enqueue(taskqueue_thread, &ic->ic_parent_task); return; } } @@ -1228,10 +1228,7 @@ IEEE80211_MSG_STATE | IEEE80211_MSG_DEBUG, "down parent %s\n", parent->if_xname); parent->if_flags &= ~IFF_UP; - /* XXX must drop lock */ - IEEE80211_UNLOCK(ic); - parent->if_ioctl(parent, SIOCSIFFLAGS, NULL); - IEEE80211_LOCK(ic); + taskqueue_enqueue(taskqueue_thread, &ic->ic_parent_task); } } } @@ -1252,22 +1249,13 @@ void ieee80211_stop_all(struct ieee80211com *ic) { - struct ifnet *parent = ic->ic_ifp; struct ieee80211vap *vap; IEEE80211_LOCK(ic); - /* XXX why do we do this? */ - /* XXX shouldn't touch driver state */ - parent->if_drv_flags &= ~IFF_DRV_RUNNING; TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { struct ifnet *ifp = vap->iv_ifp; - if (IFNET_IS_UP_RUNNING(ifp)) { /* NB: avoid recursion */ - /* - * NB: since parent is marked !RUNNING - * this won't drop com lock - */ + if (IFNET_IS_UP_RUNNING(ifp)) /* NB: avoid recursion */ ieee80211_stop_locked(vap); - } } IEEE80211_UNLOCK(ic); }