PERFORCE change 137689 for review

Sam Leffler sam at FreeBSD.org
Fri Mar 14 05:33:23 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=137689

Change 137689 by sam at 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);
 }
 
 /*


More information about the p4-projects mailing list