diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-rs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-agn-rs.c | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c index 0332805cc630..3a2b81291d86 100644 --- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c | |||
@@ -281,10 +281,9 @@ static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data, | |||
281 | u32 time_diff; | 281 | u32 time_diff; |
282 | s32 index; | 282 | s32 index; |
283 | struct iwl_traffic_load *tl = NULL; | 283 | struct iwl_traffic_load *tl = NULL; |
284 | __le16 fc = hdr->frame_control; | ||
285 | u8 tid; | 284 | u8 tid; |
286 | 285 | ||
287 | if (ieee80211_is_data_qos(fc)) { | 286 | if (ieee80211_is_data_qos(hdr->frame_control)) { |
288 | u8 *qc = ieee80211_get_qos_ctl(hdr); | 287 | u8 *qc = ieee80211_get_qos_ctl(hdr); |
289 | tid = qc[0] & 0xf; | 288 | tid = qc[0] & 0xf; |
290 | } else | 289 | } else |
@@ -773,7 +772,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
773 | int status; | 772 | int status; |
774 | u8 retries; | 773 | u8 retries; |
775 | int rs_index, index = 0; | 774 | int rs_index, index = 0; |
776 | struct iwl_lq_sta *lq_sta; | 775 | struct iwl_lq_sta *lq_sta = priv_sta; |
777 | struct iwl_link_quality_cmd *table; | 776 | struct iwl_link_quality_cmd *table; |
778 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 777 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
779 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; | 778 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; |
@@ -785,12 +784,12 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
785 | struct iwl_scale_tbl_info tbl_type; | 784 | struct iwl_scale_tbl_info tbl_type; |
786 | struct iwl_scale_tbl_info *curr_tbl, *search_tbl; | 785 | struct iwl_scale_tbl_info *curr_tbl, *search_tbl; |
787 | u8 active_index = 0; | 786 | u8 active_index = 0; |
788 | __le16 fc = hdr->frame_control; | ||
789 | s32 tpt = 0; | 787 | s32 tpt = 0; |
790 | 788 | ||
791 | IWL_DEBUG_RATE_LIMIT("get frame ack response, update rate scale window\n"); | 789 | IWL_DEBUG_RATE_LIMIT("get frame ack response, update rate scale window\n"); |
792 | 790 | ||
793 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1)) | 791 | if (!ieee80211_is_data(hdr->frame_control) || |
792 | is_multicast_ether_addr(hdr->addr1)) | ||
794 | return; | 793 | return; |
795 | 794 | ||
796 | /* This packet was aggregated but doesn't carry rate scale info */ | 795 | /* This packet was aggregated but doesn't carry rate scale info */ |
@@ -803,8 +802,6 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband, | |||
803 | if (retries > 15) | 802 | if (retries > 15) |
804 | retries = 15; | 803 | retries = 15; |
805 | 804 | ||
806 | lq_sta = (struct iwl_lq_sta *)priv_sta; | ||
807 | |||
808 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && | 805 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
809 | !lq_sta->ibss_sta_added) | 806 | !lq_sta->ibss_sta_added) |
810 | goto out; | 807 | goto out; |
@@ -1675,7 +1672,6 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1675 | int high_tpt = IWL_INVALID_VALUE; | 1672 | int high_tpt = IWL_INVALID_VALUE; |
1676 | u32 fail_count; | 1673 | u32 fail_count; |
1677 | s8 scale_action = 0; | 1674 | s8 scale_action = 0; |
1678 | __le16 fc; | ||
1679 | u16 rate_mask; | 1675 | u16 rate_mask; |
1680 | u8 update_lq = 0; | 1676 | u8 update_lq = 0; |
1681 | struct iwl_scale_tbl_info *tbl, *tbl1; | 1677 | struct iwl_scale_tbl_info *tbl, *tbl1; |
@@ -1690,13 +1686,12 @@ static void rs_rate_scale_perform(struct iwl_priv *priv, | |||
1690 | 1686 | ||
1691 | IWL_DEBUG_RATE("rate scale calculate new rate for skb\n"); | 1687 | IWL_DEBUG_RATE("rate scale calculate new rate for skb\n"); |
1692 | 1688 | ||
1693 | fc = hdr->frame_control; | 1689 | /* Send management frames and broadcast/multicast data using |
1694 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1)) { | 1690 | * lowest rate. */ |
1695 | /* Send management frames and broadcast/multicast data using | 1691 | /* TODO: this could probably be improved.. */ |
1696 | * lowest rate. */ | 1692 | if (!ieee80211_is_data(hdr->frame_control) || |
1697 | /* TODO: this could probably be improved.. */ | 1693 | is_multicast_ether_addr(hdr->addr1)) |
1698 | return; | 1694 | return; |
1699 | } | ||
1700 | 1695 | ||
1701 | if (!sta || !lq_sta) | 1696 | if (!sta || !lq_sta) |
1702 | return; | 1697 | return; |
@@ -2095,29 +2090,26 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | |||
2095 | struct ieee80211_tx_rate_control *txrc) | 2090 | struct ieee80211_tx_rate_control *txrc) |
2096 | { | 2091 | { |
2097 | 2092 | ||
2098 | int i; | ||
2099 | struct sk_buff *skb = txrc->skb; | 2093 | struct sk_buff *skb = txrc->skb; |
2100 | struct ieee80211_supported_band *sband = txrc->sband; | 2094 | struct ieee80211_supported_band *sband = txrc->sband; |
2101 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; | 2095 | struct iwl_priv *priv = (struct iwl_priv *)priv_r; |
2102 | struct ieee80211_conf *conf = &priv->hw->conf; | 2096 | struct ieee80211_conf *conf = &priv->hw->conf; |
2103 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 2097 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
2104 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 2098 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
2105 | __le16 fc; | 2099 | struct iwl_lq_sta *lq_sta = priv_sta; |
2106 | struct iwl_lq_sta *lq_sta; | 2100 | int rate_idx; |
2107 | 2101 | ||
2108 | IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); | 2102 | IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n"); |
2109 | 2103 | ||
2110 | /* Send management frames and broadcast/multicast data using lowest | 2104 | /* Send management frames and broadcast/multicast data using lowest |
2111 | * rate. */ | 2105 | * rate. */ |
2112 | fc = hdr->frame_control; | 2106 | if (!ieee80211_is_data(hdr->frame_control) || |
2113 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || | 2107 | is_multicast_ether_addr(hdr->addr1) || !sta || !lq_sta) { |
2114 | !sta || !priv_sta) { | ||
2115 | info->control.rates[0].idx = rate_lowest_index(sband, sta); | 2108 | info->control.rates[0].idx = rate_lowest_index(sband, sta); |
2116 | return; | 2109 | return; |
2117 | } | 2110 | } |
2118 | 2111 | ||
2119 | lq_sta = (struct iwl_lq_sta *)priv_sta; | 2112 | rate_idx = lq_sta->last_txrate_idx; |
2120 | i = lq_sta->last_txrate_idx; | ||
2121 | 2113 | ||
2122 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && | 2114 | if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && |
2123 | !lq_sta->ibss_sta_added) { | 2115 | !lq_sta->ibss_sta_added) { |
@@ -2137,14 +2129,12 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta, | |||
2137 | } | 2129 | } |
2138 | } | 2130 | } |
2139 | 2131 | ||
2140 | if ((i < 0) || (i > IWL_RATE_COUNT)) { | 2132 | if (rate_idx < 0 || rate_idx > IWL_RATE_COUNT) |
2141 | info->control.rates[0].idx = rate_lowest_index(sband, sta); | 2133 | rate_idx = rate_lowest_index(sband, sta); |
2142 | return; | 2134 | else if (sband->band == IEEE80211_BAND_5GHZ) |
2143 | } | 2135 | rate_idx -= IWL_FIRST_OFDM_RATE; |
2144 | 2136 | ||
2145 | if (sband->band == IEEE80211_BAND_5GHZ) | 2137 | info->control.rates[0].idx = rate_idx; |
2146 | i -= IWL_FIRST_OFDM_RATE; | ||
2147 | info->control.rates[0].idx = i; | ||
2148 | } | 2138 | } |
2149 | 2139 | ||
2150 | static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, | 2140 | static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, |
@@ -2525,7 +2515,7 @@ static ssize_t rs_sta_dbgfs_stats_table_read(struct file *file, | |||
2525 | for (i = 0; i < LQ_SIZE; i++) { | 2515 | for (i = 0; i < LQ_SIZE; i++) { |
2526 | desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n" | 2516 | desc += sprintf(buff+desc, "%s type=%d SGI=%d FAT=%d DUP=%d\n" |
2527 | "rate=0x%X\n", | 2517 | "rate=0x%X\n", |
2528 | lq_sta->active_tbl == i?"*":"x", | 2518 | lq_sta->active_tbl == i ? "*" : "x", |
2529 | lq_sta->lq_info[i].lq_type, | 2519 | lq_sta->lq_info[i].lq_type, |
2530 | lq_sta->lq_info[i].is_SGI, | 2520 | lq_sta->lq_info[i].is_SGI, |
2531 | lq_sta->lq_info[i].is_fat, | 2521 | lq_sta->lq_info[i].is_fat, |