Date: Sun, 4 May 2008 19:04:11 GMT From: Andrew Thompson <thompsa@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 141154 for review Message-ID: <200805041904.m44J4BoU067449@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805041904.m44J4BoU067449>