Date: Tue, 27 May 2008 18:50:59 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 142399 for review Message-ID: <200805271850.m4RIox6j023590@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=142399 Change 142399 by sam@sam_ebb on 2008/05/27 18:50:10 Simplify softled support a bit: o eliminate ATH_LED_* enum, just pass the rate index in, the work is the same regardless and eliminates the need for sc_rxrate o record the tx rate index instead of the rate code; when 11n support shows up we'll be dealing with indices anyway Affected files ... .. //depot/projects/vap/sys/dev/ath/if_ath.c#80 edit .. //depot/projects/vap/sys/dev/ath/if_athvar.h#26 edit Differences ... ==== //depot/projects/vap/sys/dev/ath/if_ath.c#80 (text+ko) ==== @@ -114,12 +114,6 @@ ((((u_int8_t *)(p))[0] ) | (((u_int8_t *)(p))[1] << 8) | \ (((u_int8_t *)(p))[2] << 16) | (((u_int8_t *)(p))[3] << 24))) -enum { - ATH_LED_TX, - ATH_LED_RX, - ATH_LED_POLL, -}; - static struct ieee80211vap *ath_vap_create(struct ieee80211com *, const char name[IFNAMSIZ], int unit, int opmode, int flags, const uint8_t bssid[IEEE80211_ADDR_LEN], @@ -3864,7 +3858,7 @@ { #define CHANNEL_HT (CHANNEL_HT20|CHANNEL_HT40PLUS|CHANNEL_HT40MINUS) struct ath_softc *sc = ifp->if_softc; - u_int8_t rix; + uint8_t rxrate; /* * Discard anything shorter than an ack or cts. @@ -3875,9 +3869,9 @@ sc->sc_stats.ast_rx_tooshort++; return 0; } - rix = rs->rs_rate; - sc->sc_rx_th.wr_rate = sc->sc_hwmap[rix].ieeerate; - sc->sc_rx_th.wr_flags = sc->sc_hwmap[rix].rxflags; + rxrate = rs->rs_rate; + sc->sc_rx_th.wr_rate = sc->sc_hwmap[rxrate].ieeerate; + sc->sc_rx_th.wr_flags = sc->sc_hwmap[rxrate].rxflags; #if HAL_ABI_VERSION >= 0x07050400 if (sc->sc_curchan.channelFlags & CHANNEL_HT) { /* @@ -4199,10 +4193,11 @@ * periodic beacon frames to trigger the poll event. */ if (type == IEEE80211_FC0_TYPE_DATA) { - sc->sc_rxrate = rs->rs_rate; - ath_led_event(sc, ATH_LED_RX); + const HAL_RATE_TABLE *rt = sc->sc_currates; + ath_led_event(sc, + rt->rateCodeToIndex[rs->rs_rate]); } else if (ticks - sc->sc_ledevent >= sc->sc_ledidle) - ath_led_event(sc, ATH_LED_POLL); + ath_led_event(sc, 0); } rx_next: STAILQ_INSERT_TAIL(&sc->sc_rxbuf, bf, bf_list); @@ -4723,7 +4718,7 @@ } else { ath_rate_findrate(sc, an, shortPreamble, pktlen, &rix, &try0, &txrate); - sc->sc_txrate = txrate; /* for LED blinking */ + sc->sc_txrix = rix; /* for LED blinking */ sc->sc_lastdatarix = rix; /* for fast frames */ if (try0 != ATH_TXMAXTRY) ismrr = 1; @@ -5103,7 +5098,7 @@ ifp->if_timer = 0; if (sc->sc_softled) - ath_led_event(sc, ATH_LED_TX); + ath_led_event(sc, sc->sc_txrix); ath_start(ifp); } @@ -5140,7 +5135,7 @@ ifp->if_timer = 0; if (sc->sc_softled) - ath_led_event(sc, ATH_LED_TX); + ath_led_event(sc, sc->sc_txrix); ath_start(ifp); } @@ -5169,7 +5164,7 @@ ifp->if_timer = 0; if (sc->sc_softled) - ath_led_event(sc, ATH_LED_TX); + ath_led_event(sc, sc->sc_txrix); ath_start(ifp); } @@ -6047,26 +6042,16 @@ } static void -ath_led_event(struct ath_softc *sc, int event) +ath_led_event(struct ath_softc *sc, int rix) { + uint8_t code; sc->sc_ledevent = ticks; /* time of last event */ if (sc->sc_blinking) /* don't interrupt active blink */ return; - switch (event) { - case ATH_LED_POLL: - ath_led_blink(sc, sc->sc_hwmap[0].ledon, - sc->sc_hwmap[0].ledoff); - break; - case ATH_LED_TX: - ath_led_blink(sc, sc->sc_hwmap[sc->sc_txrate].ledon, - sc->sc_hwmap[sc->sc_txrate].ledoff); - break; - case ATH_LED_RX: - ath_led_blink(sc, sc->sc_hwmap[sc->sc_rxrate].ledon, - sc->sc_hwmap[sc->sc_rxrate].ledoff); - break; - } + /* temp write-around before we change sc_hwmap */ + code = sc->sc_currates->info[rix].rateCode; + ath_led_blink(sc, sc->sc_hwmap[code].ledon, sc->sc_hwmap[code].ledoff); } static int @@ -6318,6 +6303,7 @@ struct ath_softc *sc = ifp->if_softc; struct ieee80211com *ic = ifp->if_l2com; struct ifreq *ifr = (struct ifreq *)data; + const HAL_RATE_TABLE *rt; int error = 0; switch (cmd) { @@ -6364,7 +6350,8 @@ ieee80211_getsignal(ic, &sc->sc_stats.ast_rx_rssi, &sc->sc_stats.ast_rx_noise); #endif - sc->sc_stats.ast_tx_rate = sc->sc_hwmap[sc->sc_txrate].ieeerate; + rt = sc->sc_currates; + sc->sc_stats.ast_tx_rate = rt->info[sc->sc_txrix].dot11Rate; return copyout(&sc->sc_stats, ifr->ifr_data, sizeof (sc->sc_stats)); #ifdef ATH_DIAGAPI @@ -6843,7 +6830,7 @@ txrate = rt->info[rix].rateCode; if (params->ibp_flags & IEEE80211_BPF_SHORTPRE) txrate |= rt->info[rix].shortPreamble; - sc->sc_txrate = txrate; + sc->sc_txrix = rix; try0 = params->ibp_try0; ismrr = (params->ibp_try1 != 0); txantenna = params->ibp_pri >> 2; ==== //depot/projects/vap/sys/dev/ath/if_athvar.h#26 (text+ko) ==== @@ -282,8 +282,7 @@ u_int sc_ledon; /* pin setting for LED on */ u_int sc_ledidle; /* idle polling interval */ int sc_ledevent; /* time of last LED event */ - u_int8_t sc_rxrate; /* current rx rate for LED */ - u_int8_t sc_txrate; /* current tx rate for LED */ + u_int8_t sc_txrix; /* current tx rate for LED */ u_int16_t sc_ledoff; /* off time for current blink */ struct callout sc_ledtimer; /* led off timer */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805271850.m4RIox6j023590>