diff options
author | David S. Miller <davem@davemloft.net> | 2009-09-02 17:18:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-09-02 17:18:09 -0400 |
commit | 3f968de276a8e585deb182d4ba56013a479c80bc (patch) | |
tree | bff8932bb5e64c22708aad48a6edbef3a707a774 /drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |
parent | 5ca1b998d33c39819fca2b675d80c4469e705f2d (diff) | |
parent | d0bec34293bb0b8dddc26d25bd46a6631d6b3ec3 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-rs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 56 |
1 files changed, 27 insertions, 29 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index 26ec969e265d..40b207aa8fef 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,17 +876,24 @@ 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; | ||
881 | /* For HT packets, map MCS to PLCP */ | ||
882 | if (mac_flags & IEEE80211_TX_RC_MCS) { | ||
883 | mac_index &= RATE_MCS_CODE_MSK; /* Remove # of streams */ | ||
884 | if (mac_index >= (IWL_RATE_9M_INDEX - IWL_FIRST_OFDM_RATE)) | ||
885 | mac_index++; | ||
886 | } | ||
879 | 887 | ||
880 | if ((info->status.rates[0].idx < 0) || | 888 | if ((mac_index < 0) || |
881 | (tbl_type.is_SGI != !!(info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)) || | 889 | (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)) || | 890 | (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)) || | 891 | (tbl_type.is_dup != !!(mac_flags & IEEE80211_TX_RC_DUP_DATA)) || |
884 | (tbl_type.ant_type != info->antenna_sel_tx) || | 892 | (tbl_type.ant_type != info->antenna_sel_tx) || |
885 | (!!(tx_rate & RATE_MCS_HT_MSK) != !!(info->status.rates[0].flags & IEEE80211_TX_RC_MCS)) || | 893 | (!!(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)) || | 894 | (!!(tx_rate & RATE_MCS_GF_MSK) != !!(mac_flags & IEEE80211_TX_RC_GREEN_FIELD)) || |
887 | (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate != | 895 | (rs_index != mac_index)) { |
888 | hw->wiphy->bands[info->band]->bitrates[info->status.rates[0].idx].bitrate)) { | 896 | IWL_DEBUG_RATE(priv, "initial rate %d does not match %d (0x%x)\n", mac_index, rs_index, tx_rate); |
889 | 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 | 897 | /* the last LQ command could failed so the LQ in ucode not |
891 | * the same in driver sync up | 898 | * the same in driver sync up |
892 | */ | 899 | */ |
@@ -2542,8 +2549,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) | 2549 | if (lq_sta->last_rate_n_flags & RATE_MCS_GF_MSK) |
2543 | info->control.rates[0].flags |= IEEE80211_TX_RC_GREEN_FIELD; | 2550 | info->control.rates[0].flags |= IEEE80211_TX_RC_GREEN_FIELD; |
2544 | } else { | 2551 | } else { |
2545 | if (rate_idx < 0 || rate_idx > IWL_RATE_COUNT) | 2552 | /* Check for invalid rates */ |
2553 | if ((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT_LEGACY) || | ||
2554 | ((sband->band == IEEE80211_BAND_5GHZ) && | ||
2555 | (rate_idx < IWL_FIRST_OFDM_RATE))) | ||
2546 | rate_idx = rate_lowest_index(sband, sta); | 2556 | rate_idx = rate_lowest_index(sband, sta); |
2557 | /* On valid 5 GHz rate, adjust index */ | ||
2547 | else if (sband->band == IEEE80211_BAND_5GHZ) | 2558 | else if (sband->band == IEEE80211_BAND_5GHZ) |
2548 | rate_idx -= IWL_FIRST_OFDM_RATE; | 2559 | rate_idx -= IWL_FIRST_OFDM_RATE; |
2549 | info->control.rates[0].flags = 0; | 2560 | info->control.rates[0].flags = 0; |
@@ -2584,9 +2595,6 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
2584 | struct ieee80211_conf *conf = &priv->hw->conf; | 2595 | struct ieee80211_conf *conf = &priv->hw->conf; |
2585 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; | 2596 | struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; |
2586 | struct iwl_lq_sta *lq_sta = priv_sta; | 2597 | struct iwl_lq_sta *lq_sta = priv_sta; |
2587 | u16 mask_bit = 0; | ||
2588 | int count; | ||
2589 | int start_rate = 0; | ||
2590 | 2598 | ||
2591 | lq_sta->flush_timer = 0; | 2599 | lq_sta->flush_timer = 0; |
2592 | lq_sta->supp_rates = sta->supp_rates[sband->band]; | 2600 | lq_sta->supp_rates = sta->supp_rates[sband->band]; |
@@ -2661,20 +2669,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; | 2669 | lq_sta->tx_agg_tid_en = IWL_AGG_ALL_TID; |
2662 | lq_sta->drv = priv; | 2670 | lq_sta->drv = priv; |
2663 | 2671 | ||
2664 | /* Find highest tx rate supported by hardware and destination station */ | 2672 | /* Set last_txrate_idx to lowest rate */ |
2665 | mask_bit = sta->supp_rates[sband->band]; | 2673 | lq_sta->last_txrate_idx = rate_lowest_index(sband, sta); |
2666 | count = sband->n_bitrates; | 2674 | if (sband->band == IEEE80211_BAND_5GHZ) |
2667 | if (sband->band == IEEE80211_BAND_5GHZ) { | 2675 | 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 | 2676 | ||
2679 | rs_initialize_lq(priv, conf, sta, lq_sta); | 2677 | rs_initialize_lq(priv, conf, sta, lq_sta); |
2680 | } | 2678 | } |