commit 64c2d04412281088407bfc614502a61ae5cc9124 Author: Jiri Slaby Date: Wed Jul 11 22:00:19 2007 +0200 set_curmode instead of setting only the sc->curmode diff --git a/ath/if_ath_pci.c b/ath/if_ath_pci.c index c7d6a9e..69bc89a 100644 --- a/ath/if_ath_pci.c +++ b/ath/if_ath_pci.c @@ -738,6 +738,64 @@ static int ath_stop_hw(struct ath_softc *sc) return ret; } +static void ath_setcurmode(struct ath_softc *sc, unsigned int mode) +{ +#ifdef BLE + /* from Atheros NDIS driver, w/ permission */ + static const struct { + u16 rate; /* tx/rx 802.11 rate */ + u16 timeOn; /* LED on time (ms) */ + u16 timeOff; /* LED off time (ms) */ + } blinkrates[] = { + { 108, 40, 10 }, + { 96, 44, 11 }, + { 72, 50, 13 }, + { 48, 57, 14 }, + { 36, 67, 16 }, + { 24, 80, 20 }, + { 22, 100, 25 }, + { 18, 133, 34 }, + { 12, 160, 40 }, + { 10, 200, 50 }, + { 6, 240, 58 }, + { 4, 267, 66 }, + { 2, 400, 100 }, + { 0, 500, 130 } + }; +#endif + const struct ath5k_rate_table* rt=ath5k_hw_get_rate_table(sc->ah, mode); +// unsigned int i, j; + + BUG_ON(rt == NULL); +#ifdef BLE + memset(sc->hwmap, 0, sizeof(sc->hwmap)); + for (i = 0; i < 32; i++) { + u8 ix = rt->rate_code_to_index[i]; + if (ix == 0xff) { + sc->hwmap[i].ledon = msecs_to_jiffies(500); + sc->hwmap[i].ledoff = msecs_to_jiffies(130); + continue; + } + sc->hwmap[i].txflags = IEEE80211_RADIOTAP_F_DATAPAD; + if (SHPREAMBLE_FLAG(ix) || rt->rates[ix].modulation == + MODULATION_OFDM) + sc->hwmap[i].txflags |= IEEE80211_RADIOTAP_F_SHORTPRE; + /* receive frames include FCS */ + sc->hwmap[i].rxflags = sc->hwmap[i].txflags | + IEEE80211_RADIOTAP_F_FCS; + /* setup blink rate table to avoid per-packet lookup */ + for (j = 0; j < ARRAY_SIZE(blinkrates) - 1; j++) + if (blinkrates[j].rate == /* XXX why 7f? */ + (rt->rates[ix].dot11_rate & 0x7f)) + break; + + sc->hwmap[i].ledon = msecs_to_jiffies(blinkrates[j].timeOn); + sc->hwmap[i].ledoff = msecs_to_jiffies(blinkrates[j].timeOff); + } +#endif + sc->curmode = mode; +} + /* * Set/change channels. If the channel is really being changed, * it's done by reseting the chip. To accomplish this we must @@ -908,7 +966,7 @@ static int ath_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) { struct ath_softc *sc = hw->priv; - sc->curmode = conf->phymode; + ath_setcurmode(sc, conf->phymode); return ath_chan_set(sc, conf->chan); } @@ -1213,63 +1271,6 @@ err: return ret; } -static void ath_setcurmode(struct ath_softc *sc, unsigned int mode) -{ - /* from Atheros NDIS driver, w/ permission */ - static const struct { - u16 rate; /* tx/rx 802.11 rate */ - u16 timeOn; /* LED on time (ms) */ - u16 timeOff; /* LED off time (ms) */ - } blinkrates[] = { - { 108, 40, 10 }, - { 96, 44, 11 }, - { 72, 50, 13 }, - { 48, 57, 14 }, - { 36, 67, 16 }, - { 24, 80, 20 }, - { 22, 100, 25 }, - { 18, 133, 34 }, - { 12, 160, 40 }, - { 10, 200, 50 }, - { 6, 240, 58 }, - { 4, 267, 66 }, - { 2, 400, 100 }, - { 0, 500, 130 } - }; - - const struct ath5k_rate_table* rt=ath5k_hw_get_rate_table(sc->ah, mode); - unsigned int i, j; - - BUG_ON(rt == NULL); - - memset(sc->hwmap, 0, sizeof(sc->hwmap)); - for (i = 0; i < 32; i++) { - u8 ix = rt->rate_code_to_index[i]; - if (ix == 0xff) { - sc->hwmap[i].ledon = msecs_to_jiffies(500); - sc->hwmap[i].ledoff = msecs_to_jiffies(130); - continue; - } - sc->hwmap[i].txflags = IEEE80211_RADIOTAP_F_DATAPAD; - if (SHPREAMBLE_FLAG(ix) || rt->rates[ix].modulation == - MODULATION_OFDM) - sc->hwmap[i].txflags |= IEEE80211_RADIOTAP_F_SHORTPRE; - /* receive frames include FCS */ - sc->hwmap[i].rxflags = sc->hwmap[i].txflags | - IEEE80211_RADIOTAP_F_FCS; - /* setup blink rate table to avoid per-packet lookup */ - for (j = 0; j < ARRAY_SIZE(blinkrates) - 1; j++) - if (blinkrates[j].rate == /* XXX why 7f? */ - (rt->rates[ix].dot11_rate & 0x7f)) - break; - - sc->hwmap[i].ledon = msecs_to_jiffies(blinkrates[j].timeOn); - sc->hwmap[i].ledoff = msecs_to_jiffies(blinkrates[j].timeOff); - } - - sc->curmode = mode; -} - static int ath_desc_alloc(struct ath_softc *sc, struct pci_dev *pdev) { struct ath_desc *ds;