aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-hw.h13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c79
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c14
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c57
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h21
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h3
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-scan.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sta.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c2
12 files changed, 106 insertions, 106 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
index 721f505ae47b..10f630e1afa6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
@@ -793,19 +793,6 @@ enum {
793 793
794/********************* END TXPOWER *****************************************/ 794/********************* END TXPOWER *****************************************/
795 795
796static inline u8 iwl4965_hw_get_rate(__le32 rate_n_flags)
797{
798 return le32_to_cpu(rate_n_flags) & 0xFF;
799}
800static inline u32 iwl4965_hw_get_rate_n_flags(__le32 rate_n_flags)
801{
802 return le32_to_cpu(rate_n_flags) & 0x1FFFF;
803}
804static inline __le32 iwl4965_hw_set_rate_n_flags(u8 rate, u16 flags)
805{
806 return cpu_to_le32(flags|(u16)rate);
807}
808
809 796
810/** 797/**
811 * Tx/Rx Queues 798 * Tx/Rx Queues
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index 77884e16a134..b9a4e4b19ab5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -536,7 +536,7 @@ static int rs_get_tbl_info_from_mcs(const u32 rate_n_flags,
536 u8 num_of_ant = get_num_of_ant_from_rate(rate_n_flags); 536 u8 num_of_ant = get_num_of_ant_from_rate(rate_n_flags);
537 u8 mcs; 537 u8 mcs;
538 538
539 *rate_idx = iwl4965_hwrate_to_plcp_idx(rate_n_flags); 539 *rate_idx = iwl_hwrate_to_plcp_idx(rate_n_flags);
540 540
541 if (*rate_idx == IWL_RATE_INVALID) { 541 if (*rate_idx == IWL_RATE_INVALID) {
542 *rate_idx = -1; 542 *rate_idx = -1;
@@ -1811,8 +1811,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1811 tbl = &(lq_sta->lq_info[active_tbl]); 1811 tbl = &(lq_sta->lq_info[active_tbl]);
1812 1812
1813 /* Revert to "active" rate and throughput info */ 1813 /* Revert to "active" rate and throughput info */
1814 index = iwl4965_hwrate_to_plcp_idx( 1814 index = iwl_hwrate_to_plcp_idx(tbl->current_rate);
1815 tbl->current_rate);
1816 current_tpt = lq_sta->last_tpt; 1815 current_tpt = lq_sta->last_tpt;
1817 1816
1818 /* Need to set up a new rate table in uCode */ 1817 /* Need to set up a new rate table in uCode */
@@ -1966,8 +1965,7 @@ lq_update:
1966 rs_rate_scale_clear_window(&(tbl->win[i])); 1965 rs_rate_scale_clear_window(&(tbl->win[i]));
1967 1966
1968 /* Use new "search" start rate */ 1967 /* Use new "search" start rate */
1969 index = iwl4965_hwrate_to_plcp_idx( 1968 index = iwl_hwrate_to_plcp_idx(tbl->current_rate);
1970 tbl->current_rate);
1971 1969
1972 IWL_DEBUG_RATE("Switch current mcs: %X index: %d\n", 1970 IWL_DEBUG_RATE("Switch current mcs: %X index: %d\n",
1973 tbl->current_rate, index); 1971 tbl->current_rate, index);
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h
index 1dd4124227a5..cbd126418490 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h
@@ -286,8 +286,6 @@ static inline u8 iwl4965_get_prev_ieee_rate(u8 rate_index)
286 return rate; 286 return rate;
287} 287}
288 288
289extern int iwl4965_hwrate_to_plcp_idx(u32 rate_n_flags);
290
291/** 289/**
292 * iwl4965_fill_rs_info - Fill an output text buffer with the rate representation 290 * iwl4965_fill_rs_info - Fill an output text buffer with the rate representation
293 * 291 *
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 1b8dc2dbdb8f..87648d0536b3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -307,60 +307,6 @@ static int is_fat_channel(__le32 rxon_flags)
307 (rxon_flags & RXON_FLG_CHANNEL_MODE_MIXED_MSK); 307 (rxon_flags & RXON_FLG_CHANNEL_MODE_MIXED_MSK);
308} 308}
309 309
310int iwl4965_hwrate_to_plcp_idx(u32 rate_n_flags)
311{
312 int idx = 0;
313
314 /* 4965 HT rate format */
315 if (rate_n_flags & RATE_MCS_HT_MSK) {
316 idx = (rate_n_flags & 0xff);
317
318 if (idx >= IWL_RATE_MIMO2_6M_PLCP)
319 idx = idx - IWL_RATE_MIMO2_6M_PLCP;
320
321 idx += IWL_FIRST_OFDM_RATE;
322 /* skip 9M not supported in ht*/
323 if (idx >= IWL_RATE_9M_INDEX)
324 idx += 1;
325 if ((idx >= IWL_FIRST_OFDM_RATE) && (idx <= IWL_LAST_OFDM_RATE))
326 return idx;
327
328 /* 4965 legacy rate format, search for match in table */
329 } else {
330 for (idx = 0; idx < ARRAY_SIZE(iwl_rates); idx++)
331 if (iwl_rates[idx].plcp == (rate_n_flags & 0xFF))
332 return idx;
333 }
334
335 return -1;
336}
337
338/**
339 * translate ucode response to mac80211 tx status control values
340 */
341void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
342 struct ieee80211_tx_info *control)
343{
344 int rate_index;
345
346 control->antenna_sel_tx =
347 ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS);
348 if (rate_n_flags & RATE_MCS_HT_MSK)
349 control->flags |= IEEE80211_TX_CTL_OFDM_HT;
350 if (rate_n_flags & RATE_MCS_GF_MSK)
351 control->flags |= IEEE80211_TX_CTL_GREEN_FIELD;
352 if (rate_n_flags & RATE_MCS_FAT_MSK)
353 control->flags |= IEEE80211_TX_CTL_40_MHZ_WIDTH;
354 if (rate_n_flags & RATE_MCS_DUP_MSK)
355 control->flags |= IEEE80211_TX_CTL_DUP_DATA;
356 if (rate_n_flags & RATE_MCS_SGI_MSK)
357 control->flags |= IEEE80211_TX_CTL_SHORT_GI;
358 rate_index = iwl4965_hwrate_to_plcp_idx(rate_n_flags);
359 if (control->band == IEEE80211_BAND_5GHZ)
360 rate_index -= IWL_FIRST_OFDM_RATE;
361 control->tx_rate_idx = rate_index;
362}
363
364/* 310/*
365 * EEPROM handlers 311 * EEPROM handlers
366 */ 312 */
@@ -1796,10 +1742,10 @@ unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
1796 1742
1797 if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP)) 1743 if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP))
1798 tx_beacon_cmd->tx.rate_n_flags = 1744 tx_beacon_cmd->tx.rate_n_flags =
1799 iwl4965_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK); 1745 iwl_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK);
1800 else 1746 else
1801 tx_beacon_cmd->tx.rate_n_flags = 1747 tx_beacon_cmd->tx.rate_n_flags =
1802 iwl4965_hw_set_rate_n_flags(rate, 0); 1748 iwl_hw_set_rate_n_flags(rate, 0);
1803 1749
1804 tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | 1750 tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK |
1805 TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK); 1751 TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK);
@@ -2568,7 +2514,7 @@ static void iwl4965_dbg_report_frame(struct iwl_priv *priv,
2568 else 2514 else
2569 title = "Frame"; 2515 title = "Frame";
2570 2516
2571 rate_idx = iwl4965_hwrate_to_plcp_idx(rate_sym); 2517 rate_idx = iwl_hwrate_to_plcp_idx(rate_sym);
2572 if (unlikely(rate_idx == -1)) 2518 if (unlikely(rate_idx == -1))
2573 bitrate = 0; 2519 bitrate = 0;
2574 else 2520 else
@@ -2633,7 +2579,7 @@ void iwl4965_rx_reply_rx(struct iwl_priv *priv,
2633 rx_status.band = (rx_start->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ? 2579 rx_status.band = (rx_start->phy_flags & RX_RES_PHY_FLAGS_BAND_24_MSK) ?
2634 IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ; 2580 IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
2635 rx_status.rate_idx = 2581 rx_status.rate_idx =
2636 iwl4965_hwrate_to_plcp_idx(le32_to_cpu(rx_start->rate_n_flags)); 2582 iwl_hwrate_to_plcp_idx(le32_to_cpu(rx_start->rate_n_flags));
2637 if (rx_status.band == IEEE80211_BAND_5GHZ) 2583 if (rx_status.band == IEEE80211_BAND_5GHZ)
2638 rx_status.rate_idx -= IWL_FIRST_OFDM_RATE; 2584 rx_status.rate_idx -= IWL_FIRST_OFDM_RATE;
2639 2585
@@ -2842,7 +2788,7 @@ static int iwl4965_tx_status_reply_compressed_ba(struct iwl_priv *priv,
2842 info->flags |= IEEE80211_TX_STAT_AMPDU; 2788 info->flags |= IEEE80211_TX_STAT_AMPDU;
2843 info->status.ampdu_ack_map = successes; 2789 info->status.ampdu_ack_map = successes;
2844 info->status.ampdu_ack_len = agg->frame_count; 2790 info->status.ampdu_ack_len = agg->frame_count;
2845 iwl4965_hwrate_to_tx_control(priv, agg->rate_n_flags, info); 2791 iwl_hwrate_to_tx_control(priv, agg->rate_n_flags, info);
2846 2792
2847 IWL_DEBUG_TX_REPLY("Bitmap %llx\n", (unsigned long long)bitmap); 2793 IWL_DEBUG_TX_REPLY("Bitmap %llx\n", (unsigned long long)bitmap);
2848 2794
@@ -3189,15 +3135,15 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
3189 struct agg_tx_status *frame_status = tx_resp->u.agg_status; 3135 struct agg_tx_status *frame_status = tx_resp->u.agg_status;
3190 struct ieee80211_tx_info *info = NULL; 3136 struct ieee80211_tx_info *info = NULL;
3191 struct ieee80211_hdr *hdr = NULL; 3137 struct ieee80211_hdr *hdr = NULL;
3138 u32 rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags);
3192 int i, sh, idx; 3139 int i, sh, idx;
3193 u16 seq; 3140 u16 seq;
3194
3195 if (agg->wait_for_ba) 3141 if (agg->wait_for_ba)
3196 IWL_DEBUG_TX_REPLY("got tx response w/o block-ack\n"); 3142 IWL_DEBUG_TX_REPLY("got tx response w/o block-ack\n");
3197 3143
3198 agg->frame_count = tx_resp->frame_count; 3144 agg->frame_count = tx_resp->frame_count;
3199 agg->start_idx = start_idx; 3145 agg->start_idx = start_idx;
3200 agg->rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags); 3146 agg->rate_n_flags = rate_n_flags;
3201 agg->bitmap = 0; 3147 agg->bitmap = 0;
3202 3148
3203 /* # frames attempted by Tx command */ 3149 /* # frames attempted by Tx command */
@@ -3215,15 +3161,12 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
3215 info->flags &= ~IEEE80211_TX_CTL_AMPDU; 3161 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
3216 info->flags |= iwl_is_tx_success(status)? 3162 info->flags |= iwl_is_tx_success(status)?
3217 IEEE80211_TX_STAT_ACK : 0; 3163 IEEE80211_TX_STAT_ACK : 0;
3218 iwl4965_hwrate_to_tx_control(priv, 3164 iwl_hwrate_to_tx_control(priv, rate_n_flags, info);
3219 le32_to_cpu(tx_resp->rate_n_flags),
3220 info);
3221 /* FIXME: code repetition end */ 3165 /* FIXME: code repetition end */
3222 3166
3223 IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n", 3167 IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n",
3224 status & 0xff, tx_resp->failure_frame); 3168 status & 0xff, tx_resp->failure_frame);
3225 IWL_DEBUG_TX_REPLY("Rate Info rate_n_flags=%x\n", 3169 IWL_DEBUG_TX_REPLY("Rate Info rate_n_flags=%x\n", rate_n_flags);
3226 iwl4965_hw_get_rate_n_flags(tx_resp->rate_n_flags));
3227 3170
3228 agg->wait_for_ba = 0; 3171 agg->wait_for_ba = 0;
3229 } else { 3172 } else {
@@ -3281,7 +3224,6 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
3281 3224
3282 agg->bitmap = bitmap; 3225 agg->bitmap = bitmap;
3283 agg->start_idx = start; 3226 agg->start_idx = start;
3284 agg->rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags);
3285 IWL_DEBUG_TX_REPLY("Frames %d start_idx=%d bitmap=0x%llx\n", 3227 IWL_DEBUG_TX_REPLY("Frames %d start_idx=%d bitmap=0x%llx\n",
3286 agg->frame_count, agg->start_idx, 3228 agg->frame_count, agg->start_idx,
3287 (unsigned long long)agg->bitmap); 3229 (unsigned long long)agg->bitmap);
@@ -3375,7 +3317,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
3375 info->status.retry_count = tx_resp->failure_frame; 3317 info->status.retry_count = tx_resp->failure_frame;
3376 info->flags |= 3318 info->flags |=
3377 iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0; 3319 iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0;
3378 iwl4965_hwrate_to_tx_control(priv, 3320 iwl_hwrate_to_tx_control(priv,
3379 le32_to_cpu(tx_resp->rate_n_flags), 3321 le32_to_cpu(tx_resp->rate_n_flags),
3380 info); 3322 info);
3381 3323
@@ -3386,6 +3328,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
3386 tx_resp->failure_frame); 3328 tx_resp->failure_frame);
3387 3329
3388 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); 3330 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index);
3331
3389 if (index != -1) { 3332 if (index != -1) {
3390 int freed = iwl_tx_queue_reclaim(priv, txq_id, index); 3333 int freed = iwl_tx_queue_reclaim(priv, txq_id, index);
3391 if (tid != MAX_TID_COUNT) 3334 if (tid != MAX_TID_COUNT)
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index da8750b97eec..8c466b02bdff 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -1139,6 +1139,7 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
1139 struct agg_tx_status *frame_status = &tx_resp->status; 1139 struct agg_tx_status *frame_status = &tx_resp->status;
1140 struct ieee80211_tx_info *info = NULL; 1140 struct ieee80211_tx_info *info = NULL;
1141 struct ieee80211_hdr *hdr = NULL; 1141 struct ieee80211_hdr *hdr = NULL;
1142 u32 rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags);
1142 int i, sh, idx; 1143 int i, sh, idx;
1143 u16 seq; 1144 u16 seq;
1144 1145
@@ -1147,7 +1148,7 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
1147 1148
1148 agg->frame_count = tx_resp->frame_count; 1149 agg->frame_count = tx_resp->frame_count;
1149 agg->start_idx = start_idx; 1150 agg->start_idx = start_idx;
1150 agg->rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags); 1151 agg->rate_n_flags = rate_n_flags;
1151 agg->bitmap = 0; 1152 agg->bitmap = 0;
1152 1153
1153 /* # frames attempted by Tx command */ 1154 /* # frames attempted by Tx command */
@@ -1165,15 +1166,13 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
1165 info->flags &= ~IEEE80211_TX_CTL_AMPDU; 1166 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
1166 info->flags |= iwl_is_tx_success(status)? 1167 info->flags |= iwl_is_tx_success(status)?
1167 IEEE80211_TX_STAT_ACK : 0; 1168 IEEE80211_TX_STAT_ACK : 0;
1168 iwl4965_hwrate_to_tx_control(priv, 1169 iwl_hwrate_to_tx_control(priv, rate_n_flags, info);
1169 le32_to_cpu(tx_resp->rate_n_flags), 1170
1170 info);
1171 /* FIXME: code repetition end */ 1171 /* FIXME: code repetition end */
1172 1172
1173 IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n", 1173 IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n",
1174 status & 0xff, tx_resp->failure_frame); 1174 status & 0xff, tx_resp->failure_frame);
1175 IWL_DEBUG_TX_REPLY("Rate Info rate_n_flags=%x\n", 1175 IWL_DEBUG_TX_REPLY("Rate Info rate_n_flags=%x\n", rate_n_flags);
1176 iwl4965_hw_get_rate_n_flags(tx_resp->rate_n_flags));
1177 1176
1178 agg->wait_for_ba = 0; 1177 agg->wait_for_ba = 0;
1179 } else { 1178 } else {
@@ -1231,7 +1230,6 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
1231 1230
1232 agg->bitmap = bitmap; 1231 agg->bitmap = bitmap;
1233 agg->start_idx = start; 1232 agg->start_idx = start;
1234 agg->rate_n_flags = le32_to_cpu(tx_resp->rate_n_flags);
1235 IWL_DEBUG_TX_REPLY("Frames %d start_idx=%d bitmap=0x%llx\n", 1233 IWL_DEBUG_TX_REPLY("Frames %d start_idx=%d bitmap=0x%llx\n",
1236 agg->frame_count, agg->start_idx, 1234 agg->frame_count, agg->start_idx,
1237 (unsigned long long)agg->bitmap); 1235 (unsigned long long)agg->bitmap);
@@ -1322,7 +1320,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
1322 info->status.retry_count = tx_resp->failure_frame; 1320 info->status.retry_count = tx_resp->failure_frame;
1323 info->flags = 1321 info->flags =
1324 iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0; 1322 iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0;
1325 iwl4965_hwrate_to_tx_control(priv, 1323 iwl_hwrate_to_tx_control(priv,
1326 le32_to_cpu(tx_resp->rate_n_flags), 1324 le32_to_cpu(tx_resp->rate_n_flags),
1327 info); 1325 info);
1328 1326
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 164697a6413d..7e20f46132d5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -85,6 +85,63 @@ const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = {
85}; 85};
86EXPORT_SYMBOL(iwl_rates); 86EXPORT_SYMBOL(iwl_rates);
87 87
88/**
89 * translate ucode response to mac80211 tx status control values
90 */
91void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
92 struct ieee80211_tx_info *control)
93{
94 int rate_index;
95
96 control->antenna_sel_tx =
97 ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS);
98 if (rate_n_flags & RATE_MCS_HT_MSK)
99 control->flags |= IEEE80211_TX_CTL_OFDM_HT;
100 if (rate_n_flags & RATE_MCS_GF_MSK)
101 control->flags |= IEEE80211_TX_CTL_GREEN_FIELD;
102 if (rate_n_flags & RATE_MCS_FAT_MSK)
103 control->flags |= IEEE80211_TX_CTL_40_MHZ_WIDTH;
104 if (rate_n_flags & RATE_MCS_DUP_MSK)
105 control->flags |= IEEE80211_TX_CTL_DUP_DATA;
106 if (rate_n_flags & RATE_MCS_SGI_MSK)
107 control->flags |= IEEE80211_TX_CTL_SHORT_GI;
108 rate_index = iwl_hwrate_to_plcp_idx(rate_n_flags);
109 if (control->band == IEEE80211_BAND_5GHZ)
110 rate_index -= IWL_FIRST_OFDM_RATE;
111 control->tx_rate_idx = rate_index;
112}
113EXPORT_SYMBOL(iwl_hwrate_to_tx_control);
114
115int iwl_hwrate_to_plcp_idx(u32 rate_n_flags)
116{
117 int idx = 0;
118
119 /* HT rate format */
120 if (rate_n_flags & RATE_MCS_HT_MSK) {
121 idx = (rate_n_flags & 0xff);
122
123 if (idx >= IWL_RATE_MIMO2_6M_PLCP)
124 idx = idx - IWL_RATE_MIMO2_6M_PLCP;
125
126 idx += IWL_FIRST_OFDM_RATE;
127 /* skip 9M not supported in ht*/
128 if (idx >= IWL_RATE_9M_INDEX)
129 idx += 1;
130 if ((idx >= IWL_FIRST_OFDM_RATE) && (idx <= IWL_LAST_OFDM_RATE))
131 return idx;
132
133 /* legacy rate format, search for match in table */
134 } else {
135 for (idx = 0; idx < ARRAY_SIZE(iwl_rates); idx++)
136 if (iwl_rates[idx].plcp == (rate_n_flags & 0xFF))
137 return idx;
138 }
139
140 return -1;
141}
142EXPORT_SYMBOL(iwl_hwrate_to_plcp_idx);
143
144
88 145
89const u8 iwl_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }; 146const u8 iwl_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
90EXPORT_SYMBOL(iwl_bcast_addr); 147EXPORT_SYMBOL(iwl_bcast_addr);
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 5837577caa8b..2eb08f3937f6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -244,6 +244,27 @@ int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id);
244int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force); 244int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force);
245 245
246/******************************************************************************* 246/*******************************************************************************
247 * Rate
248 ******************************************************************************/
249
250void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
251 struct ieee80211_tx_info *info);
252int iwl_hwrate_to_plcp_idx(u32 rate_n_flags);
253
254static inline u8 iwl_hw_get_rate(__le32 rate_n_flags)
255{
256 return le32_to_cpu(rate_n_flags) & 0xFF;
257}
258static inline u32 iwl_hw_get_rate_n_flags(__le32 rate_n_flags)
259{
260 return le32_to_cpu(rate_n_flags) & 0x1FFFF;
261}
262static inline __le32 iwl_hw_set_rate_n_flags(u8 rate, u32 flags)
263{
264 return cpu_to_le32(flags|(u32)rate);
265}
266
267/*******************************************************************************
247 * Scanning 268 * Scanning
248 ******************************************************************************/ 269 ******************************************************************************/
249int iwl_scan_cancel(struct iwl_priv *priv); 270int iwl_scan_cancel(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index e5869874213c..69765c975d38 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -733,9 +733,6 @@ extern int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv,
733extern int iwl4965_alive_notify(struct iwl_priv *priv); 733extern int iwl4965_alive_notify(struct iwl_priv *priv);
734extern void iwl4965_update_rate_scaling(struct iwl_priv *priv, u8 mode); 734extern void iwl4965_update_rate_scaling(struct iwl_priv *priv, u8 mode);
735extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv); 735extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv);
736extern void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv,
737 u32 rate_n_flags,
738 struct ieee80211_tx_info *info);
739 736
740extern void iwl4965_init_ht_hw_capab(const struct iwl_priv *priv, 737extern void iwl4965_init_ht_hw_capab(const struct iwl_priv *priv,
741 struct ieee80211_ht_info *ht_info, 738 struct ieee80211_ht_info *ht_info,
diff --git a/drivers/net/wireless/iwlwifi/iwl-scan.c b/drivers/net/wireless/iwlwifi/iwl-scan.c
index c2ed7c17ea1f..7b9475b7f0f4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-scan.c
+++ b/drivers/net/wireless/iwlwifi/iwl-scan.c
@@ -792,8 +792,9 @@ static void iwl_bg_request_scan(struct work_struct *data)
792 case 2: 792 case 2:
793 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 793 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
794 scan->tx_cmd.rate_n_flags = 794 scan->tx_cmd.rate_n_flags =
795 iwl4965_hw_set_rate_n_flags(IWL_RATE_1M_PLCP, 795 iwl_hw_set_rate_n_flags(IWL_RATE_1M_PLCP,
796 RATE_MCS_ANT_B_MSK|RATE_MCS_CCK_MSK); 796 RATE_MCS_ANT_B_MSK|
797 RATE_MCS_CCK_MSK);
797 798
798 scan->good_CRC_th = 0; 799 scan->good_CRC_th = 0;
799 band = IEEE80211_BAND_2GHZ; 800 band = IEEE80211_BAND_2GHZ;
@@ -801,8 +802,8 @@ static void iwl_bg_request_scan(struct work_struct *data)
801 802
802 case 1: 803 case 1:
803 scan->tx_cmd.rate_n_flags = 804 scan->tx_cmd.rate_n_flags =
804 iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, 805 iwl_hw_set_rate_n_flags(IWL_RATE_6M_PLCP,
805 RATE_MCS_ANT_B_MSK); 806 RATE_MCS_ANT_B_MSK);
806 scan->good_CRC_th = IWL_GOOD_CRC_TH; 807 scan->good_CRC_th = IWL_GOOD_CRC_TH;
807 band = IEEE80211_BAND_5GHZ; 808 band = IEEE80211_BAND_5GHZ;
808 break; 809 break;
diff --git a/drivers/net/wireless/iwlwifi/iwl-sta.c b/drivers/net/wireless/iwlwifi/iwl-sta.c
index 3e257cfb44a2..fae5d6d528d4 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sta.c
@@ -824,7 +824,7 @@ static void iwl_sta_init_lq(struct iwl_priv *priv, const u8 *addr, int is_ap)
824 rate_flags |= RATE_MCS_ANT_B_MSK; /*FIXME:RS*/ 824 rate_flags |= RATE_MCS_ANT_B_MSK; /*FIXME:RS*/
825 825
826 link_cmd.rs_table[i].rate_n_flags = 826 link_cmd.rs_table[i].rate_n_flags =
827 iwl4965_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags); 827 iwl_hw_set_rate_n_flags(iwl_rates[r].plcp, rate_flags);
828 r = iwl4965_get_prev_ieee_rate(r); 828 r = iwl4965_get_prev_ieee_rate(r);
829 } 829 }
830 830
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index 1aa19f4a8bcb..e804bf8aea80 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -696,7 +696,7 @@ static void iwl_tx_cmd_build_rate(struct iwl_priv *priv,
696 696
697 tx_cmd->rts_retry_limit = rts_retry_limit; 697 tx_cmd->rts_retry_limit = rts_retry_limit;
698 tx_cmd->data_retry_limit = data_retry_limit; 698 tx_cmd->data_retry_limit = data_retry_limit;
699 tx_cmd->rate_n_flags = iwl4965_hw_set_rate_n_flags(rate_plcp, rate_flags); 699 tx_cmd->rate_n_flags = iwl_hw_set_rate_n_flags(rate_plcp, rate_flags);
700} 700}
701 701
702static void iwl_tx_cmd_build_hwcrypto(struct iwl_priv *priv, 702static void iwl_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 4183bd5ebe32..2073ba686f35 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -1331,7 +1331,7 @@ static void iwl4965_rx_beacon_notif(struct iwl_priv *priv,
1331#ifdef CONFIG_IWLWIFI_DEBUG 1331#ifdef CONFIG_IWLWIFI_DEBUG
1332 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data; 1332 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
1333 struct iwl4965_beacon_notif *beacon = &(pkt->u.beacon_status); 1333 struct iwl4965_beacon_notif *beacon = &(pkt->u.beacon_status);
1334 u8 rate = iwl4965_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags); 1334 u8 rate = iwl_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags);
1335 1335
1336 IWL_DEBUG_RX("beacon status %x retries %d iss %d " 1336 IWL_DEBUG_RX("beacon status %x retries %d iss %d "
1337 "tsf %d %d rate %d\n", 1337 "tsf %d %d rate %d\n",