diff options
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r-- | net/mac80211/tx.c | 164 |
1 files changed, 102 insertions, 62 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 38e1b2bd8245..9e5359991985 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -92,9 +92,13 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, | |||
92 | int rate, mrate, erp, dur, i; | 92 | int rate, mrate, erp, dur, i; |
93 | struct ieee80211_rate *txrate = tx->u.tx.rate; | 93 | struct ieee80211_rate *txrate = tx->u.tx.rate; |
94 | struct ieee80211_local *local = tx->local; | 94 | struct ieee80211_local *local = tx->local; |
95 | struct ieee80211_hw_mode *mode = tx->u.tx.mode; | 95 | struct ieee80211_supported_band *sband; |
96 | 96 | ||
97 | erp = txrate->flags & IEEE80211_RATE_ERP; | 97 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
98 | |||
99 | erp = 0; | ||
100 | if (tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | ||
101 | erp = txrate->flags & IEEE80211_RATE_ERP_G; | ||
98 | 102 | ||
99 | /* | 103 | /* |
100 | * data and mgmt (except PS Poll): | 104 | * data and mgmt (except PS Poll): |
@@ -150,20 +154,36 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, | |||
150 | * Mandatory rates for IEEE 802.11g PHY: 1, 2, 5.5, 11, 6, 12, 24 Mbps | 154 | * Mandatory rates for IEEE 802.11g PHY: 1, 2, 5.5, 11, 6, 12, 24 Mbps |
151 | */ | 155 | */ |
152 | rate = -1; | 156 | rate = -1; |
153 | mrate = 10; /* use 1 Mbps if everything fails */ | 157 | /* use lowest available if everything fails */ |
154 | for (i = 0; i < mode->num_rates; i++) { | 158 | mrate = sband->bitrates[0].bitrate; |
155 | struct ieee80211_rate *r = &mode->rates[i]; | 159 | for (i = 0; i < sband->n_bitrates; i++) { |
156 | if (r->rate > txrate->rate) | 160 | struct ieee80211_rate *r = &sband->bitrates[i]; |
157 | break; | ||
158 | 161 | ||
159 | if (IEEE80211_RATE_MODULATION(txrate->flags) != | 162 | if (r->bitrate > txrate->bitrate) |
160 | IEEE80211_RATE_MODULATION(r->flags)) | 163 | break; |
161 | continue; | ||
162 | 164 | ||
163 | if (r->flags & IEEE80211_RATE_BASIC) | 165 | if (tx->sdata->basic_rates & BIT(i)) |
164 | rate = r->rate; | 166 | rate = r->bitrate; |
165 | else if (r->flags & IEEE80211_RATE_MANDATORY) | 167 | |
166 | mrate = r->rate; | 168 | switch (sband->band) { |
169 | case IEEE80211_BAND_2GHZ: { | ||
170 | u32 flag; | ||
171 | if (tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | ||
172 | flag = IEEE80211_RATE_MANDATORY_G; | ||
173 | else | ||
174 | flag = IEEE80211_RATE_MANDATORY_B; | ||
175 | if (r->flags & flag) | ||
176 | mrate = r->bitrate; | ||
177 | break; | ||
178 | } | ||
179 | case IEEE80211_BAND_5GHZ: | ||
180 | if (r->flags & IEEE80211_RATE_MANDATORY_A) | ||
181 | mrate = r->bitrate; | ||
182 | break; | ||
183 | case IEEE80211_NUM_BANDS: | ||
184 | WARN_ON(1); | ||
185 | break; | ||
186 | } | ||
167 | } | 187 | } |
168 | if (rate == -1) { | 188 | if (rate == -1) { |
169 | /* No matching basic rate found; use highest suitable mandatory | 189 | /* No matching basic rate found; use highest suitable mandatory |
@@ -184,7 +204,7 @@ static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, | |||
184 | dur *= 2; /* ACK + SIFS */ | 204 | dur *= 2; /* ACK + SIFS */ |
185 | /* next fragment */ | 205 | /* next fragment */ |
186 | dur += ieee80211_frame_duration(local, next_frag_len, | 206 | dur += ieee80211_frame_duration(local, next_frag_len, |
187 | txrate->rate, erp, | 207 | txrate->bitrate, erp, |
188 | tx->sdata->bss_conf.use_short_preamble); | 208 | tx->sdata->bss_conf.use_short_preamble); |
189 | } | 209 | } |
190 | 210 | ||
@@ -585,26 +605,28 @@ static ieee80211_txrx_result | |||
585 | ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx) | 605 | ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx) |
586 | { | 606 | { |
587 | struct rate_selection rsel; | 607 | struct rate_selection rsel; |
608 | struct ieee80211_supported_band *sband; | ||
609 | |||
610 | sband = tx->local->hw.wiphy->bands[tx->local->hw.conf.channel->band]; | ||
588 | 611 | ||
589 | if (likely(!tx->u.tx.rate)) { | 612 | if (likely(!tx->u.tx.rate)) { |
590 | rate_control_get_rate(tx->dev, tx->u.tx.mode, tx->skb, &rsel); | 613 | rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); |
591 | tx->u.tx.rate = rsel.rate; | 614 | tx->u.tx.rate = rsel.rate; |
592 | if (unlikely(rsel.probe != NULL)) { | 615 | if (unlikely(rsel.probe)) { |
593 | tx->u.tx.control->flags |= | 616 | tx->u.tx.control->flags |= |
594 | IEEE80211_TXCTL_RATE_CTRL_PROBE; | 617 | IEEE80211_TXCTL_RATE_CTRL_PROBE; |
595 | tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; | 618 | tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; |
596 | tx->u.tx.control->alt_retry_rate = tx->u.tx.rate->val; | 619 | tx->u.tx.control->alt_retry_rate = tx->u.tx.rate; |
597 | tx->u.tx.rate = rsel.probe; | 620 | tx->u.tx.rate = rsel.probe; |
598 | } else | 621 | } else |
599 | tx->u.tx.control->alt_retry_rate = -1; | 622 | tx->u.tx.control->alt_retry_rate = NULL; |
600 | 623 | ||
601 | if (!tx->u.tx.rate) | 624 | if (!tx->u.tx.rate) |
602 | return TXRX_DROP; | 625 | return TXRX_DROP; |
603 | } else | 626 | } else |
604 | tx->u.tx.control->alt_retry_rate = -1; | 627 | tx->u.tx.control->alt_retry_rate = NULL; |
605 | 628 | ||
606 | if (tx->u.tx.mode->mode == MODE_IEEE80211G && | 629 | if (tx->sdata->bss_conf.use_cts_prot && |
607 | tx->sdata->bss_conf.use_cts_prot && | ||
608 | (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && rsel.nonerp) { | 630 | (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && rsel.nonerp) { |
609 | tx->u.tx.last_frag_rate = tx->u.tx.rate; | 631 | tx->u.tx.last_frag_rate = tx->u.tx.rate; |
610 | if (rsel.probe) | 632 | if (rsel.probe) |
@@ -612,13 +634,13 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx) | |||
612 | else | 634 | else |
613 | tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; | 635 | tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; |
614 | tx->u.tx.rate = rsel.nonerp; | 636 | tx->u.tx.rate = rsel.nonerp; |
615 | tx->u.tx.control->rate = rsel.nonerp; | 637 | tx->u.tx.control->tx_rate = rsel.nonerp; |
616 | tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE; | 638 | tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE; |
617 | } else { | 639 | } else { |
618 | tx->u.tx.last_frag_rate = tx->u.tx.rate; | 640 | tx->u.tx.last_frag_rate = tx->u.tx.rate; |
619 | tx->u.tx.control->rate = tx->u.tx.rate; | 641 | tx->u.tx.control->tx_rate = tx->u.tx.rate; |
620 | } | 642 | } |
621 | tx->u.tx.control->tx_rate = tx->u.tx.rate->val; | 643 | tx->u.tx.control->tx_rate = tx->u.tx.rate; |
622 | 644 | ||
623 | return TXRX_CONTINUE; | 645 | return TXRX_CONTINUE; |
624 | } | 646 | } |
@@ -630,7 +652,6 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) | |||
630 | u16 fc = le16_to_cpu(hdr->frame_control); | 652 | u16 fc = le16_to_cpu(hdr->frame_control); |
631 | u16 dur; | 653 | u16 dur; |
632 | struct ieee80211_tx_control *control = tx->u.tx.control; | 654 | struct ieee80211_tx_control *control = tx->u.tx.control; |
633 | struct ieee80211_hw_mode *mode = tx->u.tx.mode; | ||
634 | 655 | ||
635 | if (!control->retry_limit) { | 656 | if (!control->retry_limit) { |
636 | if (!is_multicast_ether_addr(hdr->addr1)) { | 657 | if (!is_multicast_ether_addr(hdr->addr1)) { |
@@ -657,14 +678,14 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) | |||
657 | * frames. | 678 | * frames. |
658 | * TODO: The last fragment could still use multiple retry | 679 | * TODO: The last fragment could still use multiple retry |
659 | * rates. */ | 680 | * rates. */ |
660 | control->alt_retry_rate = -1; | 681 | control->alt_retry_rate = NULL; |
661 | } | 682 | } |
662 | 683 | ||
663 | /* Use CTS protection for unicast frames sent using extended rates if | 684 | /* Use CTS protection for unicast frames sent using extended rates if |
664 | * there are associated non-ERP stations and RTS/CTS is not configured | 685 | * there are associated non-ERP stations and RTS/CTS is not configured |
665 | * for the frame. */ | 686 | * for the frame. */ |
666 | if (mode->mode == MODE_IEEE80211G && | 687 | if ((tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) && |
667 | (tx->u.tx.rate->flags & IEEE80211_RATE_ERP) && | 688 | (tx->u.tx.rate->flags & IEEE80211_RATE_ERP_G) && |
668 | (tx->flags & IEEE80211_TXRXD_TXUNICAST) && | 689 | (tx->flags & IEEE80211_TXRXD_TXUNICAST) && |
669 | tx->sdata->bss_conf.use_cts_prot && | 690 | tx->sdata->bss_conf.use_cts_prot && |
670 | !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) | 691 | !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) |
@@ -674,10 +695,10 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) | |||
674 | * short preambles at the selected rate and short preambles are | 695 | * short preambles at the selected rate and short preambles are |
675 | * available on the network at the current point in time. */ | 696 | * available on the network at the current point in time. */ |
676 | if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && | 697 | if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && |
677 | (tx->u.tx.rate->flags & IEEE80211_RATE_PREAMBLE2) && | 698 | (tx->u.tx.rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) && |
678 | tx->sdata->bss_conf.use_short_preamble && | 699 | tx->sdata->bss_conf.use_short_preamble && |
679 | (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) { | 700 | (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) { |
680 | tx->u.tx.control->tx_rate = tx->u.tx.rate->val2; | 701 | tx->u.tx.control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; |
681 | } | 702 | } |
682 | 703 | ||
683 | /* Setup duration field for the first fragment of the frame. Duration | 704 | /* Setup duration field for the first fragment of the frame. Duration |
@@ -690,19 +711,33 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) | |||
690 | 711 | ||
691 | if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) || | 712 | if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) || |
692 | (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) { | 713 | (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) { |
693 | struct ieee80211_rate *rate; | 714 | struct ieee80211_supported_band *sband; |
715 | struct ieee80211_rate *rate, *baserate; | ||
716 | int idx; | ||
717 | |||
718 | sband = tx->local->hw.wiphy->bands[ | ||
719 | tx->local->hw.conf.channel->band]; | ||
694 | 720 | ||
695 | /* Do not use multiple retry rates when using RTS/CTS */ | 721 | /* Do not use multiple retry rates when using RTS/CTS */ |
696 | control->alt_retry_rate = -1; | 722 | control->alt_retry_rate = NULL; |
697 | 723 | ||
698 | /* Use min(data rate, max base rate) as CTS/RTS rate */ | 724 | /* Use min(data rate, max base rate) as CTS/RTS rate */ |
699 | rate = tx->u.tx.rate; | 725 | rate = tx->u.tx.rate; |
700 | while (rate > mode->rates && | 726 | baserate = NULL; |
701 | !(rate->flags & IEEE80211_RATE_BASIC)) | 727 | |
702 | rate--; | 728 | for (idx = 0; idx < sband->n_bitrates; idx++) { |
729 | if (sband->bitrates[idx].bitrate > rate->bitrate) | ||
730 | continue; | ||
731 | if (tx->sdata->basic_rates & BIT(idx) && | ||
732 | (!baserate || | ||
733 | (baserate->bitrate < sband->bitrates[idx].bitrate))) | ||
734 | baserate = &sband->bitrates[idx]; | ||
735 | } | ||
703 | 736 | ||
704 | control->rts_cts_rate = rate->val; | 737 | if (baserate) |
705 | control->rts_rate = rate; | 738 | control->rts_cts_rate = baserate; |
739 | else | ||
740 | control->rts_cts_rate = &sband->bitrates[0]; | ||
706 | } | 741 | } |
707 | 742 | ||
708 | if (tx->sta) { | 743 | if (tx->sta) { |
@@ -726,10 +761,10 @@ static ieee80211_txrx_result | |||
726 | ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx) | 761 | ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx) |
727 | { | 762 | { |
728 | struct ieee80211_local *local = tx->local; | 763 | struct ieee80211_local *local = tx->local; |
729 | struct ieee80211_hw_mode *mode = tx->u.tx.mode; | ||
730 | struct sk_buff *skb = tx->skb; | 764 | struct sk_buff *skb = tx->skb; |
731 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | 765 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
732 | u32 load = 0, hdrtime; | 766 | u32 load = 0, hdrtime; |
767 | struct ieee80211_rate *rate = tx->u.tx.rate; | ||
733 | 768 | ||
734 | /* TODO: this could be part of tx_status handling, so that the number | 769 | /* TODO: this could be part of tx_status handling, so that the number |
735 | * of retries would be known; TX rate should in that case be stored | 770 | * of retries would be known; TX rate should in that case be stored |
@@ -740,9 +775,9 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx) | |||
740 | /* 1 bit at 1 Mbit/s takes 1 usec; in channel_use values, | 775 | /* 1 bit at 1 Mbit/s takes 1 usec; in channel_use values, |
741 | * 1 usec = 1/8 * (1080 / 10) = 13.5 */ | 776 | * 1 usec = 1/8 * (1080 / 10) = 13.5 */ |
742 | 777 | ||
743 | if (mode->mode == MODE_IEEE80211A || | 778 | if (tx->u.tx.channel->band == IEEE80211_BAND_5GHZ || |
744 | (mode->mode == MODE_IEEE80211G && | 779 | (tx->u.tx.channel->band == IEEE80211_BAND_2GHZ && |
745 | tx->u.tx.rate->flags & IEEE80211_RATE_ERP)) | 780 | rate->flags & IEEE80211_RATE_ERP_G)) |
746 | hdrtime = CHAN_UTIL_HDR_SHORT; | 781 | hdrtime = CHAN_UTIL_HDR_SHORT; |
747 | else | 782 | else |
748 | hdrtime = CHAN_UTIL_HDR_LONG; | 783 | hdrtime = CHAN_UTIL_HDR_LONG; |
@@ -756,14 +791,15 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx) | |||
756 | else if (tx->u.tx.control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) | 791 | else if (tx->u.tx.control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) |
757 | load += hdrtime; | 792 | load += hdrtime; |
758 | 793 | ||
759 | load += skb->len * tx->u.tx.rate->rate_inv; | 794 | /* TODO: optimise again */ |
795 | load += skb->len * CHAN_UTIL_RATE_LCM / rate->bitrate; | ||
760 | 796 | ||
761 | if (tx->u.tx.extra_frag) { | 797 | if (tx->u.tx.extra_frag) { |
762 | int i; | 798 | int i; |
763 | for (i = 0; i < tx->u.tx.num_extra_frag; i++) { | 799 | for (i = 0; i < tx->u.tx.num_extra_frag; i++) { |
764 | load += 2 * hdrtime; | 800 | load += 2 * hdrtime; |
765 | load += tx->u.tx.extra_frag[i]->len * | 801 | load += tx->u.tx.extra_frag[i]->len * |
766 | tx->u.tx.rate->rate; | 802 | tx->u.tx.rate->bitrate; |
767 | } | 803 | } |
768 | } | 804 | } |
769 | 805 | ||
@@ -816,10 +852,12 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, | |||
816 | struct ieee80211_radiotap_iterator iterator; | 852 | struct ieee80211_radiotap_iterator iterator; |
817 | struct ieee80211_radiotap_header *rthdr = | 853 | struct ieee80211_radiotap_header *rthdr = |
818 | (struct ieee80211_radiotap_header *) skb->data; | 854 | (struct ieee80211_radiotap_header *) skb->data; |
819 | struct ieee80211_hw_mode *mode = tx->local->hw.conf.mode; | 855 | struct ieee80211_supported_band *sband; |
820 | int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); | 856 | int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); |
821 | struct ieee80211_tx_control *control = tx->u.tx.control; | 857 | struct ieee80211_tx_control *control = tx->u.tx.control; |
822 | 858 | ||
859 | sband = tx->local->hw.wiphy->bands[tx->local->hw.conf.channel->band]; | ||
860 | |||
823 | control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; | 861 | control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; |
824 | tx->flags |= IEEE80211_TXRXD_TX_INJECTED; | 862 | tx->flags |= IEEE80211_TXRXD_TX_INJECTED; |
825 | tx->flags &= ~IEEE80211_TXRXD_FRAGMENTED; | 863 | tx->flags &= ~IEEE80211_TXRXD_FRAGMENTED; |
@@ -852,10 +890,12 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, | |||
852 | * ieee80211 rate int is in 100kbps units eg, 0x0a=1Mbps | 890 | * ieee80211 rate int is in 100kbps units eg, 0x0a=1Mbps |
853 | */ | 891 | */ |
854 | target_rate = (*iterator.this_arg) * 5; | 892 | target_rate = (*iterator.this_arg) * 5; |
855 | for (i = 0; i < mode->num_rates; i++) { | 893 | for (i = 0; i < sband->n_bitrates; i++) { |
856 | struct ieee80211_rate *r = &mode->rates[i]; | 894 | struct ieee80211_rate *r; |
857 | 895 | ||
858 | if (r->rate == target_rate) { | 896 | r = &sband->bitrates[i]; |
897 | |||
898 | if (r->bitrate == target_rate) { | ||
859 | tx->u.tx.rate = r; | 899 | tx->u.tx.rate = r; |
860 | break; | 900 | break; |
861 | } | 901 | } |
@@ -870,9 +910,11 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, | |||
870 | control->antenna_sel_tx = (*iterator.this_arg) + 1; | 910 | control->antenna_sel_tx = (*iterator.this_arg) + 1; |
871 | break; | 911 | break; |
872 | 912 | ||
913 | #if 0 | ||
873 | case IEEE80211_RADIOTAP_DBM_TX_POWER: | 914 | case IEEE80211_RADIOTAP_DBM_TX_POWER: |
874 | control->power_level = *iterator.this_arg; | 915 | control->power_level = *iterator.this_arg; |
875 | break; | 916 | break; |
917 | #endif | ||
876 | 918 | ||
877 | case IEEE80211_RADIOTAP_FLAGS: | 919 | case IEEE80211_RADIOTAP_FLAGS: |
878 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) { | 920 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) { |
@@ -1054,8 +1096,8 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | |||
1054 | if (__ieee80211_queue_stopped(local, control->queue)) | 1096 | if (__ieee80211_queue_stopped(local, control->queue)) |
1055 | return IEEE80211_TX_FRAG_AGAIN; | 1097 | return IEEE80211_TX_FRAG_AGAIN; |
1056 | if (i == tx->u.tx.num_extra_frag) { | 1098 | if (i == tx->u.tx.num_extra_frag) { |
1057 | control->tx_rate = tx->u.tx.last_frag_hwrate; | 1099 | control->tx_rate = tx->u.tx.last_frag_rate; |
1058 | control->rate = tx->u.tx.last_frag_rate; | 1100 | |
1059 | if (tx->flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG) | 1101 | if (tx->flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG) |
1060 | control->flags |= | 1102 | control->flags |= |
1061 | IEEE80211_TXCTL_RATE_CTRL_PROBE; | 1103 | IEEE80211_TXCTL_RATE_CTRL_PROBE; |
@@ -1114,7 +1156,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, | |||
1114 | rcu_read_lock(); | 1156 | rcu_read_lock(); |
1115 | 1157 | ||
1116 | sta = tx.sta; | 1158 | sta = tx.sta; |
1117 | tx.u.tx.mode = local->hw.conf.mode; | 1159 | tx.u.tx.channel = local->hw.conf.channel; |
1118 | 1160 | ||
1119 | for (handler = local->tx_handlers; *handler != NULL; | 1161 | for (handler = local->tx_handlers; *handler != NULL; |
1120 | handler++) { | 1162 | handler++) { |
@@ -1151,7 +1193,6 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, | |||
1151 | } else { | 1193 | } else { |
1152 | next_len = 0; | 1194 | next_len = 0; |
1153 | tx.u.tx.rate = tx.u.tx.last_frag_rate; | 1195 | tx.u.tx.rate = tx.u.tx.last_frag_rate; |
1154 | tx.u.tx.last_frag_hwrate = tx.u.tx.rate->val; | ||
1155 | } | 1196 | } |
1156 | dur = ieee80211_duration(&tx, 0, next_len); | 1197 | dur = ieee80211_duration(&tx, 0, next_len); |
1157 | hdr->duration_id = cpu_to_le16(dur); | 1198 | hdr->duration_id = cpu_to_le16(dur); |
@@ -1188,7 +1229,6 @@ retry: | |||
1188 | store->skb = skb; | 1229 | store->skb = skb; |
1189 | store->extra_frag = tx.u.tx.extra_frag; | 1230 | store->extra_frag = tx.u.tx.extra_frag; |
1190 | store->num_extra_frag = tx.u.tx.num_extra_frag; | 1231 | store->num_extra_frag = tx.u.tx.num_extra_frag; |
1191 | store->last_frag_hwrate = tx.u.tx.last_frag_hwrate; | ||
1192 | store->last_frag_rate = tx.u.tx.last_frag_rate; | 1232 | store->last_frag_rate = tx.u.tx.last_frag_rate; |
1193 | store->last_frag_rate_ctrl_probe = | 1233 | store->last_frag_rate_ctrl_probe = |
1194 | !!(tx.flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG); | 1234 | !!(tx.flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG); |
@@ -1609,7 +1649,6 @@ void ieee80211_tx_pending(unsigned long data) | |||
1609 | tx.u.tx.control = &store->control; | 1649 | tx.u.tx.control = &store->control; |
1610 | tx.u.tx.extra_frag = store->extra_frag; | 1650 | tx.u.tx.extra_frag = store->extra_frag; |
1611 | tx.u.tx.num_extra_frag = store->num_extra_frag; | 1651 | tx.u.tx.num_extra_frag = store->num_extra_frag; |
1612 | tx.u.tx.last_frag_hwrate = store->last_frag_hwrate; | ||
1613 | tx.u.tx.last_frag_rate = store->last_frag_rate; | 1652 | tx.u.tx.last_frag_rate = store->last_frag_rate; |
1614 | tx.flags = 0; | 1653 | tx.flags = 0; |
1615 | if (store->last_frag_rate_ctrl_probe) | 1654 | if (store->last_frag_rate_ctrl_probe) |
@@ -1712,6 +1751,9 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1712 | struct ieee80211_if_ap *ap = NULL; | 1751 | struct ieee80211_if_ap *ap = NULL; |
1713 | struct rate_selection rsel; | 1752 | struct rate_selection rsel; |
1714 | struct beacon_data *beacon; | 1753 | struct beacon_data *beacon; |
1754 | struct ieee80211_supported_band *sband; | ||
1755 | |||
1756 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
1715 | 1757 | ||
1716 | rcu_read_lock(); | 1758 | rcu_read_lock(); |
1717 | 1759 | ||
@@ -1750,8 +1792,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1750 | beacon->tail_len); | 1792 | beacon->tail_len); |
1751 | 1793 | ||
1752 | if (control) { | 1794 | if (control) { |
1753 | rate_control_get_rate(local->mdev, local->oper_hw_mode, skb, | 1795 | rate_control_get_rate(local->mdev, sband, skb, &rsel); |
1754 | &rsel); | ||
1755 | if (!rsel.rate) { | 1796 | if (!rsel.rate) { |
1756 | if (net_ratelimit()) { | 1797 | if (net_ratelimit()) { |
1757 | printk(KERN_DEBUG "%s: ieee80211_beacon_get: " | 1798 | printk(KERN_DEBUG "%s: ieee80211_beacon_get: " |
@@ -1764,12 +1805,11 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1764 | } | 1805 | } |
1765 | 1806 | ||
1766 | control->vif = vif; | 1807 | control->vif = vif; |
1767 | control->tx_rate = | 1808 | control->tx_rate = rsel.rate; |
1768 | (sdata->bss_conf.use_short_preamble && | 1809 | if (sdata->bss_conf.use_short_preamble && |
1769 | (rsel.rate->flags & IEEE80211_RATE_PREAMBLE2)) ? | 1810 | rsel.rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) |
1770 | rsel.rate->val2 : rsel.rate->val; | 1811 | control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; |
1771 | control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; | 1812 | control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; |
1772 | control->power_level = local->hw.conf.power_level; | ||
1773 | control->flags |= IEEE80211_TXCTL_NO_ACK; | 1813 | control->flags |= IEEE80211_TXCTL_NO_ACK; |
1774 | control->retry_limit = 1; | 1814 | control->retry_limit = 1; |
1775 | control->flags |= IEEE80211_TXCTL_CLEAR_DST_MASK; | 1815 | control->flags |= IEEE80211_TXCTL_CLEAR_DST_MASK; |
@@ -1874,7 +1914,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
1874 | } | 1914 | } |
1875 | sta = tx.sta; | 1915 | sta = tx.sta; |
1876 | tx.flags |= IEEE80211_TXRXD_TXPS_BUFFERED; | 1916 | tx.flags |= IEEE80211_TXRXD_TXPS_BUFFERED; |
1877 | tx.u.tx.mode = local->hw.conf.mode; | 1917 | tx.u.tx.channel = local->hw.conf.channel; |
1878 | 1918 | ||
1879 | for (handler = local->tx_handlers; *handler != NULL; handler++) { | 1919 | for (handler = local->tx_handlers; *handler != NULL; handler++) { |
1880 | res = (*handler)(&tx); | 1920 | res = (*handler)(&tx); |