From owner-p4-projects@FreeBSD.ORG Fri Mar 14 05:33:22 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 525651065673; Fri, 14 Mar 2008 05:33:22 +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 11E52106566B for ; Fri, 14 Mar 2008 05:33:22 +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 F39C98FC14 for ; Fri, 14 Mar 2008 05:33:21 +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 m2E5XLmj097051 for ; Fri, 14 Mar 2008 05:33:21 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m2E5XLQI097049 for perforce@freebsd.org; Fri, 14 Mar 2008 05:33:21 GMT (envelope-from sam@freebsd.org) Date: Fri, 14 Mar 2008 05:33:21 GMT Message-Id: <200803140533.m2E5XLQI097049@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 137689 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, 14 Mar 2008 05:33:23 -0000 http://perforce.freebsd.org/chv.cgi?CH=137689 Change 137689 by sam@sam_ebb on 2008/03/14 05:33:17 o track amrr changes o replace amrr update work from callout with inline rate choosing to avoid races o with amrr updates no longer done from a callout the only left in the callout is the calibration work so set the callout interval to 60 seconds and eliminate the counter o purge some dead obsd code Affected files ... .. //depot/projects/vap/sys/dev/wpi/if_wpi.c#10 edit Differences ... ==== //depot/projects/vap/sys/dev/wpi/if_wpi.c#10 (text+ko) ==== @@ -226,7 +226,6 @@ static void wpi_init_locked(struct wpi_softc *, int); static void wpi_stop(struct wpi_softc *); static void wpi_stop_locked(struct wpi_softc *); -static void wpi_iter_func(void *, struct ieee80211_node *); static void wpi_newassoc(struct ieee80211_node *, int); static int wpi_set_txpower(struct wpi_softc *, struct ieee80211_channel *, @@ -784,7 +783,8 @@ ieee80211_amrr_init(&wvp->amrr, vap, IEEE80211_AMRR_MIN_SUCCESS_THRESHOLD, - IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD); + IEEE80211_AMRR_MAX_SUCCESS_THRESHOLD, + 500 /*ms*/); /* complete setup */ ieee80211_vap_attach(vap, ieee80211_media_change, ieee80211_media_status); @@ -797,6 +797,7 @@ { struct wpi_vap *wvp = WPI_VAP(vap); + ieee80211_amrr_cleanup(&wvp->amrr); ieee80211_vap_detach(vap); free(wvp, M_80211_VAP); } @@ -1884,8 +1885,8 @@ } else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE) { rate = tp->ucastrate; } else { - rate = ni->ni_rates.rs_rates[ni->ni_txrate]; - rate &= IEEE80211_RATE_VAL; + (void) ieee80211_amrr_choose(ni, &WPI_NODE(ni)->amn); + rate = ni->ni_txrate; } tx->rate = wpi_plcp_signal(rate); @@ -2448,7 +2449,7 @@ wpi_set_led(sc, WPI_LED_LINK, 0, 1); /* start automatic rate control timer */ - callout_reset(&sc->calib_to, hz/2, wpi_calib_timeout, sc); + callout_reset(&sc->calib_to, 60*hz, wpi_calib_timeout, sc); return (error); } @@ -3144,62 +3145,27 @@ } static void -wpi_iter_func(void *arg, struct ieee80211_node *ni) -{ - struct ieee80211vap *vap = ni->ni_vap; - struct wpi_vap *wvp = WPI_VAP(vap); - - ieee80211_amrr_choose(&wvp->amrr, ni, &WPI_NODE(ni)->amn); -} - -static void wpi_newassoc(struct ieee80211_node *ni, int isnew) { struct ieee80211vap *vap = ni->ni_vap; struct wpi_vap *wvp = WPI_VAP(vap); - int i; - ieee80211_amrr_node_init(&wvp->amrr, &WPI_NODE(ni)->amn); - - for (i = ni->ni_rates.rs_nrates - 1; - i > 0 && (ni->ni_rates.rs_rates[i] & IEEE80211_RATE_VAL) > 72; - i--); - ni->ni_txrate = i; + ieee80211_amrr_node_init(&wvp->amrr, &WPI_NODE(ni)->amn, ni); } static void wpi_calib_timeout(void *arg) { struct wpi_softc *sc = arg; - struct ieee80211com *ic = &sc->sc_ic; - struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps); - const struct ieee80211_txparam *tp; int temp; - /* automatic rate control triggered every 500ms */ - tp = &vap->iv_txparms[ieee80211_chan2mode(vap->iv_bss->ni_chan)]; - if (tp->ucastrate == IEEE80211_FIXED_RATE_NONE) { - if (vap->iv_opmode == IEEE80211_M_STA) - wpi_iter_func(sc, vap->iv_bss); - else - ieee80211_iterate_nodes(&ic->ic_sta, wpi_iter_func, sc); - } - /* update sensor data */ temp = (int)WPI_READ(sc, WPI_TEMPERATURE); DPRINTFN(WPI_DEBUG_TEMP,("Temp in calibration is: %d\n", temp)); -#if 0 - //XXX Used by OpenBSD Sensor Framework - sc->sensor.value = temp + 260; -#endif - /* automatic power calibration every 60s */ - if (++sc->calib_cnt >= 120) { - wpi_power_calibration(sc, temp); - sc->calib_cnt = 0; - } + wpi_power_calibration(sc, temp); - callout_reset(&sc->calib_to, hz/2, wpi_calib_timeout, sc); + callout_reset(&sc->calib_to, 60*hz, wpi_calib_timeout, sc); } /*