diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-05-06 02:20:00 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-05-06 15:15:05 -0400 |
commit | 4f0fc7c39f2a224b939f22d4dca552b266319525 (patch) | |
tree | 4dcea1285bdfe15a9a22e88097a3e8e7c9b57b8d /drivers/net/wireless/ath/ath9k/rc.c | |
parent | 7c5a189dc6a43def594fedc7cd8f6886596b65de (diff) |
ath9k: make private driver rate tables const
On x86 this allows us to do the following small savings:
shave off 23 % off of the module's data, and
shave off 6 % off of the module's text.
We save 456 bytes, for those counting.
$ size ath9k.ko
text data bss dec hex filename
250794 3628 1600 256022 3e816 ath9k.ko
$ size ath9k-old.ko
text data bss dec hex filename
239114 15308 1600 256022 3e816 ath9k-old.ko
$ du -b ath9k.ko
4034244 ath9k.ko
$ du -b ath9k-old.ko
4033788 ath9k-old.ko
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/rc.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/rc.c | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c index e526dbce57d1..ba06e78b2f50 100644 --- a/drivers/net/wireless/ath/ath9k/rc.c +++ b/drivers/net/wireless/ath/ath9k/rc.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | #include "ath9k.h" | 18 | #include "ath9k.h" |
19 | 19 | ||
20 | static struct ath_rate_table ar5416_11na_ratetable = { | 20 | static const struct ath_rate_table ar5416_11na_ratetable = { |
21 | 42, | 21 | 42, |
22 | { | 22 | { |
23 | { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ | 23 | { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ |
@@ -155,7 +155,7 @@ static struct ath_rate_table ar5416_11na_ratetable = { | |||
155 | /* 4ms frame limit not used for NG mode. The values filled | 155 | /* 4ms frame limit not used for NG mode. The values filled |
156 | * for HT are the 64K max aggregate limit */ | 156 | * for HT are the 64K max aggregate limit */ |
157 | 157 | ||
158 | static struct ath_rate_table ar5416_11ng_ratetable = { | 158 | static const struct ath_rate_table ar5416_11ng_ratetable = { |
159 | 46, | 159 | 46, |
160 | { | 160 | { |
161 | { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ | 161 | { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ |
@@ -302,7 +302,7 @@ static struct ath_rate_table ar5416_11ng_ratetable = { | |||
302 | WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ | 302 | WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ |
303 | }; | 303 | }; |
304 | 304 | ||
305 | static struct ath_rate_table ar5416_11a_ratetable = { | 305 | static const struct ath_rate_table ar5416_11a_ratetable = { |
306 | 8, | 306 | 8, |
307 | { | 307 | { |
308 | { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ | 308 | { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ |
@@ -335,7 +335,7 @@ static struct ath_rate_table ar5416_11a_ratetable = { | |||
335 | 0, /* Phy rates allowed initially */ | 335 | 0, /* Phy rates allowed initially */ |
336 | }; | 336 | }; |
337 | 337 | ||
338 | static struct ath_rate_table ar5416_11g_ratetable = { | 338 | static const struct ath_rate_table ar5416_11g_ratetable = { |
339 | 12, | 339 | 12, |
340 | { | 340 | { |
341 | { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ | 341 | { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ |
@@ -380,7 +380,7 @@ static struct ath_rate_table ar5416_11g_ratetable = { | |||
380 | 0, /* Phy rates allowed initially */ | 380 | 0, /* Phy rates allowed initially */ |
381 | }; | 381 | }; |
382 | 382 | ||
383 | static struct ath_rate_table ar5416_11b_ratetable = { | 383 | static const struct ath_rate_table ar5416_11b_ratetable = { |
384 | 4, | 384 | 4, |
385 | { | 385 | { |
386 | { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ | 386 | { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ |
@@ -420,7 +420,7 @@ static inline int8_t median(int8_t a, int8_t b, int8_t c) | |||
420 | } | 420 | } |
421 | } | 421 | } |
422 | 422 | ||
423 | static void ath_rc_sort_validrates(struct ath_rate_table *rate_table, | 423 | static void ath_rc_sort_validrates(const struct ath_rate_table *rate_table, |
424 | struct ath_rate_priv *ath_rc_priv) | 424 | struct ath_rate_priv *ath_rc_priv) |
425 | { | 425 | { |
426 | u8 i, j, idx, idx_next; | 426 | u8 i, j, idx, idx_next; |
@@ -461,10 +461,11 @@ static inline int ath_rc_isvalid_txmask(struct ath_rate_priv *ath_rc_priv, | |||
461 | return ath_rc_priv->valid_rate_index[index]; | 461 | return ath_rc_priv->valid_rate_index[index]; |
462 | } | 462 | } |
463 | 463 | ||
464 | static inline int ath_rc_get_nextvalid_txrate(struct ath_rate_table *rate_table, | 464 | static inline |
465 | struct ath_rate_priv *ath_rc_priv, | 465 | int ath_rc_get_nextvalid_txrate(const struct ath_rate_table *rate_table, |
466 | u8 cur_valid_txrate, | 466 | struct ath_rate_priv *ath_rc_priv, |
467 | u8 *next_idx) | 467 | u8 cur_valid_txrate, |
468 | u8 *next_idx) | ||
468 | { | 469 | { |
469 | u8 i; | 470 | u8 i; |
470 | 471 | ||
@@ -500,7 +501,7 @@ static int ath_rc_valid_phyrate(u32 phy, u32 capflag, int ignore_cw) | |||
500 | } | 501 | } |
501 | 502 | ||
502 | static inline int | 503 | static inline int |
503 | ath_rc_get_nextlowervalid_txrate(struct ath_rate_table *rate_table, | 504 | ath_rc_get_nextlowervalid_txrate(const struct ath_rate_table *rate_table, |
504 | struct ath_rate_priv *ath_rc_priv, | 505 | struct ath_rate_priv *ath_rc_priv, |
505 | u8 cur_valid_txrate, u8 *next_idx) | 506 | u8 cur_valid_txrate, u8 *next_idx) |
506 | { | 507 | { |
@@ -517,7 +518,7 @@ ath_rc_get_nextlowervalid_txrate(struct ath_rate_table *rate_table, | |||
517 | } | 518 | } |
518 | 519 | ||
519 | static u8 ath_rc_init_validrates(struct ath_rate_priv *ath_rc_priv, | 520 | static u8 ath_rc_init_validrates(struct ath_rate_priv *ath_rc_priv, |
520 | struct ath_rate_table *rate_table, | 521 | const struct ath_rate_table *rate_table, |
521 | u32 capflag) | 522 | u32 capflag) |
522 | { | 523 | { |
523 | u8 i, hi = 0; | 524 | u8 i, hi = 0; |
@@ -547,7 +548,7 @@ static u8 ath_rc_init_validrates(struct ath_rate_priv *ath_rc_priv, | |||
547 | } | 548 | } |
548 | 549 | ||
549 | static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv, | 550 | static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv, |
550 | struct ath_rate_table *rate_table, | 551 | const struct ath_rate_table *rate_table, |
551 | struct ath_rateset *rateset, | 552 | struct ath_rateset *rateset, |
552 | u32 capflag) | 553 | u32 capflag) |
553 | { | 554 | { |
@@ -592,7 +593,7 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv, | |||
592 | } | 593 | } |
593 | 594 | ||
594 | static u8 ath_rc_setvalid_htrates(struct ath_rate_priv *ath_rc_priv, | 595 | static u8 ath_rc_setvalid_htrates(struct ath_rate_priv *ath_rc_priv, |
595 | struct ath_rate_table *rate_table, | 596 | const struct ath_rate_table *rate_table, |
596 | u8 *mcs_set, u32 capflag) | 597 | u8 *mcs_set, u32 capflag) |
597 | { | 598 | { |
598 | struct ath_rateset *rateset = (struct ath_rateset *)mcs_set; | 599 | struct ath_rateset *rateset = (struct ath_rateset *)mcs_set; |
@@ -630,7 +631,7 @@ static u8 ath_rc_setvalid_htrates(struct ath_rate_priv *ath_rc_priv, | |||
630 | 631 | ||
631 | static u8 ath_rc_ratefind_ht(struct ath_softc *sc, | 632 | static u8 ath_rc_ratefind_ht(struct ath_softc *sc, |
632 | struct ath_rate_priv *ath_rc_priv, | 633 | struct ath_rate_priv *ath_rc_priv, |
633 | struct ath_rate_table *rate_table, | 634 | const struct ath_rate_table *rate_table, |
634 | int *is_probing) | 635 | int *is_probing) |
635 | { | 636 | { |
636 | u32 dt, best_thruput, this_thruput, now_msec; | 637 | u32 dt, best_thruput, this_thruput, now_msec; |
@@ -748,7 +749,7 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc, | |||
748 | return rate; | 749 | return rate; |
749 | } | 750 | } |
750 | 751 | ||
751 | static void ath_rc_rate_set_series(struct ath_rate_table *rate_table, | 752 | static void ath_rc_rate_set_series(const struct ath_rate_table *rate_table, |
752 | struct ieee80211_tx_rate *rate, | 753 | struct ieee80211_tx_rate *rate, |
753 | struct ieee80211_tx_rate_control *txrc, | 754 | struct ieee80211_tx_rate_control *txrc, |
754 | u8 tries, u8 rix, int rtsctsenable) | 755 | u8 tries, u8 rix, int rtsctsenable) |
@@ -769,7 +770,7 @@ static void ath_rc_rate_set_series(struct ath_rate_table *rate_table, | |||
769 | } | 770 | } |
770 | 771 | ||
771 | static void ath_rc_rate_set_rtscts(struct ath_softc *sc, | 772 | static void ath_rc_rate_set_rtscts(struct ath_softc *sc, |
772 | struct ath_rate_table *rate_table, | 773 | const struct ath_rate_table *rate_table, |
773 | struct ieee80211_tx_info *tx_info) | 774 | struct ieee80211_tx_info *tx_info) |
774 | { | 775 | { |
775 | struct ieee80211_tx_rate *rates = tx_info->control.rates; | 776 | struct ieee80211_tx_rate *rates = tx_info->control.rates; |
@@ -807,7 +808,7 @@ static void ath_rc_rate_set_rtscts(struct ath_softc *sc, | |||
807 | 808 | ||
808 | static u8 ath_rc_rate_getidx(struct ath_softc *sc, | 809 | static u8 ath_rc_rate_getidx(struct ath_softc *sc, |
809 | struct ath_rate_priv *ath_rc_priv, | 810 | struct ath_rate_priv *ath_rc_priv, |
810 | struct ath_rate_table *rate_table, | 811 | const struct ath_rate_table *rate_table, |
811 | u8 rix, u16 stepdown, | 812 | u8 rix, u16 stepdown, |
812 | u16 min_rate) | 813 | u16 min_rate) |
813 | { | 814 | { |
@@ -838,7 +839,7 @@ static void ath_rc_ratefind(struct ath_softc *sc, | |||
838 | struct ath_rate_priv *ath_rc_priv, | 839 | struct ath_rate_priv *ath_rc_priv, |
839 | struct ieee80211_tx_rate_control *txrc) | 840 | struct ieee80211_tx_rate_control *txrc) |
840 | { | 841 | { |
841 | struct ath_rate_table *rate_table; | 842 | const struct ath_rate_table *rate_table; |
842 | struct sk_buff *skb = txrc->skb; | 843 | struct sk_buff *skb = txrc->skb; |
843 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 844 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
844 | struct ieee80211_tx_rate *rates = tx_info->control.rates; | 845 | struct ieee80211_tx_rate *rates = tx_info->control.rates; |
@@ -937,7 +938,7 @@ static void ath_rc_ratefind(struct ath_softc *sc, | |||
937 | } | 938 | } |
938 | 939 | ||
939 | static bool ath_rc_update_per(struct ath_softc *sc, | 940 | static bool ath_rc_update_per(struct ath_softc *sc, |
940 | struct ath_rate_table *rate_table, | 941 | const struct ath_rate_table *rate_table, |
941 | struct ath_rate_priv *ath_rc_priv, | 942 | struct ath_rate_priv *ath_rc_priv, |
942 | struct ath_tx_info_priv *tx_info_priv, | 943 | struct ath_tx_info_priv *tx_info_priv, |
943 | int tx_rate, int xretries, int retries, | 944 | int tx_rate, int xretries, int retries, |
@@ -1142,7 +1143,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1142 | int rate; | 1143 | int rate; |
1143 | u8 last_per; | 1144 | u8 last_per; |
1144 | bool state_change = false; | 1145 | bool state_change = false; |
1145 | struct ath_rate_table *rate_table = sc->cur_rate_table; | 1146 | const struct ath_rate_table *rate_table = sc->cur_rate_table; |
1146 | int size = ath_rc_priv->rate_table_size; | 1147 | int size = ath_rc_priv->rate_table_size; |
1147 | 1148 | ||
1148 | if ((tx_rate < 0) || (tx_rate > rate_table->rate_cnt)) | 1149 | if ((tx_rate < 0) || (tx_rate > rate_table->rate_cnt)) |
@@ -1276,7 +1277,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1276 | #undef CHK_RSSI | 1277 | #undef CHK_RSSI |
1277 | } | 1278 | } |
1278 | 1279 | ||
1279 | static int ath_rc_get_rateindex(struct ath_rate_table *rate_table, | 1280 | static int ath_rc_get_rateindex(const struct ath_rate_table *rate_table, |
1280 | struct ieee80211_tx_rate *rate) | 1281 | struct ieee80211_tx_rate *rate) |
1281 | { | 1282 | { |
1282 | int rix; | 1283 | int rix; |
@@ -1300,7 +1301,7 @@ static void ath_rc_tx_status(struct ath_softc *sc, | |||
1300 | int final_ts_idx, int xretries, int long_retry) | 1301 | int final_ts_idx, int xretries, int long_retry) |
1301 | { | 1302 | { |
1302 | struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); | 1303 | struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); |
1303 | struct ath_rate_table *rate_table; | 1304 | const struct ath_rate_table *rate_table; |
1304 | struct ieee80211_tx_rate *rates = tx_info->status.rates; | 1305 | struct ieee80211_tx_rate *rates = tx_info->status.rates; |
1305 | u8 flags; | 1306 | u8 flags; |
1306 | u32 i = 0, rix; | 1307 | u32 i = 0, rix; |
@@ -1354,9 +1355,11 @@ static void ath_rc_tx_status(struct ath_softc *sc, | |||
1354 | xretries, long_retry); | 1355 | xretries, long_retry); |
1355 | } | 1356 | } |
1356 | 1357 | ||
1357 | static struct ath_rate_table *ath_choose_rate_table(struct ath_softc *sc, | 1358 | static const |
1358 | enum ieee80211_band band, | 1359 | struct ath_rate_table *ath_choose_rate_table(struct ath_softc *sc, |
1359 | bool is_ht, bool is_cw_40) | 1360 | enum ieee80211_band band, |
1361 | bool is_ht, | ||
1362 | bool is_cw_40) | ||
1360 | { | 1363 | { |
1361 | int mode = 0; | 1364 | int mode = 0; |
1362 | 1365 | ||
@@ -1390,7 +1393,7 @@ static void ath_rc_init(struct ath_softc *sc, | |||
1390 | struct ath_rate_priv *ath_rc_priv, | 1393 | struct ath_rate_priv *ath_rc_priv, |
1391 | struct ieee80211_supported_band *sband, | 1394 | struct ieee80211_supported_band *sband, |
1392 | struct ieee80211_sta *sta, | 1395 | struct ieee80211_sta *sta, |
1393 | struct ath_rate_table *rate_table) | 1396 | const struct ath_rate_table *rate_table) |
1394 | { | 1397 | { |
1395 | struct ath_rateset *rateset = &ath_rc_priv->neg_rates; | 1398 | struct ath_rateset *rateset = &ath_rc_priv->neg_rates; |
1396 | u8 *ht_mcs = (u8 *)&ath_rc_priv->neg_ht_rates; | 1399 | u8 *ht_mcs = (u8 *)&ath_rc_priv->neg_ht_rates; |
@@ -1587,7 +1590,7 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, | |||
1587 | { | 1590 | { |
1588 | struct ath_softc *sc = priv; | 1591 | struct ath_softc *sc = priv; |
1589 | struct ath_rate_priv *ath_rc_priv = priv_sta; | 1592 | struct ath_rate_priv *ath_rc_priv = priv_sta; |
1590 | struct ath_rate_table *rate_table = NULL; | 1593 | const struct ath_rate_table *rate_table = NULL; |
1591 | bool is_cw40, is_sgi40; | 1594 | bool is_cw40, is_sgi40; |
1592 | int i, j = 0; | 1595 | int i, j = 0; |
1593 | 1596 | ||
@@ -1636,7 +1639,7 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, | |||
1636 | { | 1639 | { |
1637 | struct ath_softc *sc = priv; | 1640 | struct ath_softc *sc = priv; |
1638 | struct ath_rate_priv *ath_rc_priv = priv_sta; | 1641 | struct ath_rate_priv *ath_rc_priv = priv_sta; |
1639 | struct ath_rate_table *rate_table = NULL; | 1642 | const struct ath_rate_table *rate_table = NULL; |
1640 | bool oper_cw40 = false, oper_sgi40; | 1643 | bool oper_cw40 = false, oper_sgi40; |
1641 | bool local_cw40 = (ath_rc_priv->ht_cap & WLAN_RC_40_FLAG) ? | 1644 | bool local_cw40 = (ath_rc_priv->ht_cap & WLAN_RC_40_FLAG) ? |
1642 | true : false; | 1645 | true : false; |