From owner-p4-projects@FreeBSD.ORG Sun May 4 19:04:12 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A0EAF106573C; Sun, 4 May 2008 19:04:12 +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 C2F13106566B for ; Sun, 4 May 2008 19:04:11 +0000 (UTC) (envelope-from thompsa@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id C37E38FC1F for ; Sun, 4 May 2008 19:04:11 +0000 (UTC) (envelope-from thompsa@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 m44J4Bex067451 for ; Sun, 4 May 2008 19:04:11 GMT (envelope-from thompsa@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m44J4BoU067449 for perforce@freebsd.org; Sun, 4 May 2008 19:04:11 GMT (envelope-from thompsa@freebsd.org) Date: Sun, 4 May 2008 19:04:11 GMT Message-Id: <200805041904.m44J4BoU067449@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to thompsa@freebsd.org using -f From: Andrew Thompson To: Perforce Change Reviews Cc: Subject: PERFORCE change 141154 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: Sun, 04 May 2008 19:04:12 -0000 http://perforce.freebsd.org/chv.cgi?CH=141154 Change 141154 by thompsa@thompsa_burger on 2008/05/04 19:03:39 Associate from a taskq as we can (and will) deadlock on the ndis hal and the com lock. Affected files ... .. //depot/projects/vap/sys/dev/if_ndis/if_ndis.c#20 edit .. //depot/projects/vap/sys/dev/if_ndis/if_ndisvar.h#12 edit Differences ... ==== //depot/projects/vap/sys/dev/if_ndis/if_ndis.c#20 (text+ko) ==== @@ -164,11 +164,13 @@ static void ndis_watchdog (struct ifnet *); static int ndis_ifmedia_upd (struct ifnet *); static void ndis_ifmedia_sts (struct ifnet *, struct ifmediareq *); +static void ndis_auth (void *, int); +static void ndis_assoc (void *, int); static int ndis_get_assoc (struct ndis_softc *, ndis_wlan_bssid_ex **); static int ndis_probe_offload (struct ndis_softc *); static int ndis_set_offload (struct ndis_softc *); static void ndis_getstate_80211 (struct ndis_softc *); -static void ndis_setstate_80211 (struct ndis_softc *); +static void ndis_auth_and_assoc (struct ndis_softc *, struct ieee80211vap *); static int ndis_set_cipher (struct ndis_softc *, int); static int ndis_set_wpa (struct ndis_softc *, void *, int); static int ndis_add_key (struct ieee80211vap *, @@ -714,6 +716,8 @@ taskqueue_start_threads(&sc->ndis_tq, 1, PI_NET, "%s taskq", device_get_nameunit(dev)); TASK_INIT(&sc->ndis_scantask, 0, ndis_scan, sc); + TASK_INIT(&sc->ndis_authtask, 0, ndis_auth, sc); + TASK_INIT(&sc->ndis_assoctask, 0, ndis_assoc, sc); ifp->if_ioctl = ndis_ioctl_80211; ic->ic_ifp = ifp; @@ -1003,8 +1007,11 @@ } else NDIS_UNLOCK(sc); - if (sc->ndis_80211) + if (sc->ndis_80211) { taskqueue_drain(sc->ndis_tq, &sc->ndis_scantask); + taskqueue_drain(sc->ndis_tq, &sc->ndis_authtask); + taskqueue_drain(sc->ndis_tq, &sc->ndis_assoctask); + } if (sc->ndis_tickitem != NULL) IoFreeWorkItem(sc->ndis_tickitem); @@ -2196,11 +2203,35 @@ } static void -ndis_setstate_80211(sc) +ndis_auth(void *arg, int npending) +{ + struct ndis_softc *sc = arg; + struct ifnet *ifp = sc->ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + + vap->iv_state = IEEE80211_S_AUTH; + ndis_auth_and_assoc(sc, vap); +} + +static void +ndis_assoc(void *arg, int npending) +{ + struct ndis_softc *sc = arg; + struct ifnet *ifp = sc->ifp; + struct ieee80211com *ic = ifp->if_l2com; + struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + + vap->iv_state = IEEE80211_S_ASSOC; + ndis_auth_and_assoc(sc, vap); +} + +static void +ndis_auth_and_assoc(sc, vap) struct ndis_softc *sc; + struct ieee80211vap *vap; { struct ieee80211com *ic; - struct ieee80211vap *vap; struct ieee80211_node *ni; ndis_80211_ssid ssid; ndis_80211_macaddr bssid; @@ -2212,7 +2243,6 @@ ifp = sc->ifp; ic = ifp->if_l2com; - vap = TAILQ_FIRST(&ic->ic_vaps); ni = vap->iv_bss; if (!NDIS_INITIALIZED(sc)) { @@ -3131,16 +3161,15 @@ case IEEE80211_S_INIT: case IEEE80211_S_SCAN: return nvp->newstate(vap, nstate, arg); - case IEEE80211_S_ASSOC: - if (ostate != IEEE80211_S_AUTH) - ndis_setstate_80211(sc); + if (ostate != IEEE80211_S_AUTH) { + taskqueue_enqueue(sc->ndis_tq, &sc->ndis_assoctask); + return EINPROGRESS; + } break; - case IEEE80211_S_AUTH: - ndis_setstate_80211(sc); - break; - + taskqueue_enqueue(sc->ndis_tq, &sc->ndis_authtask); + return EINPROGRESS; default: break; } ==== //depot/projects/vap/sys/dev/if_ndis/if_ndisvar.h#12 (text+ko) ==== @@ -177,6 +177,8 @@ struct taskqueue *ndis_tq; /* private task queue */ struct task ndis_scantask; + struct task ndis_authtask; + struct task ndis_assoctask; int (*ndis_newstate)(struct ieee80211com *, enum ieee80211_state, int); };