diff options
author | Daniel C Halperin <daniel.c.halperin@intel.com> | 2009-08-28 12:44:45 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-08-31 14:42:09 -0400 |
commit | 5027309b5581e9c251a46f0ecbf88996d5e0f1e0 (patch) | |
tree | 78b42b3f93e377381623701944ee439994078fa6 | |
parent | 9e39f7c5b311a306977c5471f9e2ce4c456aa038 (diff) |
iwlwifi: remove 60 Mbps from sband bitrates table
ieee80211_supported_band is supposed to only contain legacy rates in the
bitrates table (HT rates go in the ieee80211_sta_ht_cap substruct). Make
iwlwifi driver obey this restriction by removing the 60 Mbps rate. Also, clean
up a few pieces of other code that formerly relied on 60 Mbps being in
sband->bitrates.
Signed-off-by: Daniel C Halperin <daniel.c.halperin@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 48 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rs.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-core.c | 12 |
3 files changed, 27 insertions, 34 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index 26ec969e265d..8239e5508cac 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -818,15 +818,15 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
818 | { | 818 | { |
819 | int status; | 819 | int status; |
820 | u8 retries; | 820 | u8 retries; |
821 | int rs_index, index = 0; | 821 | int rs_index, mac_index, index = 0; |
822 | struct iwl_lq_sta *lq_sta = priv_sta; | 822 | struct iwl_lq_sta *lq_sta = priv_sta; |
823 | struct iwl_link_quality_cmd *table; | 823 | struct iwl_link_quality_cmd *table; |
824 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 824 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
825 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; | 825 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; |
826 | struct ieee80211_hw *hw = priv->hw; | ||
827 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 826 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
828 | struct iwl_rate_scale_data *window = NULL; | 827 | struct iwl_rate_scale_data *window = NULL; |
829 | struct iwl_rate_scale_data *search_win = NULL; | 828 | struct iwl_rate_scale_data *search_win = NULL; |
829 | enum mac80211_rate_control_flags mac_flags; | ||
830 | u32 tx_rate; | 830 | u32 tx_rate; |
831 | struct iwl_scale_tbl_info tbl_type; | 831 | struct iwl_scale_tbl_info tbl_type; |
832 | struct iwl_scale_tbl_info *curr_tbl, *search_tbl; | 832 | struct iwl_scale_tbl_info *curr_tbl, *search_tbl; |
@@ -876,16 +876,17 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
876 | rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index); | 876 | rs_get_tbl_info_from_mcs(tx_rate, priv->band, &tbl_type, &rs_index); |
877 | if (priv->band == IEEE80211_BAND_5GHZ) | 877 | if (priv->band == IEEE80211_BAND_5GHZ) |
878 | rs_index -= IWL_FIRST_OFDM_RATE; | 878 | rs_index -= IWL_FIRST_OFDM_RATE; |
879 | mac_flags = info->status.rates[0].flags; | ||
880 | mac_index = info->status.rates[0].idx; | ||
879 | 881 | ||
880 | if ((info->status.rates[0].idx < 0) || | 882 | if ((mac_index < 0) || |
881 | (tbl_type.is_SGI != !!(info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)) || | 883 | (tbl_type.is_SGI != !!(mac_flags & IEEE80211_TX_RC_SHORT_GI)) || |
882 | (tbl_type.is_ht40 != !!(info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)) || | 884 | (tbl_type.is_ht40 != !!(mac_flags & IEEE80211_TX_RC_40_MHZ_WIDTH)) || |
883 | (tbl_type.is_dup != !!(info->status.rates[0].flags & IEEE80211_TX_RC_DUP_DATA)) || | 885 | (tbl_type.is_dup != !!(mac_flags & IEEE80211_TX_RC_DUP_DATA)) || |
884 | (tbl_type.ant_type != info->antenna_sel_tx) || | 886 | (tbl_type.ant_type != info->antenna_sel_tx) || |
885 | (!!(tx_rate & RATE_MCS_HT_MSK) != !!(info->status.rates[0].flags & IEEE80211_TX_RC_MCS)) || | 887 | (!!(tx_rate & RATE_MCS_HT_MSK) != !!(mac_flags & IEEE80211_TX_RC_MCS)) || |
886 | (!!(tx_rate & RATE_MCS_GF_MSK) != !!(info->status.rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD)) || | 888 | (!!(tx_rate & RATE_MCS_GF_MSK) != !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD)) || |
887 | (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate != | 889 | rs_index != mac_index) { |
888 | hw->wiphy->bands[info->band]->bitrates[info->status.rates[0].idx].bitrate)) { | ||
889 | IWL_DEBUG_RATE(priv, "initial rate does not match 0x%x\n", tx_rate); | 890 | IWL_DEBUG_RATE(priv, "initial rate does not match 0x%x\n", tx_rate); |
890 | /* the last LQ command could failed so the LQ in ucode not | 891 | /* the last LQ command could failed so the LQ in ucode not |
891 | * the same in driver sync up | 892 | * the same in driver sync up |
@@ -2542,8 +2543,12 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | |||
2542 | if (lq_sta->last_rate_n_flags & RATE_MCS_GF_MSK) | 2543 | if (lq_sta->last_rate_n_flags & RATE_MCS_GF_MSK) |
2543 | info->control.rates[0].flags |= IEEE80211_TX_RC_GREEN_FIELD; | 2544 | info->control.rates[0].flags |= IEEE80211_TX_RC_GREEN_FIELD; |
2544 | } else { | 2545 | } else { |
2545 | if (rate_idx < 0 || rate_idx > IWL_RATE_COUNT) | 2546 | /* Check for invalid rates */ |
2547 | if ((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT_LEGACY) || | ||
2548 | ((sband->band == IEEE80211_BAND_5GHZ) && | ||
2549 | (rate_idx < IWL_FIRST_OFDM_RATE))) | ||
2546 | rate_idx = rate_lowest_index(sband, sta); | 2550 | rate_idx = rate_lowest_index(sband, sta); |
2551 | /* On valid 5 GHz rate, adjust index */ | ||
2547 | else if (sband->band == IEEE80211_BAND_5GHZ) | 2552 | else if (sband->band == IEEE80211_BAND_5GHZ) |
2548 | rate_idx -= IWL_FIRST_OFDM_RATE; | 2553 | rate_idx -= IWL_FIRST_OFDM_RATE; |
2549 | info->control.rates[0].flags = 0; | 2554 | info->control.rates[0].flags = 0; |
@@ -2584,9 +2589,6 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2584 | struct ieee80211_conf *conf = &priv->hw->conf; | 2589 | struct ieee80211_conf *conf = &priv->hw->conf; |
2585 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; | 2590 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; |
2586 | struct iwl_lq_sta *lq_sta = priv_sta; | 2591 | struct iwl_lq_sta *lq_sta = priv_sta; |
2587 | u16 mask_bit = 0; | ||
2588 | int count; | ||
2589 | int start_rate = 0; | ||
2590 | 2592 | ||
2591 | lq_sta->flush_timer = 0; | 2593 | lq_sta->flush_timer = 0; |
2592 | lq_sta->supp_rates = sta->supp_rates[sband->band]; | 2594 | lq_sta->supp_rates = sta->supp_rates[sband->band]; |
@@ -2661,20 +2663,10 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2661 | lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; | 2663 | lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; |
2662 | lq_sta->drv = priv; | 2664 | lq_sta->drv = priv; |
2663 | 2665 | ||
2664 | /* Find highest tx rate supported by hardware and destination station */ | 2666 | /* Set last_txrate_idx to lowest rate */ |
2665 | mask_bit = sta->supp_rates[sband->band]; | 2667 | lq_sta->last_txrate_idx = rate_lowest_index(sband, sta); |
2666 | count = sband->n_bitrates; | 2668 | if (sband->band == IEEE80211_BAND_5GHZ) |
2667 | if (sband->band == IEEE80211_BAND_5GHZ) { | 2669 | lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; |
2668 | count += IWL_FIRST_OFDM_RATE; | ||
2669 | start_rate = IWL_FIRST_OFDM_RATE; | ||
2670 | mask_bit <<= IWL_FIRST_OFDM_RATE; | ||
2671 | } | ||
2672 | |||
2673 | mask_bit = mask_bit & lq_sta->active_legacy_rate; | ||
2674 | lq_sta->last_txrate_idx = 4; | ||
2675 | for (i = start_rate; i < count; i++) | ||
2676 | if (mask_bit & BIT(i)) | ||
2677 | lq_sta->last_txrate_idx = i; | ||
2678 | 2670 | ||
2679 | rs_initialize_lq(priv, conf, sta, lq_sta); | 2671 | rs_initialize_lq(priv, conf, sta, lq_sta); |
2680 | } | 2672 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h index 25050bf315a2..9fac530cfb7e 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.h +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.h | |||
@@ -73,6 +73,7 @@ enum { | |||
73 | IWL_RATE_54M_INDEX, | 73 | IWL_RATE_54M_INDEX, |
74 | IWL_RATE_60M_INDEX, | 74 | IWL_RATE_60M_INDEX, |
75 | IWL_RATE_COUNT, /*FIXME:RS:change to IWL_RATE_INDEX_COUNT,*/ | 75 | IWL_RATE_COUNT, /*FIXME:RS:change to IWL_RATE_INDEX_COUNT,*/ |
76 | IWL_RATE_COUNT_LEGACY = IWL_RATE_COUNT - 1, /* Excluding 60M */ | ||
76 | IWL_RATE_COUNT_3945 = IWL_RATE_COUNT - 1, | 77 | IWL_RATE_COUNT_3945 = IWL_RATE_COUNT - 1, |
77 | IWL_RATE_INVM_INDEX = IWL_RATE_COUNT, | 78 | IWL_RATE_INVM_INDEX = IWL_RATE_COUNT, |
78 | IWL_RATE_INVALID = IWL_RATE_COUNT, | 79 | IWL_RATE_INVALID = IWL_RATE_COUNT, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c index 0bfd4e918139..813582467ffb 100644 --- a/drivers/net/wireless/iwlwifi/iwl-core.c +++ b/drivers/net/wireless/iwlwifi/iwl-core.c | |||
@@ -439,12 +439,12 @@ static void iwlcore_init_hw_rates(struct iwl_priv *priv, | |||
439 | { | 439 | { |
440 | int i; | 440 | int i; |
441 | 441 | ||
442 | for (i = 0; i < IWL_RATE_COUNT; i++) { | 442 | for (i = 0; i < IWL_RATE_COUNT_LEGACY; i++) { |
443 | rates[i].bitrate = iwl_rates[i].ieee * 5; | 443 | rates[i].bitrate = iwl_rates[i].ieee * 5; |
444 | rates[i].hw_value = i; /* Rate scaling will work on indexes */ | 444 | rates[i].hw_value = i; /* Rate scaling will work on indexes */ |
445 | rates[i].hw_value_short = i; | 445 | rates[i].hw_value_short = i; |
446 | rates[i].flags = 0; | 446 | rates[i].flags = 0; |
447 | if ((i > IWL_LAST_OFDM_RATE) || (i < IWL_FIRST_OFDM_RATE)) { | 447 | if ((i >= IWL_FIRST_CCK_RATE) && (i <= IWL_LAST_CCK_RATE)) { |
448 | /* | 448 | /* |
449 | * If CCK != 1M then set short preamble rate flag. | 449 | * If CCK != 1M then set short preamble rate flag. |
450 | */ | 450 | */ |
@@ -480,7 +480,7 @@ int iwlcore_init_geos(struct iwl_priv *priv) | |||
480 | if (!channels) | 480 | if (!channels) |
481 | return -ENOMEM; | 481 | return -ENOMEM; |
482 | 482 | ||
483 | rates = kzalloc((sizeof(struct ieee80211_rate) * (IWL_RATE_COUNT + 1)), | 483 | rates = kzalloc((sizeof(struct ieee80211_rate) * IWL_RATE_COUNT_LEGACY), |
484 | GFP_KERNEL); | 484 | GFP_KERNEL); |
485 | if (!rates) { | 485 | if (!rates) { |
486 | kfree(channels); | 486 | kfree(channels); |
@@ -492,7 +492,7 @@ int iwlcore_init_geos(struct iwl_priv *priv) | |||
492 | sband->channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; | 492 | sband->channels = &channels[ARRAY_SIZE(iwl_eeprom_band_1)]; |
493 | /* just OFDM */ | 493 | /* just OFDM */ |
494 | sband->bitrates = &rates[IWL_FIRST_OFDM_RATE]; | 494 | sband->bitrates = &rates[IWL_FIRST_OFDM_RATE]; |
495 | sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE; | 495 | sband->n_bitrates = IWL_RATE_COUNT_LEGACY - IWL_FIRST_OFDM_RATE; |
496 | 496 | ||
497 | if (priv->cfg->sku & IWL_SKU_N) | 497 | if (priv->cfg->sku & IWL_SKU_N) |
498 | iwlcore_init_ht_hw_capab(priv, &sband->ht_cap, | 498 | iwlcore_init_ht_hw_capab(priv, &sband->ht_cap, |
@@ -502,7 +502,7 @@ int iwlcore_init_geos(struct iwl_priv *priv) | |||
502 | sband->channels = channels; | 502 | sband->channels = channels; |
503 | /* OFDM & CCK */ | 503 | /* OFDM & CCK */ |
504 | sband->bitrates = rates; | 504 | sband->bitrates = rates; |
505 | sband->n_bitrates = IWL_RATE_COUNT; | 505 | sband->n_bitrates = IWL_RATE_COUNT_LEGACY; |
506 | 506 | ||
507 | if (priv->cfg->sku & IWL_SKU_N) | 507 | if (priv->cfg->sku & IWL_SKU_N) |
508 | iwlcore_init_ht_hw_capab(priv, &sband->ht_cap, | 508 | iwlcore_init_ht_hw_capab(priv, &sband->ht_cap, |
@@ -1231,7 +1231,7 @@ static void iwl_set_rate(struct iwl_priv *priv) | |||
1231 | 1231 | ||
1232 | for (i = 0; i < hw->n_bitrates; i++) { | 1232 | for (i = 0; i < hw->n_bitrates; i++) { |
1233 | rate = &(hw->bitrates[i]); | 1233 | rate = &(hw->bitrates[i]); |
1234 | if (rate->hw_value < IWL_RATE_COUNT) | 1234 | if (rate->hw_value < IWL_RATE_COUNT_LEGACY) |
1235 | priv->active_rate |= (1 << rate->hw_value); | 1235 | priv->active_rate |= (1 << rate->hw_value); |
1236 | } | 1236 | } |
1237 | 1237 | ||