aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-agn-rs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c86
1 files changed, 47 insertions, 39 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index 91f26556ac2..592b0cfcf71 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -335,6 +335,32 @@ static u8 rs_tl_add_packet(struct iwl_lq_sta *lq_data,
335 return tid; 335 return tid;
336} 336}
337 337
338#ifdef CONFIG_MAC80211_DEBUGFS
339static void rs_program_fix_rate(struct iwl_priv *priv,
340 struct iwl_lq_sta *lq_sta)
341{
342 struct iwl_station_priv *sta_priv =
343 container_of(lq_sta, struct iwl_station_priv, lq_sta);
344 struct iwl_rxon_context *ctx = sta_priv->common.ctx;
345
346 lq_sta->active_legacy_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */
347 lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
348 lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
349 lq_sta->active_mimo3_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
350
351 lq_sta->dbg_fixed_rate = priv->dbg_fixed_rate;
352
353 IWL_DEBUG_RATE(priv, "sta_id %d rate 0x%X\n",
354 lq_sta->lq.sta_id, priv->dbg_fixed_rate);
355
356 if (priv->dbg_fixed_rate) {
357 rs_fill_link_cmd(NULL, lq_sta, priv->dbg_fixed_rate);
358 iwl_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC,
359 false);
360 }
361}
362#endif
363
338/* 364/*
339 get the traffic load value for tid 365 get the traffic load value for tid
340*/ 366*/
@@ -1046,7 +1072,10 @@ done:
1046 /* See if there's a better rate or modulation mode to try. */ 1072 /* See if there's a better rate or modulation mode to try. */
1047 if (sta && sta->supp_rates[sband->band]) 1073 if (sta && sta->supp_rates[sband->band])
1048 rs_rate_scale_perform(priv, skb, sta, lq_sta); 1074 rs_rate_scale_perform(priv, skb, sta, lq_sta);
1049 1075#ifdef CONFIG_MAC80211_DEBUGFS
1076 if (priv->dbg_fixed_rate != lq_sta->dbg_fixed_rate)
1077 rs_program_fix_rate(priv, lq_sta);
1078#endif
1050 if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist) 1079 if (priv->cfg->bt_params && priv->cfg->bt_params->advanced_bt_coexist)
1051 rs_bt_update_lq(priv, ctx, lq_sta); 1080 rs_bt_update_lq(priv, ctx, lq_sta);
1052} 1081}
@@ -2170,11 +2199,11 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta, bool force_search)
2170 * setup rate table in uCode 2199 * setup rate table in uCode
2171 * return rate_n_flags as used in the table 2200 * return rate_n_flags as used in the table
2172 */ 2201 */
2173static u32 rs_update_rate_tbl(struct iwl_priv *priv, 2202static void rs_update_rate_tbl(struct iwl_priv *priv,
2174 struct iwl_rxon_context *ctx, 2203 struct iwl_rxon_context *ctx,
2175 struct iwl_lq_sta *lq_sta, 2204 struct iwl_lq_sta *lq_sta,
2176 struct iwl_scale_tbl_info *tbl, 2205 struct iwl_scale_tbl_info *tbl,
2177 int index, u8 is_green) 2206 int index, u8 is_green)
2178{ 2207{
2179 u32 rate; 2208 u32 rate;
2180 2209
@@ -2182,8 +2211,6 @@ static u32 rs_update_rate_tbl(struct iwl_priv *priv,
2182 rate = rate_n_flags_from_tbl(priv, tbl, index, is_green); 2211 rate = rate_n_flags_from_tbl(priv, tbl, index, is_green);
2183 rs_fill_link_cmd(priv, lq_sta, rate); 2212 rs_fill_link_cmd(priv, lq_sta, rate);
2184 iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false); 2213 iwl_send_lq_cmd(priv, ctx, &lq_sta->lq, CMD_ASYNC, false);
2185
2186 return rate;
2187} 2214}
2188 2215
2189/* 2216/*
@@ -2212,7 +2239,6 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
2212 u8 update_lq = 0; 2239 u8 update_lq = 0;
2213 struct iwl_scale_tbl_info *tbl, *tbl1; 2240 struct iwl_scale_tbl_info *tbl, *tbl1;
2214 u16 rate_scale_index_msk = 0; 2241 u16 rate_scale_index_msk = 0;
2215 u32 rate;
2216 u8 is_green = 0; 2242 u8 is_green = 0;
2217 u8 active_tbl = 0; 2243 u8 active_tbl = 0;
2218 u8 done_search = 0; 2244 u8 done_search = 0;
@@ -2299,8 +2325,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
2299 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]); 2325 tbl = &(lq_sta->lq_info[lq_sta->active_tbl]);
2300 /* get "active" rate info */ 2326 /* get "active" rate info */
2301 index = iwl_hwrate_to_plcp_idx(tbl->current_rate); 2327 index = iwl_hwrate_to_plcp_idx(tbl->current_rate);
2302 rate = rs_update_rate_tbl(priv, ctx, lq_sta, 2328 rs_update_rate_tbl(priv, ctx, lq_sta, tbl,
2303 tbl, index, is_green); 2329 index, is_green);
2304 } 2330 }
2305 return; 2331 return;
2306 } 2332 }
@@ -2541,8 +2567,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
2541lq_update: 2567lq_update:
2542 /* Replace uCode's rate table for the destination station. */ 2568 /* Replace uCode's rate table for the destination station. */
2543 if (update_lq) 2569 if (update_lq)
2544 rate = rs_update_rate_tbl(priv, ctx, lq_sta, 2570 rs_update_rate_tbl(priv, ctx, lq_sta, tbl, index, is_green);
2545 tbl, index, is_green);
2546 2571
2547 if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_MULTI) { 2572 if (iwl_tx_ant_restriction(priv) == IWL_ANT_OK_MULTI) {
2548 /* Should we stay with this modulation mode, 2573 /* Should we stay with this modulation mode,
@@ -2871,6 +2896,7 @@ void iwl_rs_rate_init(struct iwl_priv *priv, struct ieee80211_sta *sta, u8 sta_i
2871 lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE; 2896 lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
2872 lq_sta->is_agg = 0; 2897 lq_sta->is_agg = 0;
2873 2898
2899 priv->dbg_fixed_rate = 0;
2874#ifdef CONFIG_MAC80211_DEBUGFS 2900#ifdef CONFIG_MAC80211_DEBUGFS
2875 lq_sta->dbg_fixed_rate = 0; 2901 lq_sta->dbg_fixed_rate = 0;
2876#endif 2902#endif
@@ -3045,7 +3071,6 @@ static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta,
3045 IWL_DEBUG_RATE(priv, "leave\n"); 3071 IWL_DEBUG_RATE(priv, "leave\n");
3046} 3072}
3047 3073
3048
3049#ifdef CONFIG_MAC80211_DEBUGFS 3074#ifdef CONFIG_MAC80211_DEBUGFS
3050static int open_file_generic(struct inode *inode, struct file *file) 3075static int open_file_generic(struct inode *inode, struct file *file)
3051{ 3076{
@@ -3070,6 +3095,7 @@ static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
3070 IWL_DEBUG_RATE(priv, "Fixed rate ON\n"); 3095 IWL_DEBUG_RATE(priv, "Fixed rate ON\n");
3071 } else { 3096 } else {
3072 lq_sta->dbg_fixed_rate = 0; 3097 lq_sta->dbg_fixed_rate = 0;
3098 priv->dbg_fixed_rate = 0;
3073 IWL_ERR(priv, 3099 IWL_ERR(priv,
3074 "Invalid antenna selection 0x%X, Valid is 0x%X\n", 3100 "Invalid antenna selection 0x%X, Valid is 0x%X\n",
3075 ant_sel_tx, valid_tx_ant); 3101 ant_sel_tx, valid_tx_ant);
@@ -3088,9 +3114,7 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
3088 char buf[64]; 3114 char buf[64];
3089 size_t buf_size; 3115 size_t buf_size;
3090 u32 parsed_rate; 3116 u32 parsed_rate;
3091 struct iwl_station_priv *sta_priv = 3117
3092 container_of(lq_sta, struct iwl_station_priv, lq_sta);
3093 struct iwl_rxon_context *ctx = sta_priv->common.ctx;
3094 3118
3095 priv = lq_sta->drv; 3119 priv = lq_sta->drv;
3096 memset(buf, 0, sizeof(buf)); 3120 memset(buf, 0, sizeof(buf));
@@ -3099,23 +3123,11 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
3099 return -EFAULT; 3123 return -EFAULT;
3100 3124
3101 if (sscanf(buf, "%x", &parsed_rate) == 1) 3125 if (sscanf(buf, "%x", &parsed_rate) == 1)
3102 lq_sta->dbg_fixed_rate = parsed_rate; 3126 priv->dbg_fixed_rate = lq_sta->dbg_fixed_rate = parsed_rate;
3103 else 3127 else
3104 lq_sta->dbg_fixed_rate = 0; 3128 priv->dbg_fixed_rate = lq_sta->dbg_fixed_rate = 0;
3105 3129
3106 lq_sta->active_legacy_rate = 0x0FFF; /* 1 - 54 MBits, includes CCK */ 3130 rs_program_fix_rate(priv, lq_sta);
3107 lq_sta->active_siso_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
3108 lq_sta->active_mimo2_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
3109 lq_sta->active_mimo3_rate = 0x1FD0; /* 6 - 60 MBits, no 9, no CCK */
3110
3111 IWL_DEBUG_RATE(priv, "sta_id %d rate 0x%X\n",
3112 lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate);
3113
3114 if (lq_sta->dbg_fixed_rate) {
3115 rs_fill_link_cmd(NULL, lq_sta, lq_sta->dbg_fixed_rate);
3116 iwl_send_lq_cmd(lq_sta->drv, ctx, &lq_sta->lq, CMD_ASYNC,
3117 false);
3118 }
3119 3131
3120 return count; 3132 return count;
3121} 3133}
@@ -3143,7 +3155,7 @@ static ssize_t rs_sta_dbgfs_scale_table_read(struct file *file,
3143 lq_sta->total_failed, lq_sta->total_success, 3155 lq_sta->total_failed, lq_sta->total_success,
3144 lq_sta->active_legacy_rate); 3156 lq_sta->active_legacy_rate);
3145 desc += sprintf(buff+desc, "fixed rate 0x%X\n", 3157 desc += sprintf(buff+desc, "fixed rate 0x%X\n",
3146 lq_sta->dbg_fixed_rate); 3158 priv->dbg_fixed_rate);
3147 desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n", 3159 desc += sprintf(buff+desc, "valid_tx_ant %s%s%s\n",
3148 (priv->hw_params.valid_tx_ant & ANT_A) ? "ANT_A," : "", 3160 (priv->hw_params.valid_tx_ant & ANT_A) ? "ANT_A," : "",
3149 (priv->hw_params.valid_tx_ant & ANT_B) ? "ANT_B," : "", 3161 (priv->hw_params.valid_tx_ant & ANT_B) ? "ANT_B," : "",
@@ -3254,14 +3266,10 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
3254static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, 3266static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file,
3255 char __user *user_buf, size_t count, loff_t *ppos) 3267 char __user *user_buf, size_t count, loff_t *ppos)
3256{ 3268{
3257 char buff[120];
3258 int desc = 0;
3259
3260 struct iwl_lq_sta *lq_sta = file->private_data; 3269 struct iwl_lq_sta *lq_sta = file->private_data;
3261 struct iwl_priv *priv;
3262 struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; 3270 struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl];
3263 3271 char buff[120];
3264 priv = lq_sta->drv; 3272 int desc = 0;
3265 3273
3266 if (is_Ht(tbl->lq_type)) 3274 if (is_Ht(tbl->lq_type))
3267 desc += sprintf(buff+desc, 3275 desc += sprintf(buff+desc,