aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c61
1 files changed, 36 insertions, 25 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index eb4d9eab0f3f..01e7a734f867 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -223,12 +223,12 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx)
223 (tx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PROBE_REQ)) 223 (tx->fc & IEEE80211_FCTL_STYPE) != IEEE80211_STYPE_PROBE_REQ))
224 return TXRX_DROP; 224 return TXRX_DROP;
225 225
226 if (tx->u.tx.ps_buffered) 226 if (tx->flags & IEEE80211_TXRXD_TXPS_BUFFERED)
227 return TXRX_CONTINUE; 227 return TXRX_CONTINUE;
228 228
229 sta_flags = tx->sta ? tx->sta->flags : 0; 229 sta_flags = tx->sta ? tx->sta->flags : 0;
230 230
231 if (likely(tx->u.tx.unicast)) { 231 if (likely(tx->flags & IEEE80211_TXRXD_TXUNICAST)) {
232 if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && 232 if (unlikely(!(sta_flags & WLAN_STA_ASSOC) &&
233 tx->sdata->type != IEEE80211_IF_TYPE_IBSS && 233 tx->sdata->type != IEEE80211_IF_TYPE_IBSS &&
234 (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 234 (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
@@ -410,10 +410,10 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx)
410static ieee80211_txrx_result 410static ieee80211_txrx_result
411ieee80211_tx_h_ps_buf(struct ieee80211_txrx_data *tx) 411ieee80211_tx_h_ps_buf(struct ieee80211_txrx_data *tx)
412{ 412{
413 if (unlikely(tx->u.tx.ps_buffered)) 413 if (unlikely(tx->flags & IEEE80211_TXRXD_TXPS_BUFFERED))
414 return TXRX_CONTINUE; 414 return TXRX_CONTINUE;
415 415
416 if (tx->u.tx.unicast) 416 if (tx->flags & IEEE80211_TXRXD_TXUNICAST)
417 return ieee80211_tx_h_unicast_ps_buf(tx); 417 return ieee80211_tx_h_unicast_ps_buf(tx);
418 else 418 else
419 return ieee80211_tx_h_multicast_ps_buf(tx); 419 return ieee80211_tx_h_multicast_ps_buf(tx);
@@ -467,7 +467,7 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx)
467 u8 *pos; 467 u8 *pos;
468 int frag_threshold = tx->local->fragmentation_threshold; 468 int frag_threshold = tx->local->fragmentation_threshold;
469 469
470 if (!tx->fragmented) 470 if (!(tx->flags & IEEE80211_TXRXD_FRAGMENTED))
471 return TXRX_CONTINUE; 471 return TXRX_CONTINUE;
472 472
473 first = tx->skb; 473 first = tx->skb;
@@ -604,7 +604,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
604 &extra); 604 &extra);
605 if (unlikely(extra.probe != NULL)) { 605 if (unlikely(extra.probe != NULL)) {
606 tx->u.tx.control->flags |= IEEE80211_TXCTL_RATE_CTRL_PROBE; 606 tx->u.tx.control->flags |= IEEE80211_TXCTL_RATE_CTRL_PROBE;
607 tx->u.tx.probe_last_frag = 1; 607 tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
608 tx->u.tx.control->alt_retry_rate = tx->u.tx.rate->val; 608 tx->u.tx.control->alt_retry_rate = tx->u.tx.rate->val;
609 tx->u.tx.rate = extra.probe; 609 tx->u.tx.rate = extra.probe;
610 } else { 610 } else {
@@ -613,11 +613,13 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx)
613 if (!tx->u.tx.rate) 613 if (!tx->u.tx.rate)
614 return TXRX_DROP; 614 return TXRX_DROP;
615 if (tx->u.tx.mode->mode == MODE_IEEE80211G && 615 if (tx->u.tx.mode->mode == MODE_IEEE80211G &&
616 tx->sdata->use_protection && tx->fragmented && 616 tx->sdata->use_protection &&
617 extra.nonerp) { 617 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && extra.nonerp) {
618 tx->u.tx.last_frag_rate = tx->u.tx.rate; 618 tx->u.tx.last_frag_rate = tx->u.tx.rate;
619 tx->u.tx.probe_last_frag = extra.probe ? 1 : 0; 619 if (extra.probe)
620 620 tx->flags &= ~IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
621 else
622 tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
621 tx->u.tx.rate = extra.nonerp; 623 tx->u.tx.rate = extra.nonerp;
622 tx->u.tx.control->rate = extra.nonerp; 624 tx->u.tx.control->rate = extra.nonerp;
623 tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE; 625 tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE;
@@ -654,7 +656,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
654 control->retry_limit = 1; 656 control->retry_limit = 1;
655 } 657 }
656 658
657 if (tx->fragmented) { 659 if (tx->flags & IEEE80211_TXRXD_FRAGMENTED) {
658 /* Do not use multiple retry rates when sending fragmented 660 /* Do not use multiple retry rates when sending fragmented
659 * frames. 661 * frames.
660 * TODO: The last fragment could still use multiple retry 662 * TODO: The last fragment could still use multiple retry
@@ -667,7 +669,8 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
667 * for the frame. */ 669 * for the frame. */
668 if (mode->mode == MODE_IEEE80211G && 670 if (mode->mode == MODE_IEEE80211G &&
669 (tx->u.tx.rate->flags & IEEE80211_RATE_ERP) && 671 (tx->u.tx.rate->flags & IEEE80211_RATE_ERP) &&
670 tx->u.tx.unicast && tx->sdata->use_protection && 672 (tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
673 tx->sdata->use_protection &&
671 !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) 674 !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
672 control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; 675 control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT;
673 676
@@ -685,8 +688,8 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
685 * for remaining fragments will be updated when they are being sent 688 * for remaining fragments will be updated when they are being sent
686 * to low-level driver in ieee80211_tx(). */ 689 * to low-level driver in ieee80211_tx(). */
687 dur = ieee80211_duration(tx, is_multicast_ether_addr(hdr->addr1), 690 dur = ieee80211_duration(tx, is_multicast_ether_addr(hdr->addr1),
688 tx->fragmented ? tx->u.tx.extra_frag[0]->len : 691 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) ?
689 0); 692 tx->u.tx.extra_frag[0]->len : 0);
690 hdr->duration_id = cpu_to_le16(dur); 693 hdr->duration_id = cpu_to_le16(dur);
691 694
692 if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) || 695 if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) ||
@@ -976,15 +979,20 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
976 } 979 }
977 980
978 tx->u.tx.control = control; 981 tx->u.tx.control = control;
979 tx->u.tx.unicast = !is_multicast_ether_addr(hdr->addr1); 982 if (is_multicast_ether_addr(hdr->addr1)) {
980 if (is_multicast_ether_addr(hdr->addr1)) 983 tx->flags &= ~IEEE80211_TXRXD_TXUNICAST;
981 control->flags |= IEEE80211_TXCTL_NO_ACK; 984 control->flags |= IEEE80211_TXCTL_NO_ACK;
982 else 985 } else {
986 tx->flags |= IEEE80211_TXRXD_TXUNICAST;
983 control->flags &= ~IEEE80211_TXCTL_NO_ACK; 987 control->flags &= ~IEEE80211_TXCTL_NO_ACK;
984 tx->fragmented = local->fragmentation_threshold < 988 }
985 IEEE80211_MAX_FRAG_THRESHOLD && tx->u.tx.unicast && 989 if (local->fragmentation_threshold < IEEE80211_MAX_FRAG_THRESHOLD &&
986 skb->len + FCS_LEN > local->fragmentation_threshold && 990 (tx->flags & IEEE80211_TXRXD_TXUNICAST) &&
987 (!local->ops->set_frag_threshold); 991 skb->len + FCS_LEN > local->fragmentation_threshold &&
992 !local->ops->set_frag_threshold)
993 tx->flags |= IEEE80211_TXRXD_FRAGMENTED;
994 else
995 tx->flags &= ~IEEE80211_TXRXD_FRAGMENTED;
988 if (!tx->sta) 996 if (!tx->sta)
989 control->flags |= IEEE80211_TXCTL_CLEAR_DST_MASK; 997 control->flags |= IEEE80211_TXCTL_CLEAR_DST_MASK;
990 else if (tx->sta->clear_dst_mask) { 998 else if (tx->sta->clear_dst_mask) {
@@ -1055,7 +1063,7 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1055 if (i == tx->u.tx.num_extra_frag) { 1063 if (i == tx->u.tx.num_extra_frag) {
1056 control->tx_rate = tx->u.tx.last_frag_hwrate; 1064 control->tx_rate = tx->u.tx.last_frag_hwrate;
1057 control->rate = tx->u.tx.last_frag_rate; 1065 control->rate = tx->u.tx.last_frag_rate;
1058 if (tx->u.tx.probe_last_frag) 1066 if (tx->flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG)
1059 control->flags |= 1067 control->flags |=
1060 IEEE80211_TXCTL_RATE_CTRL_PROBE; 1068 IEEE80211_TXCTL_RATE_CTRL_PROBE;
1061 else 1069 else
@@ -1186,7 +1194,8 @@ retry:
1186 store->num_extra_frag = tx.u.tx.num_extra_frag; 1194 store->num_extra_frag = tx.u.tx.num_extra_frag;
1187 store->last_frag_hwrate = tx.u.tx.last_frag_hwrate; 1195 store->last_frag_hwrate = tx.u.tx.last_frag_hwrate;
1188 store->last_frag_rate = tx.u.tx.last_frag_rate; 1196 store->last_frag_rate = tx.u.tx.last_frag_rate;
1189 store->last_frag_rate_ctrl_probe = tx.u.tx.probe_last_frag; 1197 store->last_frag_rate_ctrl_probe =
1198 !!(tx.flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG);
1190 } 1199 }
1191 return 0; 1200 return 0;
1192 1201
@@ -1613,7 +1622,9 @@ void ieee80211_tx_pending(unsigned long data)
1613 tx.u.tx.num_extra_frag = store->num_extra_frag; 1622 tx.u.tx.num_extra_frag = store->num_extra_frag;
1614 tx.u.tx.last_frag_hwrate = store->last_frag_hwrate; 1623 tx.u.tx.last_frag_hwrate = store->last_frag_hwrate;
1615 tx.u.tx.last_frag_rate = store->last_frag_rate; 1624 tx.u.tx.last_frag_rate = store->last_frag_rate;
1616 tx.u.tx.probe_last_frag = store->last_frag_rate_ctrl_probe; 1625 tx.flags = 0;
1626 if (store->last_frag_rate_ctrl_probe)
1627 tx.flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG;
1617 ret = __ieee80211_tx(local, store->skb, &tx); 1628 ret = __ieee80211_tx(local, store->skb, &tx);
1618 if (ret) { 1629 if (ret) {
1619 if (ret == IEEE80211_TX_FRAG_AGAIN) 1630 if (ret == IEEE80211_TX_FRAG_AGAIN)
@@ -1859,7 +1870,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id,
1859 dev_kfree_skb_any(skb); 1870 dev_kfree_skb_any(skb);
1860 } 1871 }
1861 sta = tx.sta; 1872 sta = tx.sta;
1862 tx.u.tx.ps_buffered = 1; 1873 tx.flags |= IEEE80211_TXRXD_TXPS_BUFFERED;
1863 1874
1864 for (handler = local->tx_handlers; *handler != NULL; handler++) { 1875 for (handler = local->tx_handlers; *handler != NULL; handler++) {
1865 res = (*handler)(&tx); 1876 res = (*handler)(&tx);