aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-10-21 06:40:02 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-10-31 19:00:23 -0400
commite6a9854b05c1a6af1308fe2b8c68f35abf28a3ee (patch)
tree241f611f8194586ccabf61bacb060508773b9d05 /net/mac80211/tx.c
parentcb121bad67a32cde37adc2729b7e18aa4fd3063e (diff)
mac80211/drivers: rewrite the rate control API
So after the previous changes we were still unhappy with how convoluted the API is and decided to make things simpler for everybody. This completely changes the rate control API, now taking into account 802.11n with MCS rates and more control, most drivers don't support that though. Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c378
1 files changed, 179 insertions, 199 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 6f3e4be9763..21951bac1ef 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -46,13 +46,20 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
46 struct ieee80211_local *local = tx->local; 46 struct ieee80211_local *local = tx->local;
47 struct ieee80211_supported_band *sband; 47 struct ieee80211_supported_band *sband;
48 struct ieee80211_hdr *hdr; 48 struct ieee80211_hdr *hdr;
49 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
50
51 /* assume HW handles this */
52 if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS)
53 return 0;
54
55 /* uh huh? */
56 if (WARN_ON_ONCE(info->control.rates[0].idx < 0))
57 return 0;
49 58
50 sband = local->hw.wiphy->bands[tx->channel->band]; 59 sband = local->hw.wiphy->bands[tx->channel->band];
51 txrate = &sband->bitrates[tx->rate_idx]; 60 txrate = &sband->bitrates[info->control.rates[0].idx];
52 61
53 erp = 0; 62 erp = txrate->flags & IEEE80211_RATE_ERP_G;
54 if (tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)
55 erp = txrate->flags & IEEE80211_RATE_ERP_G;
56 63
57 /* 64 /*
58 * data and mgmt (except PS Poll): 65 * data and mgmt (except PS Poll):
@@ -437,140 +444,154 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
437static ieee80211_tx_result debug_noinline 444static ieee80211_tx_result debug_noinline
438ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) 445ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
439{ 446{
440 struct rate_selection rsel;
441 struct ieee80211_supported_band *sband;
442 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); 447 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
448 struct ieee80211_hdr *hdr = (void *)tx->skb->data;
449 struct ieee80211_supported_band *sband;
450 struct ieee80211_rate *rate;
451 int i, len;
452 bool inval = false, rts = false, short_preamble = false;
453 struct ieee80211_tx_rate_control txrc;
443 454
444 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 455 memset(&txrc, 0, sizeof(txrc));
445 456
446 if (likely(tx->rate_idx < 0)) { 457 sband = tx->local->hw.wiphy->bands[tx->channel->band];
447 rate_control_get_rate(tx->sdata, sband, tx->sta,
448 tx->skb, &rsel);
449 if (tx->sta)
450 tx->sta->last_txrate_idx = rsel.rate_idx;
451 tx->rate_idx = rsel.rate_idx;
452 if (unlikely(rsel.probe_idx >= 0)) {
453 info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE;
454 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG;
455 info->control.retries[0].rate_idx = tx->rate_idx;
456 info->control.retries[0].limit = tx->local->hw.max_altrate_tries;
457 tx->rate_idx = rsel.probe_idx;
458 } else if (info->control.retries[0].limit == 0)
459 info->control.retries[0].rate_idx = -1;
460
461 if (unlikely(tx->rate_idx < 0))
462 return TX_DROP;
463 } else
464 info->control.retries[0].rate_idx = -1;
465 458
466 if (tx->sdata->vif.bss_conf.use_cts_prot && 459 len = min_t(int, tx->skb->len + FCS_LEN,
467 (tx->flags & IEEE80211_TX_FRAGMENTED) && (rsel.nonerp_idx >= 0)) { 460 tx->local->fragmentation_threshold);
468 tx->last_frag_rate_idx = tx->rate_idx; 461
469 if (rsel.probe_idx >= 0) 462 /* set up the tx rate control struct we give the RC algo */
470 tx->flags &= ~IEEE80211_TX_PROBE_LAST_FRAG; 463 txrc.hw = local_to_hw(tx->local);
471 else 464 txrc.sband = sband;
472 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; 465 txrc.bss_conf = &tx->sdata->vif.bss_conf;
473 tx->rate_idx = rsel.nonerp_idx; 466 txrc.skb = tx->skb;
474 info->tx_rate_idx = rsel.nonerp_idx; 467 txrc.reported_rate.idx = -1;
475 info->flags &= ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; 468 txrc.max_rate_idx = tx->sdata->max_ratectrl_rateidx;
476 } else { 469
477 tx->last_frag_rate_idx = tx->rate_idx; 470 /* set up RTS protection if desired */
478 info->tx_rate_idx = tx->rate_idx; 471 if (tx->local->rts_threshold < IEEE80211_MAX_RTS_THRESHOLD &&
472 len > tx->local->rts_threshold) {
473 txrc.rts = rts = true;
479 } 474 }
480 info->tx_rate_idx = tx->rate_idx;
481 475
482 return TX_CONTINUE; 476 /*
483} 477 * Use short preamble if the BSS can handle it, but not for
478 * management frames unless we know the receiver can handle
479 * that -- the management frame might be to a station that
480 * just wants a probe response.
481 */
482 if (tx->sdata->vif.bss_conf.use_short_preamble &&
483 (ieee80211_is_data(hdr->frame_control) ||
484 (tx->sta && test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE))))
485 txrc.short_preamble = short_preamble = true;
484 486
485static ieee80211_tx_result debug_noinline
486ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
487{
488 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
489 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
490 struct ieee80211_supported_band *sband;
491 487
492 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 488 rate_control_get_rate(tx->sdata, tx->sta, &txrc);
489
490 if (unlikely(info->control.rates[0].idx < 0))
491 return TX_DROP;
492
493 if (txrc.reported_rate.idx < 0)
494 txrc.reported_rate = info->control.rates[0];
493 495
494 if (tx->sta) 496 if (tx->sta)
495 info->control.sta = &tx->sta->sta; 497 tx->sta->last_tx_rate = txrc.reported_rate;
496 498
497 if (!info->control.retry_limit) { 499 if (unlikely(!info->control.rates[0].count))
498 if (!is_multicast_ether_addr(hdr->addr1)) { 500 info->control.rates[0].count = 1;
499 int len = min_t(int, tx->skb->len + FCS_LEN,
500 tx->local->fragmentation_threshold);
501 if (len > tx->local->rts_threshold
502 && tx->local->rts_threshold <
503 IEEE80211_MAX_RTS_THRESHOLD) {
504 info->flags |= IEEE80211_TX_CTL_USE_RTS_CTS;
505 info->flags |=
506 IEEE80211_TX_CTL_LONG_RETRY_LIMIT;
507 info->control.retry_limit =
508 tx->local->hw.conf.long_frame_max_tx_count - 1;
509 } else {
510 info->control.retry_limit =
511 tx->local->hw.conf.short_frame_max_tx_count - 1;
512 }
513 } else {
514 info->control.retry_limit = 1;
515 }
516 }
517 501
518 if (tx->flags & IEEE80211_TX_FRAGMENTED) { 502 if (is_multicast_ether_addr(hdr->addr1)) {
519 /* Do not use multiple retry rates when sending fragmented 503 /*
520 * frames. 504 * XXX: verify the rate is in the basic rateset
521 * TODO: The last fragment could still use multiple retry 505 */
522 * rates. */ 506 return TX_CONTINUE;
523 info->control.retries[0].rate_idx = -1;
524 } 507 }
525 508
526 /* Use CTS protection for unicast frames sent using extended rates if 509 /*
527 * there are associated non-ERP stations and RTS/CTS is not configured 510 * set up the RTS/CTS rate as the fastest basic rate
528 * for the frame. */ 511 * that is not faster than the data rate
529 if ((tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) && 512 *
530 (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_ERP_G) && 513 * XXX: Should this check all retry rates?
531 (tx->flags & IEEE80211_TX_UNICAST) && 514 */
532 tx->sdata->vif.bss_conf.use_cts_prot && 515 if (!(info->control.rates[0].flags & IEEE80211_TX_RC_MCS)) {
533 !(info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)) 516 s8 baserate = 0;
534 info->flags |= IEEE80211_TX_CTL_USE_CTS_PROTECT; 517
535 518 rate = &sband->bitrates[info->control.rates[0].idx];
536 /* Transmit data frames using short preambles if the driver supports 519
537 * short preambles at the selected rate and short preambles are 520 for (i = 0; i < sband->n_bitrates; i++) {
538 * available on the network at the current point in time. */ 521 /* must be a basic rate */
539 if (ieee80211_is_data(hdr->frame_control) && 522 if (!(tx->sdata->vif.bss_conf.basic_rates & BIT(i)))
540 (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) && 523 continue;
541 tx->sdata->vif.bss_conf.use_short_preamble && 524 /* must not be faster than the data rate */
542 (!tx->sta || test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE))) { 525 if (sband->bitrates[i].bitrate > rate->bitrate)
543 info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE; 526 continue;
527 /* maximum */
528 if (sband->bitrates[baserate].bitrate <
529 sband->bitrates[i].bitrate)
530 baserate = i;
531 }
532
533 info->control.rts_cts_rate_idx = baserate;
544 } 534 }
545 535
546 if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) || 536 for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
547 (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) { 537 /*
548 struct ieee80211_rate *rate; 538 * make sure there's no valid rate following
549 s8 baserate = -1; 539 * an invalid one, just in case drivers don't
550 int idx; 540 * take the API seriously to stop at -1.
541 */
542 if (inval) {
543 info->control.rates[i].idx = -1;
544 continue;
545 }
546 if (info->control.rates[i].idx < 0) {
547 inval = true;
548 continue;
549 }
551 550
552 /* Do not use multiple retry rates when using RTS/CTS */ 551 /*
553 info->control.retries[0].rate_idx = -1; 552 * For now assume MCS is already set up correctly, this
553 * needs to be fixed.
554 */
555 if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS) {
556 WARN_ON(info->control.rates[i].idx > 76);
557 continue;
558 }
554 559
555 /* Use min(data rate, max base rate) as CTS/RTS rate */ 560 /* set up RTS protection if desired */
556 rate = &sband->bitrates[tx->rate_idx]; 561 if (rts)
562 info->control.rates[i].flags |=
563 IEEE80211_TX_RC_USE_RTS_CTS;
557 564
558 for (idx = 0; idx < sband->n_bitrates; idx++) { 565 /* RC is busted */
559 if (sband->bitrates[idx].bitrate > rate->bitrate) 566 if (WARN_ON(info->control.rates[i].idx >=
560 continue; 567 sband->n_bitrates)) {
561 if (tx->sdata->vif.bss_conf.basic_rates & BIT(idx) && 568 info->control.rates[i].idx = -1;
562 (baserate < 0 || 569 continue;
563 (sband->bitrates[baserate].bitrate
564 < sband->bitrates[idx].bitrate)))
565 baserate = idx;
566 } 570 }
567 571
568 if (baserate >= 0) 572 rate = &sband->bitrates[info->control.rates[i].idx];
569 info->control.rts_cts_rate_idx = baserate; 573
570 else 574 /* set up short preamble */
571 info->control.rts_cts_rate_idx = 0; 575 if (short_preamble &&
576 rate->flags & IEEE80211_RATE_SHORT_PREAMBLE)
577 info->control.rates[i].flags |=
578 IEEE80211_TX_RC_USE_SHORT_PREAMBLE;
579
580 /* set up G protection */
581 if (!rts && tx->sdata->vif.bss_conf.use_cts_prot &&
582 rate->flags & IEEE80211_RATE_ERP_G)
583 info->control.rates[i].flags |=
584 IEEE80211_TX_RC_USE_CTS_PROTECT;
572 } 585 }
573 586
587 return TX_CONTINUE;
588}
589
590static ieee80211_tx_result debug_noinline
591ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
592{
593 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
594
574 if (tx->sta) 595 if (tx->sta)
575 info->control.sta = &tx->sta->sta; 596 info->control.sta = &tx->sta->sta;
576 597
@@ -678,6 +699,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
678 left = payload_len - per_fragm; 699 left = payload_len - per_fragm;
679 for (i = 0; i < num_fragm - 1; i++) { 700 for (i = 0; i < num_fragm - 1; i++) {
680 struct ieee80211_hdr *fhdr; 701 struct ieee80211_hdr *fhdr;
702 struct ieee80211_tx_info *info;
681 size_t copylen; 703 size_t copylen;
682 704
683 if (left <= 0) 705 if (left <= 0)
@@ -692,20 +714,45 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
692 IEEE80211_ENCRYPT_TAILROOM); 714 IEEE80211_ENCRYPT_TAILROOM);
693 if (!frag) 715 if (!frag)
694 goto fail; 716 goto fail;
717
695 /* Make sure that all fragments use the same priority so 718 /* Make sure that all fragments use the same priority so
696 * that they end up using the same TX queue */ 719 * that they end up using the same TX queue */
697 frag->priority = first->priority; 720 frag->priority = first->priority;
721
698 skb_reserve(frag, tx->local->tx_headroom + 722 skb_reserve(frag, tx->local->tx_headroom +
699 IEEE80211_ENCRYPT_HEADROOM); 723 IEEE80211_ENCRYPT_HEADROOM);
724
725 /* copy TX information */
726 info = IEEE80211_SKB_CB(frag);
727 memcpy(info, first->cb, sizeof(frag->cb));
728
729 /* copy/fill in 802.11 header */
700 fhdr = (struct ieee80211_hdr *) skb_put(frag, hdrlen); 730 fhdr = (struct ieee80211_hdr *) skb_put(frag, hdrlen);
701 memcpy(fhdr, first->data, hdrlen); 731 memcpy(fhdr, first->data, hdrlen);
702 if (i == num_fragm - 2)
703 fhdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREFRAGS);
704 fhdr->seq_ctrl = cpu_to_le16(seq | ((i + 1) & IEEE80211_SCTL_FRAG)); 732 fhdr->seq_ctrl = cpu_to_le16(seq | ((i + 1) & IEEE80211_SCTL_FRAG));
733
734 if (i == num_fragm - 2) {
735 /* clear MOREFRAGS bit for the last fragment */
736 fhdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREFRAGS);
737 } else {
738 /*
739 * No multi-rate retries for fragmented frames, that
740 * would completely throw off the NAV at other STAs.
741 */
742 info->control.rates[1].idx = -1;
743 info->control.rates[2].idx = -1;
744 info->control.rates[3].idx = -1;
745 info->control.rates[4].idx = -1;
746 BUILD_BUG_ON(IEEE80211_TX_MAX_RATES != 5);
747 info->flags &= ~IEEE80211_TX_CTL_RATE_CTRL_PROBE;
748 }
749
750 /* copy data */
705 copylen = left > per_fragm ? per_fragm : left; 751 copylen = left > per_fragm ? per_fragm : left;
706 memcpy(skb_put(frag, copylen), pos, copylen); 752 memcpy(skb_put(frag, copylen), pos, copylen);
707 memcpy(frag->cb, first->cb, sizeof(frag->cb)); 753
708 skb_copy_queue_mapping(frag, first); 754 skb_copy_queue_mapping(frag, first);
755
709 frag->do_not_encrypt = first->do_not_encrypt; 756 frag->do_not_encrypt = first->do_not_encrypt;
710 757
711 pos += copylen; 758 pos += copylen;
@@ -765,12 +812,10 @@ ieee80211_tx_h_calculate_duration(struct ieee80211_tx_data *tx)
765 tx->extra_frag[0]->len); 812 tx->extra_frag[0]->len);
766 813
767 for (i = 0; i < tx->num_extra_frag; i++) { 814 for (i = 0; i < tx->num_extra_frag; i++) {
768 if (i + 1 < tx->num_extra_frag) { 815 if (i + 1 < tx->num_extra_frag)
769 next_len = tx->extra_frag[i + 1]->len; 816 next_len = tx->extra_frag[i + 1]->len;
770 } else { 817 else
771 next_len = 0; 818 next_len = 0;
772 tx->rate_idx = tx->last_frag_rate_idx;
773 }
774 819
775 hdr = (struct ieee80211_hdr *)tx->extra_frag[i]->data; 820 hdr = (struct ieee80211_hdr *)tx->extra_frag[i]->data;
776 hdr->duration_id = ieee80211_duration(tx, 0, next_len); 821 hdr->duration_id = ieee80211_duration(tx, 0, next_len);
@@ -823,7 +868,6 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
823 (struct ieee80211_radiotap_header *) skb->data; 868 (struct ieee80211_radiotap_header *) skb->data;
824 struct ieee80211_supported_band *sband; 869 struct ieee80211_supported_band *sband;
825 int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); 870 int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len);
826 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
827 871
828 sband = tx->local->hw.wiphy->bands[tx->channel->band]; 872 sband = tx->local->hw.wiphy->bands[tx->channel->band];
829 873
@@ -837,8 +881,6 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
837 */ 881 */
838 882
839 while (!ret) { 883 while (!ret) {
840 int i, target_rate;
841
842 ret = ieee80211_radiotap_iterator_next(&iterator); 884 ret = ieee80211_radiotap_iterator_next(&iterator);
843 885
844 if (ret) 886 if (ret)
@@ -852,38 +894,6 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
852 * get_unaligned((type *)iterator.this_arg) to dereference 894 * get_unaligned((type *)iterator.this_arg) to dereference
853 * iterator.this_arg for type "type" safely on all arches. 895 * iterator.this_arg for type "type" safely on all arches.
854 */ 896 */
855 case IEEE80211_RADIOTAP_RATE:
856 /*
857 * radiotap rate u8 is in 500kbps units eg, 0x02=1Mbps
858 * ieee80211 rate int is in 100kbps units eg, 0x0a=1Mbps
859 */
860 target_rate = (*iterator.this_arg) * 5;
861 for (i = 0; i < sband->n_bitrates; i++) {
862 struct ieee80211_rate *r;
863
864 r = &sband->bitrates[i];
865
866 if (r->bitrate == target_rate) {
867 tx->rate_idx = i;
868 break;
869 }
870 }
871 break;
872
873 case IEEE80211_RADIOTAP_ANTENNA:
874 /*
875 * radiotap uses 0 for 1st ant, mac80211 is 1 for
876 * 1st ant
877 */
878 info->antenna_sel_tx = (*iterator.this_arg) + 1;
879 break;
880
881#if 0
882 case IEEE80211_RADIOTAP_DBM_TX_POWER:
883 control->power_level = *iterator.this_arg;
884 break;
885#endif
886
887 case IEEE80211_RADIOTAP_FLAGS: 897 case IEEE80211_RADIOTAP_FLAGS:
888 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) { 898 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) {
889 /* 899 /*
@@ -949,8 +959,6 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
949 tx->local = local; 959 tx->local = local;
950 tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); 960 tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev);
951 tx->channel = local->hw.conf.channel; 961 tx->channel = local->hw.conf.channel;
952 tx->rate_idx = -1;
953 tx->last_frag_rate_idx = -1;
954 /* 962 /*
955 * Set this flag (used below to indicate "automatic fragmentation"), 963 * Set this flag (used below to indicate "automatic fragmentation"),
956 * it will be cleared/left by radiotap as desired. 964 * it will be cleared/left by radiotap as desired.
@@ -1051,23 +1059,11 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1051 if (!tx->extra_frag[i]) 1059 if (!tx->extra_frag[i])
1052 continue; 1060 continue;
1053 info = IEEE80211_SKB_CB(tx->extra_frag[i]); 1061 info = IEEE80211_SKB_CB(tx->extra_frag[i]);
1054 info->flags &= ~(IEEE80211_TX_CTL_USE_RTS_CTS | 1062 info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT |
1055 IEEE80211_TX_CTL_USE_CTS_PROTECT |
1056 IEEE80211_TX_CTL_CLEAR_PS_FILT |
1057 IEEE80211_TX_CTL_FIRST_FRAGMENT); 1063 IEEE80211_TX_CTL_FIRST_FRAGMENT);
1058 if (netif_subqueue_stopped(local->mdev, 1064 if (netif_subqueue_stopped(local->mdev,
1059 tx->extra_frag[i])) 1065 tx->extra_frag[i]))
1060 return IEEE80211_TX_FRAG_AGAIN; 1066 return IEEE80211_TX_FRAG_AGAIN;
1061 if (i == tx->num_extra_frag) {
1062 info->tx_rate_idx = tx->last_frag_rate_idx;
1063
1064 if (tx->flags & IEEE80211_TX_PROBE_LAST_FRAG)
1065 info->flags |=
1066 IEEE80211_TX_CTL_RATE_CTRL_PROBE;
1067 else
1068 info->flags &=
1069 ~IEEE80211_TX_CTL_RATE_CTRL_PROBE;
1070 }
1071 1067
1072 ret = local->ops->tx(local_to_hw(local), 1068 ret = local->ops->tx(local_to_hw(local),
1073 tx->extra_frag[i]); 1069 tx->extra_frag[i]);
@@ -1204,9 +1200,6 @@ retry:
1204 store->skb = skb; 1200 store->skb = skb;
1205 store->extra_frag = tx.extra_frag; 1201 store->extra_frag = tx.extra_frag;
1206 store->num_extra_frag = tx.num_extra_frag; 1202 store->num_extra_frag = tx.num_extra_frag;
1207 store->last_frag_rate_idx = tx.last_frag_rate_idx;
1208 store->last_frag_rate_ctrl_probe =
1209 !!(tx.flags & IEEE80211_TX_PROBE_LAST_FRAG);
1210 } 1203 }
1211 out: 1204 out:
1212 rcu_read_unlock(); 1205 rcu_read_unlock();
@@ -1763,10 +1756,7 @@ void ieee80211_tx_pending(unsigned long data)
1763 store = &local->pending_packet[i]; 1756 store = &local->pending_packet[i];
1764 tx.extra_frag = store->extra_frag; 1757 tx.extra_frag = store->extra_frag;
1765 tx.num_extra_frag = store->num_extra_frag; 1758 tx.num_extra_frag = store->num_extra_frag;
1766 tx.last_frag_rate_idx = store->last_frag_rate_idx;
1767 tx.flags = 0; 1759 tx.flags = 0;
1768 if (store->last_frag_rate_ctrl_probe)
1769 tx.flags |= IEEE80211_TX_PROBE_LAST_FRAG;
1770 ret = __ieee80211_tx(local, store->skb, &tx); 1760 ret = __ieee80211_tx(local, store->skb, &tx);
1771 if (ret) { 1761 if (ret) {
1772 if (ret == IEEE80211_TX_FRAG_AGAIN) 1762 if (ret == IEEE80211_TX_FRAG_AGAIN)
@@ -1854,7 +1844,6 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1854 struct ieee80211_sub_if_data *sdata = NULL; 1844 struct ieee80211_sub_if_data *sdata = NULL;
1855 struct ieee80211_if_ap *ap = NULL; 1845 struct ieee80211_if_ap *ap = NULL;
1856 struct ieee80211_if_sta *ifsta = NULL; 1846 struct ieee80211_if_sta *ifsta = NULL;
1857 struct rate_selection rsel;
1858 struct beacon_data *beacon; 1847 struct beacon_data *beacon;
1859 struct ieee80211_supported_band *sband; 1848 struct ieee80211_supported_band *sband;
1860 enum ieee80211_band band = local->hw.conf.channel->band; 1849 enum ieee80211_band band = local->hw.conf.channel->band;
@@ -1958,32 +1947,23 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
1958 skb->do_not_encrypt = 1; 1947 skb->do_not_encrypt = 1;
1959 1948
1960 info->band = band; 1949 info->band = band;
1961 rate_control_get_rate(sdata, sband, NULL, skb, &rsel); 1950 /*
1962 1951 * XXX: For now, always use the lowest rate
1963 if (unlikely(rsel.rate_idx < 0)) { 1952 */
1964 if (net_ratelimit()) { 1953 info->control.rates[0].idx = 0;
1965 printk(KERN_DEBUG "%s: ieee80211_beacon_get: " 1954 info->control.rates[0].count = 1;
1966 "no rate found\n", 1955 info->control.rates[1].idx = -1;
1967 wiphy_name(local->hw.wiphy)); 1956 info->control.rates[2].idx = -1;
1968 } 1957 info->control.rates[3].idx = -1;
1969 dev_kfree_skb_any(skb); 1958 info->control.rates[4].idx = -1;
1970 skb = NULL; 1959 BUILD_BUG_ON(IEEE80211_TX_MAX_RATES != 5);
1971 goto out;
1972 }
1973 1960
1974 info->control.vif = vif; 1961 info->control.vif = vif;
1975 info->tx_rate_idx = rsel.rate_idx;
1976 1962
1977 info->flags |= IEEE80211_TX_CTL_NO_ACK; 1963 info->flags |= IEEE80211_TX_CTL_NO_ACK;
1978 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; 1964 info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT;
1979 info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; 1965 info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ;
1980 if (sdata->vif.bss_conf.use_short_preamble && 1966 out:
1981 sband->bitrates[rsel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE)
1982 info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE;
1983
1984 info->control.retry_limit = 1;
1985
1986out:
1987 rcu_read_unlock(); 1967 rcu_read_unlock();
1988 return skb; 1968 return skb;
1989} 1969}