Loading drivers/net/wireless/ath9k/ath9k.h +3 −23 Original line number Diff line number Diff line Loading @@ -401,22 +401,6 @@ enum ath9k_int { ATH9K_INT_NOCARD = 0xffffffff }; struct ath9k_rate_table { int rateCount; u8 rateCodeToIndex[256]; struct { u8 valid; u8 phy; u32 rateKbps; u8 rateCode; u8 shortPreamble; u8 dot11Rate; u8 controlRate; u16 lpAckDuration; u16 spAckDuration; } info[32]; }; #define ATH9K_RATESERIES_RTS_CTS 0x0001 #define ATH9K_RATESERIES_2040 0x0002 #define ATH9K_RATESERIES_HALFGI 0x0004 Loading Loading @@ -828,6 +812,8 @@ struct chan_centers { u16 ext_center; }; struct ath_rate_table; /* Helpers */ enum wireless_mode ath9k_hw_chan2wmode(struct ath_hal *ah, Loading @@ -838,7 +824,7 @@ bool ath9k_get_channel_edges(struct ath_hal *ah, u16 flags, u16 *low, u16 *high); u16 ath9k_hw_computetxtime(struct ath_hal *ah, const struct ath9k_rate_table *rates, struct ath_rate_table *rates, u32 frameLen, u16 rateix, bool shortPreamble); u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags); Loading Loading @@ -883,12 +869,6 @@ void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore); void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period); void ath9k_hw_set_sta_beacon_timers(struct ath_hal *ah, const struct ath9k_beacon_state *bs); /* Rate table */ const struct ath9k_rate_table *ath9k_hw_getratetable(struct ath_hal *ah, u32 mode); /* HW Capabilities */ bool ath9k_hw_fill_cap_info(struct ath_hal *ah); Loading drivers/net/wireless/ath9k/beacon.c +4 −4 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_hal *ah = sc->sc_ah; struct ath_desc *ds; struct ath9k_11n_rate_series series[4]; const struct ath9k_rate_table *rt; struct ath_rate_table *rt; int flags, antenna; u8 rix, rate; int ctsrate = 0; Loading Loading @@ -106,10 +106,10 @@ static void ath_beacon_setup(struct ath_softc *sc, * XXX everything at min xmit rate */ rix = 0; rt = sc->sc_currates; rate = rt->info[rix].rateCode; rt = sc->hw_rate_table[sc->sc_curmode]; rate = rt->info[rix].ratecode; if (sc->sc_flags & SC_OP_PREAMBLE_SHORT) rate |= rt->info[rix].shortPreamble; rate |= rt->info[rix].short_preamble; ath9k_hw_set11n_txdesc(ah, ds, skb->len + FCS_LEN, /* frame length */ Loading drivers/net/wireless/ath9k/core.c +9 −43 Original line number Diff line number Diff line Loading @@ -80,38 +80,9 @@ static u8 parse_mpdudensity(u8 mpdudensity) /* * Set current operating mode * * This function initializes and fills the rate table in the ATH object based * on the operating mode. */ static void ath_setcurmode(struct ath_softc *sc, enum wireless_mode mode) { const struct ath9k_rate_table *rt; int i; rt = ath9k_hw_getratetable(sc->sc_ah, mode); BUG_ON(!rt); memset(sc->sc_hwmap, 0, sizeof(sc->sc_hwmap)); for (i = 0; i < 256; i++) { u8 ix = rt->rateCodeToIndex[i]; if (ix == 0xff) continue; sc->sc_hwmap[i].ieeerate = rt->info[ix].dot11Rate & IEEE80211_RATE_VAL; sc->sc_hwmap[i].rateKbps = rt->info[ix].rateKbps; if (rt->info[ix].shortPreamble || rt->info[ix].phy == PHY_OFDM) { /* XXX: Handle this */ } /* NB: this uses the last entry if the rate isn't found */ /* XXX beware of overlow */ } sc->sc_currates = rt; sc->sc_curmode = mode; /* * All protection frames are transmited at 2Mb/s for Loading @@ -126,37 +97,36 @@ static void ath_setcurmode(struct ath_softc *sc, enum wireless_mode mode) */ static void ath_setup_rates(struct ath_softc *sc, enum ieee80211_band band) { struct ath_hal *ah = sc->sc_ah; const struct ath9k_rate_table *rt = NULL; struct ath_rate_table *rate_table = NULL; struct ieee80211_supported_band *sband; struct ieee80211_rate *rate; int i, maxrates; switch (band) { case IEEE80211_BAND_2GHZ: rt = ath9k_hw_getratetable(ah, ATH9K_MODE_11G); rate_table = sc->hw_rate_table[ATH9K_MODE_11G]; break; case IEEE80211_BAND_5GHZ: rt = ath9k_hw_getratetable(ah, ATH9K_MODE_11A); rate_table = sc->hw_rate_table[ATH9K_MODE_11A]; break; default: break; } if (rt == NULL) if (rate_table == NULL) return; sband = &sc->sbands[band]; rate = sc->rates[band]; if (rt->rateCount > ATH_RATE_MAX) if (rate_table->rate_cnt > ATH_RATE_MAX) maxrates = ATH_RATE_MAX; else maxrates = rt->rateCount; maxrates = rate_table->rate_cnt; for (i = 0; i < maxrates; i++) { rate[i].bitrate = rt->info[i].rateKbps / 100; rate[i].hw_value = rt->info[i].rateCode; rate[i].bitrate = rate_table->info[i].ratekbps / 100; rate[i].hw_value = rate_table->info[i].ratecode; sband->n_bitrates++; DPRINTF(sc, ATH_DBG_CONFIG, "%s: Rate: %2dMbps, ratecode: %2d\n", Loading Loading @@ -1000,12 +970,10 @@ int ath_init(u16 devid, struct ath_softc *sc) /* Setup rate tables */ ath_rate_attach(sc); ath_setup_rates(sc, IEEE80211_BAND_2GHZ); ath_setup_rates(sc, IEEE80211_BAND_5GHZ); /* NB: setup here so ath_rate_update is happy */ ath_setcurmode(sc, ATH9K_MODE_11A); /* * Allocate hardware transmit queues: one queue for * beacon frames and one data queue for each QoS Loading Loading @@ -1071,8 +1039,6 @@ int ath_init(u16 devid, struct ath_softc *sc) sc->sc_ani.sc_noise_floor = ATH_DEFAULT_NOISE_FLOOR; setup_timer(&sc->sc_ani.timer, ath_ani_calibrate, (unsigned long)sc); ath_rate_attach(sc); if (ath9k_hw_getcapability(ah, ATH9K_CAP_CIPHER, ATH9K_CIPHER_TKIP, NULL)) { /* Loading drivers/net/wireless/ath9k/core.h +0 −5 Original line number Diff line number Diff line Loading @@ -858,12 +858,7 @@ struct ath_softc { /* Rate */ struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX]; struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX]; const struct ath9k_rate_table *sc_currates; u8 sc_protrix; /* protection rate index */ struct { u32 rateKbps; /* transfer rate in kbs */ u8 ieeerate; /* IEEE rate */ } sc_hwmap[256]; /* h/w rate ix mappings */ /* Channel, Band */ struct ieee80211_channel channels[IEEE80211_NUM_BANDS][ATH_CHAN_MAX]; Loading drivers/net/wireless/ath9k/hw.c +3 −187 Original line number Diff line number Diff line Loading @@ -142,14 +142,14 @@ bool ath9k_get_channel_edges(struct ath_hal *ah, } u16 ath9k_hw_computetxtime(struct ath_hal *ah, const struct ath9k_rate_table *rates, struct ath_rate_table *rates, u32 frameLen, u16 rateix, bool shortPreamble) { u32 bitsPerSymbol, numBits, numSymbols, phyTime, txTime; u32 kbps; kbps = rates->info[rateix].rateKbps; kbps = rates->info[rateix].ratekbps; if (kbps == 0) return 0; Loading @@ -157,7 +157,7 @@ u16 ath9k_hw_computetxtime(struct ath_hal *ah, switch (rates->info[rateix].phy) { case PHY_CCK: phyTime = CCK_PREAMBLE_BITS + CCK_PLCP_BITS; if (shortPreamble && rates->info[rateix].shortPreamble) if (shortPreamble && rates->info[rateix].short_preamble) phyTime >>= 1; numBits = frameLen << 3; txTime = CCK_SIFS_TIME + phyTime + ((numBits * 1000) / kbps); Loading Loading @@ -3190,190 +3190,6 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hal *ah, } /***************/ /* Rate tables */ /***************/ static struct ath9k_rate_table ar5416_11a_table = { 8, {0}, { {true, PHY_OFDM, 6000, 0x0b, 0x00, (0x80 | 12), 0}, {true, PHY_OFDM, 9000, 0x0f, 0x00, 18, 0}, {true, PHY_OFDM, 12000, 0x0a, 0x00, (0x80 | 24), 2}, {true, PHY_OFDM, 18000, 0x0e, 0x00, 36, 2}, {true, PHY_OFDM, 24000, 0x09, 0x00, (0x80 | 48), 4}, {true, PHY_OFDM, 36000, 0x0d, 0x00, 72, 4}, {true, PHY_OFDM, 48000, 0x08, 0x00, 96, 4}, {true, PHY_OFDM, 54000, 0x0c, 0x00, 108, 4} }, }; static struct ath9k_rate_table ar5416_11b_table = { 4, {0}, { {true, PHY_CCK, 1000, 0x1b, 0x00, (0x80 | 2), 0}, {true, PHY_CCK, 2000, 0x1a, 0x04, (0x80 | 4), 1}, {true, PHY_CCK, 5500, 0x19, 0x04, (0x80 | 11), 1}, {true, PHY_CCK, 11000, 0x18, 0x04, (0x80 | 22), 1} }, }; static struct ath9k_rate_table ar5416_11g_table = { 12, {0}, { {true, PHY_CCK, 1000, 0x1b, 0x00, (0x80 | 2), 0}, {true, PHY_CCK, 2000, 0x1a, 0x04, (0x80 | 4), 1}, {true, PHY_CCK, 5500, 0x19, 0x04, (0x80 | 11), 2}, {true, PHY_CCK, 11000, 0x18, 0x04, (0x80 | 22), 3}, {false, PHY_OFDM, 6000, 0x0b, 0x00, 12, 4}, {false, PHY_OFDM, 9000, 0x0f, 0x00, 18, 4}, {true, PHY_OFDM, 12000, 0x0a, 0x00, 24, 6}, {true, PHY_OFDM, 18000, 0x0e, 0x00, 36, 6}, {true, PHY_OFDM, 24000, 0x09, 0x00, 48, 8}, {true, PHY_OFDM, 36000, 0x0d, 0x00, 72, 8}, {true, PHY_OFDM, 48000, 0x08, 0x00, 96, 8}, {true, PHY_OFDM, 54000, 0x0c, 0x00, 108, 8} }, }; static struct ath9k_rate_table ar5416_11ng_table = { 28, {0}, { {true, PHY_CCK, 1000, 0x1b, 0x00, (0x80 | 2), 0}, {true, PHY_CCK, 2000, 0x1a, 0x04, (0x80 | 4), 1}, {true, PHY_CCK, 5500, 0x19, 0x04, (0x80 | 11), 2}, {true, PHY_CCK, 11000, 0x18, 0x04, (0x80 | 22), 3}, {false, PHY_OFDM, 6000, 0x0b, 0x00, 12, 4}, {false, PHY_OFDM, 9000, 0x0f, 0x00, 18, 4}, {true, PHY_OFDM, 12000, 0x0a, 0x00, 24, 6}, {true, PHY_OFDM, 18000, 0x0e, 0x00, 36, 6}, {true, PHY_OFDM, 24000, 0x09, 0x00, 48, 8}, {true, PHY_OFDM, 36000, 0x0d, 0x00, 72, 8}, {true, PHY_OFDM, 48000, 0x08, 0x00, 96, 8}, {true, PHY_OFDM, 54000, 0x0c, 0x00, 108, 8}, {true, PHY_HT, 6500, 0x80, 0x00, 0, 4}, {true, PHY_HT, 13000, 0x81, 0x00, 1, 6}, {true, PHY_HT, 19500, 0x82, 0x00, 2, 6}, {true, PHY_HT, 26000, 0x83, 0x00, 3, 8}, {true, PHY_HT, 39000, 0x84, 0x00, 4, 8}, {true, PHY_HT, 52000, 0x85, 0x00, 5, 8}, {true, PHY_HT, 58500, 0x86, 0x00, 6, 8}, {true, PHY_HT, 65000, 0x87, 0x00, 7, 8}, {true, PHY_HT, 13000, 0x88, 0x00, 8, 4}, {true, PHY_HT, 26000, 0x89, 0x00, 9, 6}, {true, PHY_HT, 39000, 0x8a, 0x00, 10, 6}, {true, PHY_HT, 52000, 0x8b, 0x00, 11, 8}, {true, PHY_HT, 78000, 0x8c, 0x00, 12, 8}, {true, PHY_HT, 104000, 0x8d, 0x00, 13, 8}, {true, PHY_HT, 117000, 0x8e, 0x00, 14, 8}, {true, PHY_HT, 130000, 0x8f, 0x00, 15, 8}, }, }; static struct ath9k_rate_table ar5416_11na_table = { 24, {0}, { {true, PHY_OFDM, 6000, 0x0b, 0x00, (0x80 | 12), 0}, {true, PHY_OFDM, 9000, 0x0f, 0x00, 18, 0}, {true, PHY_OFDM, 12000, 0x0a, 0x00, (0x80 | 24), 2}, {true, PHY_OFDM, 18000, 0x0e, 0x00, 36, 2}, {true, PHY_OFDM, 24000, 0x09, 0x00, (0x80 | 48), 4}, {true, PHY_OFDM, 36000, 0x0d, 0x00, 72, 4}, {true, PHY_OFDM, 48000, 0x08, 0x00, 96, 4}, {true, PHY_OFDM, 54000, 0x0c, 0x00, 108, 4}, {true, PHY_HT, 6500, 0x80, 0x00, 0, 0}, {true, PHY_HT, 13000, 0x81, 0x00, 1, 2}, {true, PHY_HT, 19500, 0x82, 0x00, 2, 2}, {true, PHY_HT, 26000, 0x83, 0x00, 3, 4}, {true, PHY_HT, 39000, 0x84, 0x00, 4, 4}, {true, PHY_HT, 52000, 0x85, 0x00, 5, 4}, {true, PHY_HT, 58500, 0x86, 0x00, 6, 4}, {true, PHY_HT, 65000, 0x87, 0x00, 7, 4}, {true, PHY_HT, 13000, 0x88, 0x00, 8, 0}, {true, PHY_HT, 26000, 0x89, 0x00, 9, 2}, {true, PHY_HT, 39000, 0x8a, 0x00, 10, 2}, {true, PHY_HT, 52000, 0x8b, 0x00, 11, 4}, {true, PHY_HT, 78000, 0x8c, 0x00, 12, 4}, {true, PHY_HT, 104000, 0x8d, 0x00, 13, 4}, {true, PHY_HT, 117000, 0x8e, 0x00, 14, 4}, {true, PHY_HT, 130000, 0x8f, 0x00, 15, 4}, }, }; static void ath9k_hw_setup_rate_table(struct ath_hal *ah, struct ath9k_rate_table *rt) { int i; if (rt->rateCodeToIndex[0] != 0) return; for (i = 0; i < 256; i++) rt->rateCodeToIndex[i] = (u8) -1; for (i = 0; i < rt->rateCount; i++) { u8 code = rt->info[i].rateCode; u8 cix = rt->info[i].controlRate; rt->rateCodeToIndex[code] = i; rt->rateCodeToIndex[code | rt->info[i].shortPreamble] = i; rt->info[i].lpAckDuration = ath9k_hw_computetxtime(ah, rt, WLAN_CTRL_FRAME_SIZE, cix, false); rt->info[i].spAckDuration = ath9k_hw_computetxtime(ah, rt, WLAN_CTRL_FRAME_SIZE, cix, true); } } const struct ath9k_rate_table *ath9k_hw_getratetable(struct ath_hal *ah, u32 mode) { struct ath9k_rate_table *rt; switch (mode) { case ATH9K_MODE_11A: rt = &ar5416_11a_table; break; case ATH9K_MODE_11B: rt = &ar5416_11b_table; break; case ATH9K_MODE_11G: rt = &ar5416_11g_table; break; case ATH9K_MODE_11NG_HT20: case ATH9K_MODE_11NG_HT40PLUS: case ATH9K_MODE_11NG_HT40MINUS: rt = &ar5416_11ng_table; break; case ATH9K_MODE_11NA_HT20: case ATH9K_MODE_11NA_HT40PLUS: case ATH9K_MODE_11NA_HT40MINUS: rt = &ar5416_11na_table; break; default: DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL, "%s: invalid mode 0x%x\n", __func__, mode); return NULL; } ath9k_hw_setup_rate_table(ah, rt); return rt; } /*******************/ /* HW Capabilities */ /*******************/ Loading Loading
drivers/net/wireless/ath9k/ath9k.h +3 −23 Original line number Diff line number Diff line Loading @@ -401,22 +401,6 @@ enum ath9k_int { ATH9K_INT_NOCARD = 0xffffffff }; struct ath9k_rate_table { int rateCount; u8 rateCodeToIndex[256]; struct { u8 valid; u8 phy; u32 rateKbps; u8 rateCode; u8 shortPreamble; u8 dot11Rate; u8 controlRate; u16 lpAckDuration; u16 spAckDuration; } info[32]; }; #define ATH9K_RATESERIES_RTS_CTS 0x0001 #define ATH9K_RATESERIES_2040 0x0002 #define ATH9K_RATESERIES_HALFGI 0x0004 Loading Loading @@ -828,6 +812,8 @@ struct chan_centers { u16 ext_center; }; struct ath_rate_table; /* Helpers */ enum wireless_mode ath9k_hw_chan2wmode(struct ath_hal *ah, Loading @@ -838,7 +824,7 @@ bool ath9k_get_channel_edges(struct ath_hal *ah, u16 flags, u16 *low, u16 *high); u16 ath9k_hw_computetxtime(struct ath_hal *ah, const struct ath9k_rate_table *rates, struct ath_rate_table *rates, u32 frameLen, u16 rateix, bool shortPreamble); u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags); Loading Loading @@ -883,12 +869,6 @@ void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore); void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period); void ath9k_hw_set_sta_beacon_timers(struct ath_hal *ah, const struct ath9k_beacon_state *bs); /* Rate table */ const struct ath9k_rate_table *ath9k_hw_getratetable(struct ath_hal *ah, u32 mode); /* HW Capabilities */ bool ath9k_hw_fill_cap_info(struct ath_hal *ah); Loading
drivers/net/wireless/ath9k/beacon.c +4 −4 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ static void ath_beacon_setup(struct ath_softc *sc, struct ath_hal *ah = sc->sc_ah; struct ath_desc *ds; struct ath9k_11n_rate_series series[4]; const struct ath9k_rate_table *rt; struct ath_rate_table *rt; int flags, antenna; u8 rix, rate; int ctsrate = 0; Loading Loading @@ -106,10 +106,10 @@ static void ath_beacon_setup(struct ath_softc *sc, * XXX everything at min xmit rate */ rix = 0; rt = sc->sc_currates; rate = rt->info[rix].rateCode; rt = sc->hw_rate_table[sc->sc_curmode]; rate = rt->info[rix].ratecode; if (sc->sc_flags & SC_OP_PREAMBLE_SHORT) rate |= rt->info[rix].shortPreamble; rate |= rt->info[rix].short_preamble; ath9k_hw_set11n_txdesc(ah, ds, skb->len + FCS_LEN, /* frame length */ Loading
drivers/net/wireless/ath9k/core.c +9 −43 Original line number Diff line number Diff line Loading @@ -80,38 +80,9 @@ static u8 parse_mpdudensity(u8 mpdudensity) /* * Set current operating mode * * This function initializes and fills the rate table in the ATH object based * on the operating mode. */ static void ath_setcurmode(struct ath_softc *sc, enum wireless_mode mode) { const struct ath9k_rate_table *rt; int i; rt = ath9k_hw_getratetable(sc->sc_ah, mode); BUG_ON(!rt); memset(sc->sc_hwmap, 0, sizeof(sc->sc_hwmap)); for (i = 0; i < 256; i++) { u8 ix = rt->rateCodeToIndex[i]; if (ix == 0xff) continue; sc->sc_hwmap[i].ieeerate = rt->info[ix].dot11Rate & IEEE80211_RATE_VAL; sc->sc_hwmap[i].rateKbps = rt->info[ix].rateKbps; if (rt->info[ix].shortPreamble || rt->info[ix].phy == PHY_OFDM) { /* XXX: Handle this */ } /* NB: this uses the last entry if the rate isn't found */ /* XXX beware of overlow */ } sc->sc_currates = rt; sc->sc_curmode = mode; /* * All protection frames are transmited at 2Mb/s for Loading @@ -126,37 +97,36 @@ static void ath_setcurmode(struct ath_softc *sc, enum wireless_mode mode) */ static void ath_setup_rates(struct ath_softc *sc, enum ieee80211_band band) { struct ath_hal *ah = sc->sc_ah; const struct ath9k_rate_table *rt = NULL; struct ath_rate_table *rate_table = NULL; struct ieee80211_supported_band *sband; struct ieee80211_rate *rate; int i, maxrates; switch (band) { case IEEE80211_BAND_2GHZ: rt = ath9k_hw_getratetable(ah, ATH9K_MODE_11G); rate_table = sc->hw_rate_table[ATH9K_MODE_11G]; break; case IEEE80211_BAND_5GHZ: rt = ath9k_hw_getratetable(ah, ATH9K_MODE_11A); rate_table = sc->hw_rate_table[ATH9K_MODE_11A]; break; default: break; } if (rt == NULL) if (rate_table == NULL) return; sband = &sc->sbands[band]; rate = sc->rates[band]; if (rt->rateCount > ATH_RATE_MAX) if (rate_table->rate_cnt > ATH_RATE_MAX) maxrates = ATH_RATE_MAX; else maxrates = rt->rateCount; maxrates = rate_table->rate_cnt; for (i = 0; i < maxrates; i++) { rate[i].bitrate = rt->info[i].rateKbps / 100; rate[i].hw_value = rt->info[i].rateCode; rate[i].bitrate = rate_table->info[i].ratekbps / 100; rate[i].hw_value = rate_table->info[i].ratecode; sband->n_bitrates++; DPRINTF(sc, ATH_DBG_CONFIG, "%s: Rate: %2dMbps, ratecode: %2d\n", Loading Loading @@ -1000,12 +970,10 @@ int ath_init(u16 devid, struct ath_softc *sc) /* Setup rate tables */ ath_rate_attach(sc); ath_setup_rates(sc, IEEE80211_BAND_2GHZ); ath_setup_rates(sc, IEEE80211_BAND_5GHZ); /* NB: setup here so ath_rate_update is happy */ ath_setcurmode(sc, ATH9K_MODE_11A); /* * Allocate hardware transmit queues: one queue for * beacon frames and one data queue for each QoS Loading Loading @@ -1071,8 +1039,6 @@ int ath_init(u16 devid, struct ath_softc *sc) sc->sc_ani.sc_noise_floor = ATH_DEFAULT_NOISE_FLOOR; setup_timer(&sc->sc_ani.timer, ath_ani_calibrate, (unsigned long)sc); ath_rate_attach(sc); if (ath9k_hw_getcapability(ah, ATH9K_CAP_CIPHER, ATH9K_CIPHER_TKIP, NULL)) { /* Loading
drivers/net/wireless/ath9k/core.h +0 −5 Original line number Diff line number Diff line Loading @@ -858,12 +858,7 @@ struct ath_softc { /* Rate */ struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX]; struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX]; const struct ath9k_rate_table *sc_currates; u8 sc_protrix; /* protection rate index */ struct { u32 rateKbps; /* transfer rate in kbs */ u8 ieeerate; /* IEEE rate */ } sc_hwmap[256]; /* h/w rate ix mappings */ /* Channel, Band */ struct ieee80211_channel channels[IEEE80211_NUM_BANDS][ATH_CHAN_MAX]; Loading
drivers/net/wireless/ath9k/hw.c +3 −187 Original line number Diff line number Diff line Loading @@ -142,14 +142,14 @@ bool ath9k_get_channel_edges(struct ath_hal *ah, } u16 ath9k_hw_computetxtime(struct ath_hal *ah, const struct ath9k_rate_table *rates, struct ath_rate_table *rates, u32 frameLen, u16 rateix, bool shortPreamble) { u32 bitsPerSymbol, numBits, numSymbols, phyTime, txTime; u32 kbps; kbps = rates->info[rateix].rateKbps; kbps = rates->info[rateix].ratekbps; if (kbps == 0) return 0; Loading @@ -157,7 +157,7 @@ u16 ath9k_hw_computetxtime(struct ath_hal *ah, switch (rates->info[rateix].phy) { case PHY_CCK: phyTime = CCK_PREAMBLE_BITS + CCK_PLCP_BITS; if (shortPreamble && rates->info[rateix].shortPreamble) if (shortPreamble && rates->info[rateix].short_preamble) phyTime >>= 1; numBits = frameLen << 3; txTime = CCK_SIFS_TIME + phyTime + ((numBits * 1000) / kbps); Loading Loading @@ -3190,190 +3190,6 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hal *ah, } /***************/ /* Rate tables */ /***************/ static struct ath9k_rate_table ar5416_11a_table = { 8, {0}, { {true, PHY_OFDM, 6000, 0x0b, 0x00, (0x80 | 12), 0}, {true, PHY_OFDM, 9000, 0x0f, 0x00, 18, 0}, {true, PHY_OFDM, 12000, 0x0a, 0x00, (0x80 | 24), 2}, {true, PHY_OFDM, 18000, 0x0e, 0x00, 36, 2}, {true, PHY_OFDM, 24000, 0x09, 0x00, (0x80 | 48), 4}, {true, PHY_OFDM, 36000, 0x0d, 0x00, 72, 4}, {true, PHY_OFDM, 48000, 0x08, 0x00, 96, 4}, {true, PHY_OFDM, 54000, 0x0c, 0x00, 108, 4} }, }; static struct ath9k_rate_table ar5416_11b_table = { 4, {0}, { {true, PHY_CCK, 1000, 0x1b, 0x00, (0x80 | 2), 0}, {true, PHY_CCK, 2000, 0x1a, 0x04, (0x80 | 4), 1}, {true, PHY_CCK, 5500, 0x19, 0x04, (0x80 | 11), 1}, {true, PHY_CCK, 11000, 0x18, 0x04, (0x80 | 22), 1} }, }; static struct ath9k_rate_table ar5416_11g_table = { 12, {0}, { {true, PHY_CCK, 1000, 0x1b, 0x00, (0x80 | 2), 0}, {true, PHY_CCK, 2000, 0x1a, 0x04, (0x80 | 4), 1}, {true, PHY_CCK, 5500, 0x19, 0x04, (0x80 | 11), 2}, {true, PHY_CCK, 11000, 0x18, 0x04, (0x80 | 22), 3}, {false, PHY_OFDM, 6000, 0x0b, 0x00, 12, 4}, {false, PHY_OFDM, 9000, 0x0f, 0x00, 18, 4}, {true, PHY_OFDM, 12000, 0x0a, 0x00, 24, 6}, {true, PHY_OFDM, 18000, 0x0e, 0x00, 36, 6}, {true, PHY_OFDM, 24000, 0x09, 0x00, 48, 8}, {true, PHY_OFDM, 36000, 0x0d, 0x00, 72, 8}, {true, PHY_OFDM, 48000, 0x08, 0x00, 96, 8}, {true, PHY_OFDM, 54000, 0x0c, 0x00, 108, 8} }, }; static struct ath9k_rate_table ar5416_11ng_table = { 28, {0}, { {true, PHY_CCK, 1000, 0x1b, 0x00, (0x80 | 2), 0}, {true, PHY_CCK, 2000, 0x1a, 0x04, (0x80 | 4), 1}, {true, PHY_CCK, 5500, 0x19, 0x04, (0x80 | 11), 2}, {true, PHY_CCK, 11000, 0x18, 0x04, (0x80 | 22), 3}, {false, PHY_OFDM, 6000, 0x0b, 0x00, 12, 4}, {false, PHY_OFDM, 9000, 0x0f, 0x00, 18, 4}, {true, PHY_OFDM, 12000, 0x0a, 0x00, 24, 6}, {true, PHY_OFDM, 18000, 0x0e, 0x00, 36, 6}, {true, PHY_OFDM, 24000, 0x09, 0x00, 48, 8}, {true, PHY_OFDM, 36000, 0x0d, 0x00, 72, 8}, {true, PHY_OFDM, 48000, 0x08, 0x00, 96, 8}, {true, PHY_OFDM, 54000, 0x0c, 0x00, 108, 8}, {true, PHY_HT, 6500, 0x80, 0x00, 0, 4}, {true, PHY_HT, 13000, 0x81, 0x00, 1, 6}, {true, PHY_HT, 19500, 0x82, 0x00, 2, 6}, {true, PHY_HT, 26000, 0x83, 0x00, 3, 8}, {true, PHY_HT, 39000, 0x84, 0x00, 4, 8}, {true, PHY_HT, 52000, 0x85, 0x00, 5, 8}, {true, PHY_HT, 58500, 0x86, 0x00, 6, 8}, {true, PHY_HT, 65000, 0x87, 0x00, 7, 8}, {true, PHY_HT, 13000, 0x88, 0x00, 8, 4}, {true, PHY_HT, 26000, 0x89, 0x00, 9, 6}, {true, PHY_HT, 39000, 0x8a, 0x00, 10, 6}, {true, PHY_HT, 52000, 0x8b, 0x00, 11, 8}, {true, PHY_HT, 78000, 0x8c, 0x00, 12, 8}, {true, PHY_HT, 104000, 0x8d, 0x00, 13, 8}, {true, PHY_HT, 117000, 0x8e, 0x00, 14, 8}, {true, PHY_HT, 130000, 0x8f, 0x00, 15, 8}, }, }; static struct ath9k_rate_table ar5416_11na_table = { 24, {0}, { {true, PHY_OFDM, 6000, 0x0b, 0x00, (0x80 | 12), 0}, {true, PHY_OFDM, 9000, 0x0f, 0x00, 18, 0}, {true, PHY_OFDM, 12000, 0x0a, 0x00, (0x80 | 24), 2}, {true, PHY_OFDM, 18000, 0x0e, 0x00, 36, 2}, {true, PHY_OFDM, 24000, 0x09, 0x00, (0x80 | 48), 4}, {true, PHY_OFDM, 36000, 0x0d, 0x00, 72, 4}, {true, PHY_OFDM, 48000, 0x08, 0x00, 96, 4}, {true, PHY_OFDM, 54000, 0x0c, 0x00, 108, 4}, {true, PHY_HT, 6500, 0x80, 0x00, 0, 0}, {true, PHY_HT, 13000, 0x81, 0x00, 1, 2}, {true, PHY_HT, 19500, 0x82, 0x00, 2, 2}, {true, PHY_HT, 26000, 0x83, 0x00, 3, 4}, {true, PHY_HT, 39000, 0x84, 0x00, 4, 4}, {true, PHY_HT, 52000, 0x85, 0x00, 5, 4}, {true, PHY_HT, 58500, 0x86, 0x00, 6, 4}, {true, PHY_HT, 65000, 0x87, 0x00, 7, 4}, {true, PHY_HT, 13000, 0x88, 0x00, 8, 0}, {true, PHY_HT, 26000, 0x89, 0x00, 9, 2}, {true, PHY_HT, 39000, 0x8a, 0x00, 10, 2}, {true, PHY_HT, 52000, 0x8b, 0x00, 11, 4}, {true, PHY_HT, 78000, 0x8c, 0x00, 12, 4}, {true, PHY_HT, 104000, 0x8d, 0x00, 13, 4}, {true, PHY_HT, 117000, 0x8e, 0x00, 14, 4}, {true, PHY_HT, 130000, 0x8f, 0x00, 15, 4}, }, }; static void ath9k_hw_setup_rate_table(struct ath_hal *ah, struct ath9k_rate_table *rt) { int i; if (rt->rateCodeToIndex[0] != 0) return; for (i = 0; i < 256; i++) rt->rateCodeToIndex[i] = (u8) -1; for (i = 0; i < rt->rateCount; i++) { u8 code = rt->info[i].rateCode; u8 cix = rt->info[i].controlRate; rt->rateCodeToIndex[code] = i; rt->rateCodeToIndex[code | rt->info[i].shortPreamble] = i; rt->info[i].lpAckDuration = ath9k_hw_computetxtime(ah, rt, WLAN_CTRL_FRAME_SIZE, cix, false); rt->info[i].spAckDuration = ath9k_hw_computetxtime(ah, rt, WLAN_CTRL_FRAME_SIZE, cix, true); } } const struct ath9k_rate_table *ath9k_hw_getratetable(struct ath_hal *ah, u32 mode) { struct ath9k_rate_table *rt; switch (mode) { case ATH9K_MODE_11A: rt = &ar5416_11a_table; break; case ATH9K_MODE_11B: rt = &ar5416_11b_table; break; case ATH9K_MODE_11G: rt = &ar5416_11g_table; break; case ATH9K_MODE_11NG_HT20: case ATH9K_MODE_11NG_HT40PLUS: case ATH9K_MODE_11NG_HT40MINUS: rt = &ar5416_11ng_table; break; case ATH9K_MODE_11NA_HT20: case ATH9K_MODE_11NA_HT40PLUS: case ATH9K_MODE_11NA_HT40MINUS: rt = &ar5416_11na_table; break; default: DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL, "%s: invalid mode 0x%x\n", __func__, mode); return NULL; } ath9k_hw_setup_rate_table(ah, rt); return rt; } /*******************/ /* HW Capabilities */ /*******************/ Loading