diff options
Diffstat (limited to 'drivers/net/wireless/ath9k/rc.c')
-rw-r--r-- | drivers/net/wireless/ath9k/rc.c | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c index 156b245ab9e4..bf637aa7ddab 100644 --- a/drivers/net/wireless/ath9k/rc.c +++ b/drivers/net/wireless/ath9k/rc.c | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | static struct ath_rate_table ar5416_11na_ratetable = { | 26 | static struct ath_rate_table ar5416_11na_ratetable = { |
27 | 42, | 27 | 42, |
28 | {0}, | ||
28 | { | 29 | { |
29 | { TRUE, TRUE, WLAN_PHY_OFDM, 6000, /* 6 Mb */ | 30 | { TRUE, TRUE, WLAN_PHY_OFDM, 6000, /* 6 Mb */ |
30 | 5400, 0x0b, 0x00, 12, | 31 | 5400, 0x0b, 0x00, 12, |
@@ -168,6 +169,7 @@ static struct ath_rate_table ar5416_11na_ratetable = { | |||
168 | 169 | ||
169 | static struct ath_rate_table ar5416_11ng_ratetable = { | 170 | static struct ath_rate_table ar5416_11ng_ratetable = { |
170 | 46, | 171 | 46, |
172 | {0}, | ||
171 | { | 173 | { |
172 | { TRUE_ALL, TRUE_ALL, WLAN_PHY_CCK, 1000, /* 1 Mb */ | 174 | { TRUE_ALL, TRUE_ALL, WLAN_PHY_CCK, 1000, /* 1 Mb */ |
173 | 900, 0x1b, 0x00, 2, | 175 | 900, 0x1b, 0x00, 2, |
@@ -315,6 +317,7 @@ static struct ath_rate_table ar5416_11ng_ratetable = { | |||
315 | 317 | ||
316 | static struct ath_rate_table ar5416_11a_ratetable = { | 318 | static struct ath_rate_table ar5416_11a_ratetable = { |
317 | 8, | 319 | 8, |
320 | {0}, | ||
318 | { | 321 | { |
319 | { TRUE, TRUE, WLAN_PHY_OFDM, 6000, /* 6 Mb */ | 322 | { TRUE, TRUE, WLAN_PHY_OFDM, 6000, /* 6 Mb */ |
320 | 5400, 0x0b, 0x00, (0x80|12), | 323 | 5400, 0x0b, 0x00, (0x80|12), |
@@ -348,6 +351,7 @@ static struct ath_rate_table ar5416_11a_ratetable = { | |||
348 | 351 | ||
349 | static struct ath_rate_table ar5416_11g_ratetable = { | 352 | static struct ath_rate_table ar5416_11g_ratetable = { |
350 | 12, | 353 | 12, |
354 | {0}, | ||
351 | { | 355 | { |
352 | { TRUE, TRUE, WLAN_PHY_CCK, 1000, /* 1 Mb */ | 356 | { TRUE, TRUE, WLAN_PHY_CCK, 1000, /* 1 Mb */ |
353 | 900, 0x1b, 0x00, 2, | 357 | 900, 0x1b, 0x00, 2, |
@@ -393,6 +397,7 @@ static struct ath_rate_table ar5416_11g_ratetable = { | |||
393 | 397 | ||
394 | static struct ath_rate_table ar5416_11b_ratetable = { | 398 | static struct ath_rate_table ar5416_11b_ratetable = { |
395 | 4, | 399 | 4, |
400 | {0}, | ||
396 | { | 401 | { |
397 | { TRUE, TRUE, WLAN_PHY_CCK, 1000, /* 1 Mb */ | 402 | { TRUE, TRUE, WLAN_PHY_CCK, 1000, /* 1 Mb */ |
398 | 900, 0x1b, 0x00, (0x80|2), | 403 | 900, 0x1b, 0x00, (0x80|2), |
@@ -1302,14 +1307,14 @@ static void ath_rc_update(struct ath_softc *sc, | |||
1302 | if (final_ts_idx != 0) { | 1307 | if (final_ts_idx != 0) { |
1303 | /* Process intermediate rates that failed.*/ | 1308 | /* Process intermediate rates that failed.*/ |
1304 | for (series = 0; series < final_ts_idx ; series++) { | 1309 | for (series = 0; series < final_ts_idx ; series++) { |
1305 | if (rates[series].count != 0) { | 1310 | if (rates[series].count != 0 && (rates[series].idx >= 0)) { |
1306 | flags = rates[series].flags; | 1311 | flags = rates[series].flags; |
1307 | /* If HT40 and we have switched mode from | 1312 | /* If HT40 and we have switched mode from |
1308 | * 40 to 20 => don't update */ | 1313 | * 40 to 20 => don't update */ |
1309 | if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && | 1314 | if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && |
1310 | (ath_rc_priv->rc_phy_mode != | 1315 | (ath_rc_priv->rc_phy_mode != WLAN_RC_40_FLAG)) |
1311 | (flags & IEEE80211_TX_RC_40_MHZ_WIDTH))) | ||
1312 | return; | 1316 | return; |
1317 | |||
1313 | if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && | 1318 | if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && |
1314 | (flags & IEEE80211_TX_RC_SHORT_GI)) | 1319 | (flags & IEEE80211_TX_RC_SHORT_GI)) |
1315 | rix = rate_table->info[ | 1320 | rix = rate_table->info[ |
@@ -1343,8 +1348,9 @@ static void ath_rc_update(struct ath_softc *sc, | |||
1343 | flags = rates[series].flags; | 1348 | flags = rates[series].flags; |
1344 | /* If HT40 and we have switched mode from 40 to 20 => don't update */ | 1349 | /* If HT40 and we have switched mode from 40 to 20 => don't update */ |
1345 | if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && | 1350 | if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && |
1346 | (ath_rc_priv->rc_phy_mode != (flags & IEEE80211_TX_RC_40_MHZ_WIDTH))) | 1351 | (ath_rc_priv->rc_phy_mode != WLAN_RC_40_FLAG)) { |
1347 | return; | 1352 | return; |
1353 | } | ||
1348 | 1354 | ||
1349 | if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && (flags & IEEE80211_TX_RC_SHORT_GI)) | 1355 | if ((flags & IEEE80211_TX_RC_40_MHZ_WIDTH) && (flags & IEEE80211_TX_RC_SHORT_GI)) |
1350 | rix = rate_table->info[rates[series].idx].ht_index; | 1356 | rix = rate_table->info[rates[series].idx].ht_index; |
@@ -1628,7 +1634,6 @@ static void ath_rate_free_sta(void *priv, struct ieee80211_sta *sta, | |||
1628 | void *priv_sta) | 1634 | void *priv_sta) |
1629 | { | 1635 | { |
1630 | struct ath_rate_node *rate_priv = priv_sta; | 1636 | struct ath_rate_node *rate_priv = priv_sta; |
1631 | |||
1632 | kfree(rate_priv); | 1637 | kfree(rate_priv); |
1633 | } | 1638 | } |
1634 | 1639 | ||
@@ -1644,6 +1649,35 @@ static struct rate_control_ops ath_rate_ops = { | |||
1644 | .free_sta = ath_rate_free_sta, | 1649 | .free_sta = ath_rate_free_sta, |
1645 | }; | 1650 | }; |
1646 | 1651 | ||
1652 | static void ath_setup_rate_table(struct ath_softc *sc, | ||
1653 | struct ath_rate_table *rate_table) | ||
1654 | { | ||
1655 | int i; | ||
1656 | |||
1657 | for (i = 0; i < 256; i++) | ||
1658 | rate_table->rateCodeToIndex[i] = (u8)-1; | ||
1659 | |||
1660 | for (i = 0; i < rate_table->rate_cnt; i++) { | ||
1661 | u8 code = rate_table->info[i].ratecode; | ||
1662 | u8 cix = rate_table->info[i].ctrl_rate; | ||
1663 | u8 sh = rate_table->info[i].short_preamble; | ||
1664 | |||
1665 | rate_table->rateCodeToIndex[code] = i; | ||
1666 | rate_table->rateCodeToIndex[code | sh] = i; | ||
1667 | |||
1668 | rate_table->info[i].lpAckDuration = | ||
1669 | ath9k_hw_computetxtime(sc->sc_ah, rate_table, | ||
1670 | WLAN_CTRL_FRAME_SIZE, | ||
1671 | cix, | ||
1672 | false); | ||
1673 | rate_table->info[i].spAckDuration = | ||
1674 | ath9k_hw_computetxtime(sc->sc_ah, rate_table, | ||
1675 | WLAN_CTRL_FRAME_SIZE, | ||
1676 | cix, | ||
1677 | true); | ||
1678 | } | ||
1679 | } | ||
1680 | |||
1647 | void ath_rate_attach(struct ath_softc *sc) | 1681 | void ath_rate_attach(struct ath_softc *sc) |
1648 | { | 1682 | { |
1649 | sc->hw_rate_table[ATH9K_MODE_11B] = | 1683 | sc->hw_rate_table[ATH9K_MODE_11B] = |
@@ -1664,6 +1698,12 @@ void ath_rate_attach(struct ath_softc *sc) | |||
1664 | &ar5416_11ng_ratetable; | 1698 | &ar5416_11ng_ratetable; |
1665 | sc->hw_rate_table[ATH9K_MODE_11NG_HT40MINUS] = | 1699 | sc->hw_rate_table[ATH9K_MODE_11NG_HT40MINUS] = |
1666 | &ar5416_11ng_ratetable; | 1700 | &ar5416_11ng_ratetable; |
1701 | |||
1702 | ath_setup_rate_table(sc, &ar5416_11b_ratetable); | ||
1703 | ath_setup_rate_table(sc, &ar5416_11a_ratetable); | ||
1704 | ath_setup_rate_table(sc, &ar5416_11g_ratetable); | ||
1705 | ath_setup_rate_table(sc, &ar5416_11na_ratetable); | ||
1706 | ath_setup_rate_table(sc, &ar5416_11ng_ratetable); | ||
1667 | } | 1707 | } |
1668 | 1708 | ||
1669 | int ath_rate_control_register(void) | 1709 | int ath_rate_control_register(void) |
@@ -1675,4 +1715,3 @@ void ath_rate_control_unregister(void) | |||
1675 | { | 1715 | { |
1676 | ieee80211_rate_control_unregister(&ath_rate_ops); | 1716 | ieee80211_rate_control_unregister(&ath_rate_ops); |
1677 | } | 1717 | } |
1678 | |||