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.c244
1 files changed, 122 insertions, 122 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 3b06e0d8f35c..33e314f3aab7 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -87,11 +87,11 @@ static inline void ieee80211_dump_frame(const char *ifname, const char *title,
87} 87}
88#endif /* CONFIG_MAC80211_LOWTX_FRAME_DUMP */ 88#endif /* CONFIG_MAC80211_LOWTX_FRAME_DUMP */
89 89
90static u16 ieee80211_duration(struct ieee80211_txrx_data *tx, int group_addr, 90static u16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr,
91 int next_frag_len) 91 int next_frag_len)
92{ 92{
93 int rate, mrate, erp, dur, i; 93 int rate, mrate, erp, dur, i;
94 struct ieee80211_rate *txrate = tx->u.tx.rate; 94 struct ieee80211_rate *txrate = tx->rate;
95 struct ieee80211_local *local = tx->local; 95 struct ieee80211_local *local = tx->local;
96 struct ieee80211_supported_band *sband; 96 struct ieee80211_supported_band *sband;
97 97
@@ -234,7 +234,7 @@ static int inline is_ieee80211_device(struct net_device *dev,
234/* tx handlers */ 234/* tx handlers */
235 235
236static ieee80211_tx_result 236static ieee80211_tx_result
237ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx) 237ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
238{ 238{
239#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 239#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
240 struct sk_buff *skb = tx->skb; 240 struct sk_buff *skb = tx->skb;
@@ -242,7 +242,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx)
242#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ 242#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
243 u32 sta_flags; 243 u32 sta_flags;
244 244
245 if (unlikely(tx->flags & IEEE80211_TXRXD_TX_INJECTED)) 245 if (unlikely(tx->flags & IEEE80211_TX_INJECTED))
246 return TX_CONTINUE; 246 return TX_CONTINUE;
247 247
248 if (unlikely(tx->local->sta_sw_scanning) && 248 if (unlikely(tx->local->sta_sw_scanning) &&
@@ -253,12 +253,12 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx)
253 if (tx->sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) 253 if (tx->sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT)
254 return TX_CONTINUE; 254 return TX_CONTINUE;
255 255
256 if (tx->flags & IEEE80211_TXRXD_TXPS_BUFFERED) 256 if (tx->flags & IEEE80211_TX_PS_BUFFERED)
257 return TX_CONTINUE; 257 return TX_CONTINUE;
258 258
259 sta_flags = tx->sta ? tx->sta->flags : 0; 259 sta_flags = tx->sta ? tx->sta->flags : 0;
260 260
261 if (likely(tx->flags & IEEE80211_TXRXD_TXUNICAST)) { 261 if (likely(tx->flags & IEEE80211_TX_UNICAST)) {
262 if (unlikely(!(sta_flags & WLAN_STA_ASSOC) && 262 if (unlikely(!(sta_flags & WLAN_STA_ASSOC) &&
263 tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS && 263 tx->sdata->vif.type != IEEE80211_IF_TYPE_IBSS &&
264 (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) { 264 (tx->fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA)) {
@@ -288,7 +288,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_txrx_data *tx)
288} 288}
289 289
290static ieee80211_tx_result 290static ieee80211_tx_result
291ieee80211_tx_h_sequence(struct ieee80211_txrx_data *tx) 291ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx)
292{ 292{
293 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; 293 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data;
294 294
@@ -346,7 +346,7 @@ static void purge_old_ps_buffers(struct ieee80211_local *local)
346} 346}
347 347
348static ieee80211_tx_result 348static ieee80211_tx_result
349ieee80211_tx_h_multicast_ps_buf(struct ieee80211_txrx_data *tx) 349ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
350{ 350{
351 /* 351 /*
352 * broadcast/multicast frame 352 * broadcast/multicast frame
@@ -383,13 +383,13 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_txrx_data *tx)
383 } 383 }
384 384
385 /* buffered in hardware */ 385 /* buffered in hardware */
386 tx->u.tx.control->flags |= IEEE80211_TXCTL_SEND_AFTER_DTIM; 386 tx->control->flags |= IEEE80211_TXCTL_SEND_AFTER_DTIM;
387 387
388 return TX_CONTINUE; 388 return TX_CONTINUE;
389} 389}
390 390
391static ieee80211_tx_result 391static ieee80211_tx_result
392ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx) 392ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
393{ 393{
394 struct sta_info *sta = tx->sta; 394 struct sta_info *sta = tx->sta;
395 DECLARE_MAC_BUF(mac); 395 DECLARE_MAC_BUF(mac);
@@ -443,32 +443,32 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_txrx_data *tx)
443} 443}
444 444
445static ieee80211_tx_result 445static ieee80211_tx_result
446ieee80211_tx_h_ps_buf(struct ieee80211_txrx_data *tx) 446ieee80211_tx_h_ps_buf(struct ieee80211_tx_data *tx)
447{ 447{
448 if (unlikely(tx->flags & IEEE80211_TXRXD_TXPS_BUFFERED)) 448 if (unlikely(tx->flags & IEEE80211_TX_PS_BUFFERED))
449 return TX_CONTINUE; 449 return TX_CONTINUE;
450 450
451 if (tx->flags & IEEE80211_TXRXD_TXUNICAST) 451 if (tx->flags & IEEE80211_TX_UNICAST)
452 return ieee80211_tx_h_unicast_ps_buf(tx); 452 return ieee80211_tx_h_unicast_ps_buf(tx);
453 else 453 else
454 return ieee80211_tx_h_multicast_ps_buf(tx); 454 return ieee80211_tx_h_multicast_ps_buf(tx);
455} 455}
456 456
457static ieee80211_tx_result 457static ieee80211_tx_result
458ieee80211_tx_h_select_key(struct ieee80211_txrx_data *tx) 458ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
459{ 459{
460 struct ieee80211_key *key; 460 struct ieee80211_key *key;
461 u16 fc = tx->fc; 461 u16 fc = tx->fc;
462 462
463 if (unlikely(tx->u.tx.control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) 463 if (unlikely(tx->control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT))
464 tx->key = NULL; 464 tx->key = NULL;
465 else if (tx->sta && (key = rcu_dereference(tx->sta->key))) 465 else if (tx->sta && (key = rcu_dereference(tx->sta->key)))
466 tx->key = key; 466 tx->key = key;
467 else if ((key = rcu_dereference(tx->sdata->default_key))) 467 else if ((key = rcu_dereference(tx->sdata->default_key)))
468 tx->key = key; 468 tx->key = key;
469 else if (tx->sdata->drop_unencrypted && 469 else if (tx->sdata->drop_unencrypted &&
470 !(tx->u.tx.control->flags & IEEE80211_TXCTL_EAPOL_FRAME) && 470 !(tx->control->flags & IEEE80211_TXCTL_EAPOL_FRAME) &&
471 !(tx->flags & IEEE80211_TXRXD_TX_INJECTED)) { 471 !(tx->flags & IEEE80211_TX_INJECTED)) {
472 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); 472 I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
473 return TX_DROP; 473 return TX_DROP;
474 } else 474 } else
@@ -497,13 +497,13 @@ ieee80211_tx_h_select_key(struct ieee80211_txrx_data *tx)
497 } 497 }
498 498
499 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) 499 if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))
500 tx->u.tx.control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; 500 tx->control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT;
501 501
502 return TX_CONTINUE; 502 return TX_CONTINUE;
503} 503}
504 504
505static ieee80211_tx_result 505static ieee80211_tx_result
506ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx) 506ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx)
507{ 507{
508 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; 508 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
509 size_t hdrlen, per_fragm, num_fragm, payload_len, left; 509 size_t hdrlen, per_fragm, num_fragm, payload_len, left;
@@ -513,7 +513,7 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx)
513 u8 *pos; 513 u8 *pos;
514 int frag_threshold = tx->local->fragmentation_threshold; 514 int frag_threshold = tx->local->fragmentation_threshold;
515 515
516 if (!(tx->flags & IEEE80211_TXRXD_FRAGMENTED)) 516 if (!(tx->flags & IEEE80211_TX_FRAGMENTED))
517 return TX_CONTINUE; 517 return TX_CONTINUE;
518 518
519 first = tx->skb; 519 first = tx->skb;
@@ -565,8 +565,8 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx)
565 } 565 }
566 skb_trim(first, hdrlen + per_fragm); 566 skb_trim(first, hdrlen + per_fragm);
567 567
568 tx->u.tx.num_extra_frag = num_fragm - 1; 568 tx->num_extra_frag = num_fragm - 1;
569 tx->u.tx.extra_frag = frags; 569 tx->extra_frag = frags;
570 570
571 return TX_CONTINUE; 571 return TX_CONTINUE;
572 572
@@ -583,7 +583,7 @@ ieee80211_tx_h_fragment(struct ieee80211_txrx_data *tx)
583} 583}
584 584
585static ieee80211_tx_result 585static ieee80211_tx_result
586ieee80211_tx_h_encrypt(struct ieee80211_txrx_data *tx) 586ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)
587{ 587{
588 if (!tx->key) 588 if (!tx->key)
589 return TX_CONTINUE; 589 return TX_CONTINUE;
@@ -603,56 +603,56 @@ ieee80211_tx_h_encrypt(struct ieee80211_txrx_data *tx)
603} 603}
604 604
605static ieee80211_tx_result 605static ieee80211_tx_result
606ieee80211_tx_h_rate_ctrl(struct ieee80211_txrx_data *tx) 606ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx)
607{ 607{
608 struct rate_selection rsel; 608 struct rate_selection rsel;
609 struct ieee80211_supported_band *sband; 609 struct ieee80211_supported_band *sband;
610 610
611 sband = tx->local->hw.wiphy->bands[tx->local->hw.conf.channel->band]; 611 sband = tx->local->hw.wiphy->bands[tx->local->hw.conf.channel->band];
612 612
613 if (likely(!tx->u.tx.rate)) { 613 if (likely(!tx->rate)) {
614 rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); 614 rate_control_get_rate(tx->dev, sband, tx->skb, &rsel);
615 tx->u.tx.rate = rsel.rate; 615 tx->rate = rsel.rate;
616 if (unlikely(rsel.probe)) { 616 if (unlikely(rsel.probe)) {
617 tx->u.tx.control->flags |= 617 tx->control->flags |=
618 IEEE80211_TXCTL_RATE_CTRL_PROBE; 618 IEEE80211_TXCTL_RATE_CTRL_PROBE;
619 tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; 619 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG;
620 tx->u.tx.control->alt_retry_rate = tx->u.tx.rate; 620 tx->control->alt_retry_rate = tx->rate;
621 tx->u.tx.rate = rsel.probe; 621 tx->rate = rsel.probe;
622 } else 622 } else
623 tx->u.tx.control->alt_retry_rate = NULL; 623 tx->control->alt_retry_rate = NULL;
624 624
625 if (!tx->u.tx.rate) 625 if (!tx->rate)
626 return TX_DROP; 626 return TX_DROP;
627 } else 627 } else
628 tx->u.tx.control->alt_retry_rate = NULL; 628 tx->control->alt_retry_rate = NULL;
629 629
630 if (tx->sdata->bss_conf.use_cts_prot && 630 if (tx->sdata->bss_conf.use_cts_prot &&
631 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) && rsel.nonerp) { 631 (tx->flags & IEEE80211_TX_FRAGMENTED) && rsel.nonerp) {
632 tx->u.tx.last_frag_rate = tx->u.tx.rate; 632 tx->last_frag_rate = tx->rate;
633 if (rsel.probe) 633 if (rsel.probe)
634 tx->flags &= ~IEEE80211_TXRXD_TXPROBE_LAST_FRAG; 634 tx->flags &= ~IEEE80211_TX_PROBE_LAST_FRAG;
635 else 635 else
636 tx->flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; 636 tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG;
637 tx->u.tx.rate = rsel.nonerp; 637 tx->rate = rsel.nonerp;
638 tx->u.tx.control->tx_rate = rsel.nonerp; 638 tx->control->tx_rate = rsel.nonerp;
639 tx->u.tx.control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE; 639 tx->control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE;
640 } else { 640 } else {
641 tx->u.tx.last_frag_rate = tx->u.tx.rate; 641 tx->last_frag_rate = tx->rate;
642 tx->u.tx.control->tx_rate = tx->u.tx.rate; 642 tx->control->tx_rate = tx->rate;
643 } 643 }
644 tx->u.tx.control->tx_rate = tx->u.tx.rate; 644 tx->control->tx_rate = tx->rate;
645 645
646 return TX_CONTINUE; 646 return TX_CONTINUE;
647} 647}
648 648
649static ieee80211_tx_result 649static ieee80211_tx_result
650ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx) 650ieee80211_tx_h_misc(struct ieee80211_tx_data *tx)
651{ 651{
652 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; 652 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data;
653 u16 fc = le16_to_cpu(hdr->frame_control); 653 u16 fc = le16_to_cpu(hdr->frame_control);
654 u16 dur; 654 u16 dur;
655 struct ieee80211_tx_control *control = tx->u.tx.control; 655 struct ieee80211_tx_control *control = tx->control;
656 656
657 if (!control->retry_limit) { 657 if (!control->retry_limit) {
658 if (!is_multicast_ether_addr(hdr->addr1)) { 658 if (!is_multicast_ether_addr(hdr->addr1)) {
@@ -674,7 +674,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
674 } 674 }
675 } 675 }
676 676
677 if (tx->flags & IEEE80211_TXRXD_FRAGMENTED) { 677 if (tx->flags & IEEE80211_TX_FRAGMENTED) {
678 /* Do not use multiple retry rates when sending fragmented 678 /* Do not use multiple retry rates when sending fragmented
679 * frames. 679 * frames.
680 * TODO: The last fragment could still use multiple retry 680 * TODO: The last fragment could still use multiple retry
@@ -686,8 +686,8 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
686 * there are associated non-ERP stations and RTS/CTS is not configured 686 * there are associated non-ERP stations and RTS/CTS is not configured
687 * for the frame. */ 687 * for the frame. */
688 if ((tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) && 688 if ((tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) &&
689 (tx->u.tx.rate->flags & IEEE80211_RATE_ERP_G) && 689 (tx->rate->flags & IEEE80211_RATE_ERP_G) &&
690 (tx->flags & IEEE80211_TXRXD_TXUNICAST) && 690 (tx->flags & IEEE80211_TX_UNICAST) &&
691 tx->sdata->bss_conf.use_cts_prot && 691 tx->sdata->bss_conf.use_cts_prot &&
692 !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) 692 !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS))
693 control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; 693 control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT;
@@ -696,18 +696,18 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
696 * short preambles at the selected rate and short preambles are 696 * short preambles at the selected rate and short preambles are
697 * available on the network at the current point in time. */ 697 * available on the network at the current point in time. */
698 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) && 698 if (((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
699 (tx->u.tx.rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) && 699 (tx->rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) &&
700 tx->sdata->bss_conf.use_short_preamble && 700 tx->sdata->bss_conf.use_short_preamble &&
701 (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) { 701 (!tx->sta || (tx->sta->flags & WLAN_STA_SHORT_PREAMBLE))) {
702 tx->u.tx.control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; 702 tx->control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE;
703 } 703 }
704 704
705 /* Setup duration field for the first fragment of the frame. Duration 705 /* Setup duration field for the first fragment of the frame. Duration
706 * for remaining fragments will be updated when they are being sent 706 * for remaining fragments will be updated when they are being sent
707 * to low-level driver in ieee80211_tx(). */ 707 * to low-level driver in ieee80211_tx(). */
708 dur = ieee80211_duration(tx, is_multicast_ether_addr(hdr->addr1), 708 dur = ieee80211_duration(tx, is_multicast_ether_addr(hdr->addr1),
709 (tx->flags & IEEE80211_TXRXD_FRAGMENTED) ? 709 (tx->flags & IEEE80211_TX_FRAGMENTED) ?
710 tx->u.tx.extra_frag[0]->len : 0); 710 tx->extra_frag[0]->len : 0);
711 hdr->duration_id = cpu_to_le16(dur); 711 hdr->duration_id = cpu_to_le16(dur);
712 712
713 if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) || 713 if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) ||
@@ -723,7 +723,7 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
723 control->alt_retry_rate = NULL; 723 control->alt_retry_rate = NULL;
724 724
725 /* Use min(data rate, max base rate) as CTS/RTS rate */ 725 /* Use min(data rate, max base rate) as CTS/RTS rate */
726 rate = tx->u.tx.rate; 726 rate = tx->rate;
727 baserate = NULL; 727 baserate = NULL;
728 728
729 for (idx = 0; idx < sband->n_bitrates; idx++) { 729 for (idx = 0; idx < sband->n_bitrates; idx++) {
@@ -745,12 +745,12 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
745 tx->sta->tx_packets++; 745 tx->sta->tx_packets++;
746 tx->sta->tx_fragments++; 746 tx->sta->tx_fragments++;
747 tx->sta->tx_bytes += tx->skb->len; 747 tx->sta->tx_bytes += tx->skb->len;
748 if (tx->u.tx.extra_frag) { 748 if (tx->extra_frag) {
749 int i; 749 int i;
750 tx->sta->tx_fragments += tx->u.tx.num_extra_frag; 750 tx->sta->tx_fragments += tx->num_extra_frag;
751 for (i = 0; i < tx->u.tx.num_extra_frag; i++) { 751 for (i = 0; i < tx->num_extra_frag; i++) {
752 tx->sta->tx_bytes += 752 tx->sta->tx_bytes +=
753 tx->u.tx.extra_frag[i]->len; 753 tx->extra_frag[i]->len;
754 } 754 }
755 } 755 }
756 } 756 }
@@ -759,13 +759,13 @@ ieee80211_tx_h_misc(struct ieee80211_txrx_data *tx)
759} 759}
760 760
761static ieee80211_tx_result 761static ieee80211_tx_result
762ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx) 762ieee80211_tx_h_load_stats(struct ieee80211_tx_data *tx)
763{ 763{
764 struct ieee80211_local *local = tx->local; 764 struct ieee80211_local *local = tx->local;
765 struct sk_buff *skb = tx->skb; 765 struct sk_buff *skb = tx->skb;
766 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 766 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
767 u32 load = 0, hdrtime; 767 u32 load = 0, hdrtime;
768 struct ieee80211_rate *rate = tx->u.tx.rate; 768 struct ieee80211_rate *rate = tx->rate;
769 769
770 /* TODO: this could be part of tx_status handling, so that the number 770 /* TODO: this could be part of tx_status handling, so that the number
771 * of retries would be known; TX rate should in that case be stored 771 * of retries would be known; TX rate should in that case be stored
@@ -776,8 +776,8 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx)
776 /* 1 bit at 1 Mbit/s takes 1 usec; in channel_use values, 776 /* 1 bit at 1 Mbit/s takes 1 usec; in channel_use values,
777 * 1 usec = 1/8 * (1080 / 10) = 13.5 */ 777 * 1 usec = 1/8 * (1080 / 10) = 13.5 */
778 778
779 if (tx->u.tx.channel->band == IEEE80211_BAND_5GHZ || 779 if (tx->channel->band == IEEE80211_BAND_5GHZ ||
780 (tx->u.tx.channel->band == IEEE80211_BAND_2GHZ && 780 (tx->channel->band == IEEE80211_BAND_2GHZ &&
781 rate->flags & IEEE80211_RATE_ERP_G)) 781 rate->flags & IEEE80211_RATE_ERP_G))
782 hdrtime = CHAN_UTIL_HDR_SHORT; 782 hdrtime = CHAN_UTIL_HDR_SHORT;
783 else 783 else
@@ -787,20 +787,20 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx)
787 if (!is_multicast_ether_addr(hdr->addr1)) 787 if (!is_multicast_ether_addr(hdr->addr1))
788 load += hdrtime; 788 load += hdrtime;
789 789
790 if (tx->u.tx.control->flags & IEEE80211_TXCTL_USE_RTS_CTS) 790 if (tx->control->flags & IEEE80211_TXCTL_USE_RTS_CTS)
791 load += 2 * hdrtime; 791 load += 2 * hdrtime;
792 else if (tx->u.tx.control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) 792 else if (tx->control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)
793 load += hdrtime; 793 load += hdrtime;
794 794
795 /* TODO: optimise again */ 795 /* TODO: optimise again */
796 load += skb->len * CHAN_UTIL_RATE_LCM / rate->bitrate; 796 load += skb->len * CHAN_UTIL_RATE_LCM / rate->bitrate;
797 797
798 if (tx->u.tx.extra_frag) { 798 if (tx->extra_frag) {
799 int i; 799 int i;
800 for (i = 0; i < tx->u.tx.num_extra_frag; i++) { 800 for (i = 0; i < tx->num_extra_frag; i++) {
801 load += 2 * hdrtime; 801 load += 2 * hdrtime;
802 load += tx->u.tx.extra_frag[i]->len * 802 load += tx->extra_frag[i]->len *
803 tx->u.tx.rate->bitrate; 803 tx->rate->bitrate;
804 } 804 }
805 } 805 }
806 806
@@ -815,7 +815,7 @@ ieee80211_tx_h_load_stats(struct ieee80211_txrx_data *tx)
815} 815}
816 816
817 817
818typedef ieee80211_tx_result (*ieee80211_tx_handler)(struct ieee80211_txrx_data *); 818typedef ieee80211_tx_result (*ieee80211_tx_handler)(struct ieee80211_tx_data *);
819static ieee80211_tx_handler ieee80211_tx_handlers[] = 819static ieee80211_tx_handler ieee80211_tx_handlers[] =
820{ 820{
821 ieee80211_tx_h_check_assoc, 821 ieee80211_tx_h_check_assoc,
@@ -838,7 +838,7 @@ static ieee80211_tx_handler ieee80211_tx_handlers[] =
838 * with Radiotap Header -- only called for monitor mode interface 838 * with Radiotap Header -- only called for monitor mode interface
839 */ 839 */
840static ieee80211_tx_result 840static ieee80211_tx_result
841__ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx, 841__ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx,
842 struct sk_buff *skb) 842 struct sk_buff *skb)
843{ 843{
844 /* 844 /*
@@ -854,13 +854,13 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx,
854 (struct ieee80211_radiotap_header *) skb->data; 854 (struct ieee80211_radiotap_header *) skb->data;
855 struct ieee80211_supported_band *sband; 855 struct ieee80211_supported_band *sband;
856 int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); 856 int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len);
857 struct ieee80211_tx_control *control = tx->u.tx.control; 857 struct ieee80211_tx_control *control = tx->control;
858 858
859 sband = tx->local->hw.wiphy->bands[tx->local->hw.conf.channel->band]; 859 sband = tx->local->hw.wiphy->bands[tx->local->hw.conf.channel->band];
860 860
861 control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; 861 control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT;
862 tx->flags |= IEEE80211_TXRXD_TX_INJECTED; 862 tx->flags |= IEEE80211_TX_INJECTED;
863 tx->flags &= ~IEEE80211_TXRXD_FRAGMENTED; 863 tx->flags &= ~IEEE80211_TX_FRAGMENTED;
864 864
865 /* 865 /*
866 * for every radiotap entry that is present 866 * for every radiotap entry that is present
@@ -896,7 +896,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx,
896 r = &sband->bitrates[i]; 896 r = &sband->bitrates[i];
897 897
898 if (r->bitrate == target_rate) { 898 if (r->bitrate == target_rate) {
899 tx->u.tx.rate = r; 899 tx->rate = r;
900 break; 900 break;
901 } 901 }
902 } 902 }
@@ -934,7 +934,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx,
934 control->flags &= 934 control->flags &=
935 ~IEEE80211_TXCTL_DO_NOT_ENCRYPT; 935 ~IEEE80211_TXCTL_DO_NOT_ENCRYPT;
936 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) 936 if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG)
937 tx->flags |= IEEE80211_TXRXD_FRAGMENTED; 937 tx->flags |= IEEE80211_TX_FRAGMENTED;
938 break; 938 break;
939 939
940 /* 940 /*
@@ -965,7 +965,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_txrx_data *tx,
965 * initialises @tx 965 * initialises @tx
966 */ 966 */
967static ieee80211_tx_result 967static ieee80211_tx_result
968__ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, 968__ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
969 struct sk_buff *skb, 969 struct sk_buff *skb,
970 struct net_device *dev, 970 struct net_device *dev,
971 struct ieee80211_tx_control *control) 971 struct ieee80211_tx_control *control)
@@ -981,12 +981,12 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
981 tx->dev = dev; /* use original interface */ 981 tx->dev = dev; /* use original interface */
982 tx->local = local; 982 tx->local = local;
983 tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); 983 tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev);
984 tx->u.tx.control = control; 984 tx->control = control;
985 /* 985 /*
986 * Set this flag (used below to indicate "automatic fragmentation"), 986 * Set this flag (used below to indicate "automatic fragmentation"),
987 * it will be cleared/left by radiotap as desired. 987 * it will be cleared/left by radiotap as desired.
988 */ 988 */
989 tx->flags |= IEEE80211_TXRXD_FRAGMENTED; 989 tx->flags |= IEEE80211_TX_FRAGMENTED;
990 990
991 /* process and remove the injection radiotap header */ 991 /* process and remove the injection radiotap header */
992 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 992 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
@@ -1007,20 +1007,20 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
1007 tx->fc = le16_to_cpu(hdr->frame_control); 1007 tx->fc = le16_to_cpu(hdr->frame_control);
1008 1008
1009 if (is_multicast_ether_addr(hdr->addr1)) { 1009 if (is_multicast_ether_addr(hdr->addr1)) {
1010 tx->flags &= ~IEEE80211_TXRXD_TXUNICAST; 1010 tx->flags &= ~IEEE80211_TX_UNICAST;
1011 control->flags |= IEEE80211_TXCTL_NO_ACK; 1011 control->flags |= IEEE80211_TXCTL_NO_ACK;
1012 } else { 1012 } else {
1013 tx->flags |= IEEE80211_TXRXD_TXUNICAST; 1013 tx->flags |= IEEE80211_TX_UNICAST;
1014 control->flags &= ~IEEE80211_TXCTL_NO_ACK; 1014 control->flags &= ~IEEE80211_TXCTL_NO_ACK;
1015 } 1015 }
1016 1016
1017 if (tx->flags & IEEE80211_TXRXD_FRAGMENTED) { 1017 if (tx->flags & IEEE80211_TX_FRAGMENTED) {
1018 if ((tx->flags & IEEE80211_TXRXD_TXUNICAST) && 1018 if ((tx->flags & IEEE80211_TX_UNICAST) &&
1019 skb->len + FCS_LEN > local->fragmentation_threshold && 1019 skb->len + FCS_LEN > local->fragmentation_threshold &&
1020 !local->ops->set_frag_threshold) 1020 !local->ops->set_frag_threshold)
1021 tx->flags |= IEEE80211_TXRXD_FRAGMENTED; 1021 tx->flags |= IEEE80211_TX_FRAGMENTED;
1022 else 1022 else
1023 tx->flags &= ~IEEE80211_TXRXD_FRAGMENTED; 1023 tx->flags &= ~IEEE80211_TX_FRAGMENTED;
1024 } 1024 }
1025 1025
1026 if (!tx->sta) 1026 if (!tx->sta)
@@ -1043,7 +1043,7 @@ __ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
1043/* 1043/*
1044 * NB: @tx is uninitialised when passed in here 1044 * NB: @tx is uninitialised when passed in here
1045 */ 1045 */
1046static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx, 1046static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx,
1047 struct sk_buff *skb, 1047 struct sk_buff *skb,
1048 struct net_device *mdev, 1048 struct net_device *mdev,
1049 struct ieee80211_tx_control *control) 1049 struct ieee80211_tx_control *control)
@@ -1066,9 +1066,9 @@ static int ieee80211_tx_prepare(struct ieee80211_txrx_data *tx,
1066} 1066}
1067 1067
1068static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, 1068static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1069 struct ieee80211_txrx_data *tx) 1069 struct ieee80211_tx_data *tx)
1070{ 1070{
1071 struct ieee80211_tx_control *control = tx->u.tx.control; 1071 struct ieee80211_tx_control *control = tx->control;
1072 int ret, i; 1072 int ret, i;
1073 1073
1074 if (!ieee80211_qdisc_installed(local->mdev) && 1074 if (!ieee80211_qdisc_installed(local->mdev) &&
@@ -1085,20 +1085,20 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1085 local->mdev->trans_start = jiffies; 1085 local->mdev->trans_start = jiffies;
1086 ieee80211_led_tx(local, 1); 1086 ieee80211_led_tx(local, 1);
1087 } 1087 }
1088 if (tx->u.tx.extra_frag) { 1088 if (tx->extra_frag) {
1089 control->flags &= ~(IEEE80211_TXCTL_USE_RTS_CTS | 1089 control->flags &= ~(IEEE80211_TXCTL_USE_RTS_CTS |
1090 IEEE80211_TXCTL_USE_CTS_PROTECT | 1090 IEEE80211_TXCTL_USE_CTS_PROTECT |
1091 IEEE80211_TXCTL_CLEAR_PS_FILT | 1091 IEEE80211_TXCTL_CLEAR_PS_FILT |
1092 IEEE80211_TXCTL_FIRST_FRAGMENT); 1092 IEEE80211_TXCTL_FIRST_FRAGMENT);
1093 for (i = 0; i < tx->u.tx.num_extra_frag; i++) { 1093 for (i = 0; i < tx->num_extra_frag; i++) {
1094 if (!tx->u.tx.extra_frag[i]) 1094 if (!tx->extra_frag[i])
1095 continue; 1095 continue;
1096 if (__ieee80211_queue_stopped(local, control->queue)) 1096 if (__ieee80211_queue_stopped(local, control->queue))
1097 return IEEE80211_TX_FRAG_AGAIN; 1097 return IEEE80211_TX_FRAG_AGAIN;
1098 if (i == tx->u.tx.num_extra_frag) { 1098 if (i == tx->num_extra_frag) {
1099 control->tx_rate = tx->u.tx.last_frag_rate; 1099 control->tx_rate = tx->last_frag_rate;
1100 1100
1101 if (tx->flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG) 1101 if (tx->flags & IEEE80211_TX_PROBE_LAST_FRAG)
1102 control->flags |= 1102 control->flags |=
1103 IEEE80211_TXCTL_RATE_CTRL_PROBE; 1103 IEEE80211_TXCTL_RATE_CTRL_PROBE;
1104 else 1104 else
@@ -1108,18 +1108,18 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
1108 1108
1109 ieee80211_dump_frame(wiphy_name(local->hw.wiphy), 1109 ieee80211_dump_frame(wiphy_name(local->hw.wiphy),
1110 "TX to low-level driver", 1110 "TX to low-level driver",
1111 tx->u.tx.extra_frag[i]); 1111 tx->extra_frag[i]);
1112 ret = local->ops->tx(local_to_hw(local), 1112 ret = local->ops->tx(local_to_hw(local),
1113 tx->u.tx.extra_frag[i], 1113 tx->extra_frag[i],
1114 control); 1114 control);
1115 if (ret) 1115 if (ret)
1116 return IEEE80211_TX_FRAG_AGAIN; 1116 return IEEE80211_TX_FRAG_AGAIN;
1117 local->mdev->trans_start = jiffies; 1117 local->mdev->trans_start = jiffies;
1118 ieee80211_led_tx(local, 1); 1118 ieee80211_led_tx(local, 1);
1119 tx->u.tx.extra_frag[i] = NULL; 1119 tx->extra_frag[i] = NULL;
1120 } 1120 }
1121 kfree(tx->u.tx.extra_frag); 1121 kfree(tx->extra_frag);
1122 tx->u.tx.extra_frag = NULL; 1122 tx->extra_frag = NULL;
1123 } 1123 }
1124 return IEEE80211_TX_OK; 1124 return IEEE80211_TX_OK;
1125} 1125}
@@ -1130,7 +1130,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1130 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 1130 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
1131 struct sta_info *sta; 1131 struct sta_info *sta;
1132 ieee80211_tx_handler *handler; 1132 ieee80211_tx_handler *handler;
1133 struct ieee80211_txrx_data tx; 1133 struct ieee80211_tx_data tx;
1134 ieee80211_tx_result res = TX_DROP, res_prepare; 1134 ieee80211_tx_result res = TX_DROP, res_prepare;
1135 int ret, i; 1135 int ret, i;
1136 1136
@@ -1156,7 +1156,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1156 rcu_read_lock(); 1156 rcu_read_lock();
1157 1157
1158 sta = tx.sta; 1158 sta = tx.sta;
1159 tx.u.tx.channel = local->hw.conf.channel; 1159 tx.channel = local->hw.conf.channel;
1160 1160
1161 for (handler = ieee80211_tx_handlers; *handler != NULL; 1161 for (handler = ieee80211_tx_handlers; *handler != NULL;
1162 handler++) { 1162 handler++) {
@@ -1181,18 +1181,18 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
1181 return 0; 1181 return 0;
1182 } 1182 }
1183 1183
1184 if (tx.u.tx.extra_frag) { 1184 if (tx.extra_frag) {
1185 for (i = 0; i < tx.u.tx.num_extra_frag; i++) { 1185 for (i = 0; i < tx.num_extra_frag; i++) {
1186 int next_len, dur; 1186 int next_len, dur;
1187 struct ieee80211_hdr *hdr = 1187 struct ieee80211_hdr *hdr =
1188 (struct ieee80211_hdr *) 1188 (struct ieee80211_hdr *)
1189 tx.u.tx.extra_frag[i]->data; 1189 tx.extra_frag[i]->data;
1190 1190
1191 if (i + 1 < tx.u.tx.num_extra_frag) { 1191 if (i + 1 < tx.num_extra_frag) {
1192 next_len = tx.u.tx.extra_frag[i + 1]->len; 1192 next_len = tx.extra_frag[i + 1]->len;
1193 } else { 1193 } else {
1194 next_len = 0; 1194 next_len = 0;
1195 tx.u.tx.rate = tx.u.tx.last_frag_rate; 1195 tx.rate = tx.last_frag_rate;
1196 } 1196 }
1197 dur = ieee80211_duration(&tx, 0, next_len); 1197 dur = ieee80211_duration(&tx, 0, next_len);
1198 hdr->duration_id = cpu_to_le16(dur); 1198 hdr->duration_id = cpu_to_le16(dur);
@@ -1227,11 +1227,11 @@ retry:
1227 memcpy(&store->control, control, 1227 memcpy(&store->control, control,
1228 sizeof(struct ieee80211_tx_control)); 1228 sizeof(struct ieee80211_tx_control));
1229 store->skb = skb; 1229 store->skb = skb;
1230 store->extra_frag = tx.u.tx.extra_frag; 1230 store->extra_frag = tx.extra_frag;
1231 store->num_extra_frag = tx.u.tx.num_extra_frag; 1231 store->num_extra_frag = tx.num_extra_frag;
1232 store->last_frag_rate = tx.u.tx.last_frag_rate; 1232 store->last_frag_rate = tx.last_frag_rate;
1233 store->last_frag_rate_ctrl_probe = 1233 store->last_frag_rate_ctrl_probe =
1234 !!(tx.flags & IEEE80211_TXRXD_TXPROBE_LAST_FRAG); 1234 !!(tx.flags & IEEE80211_TX_PROBE_LAST_FRAG);
1235 } 1235 }
1236 rcu_read_unlock(); 1236 rcu_read_unlock();
1237 return 0; 1237 return 0;
@@ -1239,10 +1239,10 @@ retry:
1239 drop: 1239 drop:
1240 if (skb) 1240 if (skb)
1241 dev_kfree_skb(skb); 1241 dev_kfree_skb(skb);
1242 for (i = 0; i < tx.u.tx.num_extra_frag; i++) 1242 for (i = 0; i < tx.num_extra_frag; i++)
1243 if (tx.u.tx.extra_frag[i]) 1243 if (tx.extra_frag[i])
1244 dev_kfree_skb(tx.u.tx.extra_frag[i]); 1244 dev_kfree_skb(tx.extra_frag[i]);
1245 kfree(tx.u.tx.extra_frag); 1245 kfree(tx.extra_frag);
1246 rcu_read_unlock(); 1246 rcu_read_unlock();
1247 return 0; 1247 return 0;
1248} 1248}
@@ -1670,7 +1670,7 @@ void ieee80211_tx_pending(unsigned long data)
1670 struct ieee80211_local *local = (struct ieee80211_local *)data; 1670 struct ieee80211_local *local = (struct ieee80211_local *)data;
1671 struct net_device *dev = local->mdev; 1671 struct net_device *dev = local->mdev;
1672 struct ieee80211_tx_stored_packet *store; 1672 struct ieee80211_tx_stored_packet *store;
1673 struct ieee80211_txrx_data tx; 1673 struct ieee80211_tx_data tx;
1674 int i, ret, reschedule = 0; 1674 int i, ret, reschedule = 0;
1675 1675
1676 netif_tx_lock_bh(dev); 1676 netif_tx_lock_bh(dev);
@@ -1682,13 +1682,13 @@ void ieee80211_tx_pending(unsigned long data)
1682 continue; 1682 continue;
1683 } 1683 }
1684 store = &local->pending_packet[i]; 1684 store = &local->pending_packet[i];
1685 tx.u.tx.control = &store->control; 1685 tx.control = &store->control;
1686 tx.u.tx.extra_frag = store->extra_frag; 1686 tx.extra_frag = store->extra_frag;
1687 tx.u.tx.num_extra_frag = store->num_extra_frag; 1687 tx.num_extra_frag = store->num_extra_frag;
1688 tx.u.tx.last_frag_rate = store->last_frag_rate; 1688 tx.last_frag_rate = store->last_frag_rate;
1689 tx.flags = 0; 1689 tx.flags = 0;
1690 if (store->last_frag_rate_ctrl_probe) 1690 if (store->last_frag_rate_ctrl_probe)
1691 tx.flags |= IEEE80211_TXRXD_TXPROBE_LAST_FRAG; 1691 tx.flags |= IEEE80211_TX_PROBE_LAST_FRAG;
1692 ret = __ieee80211_tx(local, store->skb, &tx); 1692 ret = __ieee80211_tx(local, store->skb, &tx);
1693 if (ret) { 1693 if (ret) {
1694 if (ret == IEEE80211_TX_FRAG_AGAIN) 1694 if (ret == IEEE80211_TX_FRAG_AGAIN)
@@ -1943,7 +1943,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
1943 struct sk_buff *skb; 1943 struct sk_buff *skb;
1944 struct sta_info *sta; 1944 struct sta_info *sta;
1945 ieee80211_tx_handler *handler; 1945 ieee80211_tx_handler *handler;
1946 struct ieee80211_txrx_data tx; 1946 struct ieee80211_tx_data tx;
1947 ieee80211_tx_result res = TX_DROP; 1947 ieee80211_tx_result res = TX_DROP;
1948 struct net_device *bdev; 1948 struct net_device *bdev;
1949 struct ieee80211_sub_if_data *sdata; 1949 struct ieee80211_sub_if_data *sdata;
@@ -1991,8 +1991,8 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
1991 dev_kfree_skb_any(skb); 1991 dev_kfree_skb_any(skb);
1992 } 1992 }
1993 sta = tx.sta; 1993 sta = tx.sta;
1994 tx.flags |= IEEE80211_TXRXD_TXPS_BUFFERED; 1994 tx.flags |= IEEE80211_TX_PS_BUFFERED;
1995 tx.u.tx.channel = local->hw.conf.channel; 1995 tx.channel = local->hw.conf.channel;
1996 1996
1997 for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) { 1997 for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) {
1998 res = (*handler)(&tx); 1998 res = (*handler)(&tx);