aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c57
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c65
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rs.c37
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c19
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c5
8 files changed, 117 insertions, 84 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index c25daec4f93d..f440ed0fe543 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -422,34 +422,6 @@ static void rs_free_sta(void *priv, struct ieee80211_sta *sta,
422} 422}
423 423
424 424
425/*
426 * get ieee prev rate from rate scale table.
427 * for A and B mode we need to overright prev
428 * value
429 */
430static int rs_adjust_next_rate(struct iwl3945_priv *priv, int rate)
431{
432 int next_rate = iwl3945_get_prev_ieee_rate(rate);
433
434 switch (priv->band) {
435 case IEEE80211_BAND_5GHZ:
436 if (rate == IWL_RATE_12M_INDEX)
437 next_rate = IWL_RATE_9M_INDEX;
438 else if (rate == IWL_RATE_6M_INDEX)
439 next_rate = IWL_RATE_6M_INDEX;
440 break;
441/* XXX cannot be invoked in current mac80211 so not a regression
442 case MODE_IEEE80211B:
443 if (rate == IWL_RATE_11M_INDEX_TABLE)
444 next_rate = IWL_RATE_5M_INDEX_TABLE;
445 break;
446 */
447 default:
448 break;
449 }
450
451 return next_rate;
452}
453/** 425/**
454 * rs_tx_status - Update rate control values based on Tx results 426 * rs_tx_status - Update rate control values based on Tx results
455 * 427 *
@@ -460,17 +432,21 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
460 struct ieee80211_sta *sta, void *priv_sta, 432 struct ieee80211_sta *sta, void *priv_sta,
461 struct sk_buff *skb) 433 struct sk_buff *skb)
462{ 434{
463 u8 retries, current_count; 435 u8 retries = 0, current_count;
464 int scale_rate_index, first_index, last_index; 436 int scale_rate_index, first_index, last_index;
465 unsigned long flags; 437 unsigned long flags;
466 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate; 438 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate;
467 struct iwl3945_rs_sta *rs_sta = priv_sta; 439 struct iwl3945_rs_sta *rs_sta = priv_sta;
468 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 440 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
441 int i;
469 442
470 IWL_DEBUG_RATE("enter\n"); 443 IWL_DEBUG_RATE("enter\n");
471 444
472 retries = info->status.retry_count; 445 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++)
473 first_index = sband->bitrates[info->tx_rate_idx].hw_value; 446 retries += info->status.rates[i].count;
447 retries--;
448
449 first_index = sband->bitrates[info->status.rates[0].idx].hw_value;
474 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) { 450 if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) {
475 IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index); 451 IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index);
476 return; 452 return;
@@ -502,7 +478,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
502 last_index = scale_rate_index; 478 last_index = scale_rate_index;
503 } else { 479 } else {
504 current_count = priv->retry_rate; 480 current_count = priv->retry_rate;
505 last_index = rs_adjust_next_rate(priv, 481 last_index = iwl3945_rs_next_rate(priv,
506 scale_rate_index); 482 scale_rate_index);
507 } 483 }
508 484
@@ -518,7 +494,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
518 494
519 if (retries) 495 if (retries)
520 scale_rate_index = 496 scale_rate_index =
521 rs_adjust_next_rate(priv, scale_rate_index); 497 iwl3945_rs_next_rate(priv, scale_rate_index);
522 } 498 }
523 499
524 500
@@ -630,10 +606,11 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
630 * rate table and must reference the driver allocated rate table 606 * rate table and must reference the driver allocated rate table
631 * 607 *
632 */ 608 */
633static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, 609static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
634 struct ieee80211_sta *sta, void *priv_sta, 610 void *priv_sta, struct ieee80211_tx_rate_control *txrc)
635 struct sk_buff *skb, struct rate_selection *sel)
636{ 611{
612 struct ieee80211_supported_band *sband = txrc->sband;
613 struct sk_buff *skb = txrc->skb;
637 u8 low = IWL_RATE_INVALID; 614 u8 low = IWL_RATE_INVALID;
638 u8 high = IWL_RATE_INVALID; 615 u8 high = IWL_RATE_INVALID;
639 u16 high_low; 616 u16 high_low;
@@ -649,6 +626,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
649 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 626 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
650 u16 fc, rate_mask; 627 u16 fc, rate_mask;
651 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r; 628 struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r;
629 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
652 630
653 IWL_DEBUG_RATE("enter\n"); 631 IWL_DEBUG_RATE("enter\n");
654 632
@@ -659,7 +637,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
659 is_multicast_ether_addr(hdr->addr1) || 637 is_multicast_ether_addr(hdr->addr1) ||
660 !sta || !priv_sta) { 638 !sta || !priv_sta) {
661 IWL_DEBUG_RATE("leave: No STA priv data to update!\n"); 639 IWL_DEBUG_RATE("leave: No STA priv data to update!\n");
662 sel->rate_idx = rate_lowest_index(sband, sta); 640 info->control.rates[0].idx = rate_lowest_index(sband, sta);
663 return; 641 return;
664 } 642 }
665 643
@@ -792,9 +770,10 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
792 770
793 rs_sta->last_txrate_idx = index; 771 rs_sta->last_txrate_idx = index;
794 if (sband->band == IEEE80211_BAND_5GHZ) 772 if (sband->band == IEEE80211_BAND_5GHZ)
795 sel->rate_idx = rs_sta->last_txrate_idx - IWL_FIRST_OFDM_RATE; 773 info->control.rates[0].idx = rs_sta->last_txrate_idx -
774 IWL_FIRST_OFDM_RATE;
796 else 775 else
797 sel->rate_idx = rs_sta->last_txrate_idx; 776 info->control.rates[0].idx = rs_sta->last_txrate_idx;
798 777
799 IWL_DEBUG_RATE("leave: %d\n", index); 778 IWL_DEBUG_RATE("leave: %d\n", index);
800} 779}
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 8a00245be51e..7afafb629706 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -261,6 +261,35 @@ static inline const char *iwl3945_get_tx_fail_reason(u32 status)
261} 261}
262#endif 262#endif
263 263
264/*
265 * get ieee prev rate from rate scale table.
266 * for A and B mode we need to overright prev
267 * value
268 */
269int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate)
270{
271 int next_rate = iwl3945_get_prev_ieee_rate(rate);
272
273 switch (priv->band) {
274 case IEEE80211_BAND_5GHZ:
275 if (rate == IWL_RATE_12M_INDEX)
276 next_rate = IWL_RATE_9M_INDEX;
277 else if (rate == IWL_RATE_6M_INDEX)
278 next_rate = IWL_RATE_6M_INDEX;
279 break;
280/* XXX cannot be invoked in current mac80211 so not a regression
281 case MODE_IEEE80211B:
282 if (rate == IWL_RATE_11M_INDEX_TABLE)
283 next_rate = IWL_RATE_5M_INDEX_TABLE;
284 break;
285 */
286 default:
287 break;
288 }
289
290 return next_rate;
291}
292
264 293
265/** 294/**
266 * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd 295 * iwl3945_tx_queue_reclaim - Reclaim Tx queue entries already Tx'd
@@ -308,6 +337,7 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
308 struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; 337 struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
309 u32 status = le32_to_cpu(tx_resp->status); 338 u32 status = le32_to_cpu(tx_resp->status);
310 int rate_idx; 339 int rate_idx;
340 int fail, i;
311 341
312 if ((index >= txq->q.n_bd) || (iwl3945_x2_queue_used(&txq->q, index) == 0)) { 342 if ((index >= txq->q.n_bd) || (iwl3945_x2_queue_used(&txq->q, index) == 0)) {
313 IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " 343 IWL_ERROR("Read index for DMA queue txq_id (%d) index %d "
@@ -318,9 +348,36 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
318 } 348 }
319 349
320 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]); 350 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb[0]);
321 memset(&info->status, 0, sizeof(info->status)); 351 ieee80211_tx_info_clear_status(info);
352
353 /* Fill the MRR chain with some info about on-chip retransmissions */
354 rate_idx = iwl3945_hwrate_to_plcp_idx(tx_resp->rate);
355 if (info->band == IEEE80211_BAND_5GHZ)
356 rate_idx -= IWL_FIRST_OFDM_RATE;
357
358 fail = tx_resp->failure_frame;
359 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
360 int next = iwl3945_rs_next_rate(priv, rate_idx);
361
362 info->status.rates[i].idx = rate_idx;
363
364 /*
365 * Put remaining into the last count as best approximation
366 * of saying exactly what the hardware would have done...
367 */
368 if ((rate_idx == next) || (i == IEEE80211_TX_MAX_RATES - 1)) {
369 info->status.rates[i].count = fail;
370 break;
371 }
372
373 info->status.rates[i].count = priv->retry_rate;
374 fail -= priv->retry_rate;
375 rate_idx = next;
376 if (fail <= 0)
377 break;
378 }
379 info->status.rates[i].count++; /* add final attempt */
322 380
323 info->status.retry_count = tx_resp->failure_frame;
324 /* tx_status->rts_retry_count = tx_resp->failure_rts; */ 381 /* tx_status->rts_retry_count = tx_resp->failure_rts; */
325 info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ? 382 info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ?
326 IEEE80211_TX_STAT_ACK : 0; 383 IEEE80211_TX_STAT_ACK : 0;
@@ -329,10 +386,6 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
329 txq_id, iwl3945_get_tx_fail_reason(status), status, 386 txq_id, iwl3945_get_tx_fail_reason(status), status,
330 tx_resp->rate, tx_resp->failure_frame); 387 tx_resp->rate, tx_resp->failure_frame);
331 388
332 rate_idx = iwl3945_hwrate_to_plcp_idx(tx_resp->rate);
333 if (info->band == IEEE80211_BAND_5GHZ)
334 rate_idx -= IWL_FIRST_OFDM_RATE;
335 info->tx_rate_idx = rate_idx;
336 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); 389 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index);
337 iwl3945_tx_queue_reclaim(priv, txq_id, index); 390 iwl3945_tx_queue_reclaim(priv, txq_id, index);
338 391
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index bdd32475b99c..592c5958723b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -954,6 +954,8 @@ static inline int is_channel_ibss(const struct iwl3945_channel_info *ch)
954extern const struct iwl3945_channel_info *iwl3945_get_channel_info( 954extern const struct iwl3945_channel_info *iwl3945_get_channel_info(
955 const struct iwl3945_priv *priv, enum ieee80211_band band, u16 channel); 955 const struct iwl3945_priv *priv, enum ieee80211_band band, u16 channel);
956 956
957extern int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate);
958
957/* Requires full declaration of iwl3945_priv before including */ 959/* Requires full declaration of iwl3945_priv before including */
958#include "iwl-3945-io.h" 960#include "iwl-3945-io.h"
959 961
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 9838de5f4369..222c2baa95ca 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -619,10 +619,10 @@ static void iwl4965_gain_computation(struct iwl_priv *priv,
619static void iwl4965_rts_tx_cmd_flag(struct ieee80211_tx_info *info, 619static void iwl4965_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
620 __le32 *tx_flags) 620 __le32 *tx_flags)
621{ 621{
622 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { 622 if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) {
623 *tx_flags |= TX_CMD_FLG_RTS_MSK; 623 *tx_flags |= TX_CMD_FLG_RTS_MSK;
624 *tx_flags &= ~TX_CMD_FLG_CTS_MSK; 624 *tx_flags &= ~TX_CMD_FLG_CTS_MSK;
625 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { 625 } else if (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
626 *tx_flags &= ~TX_CMD_FLG_RTS_MSK; 626 *tx_flags &= ~TX_CMD_FLG_RTS_MSK;
627 *tx_flags |= TX_CMD_FLG_CTS_MSK; 627 *tx_flags |= TX_CMD_FLG_CTS_MSK;
628 } 628 }
@@ -2070,7 +2070,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
2070 agg->frame_count, agg->start_idx, idx); 2070 agg->frame_count, agg->start_idx, idx);
2071 2071
2072 info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]); 2072 info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]);
2073 info->status.retry_count = tx_resp->failure_frame; 2073 info->status.rates[0].count = tx_resp->failure_frame + 1;
2074 info->flags &= ~IEEE80211_TX_CTL_AMPDU; 2074 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
2075 info->flags |= iwl_is_tx_success(status)? 2075 info->flags |= iwl_is_tx_success(status)?
2076 IEEE80211_TX_STAT_ACK : 0; 2076 IEEE80211_TX_STAT_ACK : 0;
@@ -2227,7 +2227,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
2227 iwl_txq_check_empty(priv, sta_id, tid, txq_id); 2227 iwl_txq_check_empty(priv, sta_id, tid, txq_id);
2228 } 2228 }
2229 } else { 2229 } else {
2230 info->status.retry_count = tx_resp->failure_frame; 2230 info->status.rates[0].count = tx_resp->failure_frame + 1;
2231 info->flags |= 2231 info->flags |=
2232 iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0; 2232 iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0;
2233 iwl_hwrate_to_tx_control(priv, 2233 iwl_hwrate_to_tx_control(priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 56a3f0c84a1e..d5282fa65084 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -390,8 +390,8 @@ static void iwl5000_chain_noise_reset(struct iwl_priv *priv)
390static void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info, 390static void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
391 __le32 *tx_flags) 391 __le32 *tx_flags)
392{ 392{
393 if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) || 393 if ((info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) ||
394 (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) 394 (info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT))
395 *tx_flags |= TX_CMD_FLG_RTS_CTS_MSK; 395 *tx_flags |= TX_CMD_FLG_RTS_CTS_MSK;
396 else 396 else
397 *tx_flags &= ~TX_CMD_FLG_RTS_CTS_MSK; 397 *tx_flags &= ~TX_CMD_FLG_RTS_CTS_MSK;
@@ -1154,7 +1154,7 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
1154 agg->frame_count, agg->start_idx, idx); 1154 agg->frame_count, agg->start_idx, idx);
1155 1155
1156 info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]); 1156 info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]);
1157 info->status.retry_count = tx_resp->failure_frame; 1157 info->status.rates[0].count = tx_resp->failure_frame + 1;
1158 info->flags &= ~IEEE80211_TX_CTL_AMPDU; 1158 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
1159 info->flags |= iwl_is_tx_success(status)? 1159 info->flags |= iwl_is_tx_success(status)?
1160 IEEE80211_TX_STAT_ACK : 0; 1160 IEEE80211_TX_STAT_ACK : 0;
@@ -1307,7 +1307,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
1307 iwl_txq_check_empty(priv, sta_id, tid, txq_id); 1307 iwl_txq_check_empty(priv, sta_id, tid, txq_id);
1308 } 1308 }
1309 } else { 1309 } else {
1310 info->status.retry_count = tx_resp->failure_frame; 1310 info->status.rates[0].count = tx_resp->failure_frame + 1;
1311 info->flags = 1311 info->flags =
1312 iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0; 1312 iwl_is_tx_success(status) ? IEEE80211_TX_STAT_ACK : 0;
1313 iwl_hwrate_to_tx_control(priv, 1313 iwl_hwrate_to_tx_control(priv,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
index e10e0ca09ce9..f685e5d6c281 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
@@ -798,7 +798,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
798 !(info->flags & IEEE80211_TX_STAT_AMPDU)) 798 !(info->flags & IEEE80211_TX_STAT_AMPDU))
799 return; 799 return;
800 800
801 retries = info->status.retry_count; 801 retries = info->status.rates[0].count - 1;
802 802
803 if (retries > 15) 803 if (retries > 15)
804 retries = 15; 804 retries = 15;
@@ -830,20 +830,15 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
830 if (priv->band == IEEE80211_BAND_5GHZ) 830 if (priv->band == IEEE80211_BAND_5GHZ)
831 rs_index -= IWL_FIRST_OFDM_RATE; 831 rs_index -= IWL_FIRST_OFDM_RATE;
832 832
833 if ((info->tx_rate_idx < 0) || 833 if ((info->status.rates[0].idx < 0) ||
834 (tbl_type.is_SGI ^ 834 (tbl_type.is_SGI != !!(info->status.rates[0].flags & IEEE80211_TX_RC_SHORT_GI)) ||
835 !!(info->flags & IEEE80211_TX_CTL_SHORT_GI)) || 835 (tbl_type.is_fat != !!(info->status.rates[0].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)) ||
836 (tbl_type.is_fat ^ 836 (tbl_type.is_dup != !!(info->status.rates[0].flags & IEEE80211_TX_RC_DUP_DATA)) ||
837 !!(info->flags & IEEE80211_TX_CTL_40_MHZ_WIDTH)) || 837 (tbl_type.ant_type != info->antenna_sel_tx) ||
838 (tbl_type.is_dup ^ 838 (!!(tx_rate & RATE_MCS_HT_MSK) != !!(info->status.rates[0].flags & IEEE80211_TX_RC_MCS)) ||
839 !!(info->flags & IEEE80211_TX_CTL_DUP_DATA)) || 839 (!!(tx_rate & RATE_MCS_GF_MSK) != !!(info->status.rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD)) ||
840 (tbl_type.ant_type ^ info->antenna_sel_tx) ||
841 (!!(tx_rate & RATE_MCS_HT_MSK) ^
842 !!(info->flags & IEEE80211_TX_CTL_OFDM_HT)) ||
843 (!!(tx_rate & RATE_MCS_GF_MSK) ^
844 !!(info->flags & IEEE80211_TX_CTL_GREEN_FIELD)) ||
845 (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate != 840 (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate !=
846 hw->wiphy->bands[info->band]->bitrates[info->tx_rate_idx].bitrate)) { 841 hw->wiphy->bands[info->band]->bitrates[info->status.rates[0].idx].bitrate)) {
847 IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate); 842 IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate);
848 goto out; 843 goto out;
849 } 844 }
@@ -2098,15 +2093,17 @@ static void rs_initialize_lq(struct iwl_priv *priv,
2098 return; 2093 return;
2099} 2094}
2100 2095
2101static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband, 2096static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
2102 struct ieee80211_sta *sta, void *priv_sta, 2097 struct ieee80211_tx_rate_control *txrc)
2103 struct sk_buff *skb, struct rate_selection *sel)
2104{ 2098{
2105 2099
2106 int i; 2100 int i;
2101 struct sk_buff *skb = txrc->skb;
2102 struct ieee80211_supported_band *sband = txrc->sband;
2107 struct iwl_priv *priv = (struct iwl_priv *)priv_r; 2103 struct iwl_priv *priv = (struct iwl_priv *)priv_r;
2108 struct ieee80211_conf *conf = &priv->hw->conf; 2104 struct ieee80211_conf *conf = &priv->hw->conf;
2109 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2105 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2106 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2110 __le16 fc; 2107 __le16 fc;
2111 struct iwl_lq_sta *lq_sta; 2108 struct iwl_lq_sta *lq_sta;
2112 2109
@@ -2117,7 +2114,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
2117 fc = hdr->frame_control; 2114 fc = hdr->frame_control;
2118 if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) || 2115 if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1) ||
2119 !sta || !priv_sta) { 2116 !sta || !priv_sta) {
2120 sel->rate_idx = rate_lowest_index(sband, sta); 2117 info->control.rates[0].idx = rate_lowest_index(sband, sta);
2121 return; 2118 return;
2122 } 2119 }
2123 2120
@@ -2143,13 +2140,13 @@ static void rs_get_rate(void *priv_r, struct ieee80211_supported_band *sband,
2143 } 2140 }
2144 2141
2145 if ((i < 0) || (i > IWL_RATE_COUNT)) { 2142 if ((i < 0) || (i > IWL_RATE_COUNT)) {
2146 sel->rate_idx = rate_lowest_index(sband, sta); 2143 info->control.rates[0].idx = rate_lowest_index(sband, sta);
2147 return; 2144 return;
2148 } 2145 }
2149 2146
2150 if (sband->band == IEEE80211_BAND_5GHZ) 2147 if (sband->band == IEEE80211_BAND_5GHZ)
2151 i -= IWL_FIRST_OFDM_RATE; 2148 i -= IWL_FIRST_OFDM_RATE;
2152 sel->rate_idx = i; 2149 info->control.rates[0].idx = i;
2153} 2150}
2154 2151
2155static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta, 2152static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta,
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 10f5a0a233fe..2c4162e48140 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -88,26 +88,27 @@ EXPORT_SYMBOL(iwl_rates);
88 * translate ucode response to mac80211 tx status control values 88 * translate ucode response to mac80211 tx status control values
89 */ 89 */
90void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags, 90void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
91 struct ieee80211_tx_info *control) 91 struct ieee80211_tx_info *info)
92{ 92{
93 int rate_index; 93 int rate_index;
94 struct ieee80211_tx_rate *r = &info->control.rates[0];
94 95
95 control->antenna_sel_tx = 96 info->antenna_sel_tx =
96 ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS); 97 ((rate_n_flags & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS);
97 if (rate_n_flags & RATE_MCS_HT_MSK) 98 if (rate_n_flags & RATE_MCS_HT_MSK)
98 control->flags |= IEEE80211_TX_CTL_OFDM_HT; 99 r->flags |= IEEE80211_TX_RC_MCS;
99 if (rate_n_flags & RATE_MCS_GF_MSK) 100 if (rate_n_flags & RATE_MCS_GF_MSK)
100 control->flags |= IEEE80211_TX_CTL_GREEN_FIELD; 101 r->flags |= IEEE80211_TX_RC_GREEN_FIELD;
101 if (rate_n_flags & RATE_MCS_FAT_MSK) 102 if (rate_n_flags & RATE_MCS_FAT_MSK)
102 control->flags |= IEEE80211_TX_CTL_40_MHZ_WIDTH; 103 r->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
103 if (rate_n_flags & RATE_MCS_DUP_MSK) 104 if (rate_n_flags & RATE_MCS_DUP_MSK)
104 control->flags |= IEEE80211_TX_CTL_DUP_DATA; 105 r->flags |= IEEE80211_TX_RC_DUP_DATA;
105 if (rate_n_flags & RATE_MCS_SGI_MSK) 106 if (rate_n_flags & RATE_MCS_SGI_MSK)
106 control->flags |= IEEE80211_TX_CTL_SHORT_GI; 107 r->flags |= IEEE80211_TX_RC_SHORT_GI;
107 rate_index = iwl_hwrate_to_plcp_idx(rate_n_flags); 108 rate_index = iwl_hwrate_to_plcp_idx(rate_n_flags);
108 if (control->band == IEEE80211_BAND_5GHZ) 109 if (info->band == IEEE80211_BAND_5GHZ)
109 rate_index -= IWL_FIRST_OFDM_RATE; 110 rate_index -= IWL_FIRST_OFDM_RATE;
110 control->tx_rate_idx = rate_index; 111 r->idx = rate_index;
111} 112}
112EXPORT_SYMBOL(iwl_hwrate_to_tx_control); 113EXPORT_SYMBOL(iwl_hwrate_to_tx_control);
113 114
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index b1464c71ea0a..2cd33b4e9e13 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2395,6 +2395,7 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2395{ 2395{
2396 __le16 fc = hdr->frame_control; 2396 __le16 fc = hdr->frame_control;
2397 __le32 tx_flags = cmd->cmd.tx.tx_flags; 2397 __le32 tx_flags = cmd->cmd.tx.tx_flags;
2398 u8 rc_flags = info->control.rates[0].flags;
2398 2399
2399 cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 2400 cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
2400 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) { 2401 if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
@@ -2421,10 +2422,10 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2421 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 2422 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
2422 } 2423 }
2423 2424
2424 if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) { 2425 if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
2425 tx_flags |= TX_CMD_FLG_RTS_MSK; 2426 tx_flags |= TX_CMD_FLG_RTS_MSK;
2426 tx_flags &= ~TX_CMD_FLG_CTS_MSK; 2427 tx_flags &= ~TX_CMD_FLG_CTS_MSK;
2427 } else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) { 2428 } else if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
2428 tx_flags &= ~TX_CMD_FLG_RTS_MSK; 2429 tx_flags &= ~TX_CMD_FLG_RTS_MSK;
2429 tx_flags |= TX_CMD_FLG_CTS_MSK; 2430 tx_flags |= TX_CMD_FLG_CTS_MSK;
2430 } 2431 }