From owner-p4-projects@FreeBSD.ORG Thu Apr 3 16:23:26 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 876D71065678; Thu, 3 Apr 2008 16:23:26 +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 49A681065675 for ; Thu, 3 Apr 2008 16:23:26 +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 33E158FC20 for ; Thu, 3 Apr 2008 16:23:26 +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 m33GNQ0l085074 for ; Thu, 3 Apr 2008 16:23:26 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m33GNQEp085072 for perforce@freebsd.org; Thu, 3 Apr 2008 16:23:26 GMT (envelope-from sam@freebsd.org) Date: Thu, 3 Apr 2008 16:23:26 GMT Message-Id: <200804031623.m33GNQEp085072@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 139270 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: Thu, 03 Apr 2008 16:23:26 -0000 http://perforce.freebsd.org/chv.cgi?CH=139270 Change 139270 by sam@sam_ebb on 2008/04/03 16:23:11 defer net80211 state machine callbacks from interrupt context to taskqueue_swi to eliminate LOR's Affected files ... .. //depot/projects/vap/sys/dev/wi/if_wi.c#23 edit .. //depot/projects/vap/sys/dev/wi/if_wivar.h#15 edit Differences ... ==== //depot/projects/vap/sys/dev/wi/if_wi.c#23 (text+ko) ==== @@ -78,6 +78,7 @@ #include #include #include +#include #include #include @@ -131,6 +132,11 @@ static void wi_rx_intr(struct wi_softc *); static void wi_tx_intr(struct wi_softc *); static void wi_tx_ex_intr(struct wi_softc *); + +static void wi_status_connected(void *, int); +static void wi_status_disconnected(void *, int); +static void wi_status_oor(void *, int); +static void wi_status_assoc_failed(void *, int); static void wi_info_intr(struct wi_softc *); static int wi_write_txrate(struct wi_softc *, struct ieee80211vap *); @@ -431,6 +437,7 @@ } sc->sc_portnum = WI_DEFAULT_PORT; + TASK_INIT(&sc->sc_oor_task, 0, wi_status_oor, ic); ieee80211_ifattach(ic); ic->ic_raw_xmit = wi_raw_xmit; @@ -506,6 +513,7 @@ M_80211_VAP, M_NOWAIT | M_ZERO); if (wvp == NULL) return NULL; + vap = &wvp->wv_vap; ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac); @@ -540,6 +548,10 @@ break; } + TASK_INIT(&wvp->wv_connected_task, 0, wi_status_connected, vap); + TASK_INIT(&wvp->wv_disconnected_task, 0, wi_status_disconnected, vap); + TASK_INIT(&wvp->wv_assoc_failed_task, 0, wi_status_assoc_failed, vap); + /* complete setup */ ieee80211_vap_attach(vap, ieee80211_media_change, wi_media_status); ic->ic_opmode = opmode; @@ -1447,11 +1459,52 @@ } } +static void +wi_status_connected(void *arg, int pending) +{ + struct ieee80211vap *vap = arg; + struct ieee80211com *ic = vap->iv_ic; + + IEEE80211_LOCK(ic); + WI_VAP(vap)->wv_newstate(vap, IEEE80211_S_RUN, 0); + if (vap->iv_newstate_cb != NULL) + vap->iv_newstate_cb(vap, IEEE80211_S_RUN, 0); + IEEE80211_UNLOCK(ic); +} + +static void +wi_status_disconnected(void *arg, int pending) +{ + struct ieee80211vap *vap = arg; + + if (vap->iv_state == IEEE80211_S_RUN) { + vap->iv_stats.is_rx_deauth++; + ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); + } +} + +static void +wi_status_oor(void *arg, int pending) +{ + struct ieee80211com *ic = arg; + + ieee80211_beacon_miss(ic); +} + +static void +wi_status_assoc_failed(void *arg, int pending) +{ + struct ieee80211vap *vap = arg; + + ieee80211_new_state(vap, IEEE80211_S_SCAN, IEEE80211_SCAN_FAIL_TIMEOUT); +} + static __noinline void wi_info_intr(struct wi_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); + struct wi_vap *wvp = WI_VAP(vap); struct ifnet *ifp = sc->sc_ifp; int i, fid, len, off; u_int16_t ltbuf[2]; @@ -1472,28 +1525,22 @@ break; /* fall thru... */ case WI_INFO_LINK_STAT_AP_CHG: - IEEE80211_LOCK(ic); - WI_VAP(vap)->wv_newstate(vap, IEEE80211_S_RUN, 0); - if (vap->iv_newstate_cb != NULL) - vap->iv_newstate_cb(vap, IEEE80211_S_RUN, 0); - IEEE80211_UNLOCK(ic); + taskqueue_enqueue(taskqueue_swi, &wvp->wv_connected_task); break; case WI_INFO_LINK_STAT_AP_INR: break; case WI_INFO_LINK_STAT_DISCONNECTED: /* we dropped off the net; e.g. due to deauth/disassoc */ - if (vap->iv_state == IEEE80211_S_RUN) { - vap->iv_stats.is_rx_deauth++; - ieee80211_new_state(vap, IEEE80211_S_SCAN, 0); - } + taskqueue_enqueue(taskqueue_swi, &wvp->wv_disconnected_task); break; case WI_INFO_LINK_STAT_AP_OOR: - ieee80211_beacon_miss(ic); + /* XXX does this need to be per-vap? */ + taskqueue_enqueue(taskqueue_swi, &sc->sc_oor_task); break; case WI_INFO_LINK_STAT_ASSOC_FAILED: if (vap->iv_opmode == IEEE80211_M_STA) - ieee80211_new_state(vap, IEEE80211_S_SCAN, - IEEE80211_SCAN_FAIL_TIMEOUT); + taskqueue_enqueue(taskqueue_swi, + &wvp->wv_assoc_failed_task); break; } break; ==== //depot/projects/vap/sys/dev/wi/if_wivar.h#15 (text+ko) ==== @@ -59,6 +59,9 @@ struct wi_vap { struct ieee80211vap wv_vap; struct ieee80211_beacon_offsets wv_bo; + struct task wv_connected_task; + struct task wv_disconnected_task; + struct task wv_assoc_failed_task; void (*wv_recv_mgmt)(struct ieee80211_node *, struct mbuf *, int, int, int, u_int32_t); @@ -73,6 +76,7 @@ device_t sc_dev; struct mtx sc_mtx; struct callout sc_watchdog; + struct task sc_oor_task; int sc_unit; int wi_gone; int sc_enabled;