aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlegacy/4965-rs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlegacy/4965-rs.c')
-rw-r--r--drivers/net/wireless/iwlegacy/4965-rs.c48
1 files changed, 15 insertions, 33 deletions
diff --git a/drivers/net/wireless/iwlegacy/4965-rs.c b/drivers/net/wireless/iwlegacy/4965-rs.c
index 467d0cb14ecd..d7e2856e41d3 100644
--- a/drivers/net/wireless/iwlegacy/4965-rs.c
+++ b/drivers/net/wireless/iwlegacy/4965-rs.c
@@ -641,13 +641,10 @@ il4965_rs_toggle_antenna(u32 valid_ant, u32 *rate_n_flags,
641 * there are no non-GF stations present in the BSS. 641 * there are no non-GF stations present in the BSS.
642 */ 642 */
643static bool 643static bool
644il4965_rs_use_green(struct ieee80211_sta *sta) 644il4965_rs_use_green(struct il_priv *il, struct ieee80211_sta *sta)
645{ 645{
646 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
647 struct il_rxon_context *ctx = sta_priv->common.ctx;
648
649 return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) && 646 return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) &&
650 !(ctx->ht.non_gf_sta_present); 647 !il->ht.non_gf_sta_present;
651} 648}
652 649
653/** 650/**
@@ -823,8 +820,6 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
823 u32 tx_rate; 820 u32 tx_rate;
824 struct il_scale_tbl_info tbl_type; 821 struct il_scale_tbl_info tbl_type;
825 struct il_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl; 822 struct il_scale_tbl_info *curr_tbl, *other_tbl, *tmp_tbl;
826 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
827 struct il_rxon_context *ctx = sta_priv->common.ctx;
828 823
829 D_RATE("get frame ack response, update rate scale win\n"); 824 D_RATE("get frame ack response, update rate scale win\n");
830 825
@@ -892,7 +887,7 @@ il4965_rs_tx_status(void *il_r, struct ieee80211_supported_band *sband,
892 lq_sta->missed_rate_counter++; 887 lq_sta->missed_rate_counter++;
893 if (lq_sta->missed_rate_counter > IL_MISSED_RATE_MAX) { 888 if (lq_sta->missed_rate_counter > IL_MISSED_RATE_MAX) {
894 lq_sta->missed_rate_counter = 0; 889 lq_sta->missed_rate_counter = 0;
895 il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_ASYNC, false); 890 il_send_lq_cmd(il, &lq_sta->lq, CMD_ASYNC, false);
896 } 891 }
897 /* Regardless, ignore this status info for outdated rate */ 892 /* Regardless, ignore this status info for outdated rate */
898 return; 893 return;
@@ -1184,8 +1179,6 @@ il4965_rs_switch_to_mimo2(struct il_priv *il, struct il_lq_sta *lq_sta,
1184 u16 rate_mask; 1179 u16 rate_mask;
1185 s32 rate; 1180 s32 rate;
1186 s8 is_green = lq_sta->is_green; 1181 s8 is_green = lq_sta->is_green;
1187 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
1188 struct il_rxon_context *ctx = sta_priv->common.ctx;
1189 1182
1190 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) 1183 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported)
1191 return -1; 1184 return -1;
@@ -1206,7 +1199,7 @@ il4965_rs_switch_to_mimo2(struct il_priv *il, struct il_lq_sta *lq_sta,
1206 tbl->max_search = IL_MAX_SEARCH; 1199 tbl->max_search = IL_MAX_SEARCH;
1207 rate_mask = lq_sta->active_mimo2_rate; 1200 rate_mask = lq_sta->active_mimo2_rate;
1208 1201
1209 if (il_is_ht40_tx_allowed(il, ctx, &sta->ht_cap)) 1202 if (il_is_ht40_tx_allowed(il, &sta->ht_cap))
1210 tbl->is_ht40 = 1; 1203 tbl->is_ht40 = 1;
1211 else 1204 else
1212 tbl->is_ht40 = 0; 1205 tbl->is_ht40 = 0;
@@ -1240,8 +1233,6 @@ il4965_rs_switch_to_siso(struct il_priv *il, struct il_lq_sta *lq_sta,
1240 u16 rate_mask; 1233 u16 rate_mask;
1241 u8 is_green = lq_sta->is_green; 1234 u8 is_green = lq_sta->is_green;
1242 s32 rate; 1235 s32 rate;
1243 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
1244 struct il_rxon_context *ctx = sta_priv->common.ctx;
1245 1236
1246 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported) 1237 if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported)
1247 return -1; 1238 return -1;
@@ -1254,7 +1245,7 @@ il4965_rs_switch_to_siso(struct il_priv *il, struct il_lq_sta *lq_sta,
1254 tbl->max_search = IL_MAX_SEARCH; 1245 tbl->max_search = IL_MAX_SEARCH;
1255 rate_mask = lq_sta->active_siso_rate; 1246 rate_mask = lq_sta->active_siso_rate;
1256 1247
1257 if (il_is_ht40_tx_allowed(il, ctx, &sta->ht_cap)) 1248 if (il_is_ht40_tx_allowed(il, &sta->ht_cap))
1258 tbl->is_ht40 = 1; 1249 tbl->is_ht40 = 1;
1259 else 1250 else
1260 tbl->is_ht40 = 0; 1251 tbl->is_ht40 = 0;
@@ -1733,8 +1724,7 @@ il4965_rs_stay_in_table(struct il_lq_sta *lq_sta, bool force_search)
1733 * setup rate table in uCode 1724 * setup rate table in uCode
1734 */ 1725 */
1735static void 1726static void
1736il4965_rs_update_rate_tbl(struct il_priv *il, struct il_rxon_context *ctx, 1727il4965_rs_update_rate_tbl(struct il_priv *il, struct il_lq_sta *lq_sta,
1737 struct il_lq_sta *lq_sta,
1738 struct il_scale_tbl_info *tbl, int idx, u8 is_green) 1728 struct il_scale_tbl_info *tbl, int idx, u8 is_green)
1739{ 1729{
1740 u32 rate; 1730 u32 rate;
@@ -1742,7 +1732,7 @@ il4965_rs_update_rate_tbl(struct il_priv *il, struct il_rxon_context *ctx,
1742 /* Update uCode's rate table. */ 1732 /* Update uCode's rate table. */
1743 rate = il4965_rate_n_flags_from_tbl(il, tbl, idx, is_green); 1733 rate = il4965_rate_n_flags_from_tbl(il, tbl, idx, is_green);
1744 il4965_rs_fill_link_cmd(il, lq_sta, rate); 1734 il4965_rs_fill_link_cmd(il, lq_sta, rate);
1745 il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_ASYNC, false); 1735 il_send_lq_cmd(il, &lq_sta->lq, CMD_ASYNC, false);
1746} 1736}
1747 1737
1748/* 1738/*
@@ -1778,8 +1768,6 @@ il4965_rs_rate_scale_perform(struct il_priv *il, struct sk_buff *skb,
1778 s32 sr; 1768 s32 sr;
1779 u8 tid = MAX_TID_COUNT; 1769 u8 tid = MAX_TID_COUNT;
1780 struct il_tid_data *tid_data; 1770 struct il_tid_data *tid_data;
1781 struct il_station_priv *sta_priv = (void *)sta->drv_priv;
1782 struct il_rxon_context *ctx = sta_priv->common.ctx;
1783 1771
1784 D_RATE("rate scale calculate new rate for skb\n"); 1772 D_RATE("rate scale calculate new rate for skb\n");
1785 1773
@@ -1815,7 +1803,7 @@ il4965_rs_rate_scale_perform(struct il_priv *il, struct sk_buff *skb,
1815 if (is_legacy(tbl->lq_type)) 1803 if (is_legacy(tbl->lq_type))
1816 lq_sta->is_green = 0; 1804 lq_sta->is_green = 0;
1817 else 1805 else
1818 lq_sta->is_green = il4965_rs_use_green(sta); 1806 lq_sta->is_green = il4965_rs_use_green(il, sta);
1819 is_green = lq_sta->is_green; 1807 is_green = lq_sta->is_green;
1820 1808
1821 /* current tx rate */ 1809 /* current tx rate */
@@ -1854,7 +1842,7 @@ il4965_rs_rate_scale_perform(struct il_priv *il, struct sk_buff *skb,
1854 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 1842 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
1855 /* get "active" rate info */ 1843 /* get "active" rate info */
1856 idx = il4965_hwrate_to_plcp_idx(tbl->current_rate); 1844 idx = il4965_hwrate_to_plcp_idx(tbl->current_rate);
1857 il4965_rs_update_rate_tbl(il, ctx, lq_sta, tbl, idx, 1845 il4965_rs_update_rate_tbl(il, lq_sta, tbl, idx,
1858 is_green); 1846 is_green);
1859 } 1847 }
1860 return; 1848 return;
@@ -2057,8 +2045,7 @@ il4965_rs_rate_scale_perform(struct il_priv *il, struct sk_buff *skb,
2057lq_update: 2045lq_update:
2058 /* Replace uCode's rate table for the destination station. */ 2046 /* Replace uCode's rate table for the destination station. */
2059 if (update_lq) 2047 if (update_lq)
2060 il4965_rs_update_rate_tbl(il, ctx, lq_sta, tbl, idx, 2048 il4965_rs_update_rate_tbl(il, lq_sta, tbl, idx, is_green);
2061 is_green);
2062 2049
2063 /* Should we stay with this modulation mode, 2050 /* Should we stay with this modulation mode,
2064 * or search for a new one? */ 2051 * or search for a new one? */
@@ -2098,7 +2085,7 @@ lq_update:
2098 D_RATE("Switch current mcs: %X idx: %d\n", 2085 D_RATE("Switch current mcs: %X idx: %d\n",
2099 tbl->current_rate, idx); 2086 tbl->current_rate, idx);
2100 il4965_rs_fill_link_cmd(il, lq_sta, tbl->current_rate); 2087 il4965_rs_fill_link_cmd(il, lq_sta, tbl->current_rate);
2101 il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_ASYNC, false); 2088 il_send_lq_cmd(il, &lq_sta->lq, CMD_ASYNC, false);
2102 } else 2089 } else
2103 done_search = 1; 2090 done_search = 1;
2104 } 2091 }
@@ -2166,17 +2153,15 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf,
2166 int rate_idx; 2153 int rate_idx;
2167 int i; 2154 int i;
2168 u32 rate; 2155 u32 rate;
2169 u8 use_green = il4965_rs_use_green(sta); 2156 u8 use_green = il4965_rs_use_green(il, sta);
2170 u8 active_tbl = 0; 2157 u8 active_tbl = 0;
2171 u8 valid_tx_ant; 2158 u8 valid_tx_ant;
2172 struct il_station_priv *sta_priv; 2159 struct il_station_priv *sta_priv;
2173 struct il_rxon_context *ctx;
2174 2160
2175 if (!sta || !lq_sta) 2161 if (!sta || !lq_sta)
2176 return; 2162 return;
2177 2163
2178 sta_priv = (void *)sta->drv_priv; 2164 sta_priv = (void *)sta->drv_priv;
2179 ctx = sta_priv->common.ctx;
2180 2165
2181 i = lq_sta->last_txrate_idx; 2166 i = lq_sta->last_txrate_idx;
2182 2167
@@ -2208,7 +2193,7 @@ il4965_rs_initialize_lq(struct il_priv *il, struct ieee80211_conf *conf,
2208 il4965_rs_set_expected_tpt_table(lq_sta, tbl); 2193 il4965_rs_set_expected_tpt_table(lq_sta, tbl);
2209 il4965_rs_fill_link_cmd(NULL, lq_sta, rate); 2194 il4965_rs_fill_link_cmd(NULL, lq_sta, rate);
2210 il->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq; 2195 il->stations[lq_sta->lq.sta_id].lq = &lq_sta->lq;
2211 il_send_lq_cmd(il, ctx, &lq_sta->lq, CMD_SYNC, true); 2196 il_send_lq_cmd(il, &lq_sta->lq, CMD_SYNC, true);
2212} 2197}
2213 2198
2214static void 2199static void
@@ -2341,7 +2326,7 @@ il4965_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id)
2341 lq_sta->is_dup = 0; 2326 lq_sta->is_dup = 0;
2342 lq_sta->max_rate_idx = -1; 2327 lq_sta->max_rate_idx = -1;
2343 lq_sta->missed_rate_counter = IL_MISSED_RATE_MAX; 2328 lq_sta->missed_rate_counter = IL_MISSED_RATE_MAX;
2344 lq_sta->is_green = il4965_rs_use_green(sta); 2329 lq_sta->is_green = il4965_rs_use_green(il, sta);
2345 lq_sta->active_legacy_rate = il->active_rate & ~(0x1000); 2330 lq_sta->active_legacy_rate = il->active_rate & ~(0x1000);
2346 lq_sta->band = il->band; 2331 lq_sta->band = il->band;
2347 /* 2332 /*
@@ -2579,9 +2564,6 @@ il4965_rs_sta_dbgfs_scale_table_write(struct file *file,
2579 char buf[64]; 2564 char buf[64];
2580 size_t buf_size; 2565 size_t buf_size;
2581 u32 parsed_rate; 2566 u32 parsed_rate;
2582 struct il_station_priv *sta_priv =
2583 container_of(lq_sta, struct il_station_priv, lq_sta);
2584 struct il_rxon_context *ctx = sta_priv->common.ctx;
2585 2567
2586 il = lq_sta->drv; 2568 il = lq_sta->drv;
2587 memset(buf, 0, sizeof(buf)); 2569 memset(buf, 0, sizeof(buf));
@@ -2603,7 +2585,7 @@ il4965_rs_sta_dbgfs_scale_table_write(struct file *file,
2603 2585
2604 if (lq_sta->dbg_fixed_rate) { 2586 if (lq_sta->dbg_fixed_rate) {
2605 il4965_rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate); 2587 il4965_rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate);
2606 il_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC, false); 2588 il_send_lq_cmd(lq_sta->drv, &lq_sta->lq, CMD_ASYNC, false);
2607 } 2589 }
2608 2590
2609 return count; 2591 return count;