diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-05-15 06:55:29 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-05-21 21:48:11 -0400 |
commit | e039fa4a4195ac4ee895e6f3d1334beed63256fe (patch) | |
tree | cfd0762d73df96b73052378be7b157c4ac6e7035 /net/mac80211/tx.c | |
parent | e24549485f859be6518929bb1c9c0257d79f033d (diff) |
mac80211: move TX info into skb->cb
This patch converts mac80211 and all drivers to have transmit
information and status in skb->cb rather than allocating extra
memory for it and copying all the data around. To make it fit,
a union is used where only data that is necessary for all steps
is kept outside of the union.
A number of fixes were done by Ivo, as well as the rt2x00 part
of this patch.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r-- | net/mac80211/tx.c | 310 |
1 files changed, 150 insertions, 160 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 666158f02a89..ac9a4af7ad42 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -238,12 +238,12 @@ static ieee80211_tx_result | |||
238 | ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | 238 | ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) |
239 | { | 239 | { |
240 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 240 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
241 | struct sk_buff *skb = tx->skb; | 241 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; |
242 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | ||
243 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 242 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
243 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
244 | u32 sta_flags; | 244 | u32 sta_flags; |
245 | 245 | ||
246 | if (unlikely(tx->flags & IEEE80211_TX_INJECTED)) | 246 | if (unlikely(info->flags & IEEE80211_TX_CTL_INJECTED)) |
247 | return TX_CONTINUE; | 247 | return TX_CONTINUE; |
248 | 248 | ||
249 | if (unlikely(tx->local->sta_sw_scanning) && | 249 | if (unlikely(tx->local->sta_sw_scanning) && |
@@ -348,6 +348,8 @@ static void purge_old_ps_buffers(struct ieee80211_local *local) | |||
348 | static ieee80211_tx_result | 348 | static ieee80211_tx_result |
349 | ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) | 349 | ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) |
350 | { | 350 | { |
351 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
352 | |||
351 | /* | 353 | /* |
352 | * broadcast/multicast frame | 354 | * broadcast/multicast frame |
353 | * | 355 | * |
@@ -383,7 +385,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) | |||
383 | } | 385 | } |
384 | 386 | ||
385 | /* buffered in hardware */ | 387 | /* buffered in hardware */ |
386 | tx->control->flags |= IEEE80211_TXCTL_SEND_AFTER_DTIM; | 388 | info->flags |= IEEE80211_TX_CTL_SEND_AFTER_DTIM; |
387 | 389 | ||
388 | return TX_CONTINUE; | 390 | return TX_CONTINUE; |
389 | } | 391 | } |
@@ -392,6 +394,7 @@ static ieee80211_tx_result | |||
392 | ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | 394 | ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) |
393 | { | 395 | { |
394 | struct sta_info *sta = tx->sta; | 396 | struct sta_info *sta = tx->sta; |
397 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
395 | u32 staflags; | 398 | u32 staflags; |
396 | DECLARE_MAC_BUF(mac); | 399 | DECLARE_MAC_BUF(mac); |
397 | 400 | ||
@@ -404,7 +407,6 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
404 | 407 | ||
405 | if (unlikely((staflags & WLAN_STA_PS) && | 408 | if (unlikely((staflags & WLAN_STA_PS) && |
406 | !(staflags & WLAN_STA_PSPOLL))) { | 409 | !(staflags & WLAN_STA_PSPOLL))) { |
407 | struct ieee80211_tx_packet_data *pkt_data; | ||
408 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 410 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
409 | printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " | 411 | printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " |
410 | "before %d)\n", | 412 | "before %d)\n", |
@@ -428,8 +430,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
428 | if (skb_queue_empty(&sta->ps_tx_buf)) | 430 | if (skb_queue_empty(&sta->ps_tx_buf)) |
429 | sta_info_set_tim_bit(sta); | 431 | sta_info_set_tim_bit(sta); |
430 | 432 | ||
431 | pkt_data = (struct ieee80211_tx_packet_data *)tx->skb->cb; | 433 | info->control.jiffies = jiffies; |
432 | pkt_data->jiffies = jiffies; | ||
433 | skb_queue_tail(&sta->ps_tx_buf, tx->skb); | 434 | skb_queue_tail(&sta->ps_tx_buf, tx->skb); |
434 | return TX_QUEUED; | 435 | return TX_QUEUED; |
435 | } | 436 | } |
@@ -461,17 +462,18 @@ static ieee80211_tx_result | |||
461 | ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | 462 | ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) |
462 | { | 463 | { |
463 | struct ieee80211_key *key; | 464 | struct ieee80211_key *key; |
465 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
464 | u16 fc = tx->fc; | 466 | u16 fc = tx->fc; |
465 | 467 | ||
466 | if (unlikely(tx->control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) | 468 | if (unlikely(info->flags & IEEE80211_TX_CTL_DO_NOT_ENCRYPT)) |
467 | tx->key = NULL; | 469 | tx->key = NULL; |
468 | else if (tx->sta && (key = rcu_dereference(tx->sta->key))) | 470 | else if (tx->sta && (key = rcu_dereference(tx->sta->key))) |
469 | tx->key = key; | 471 | tx->key = key; |
470 | else if ((key = rcu_dereference(tx->sdata->default_key))) | 472 | else if ((key = rcu_dereference(tx->sdata->default_key))) |
471 | tx->key = key; | 473 | tx->key = key; |
472 | else if (tx->sdata->drop_unencrypted && | 474 | else if (tx->sdata->drop_unencrypted && |
473 | !(tx->control->flags & IEEE80211_TXCTL_EAPOL_FRAME) && | 475 | !(info->flags & IEEE80211_TX_CTL_EAPOL_FRAME) && |
474 | !(tx->flags & IEEE80211_TX_INJECTED)) { | 476 | !(info->flags & IEEE80211_TX_CTL_INJECTED)) { |
475 | I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); | 477 | I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); |
476 | return TX_DROP; | 478 | return TX_DROP; |
477 | } else | 479 | } else |
@@ -500,7 +502,7 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | |||
500 | } | 502 | } |
501 | 503 | ||
502 | if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) | 504 | if (!tx->key || !(tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) |
503 | tx->control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; | 505 | info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; |
504 | 506 | ||
505 | return TX_CONTINUE; | 507 | return TX_CONTINUE; |
506 | } | 508 | } |
@@ -510,6 +512,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
510 | { | 512 | { |
511 | struct rate_selection rsel; | 513 | struct rate_selection rsel; |
512 | struct ieee80211_supported_band *sband; | 514 | struct ieee80211_supported_band *sband; |
515 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
513 | 516 | ||
514 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 517 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
515 | 518 | ||
@@ -517,18 +520,17 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
517 | rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); | 520 | rate_control_get_rate(tx->dev, sband, tx->skb, &rsel); |
518 | tx->rate_idx = rsel.rate_idx; | 521 | tx->rate_idx = rsel.rate_idx; |
519 | if (unlikely(rsel.probe_idx >= 0)) { | 522 | if (unlikely(rsel.probe_idx >= 0)) { |
520 | tx->control->flags |= | 523 | info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; |
521 | IEEE80211_TXCTL_RATE_CTRL_PROBE; | ||
522 | tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; | 524 | tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; |
523 | tx->control->alt_retry_rate_idx = tx->rate_idx; | 525 | info->control.alt_retry_rate_idx = tx->rate_idx; |
524 | tx->rate_idx = rsel.probe_idx; | 526 | tx->rate_idx = rsel.probe_idx; |
525 | } else | 527 | } else |
526 | tx->control->alt_retry_rate_idx = -1; | 528 | info->control.alt_retry_rate_idx = -1; |
527 | 529 | ||
528 | if (unlikely(tx->rate_idx < 0)) | 530 | if (unlikely(tx->rate_idx < 0)) |
529 | return TX_DROP; | 531 | return TX_DROP; |
530 | } else | 532 | } else |
531 | tx->control->alt_retry_rate_idx = -1; | 533 | info->control.alt_retry_rate_idx = -1; |
532 | 534 | ||
533 | if (tx->sdata->bss_conf.use_cts_prot && | 535 | if (tx->sdata->bss_conf.use_cts_prot && |
534 | (tx->flags & IEEE80211_TX_FRAGMENTED) && (rsel.nonerp_idx >= 0)) { | 536 | (tx->flags & IEEE80211_TX_FRAGMENTED) && (rsel.nonerp_idx >= 0)) { |
@@ -538,13 +540,13 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
538 | else | 540 | else |
539 | tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; | 541 | tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; |
540 | tx->rate_idx = rsel.nonerp_idx; | 542 | tx->rate_idx = rsel.nonerp_idx; |
541 | tx->control->tx_rate_idx = rsel.nonerp_idx; | 543 | info->tx_rate_idx = rsel.nonerp_idx; |
542 | tx->control->flags &= ~IEEE80211_TXCTL_RATE_CTRL_PROBE; | 544 | info->flags &= ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; |
543 | } else { | 545 | } else { |
544 | tx->last_frag_rate_idx = tx->rate_idx; | 546 | tx->last_frag_rate_idx = tx->rate_idx; |
545 | tx->control->tx_rate_idx = tx->rate_idx; | 547 | info->tx_rate_idx = tx->rate_idx; |
546 | } | 548 | } |
547 | tx->control->tx_rate_idx = tx->rate_idx; | 549 | info->tx_rate_idx = tx->rate_idx; |
548 | 550 | ||
549 | return TX_CONTINUE; | 551 | return TX_CONTINUE; |
550 | } | 552 | } |
@@ -555,28 +557,32 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
555 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; | 557 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) tx->skb->data; |
556 | u16 fc = le16_to_cpu(hdr->frame_control); | 558 | u16 fc = le16_to_cpu(hdr->frame_control); |
557 | u16 dur; | 559 | u16 dur; |
558 | struct ieee80211_tx_control *control = tx->control; | 560 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
559 | struct ieee80211_supported_band *sband; | 561 | struct ieee80211_supported_band *sband; |
560 | 562 | ||
561 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 563 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
562 | 564 | ||
563 | if (!control->retry_limit) { | 565 | if (tx->sta) |
566 | info->control.aid = tx->sta->aid; | ||
567 | |||
568 | if (!info->control.retry_limit) { | ||
564 | if (!is_multicast_ether_addr(hdr->addr1)) { | 569 | if (!is_multicast_ether_addr(hdr->addr1)) { |
565 | if (tx->skb->len + FCS_LEN > tx->local->rts_threshold | 570 | int len = min_t(int, tx->skb->len + FCS_LEN, |
571 | tx->local->fragmentation_threshold); | ||
572 | if (len > tx->local->rts_threshold | ||
566 | && tx->local->rts_threshold < | 573 | && tx->local->rts_threshold < |
567 | IEEE80211_MAX_RTS_THRESHOLD) { | 574 | IEEE80211_MAX_RTS_THRESHOLD) { |
568 | control->flags |= | 575 | info->flags |= IEEE80211_TX_CTL_USE_RTS_CTS; |
569 | IEEE80211_TXCTL_USE_RTS_CTS; | 576 | info->flags |= |
570 | control->flags |= | 577 | IEEE80211_TX_CTL_LONG_RETRY_LIMIT; |
571 | IEEE80211_TXCTL_LONG_RETRY_LIMIT; | 578 | info->control.retry_limit = |
572 | control->retry_limit = | ||
573 | tx->local->long_retry_limit; | 579 | tx->local->long_retry_limit; |
574 | } else { | 580 | } else { |
575 | control->retry_limit = | 581 | info->control.retry_limit = |
576 | tx->local->short_retry_limit; | 582 | tx->local->short_retry_limit; |
577 | } | 583 | } |
578 | } else { | 584 | } else { |
579 | control->retry_limit = 1; | 585 | info->control.retry_limit = 1; |
580 | } | 586 | } |
581 | } | 587 | } |
582 | 588 | ||
@@ -585,7 +591,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
585 | * frames. | 591 | * frames. |
586 | * TODO: The last fragment could still use multiple retry | 592 | * TODO: The last fragment could still use multiple retry |
587 | * rates. */ | 593 | * rates. */ |
588 | control->alt_retry_rate_idx = -1; | 594 | info->control.alt_retry_rate_idx = -1; |
589 | } | 595 | } |
590 | 596 | ||
591 | /* Use CTS protection for unicast frames sent using extended rates if | 597 | /* Use CTS protection for unicast frames sent using extended rates if |
@@ -595,8 +601,8 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
595 | (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_ERP_G) && | 601 | (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_ERP_G) && |
596 | (tx->flags & IEEE80211_TX_UNICAST) && | 602 | (tx->flags & IEEE80211_TX_UNICAST) && |
597 | tx->sdata->bss_conf.use_cts_prot && | 603 | tx->sdata->bss_conf.use_cts_prot && |
598 | !(control->flags & IEEE80211_TXCTL_USE_RTS_CTS)) | 604 | !(info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)) |
599 | control->flags |= IEEE80211_TXCTL_USE_CTS_PROTECT; | 605 | info->flags |= IEEE80211_TX_CTL_USE_CTS_PROTECT; |
600 | 606 | ||
601 | /* Transmit data frames using short preambles if the driver supports | 607 | /* Transmit data frames using short preambles if the driver supports |
602 | * short preambles at the selected rate and short preambles are | 608 | * short preambles at the selected rate and short preambles are |
@@ -605,7 +611,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
605 | (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) && | 611 | (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) && |
606 | tx->sdata->bss_conf.use_short_preamble && | 612 | tx->sdata->bss_conf.use_short_preamble && |
607 | (!tx->sta || test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE))) { | 613 | (!tx->sta || test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE))) { |
608 | tx->control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; | 614 | info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE; |
609 | } | 615 | } |
610 | 616 | ||
611 | /* Setup duration field for the first fragment of the frame. Duration | 617 | /* Setup duration field for the first fragment of the frame. Duration |
@@ -616,8 +622,8 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
616 | tx->extra_frag[0]->len : 0); | 622 | tx->extra_frag[0]->len : 0); |
617 | hdr->duration_id = cpu_to_le16(dur); | 623 | hdr->duration_id = cpu_to_le16(dur); |
618 | 624 | ||
619 | if ((control->flags & IEEE80211_TXCTL_USE_RTS_CTS) || | 625 | if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) || |
620 | (control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) { | 626 | (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) { |
621 | struct ieee80211_supported_band *sband; | 627 | struct ieee80211_supported_band *sband; |
622 | struct ieee80211_rate *rate; | 628 | struct ieee80211_rate *rate; |
623 | s8 baserate = -1; | 629 | s8 baserate = -1; |
@@ -626,7 +632,7 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
626 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 632 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
627 | 633 | ||
628 | /* Do not use multiple retry rates when using RTS/CTS */ | 634 | /* Do not use multiple retry rates when using RTS/CTS */ |
629 | control->alt_retry_rate_idx = -1; | 635 | info->control.alt_retry_rate_idx = -1; |
630 | 636 | ||
631 | /* Use min(data rate, max base rate) as CTS/RTS rate */ | 637 | /* Use min(data rate, max base rate) as CTS/RTS rate */ |
632 | rate = &sband->bitrates[tx->rate_idx]; | 638 | rate = &sband->bitrates[tx->rate_idx]; |
@@ -642,13 +648,13 @@ ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | |||
642 | } | 648 | } |
643 | 649 | ||
644 | if (baserate >= 0) | 650 | if (baserate >= 0) |
645 | control->rts_cts_rate_idx = baserate; | 651 | info->control.rts_cts_rate_idx = baserate; |
646 | else | 652 | else |
647 | control->rts_cts_rate_idx = 0; | 653 | info->control.rts_cts_rate_idx = 0; |
648 | } | 654 | } |
649 | 655 | ||
650 | if (tx->sta) | 656 | if (tx->sta) |
651 | control->aid = tx->sta->aid; | 657 | info->control.aid = tx->sta->aid; |
652 | 658 | ||
653 | return TX_CONTINUE; | 659 | return TX_CONTINUE; |
654 | } | 660 | } |
@@ -762,6 +768,7 @@ ieee80211_tx_h_stats(struct ieee80211_tx_data *tx) | |||
762 | u32 load = 0, hdrtime; | 768 | u32 load = 0, hdrtime; |
763 | struct ieee80211_rate *rate; | 769 | struct ieee80211_rate *rate; |
764 | struct ieee80211_supported_band *sband; | 770 | struct ieee80211_supported_band *sband; |
771 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
765 | 772 | ||
766 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 773 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
767 | rate = &sband->bitrates[tx->rate_idx]; | 774 | rate = &sband->bitrates[tx->rate_idx]; |
@@ -786,9 +793,9 @@ ieee80211_tx_h_stats(struct ieee80211_tx_data *tx) | |||
786 | if (!is_multicast_ether_addr(hdr->addr1)) | 793 | if (!is_multicast_ether_addr(hdr->addr1)) |
787 | load += hdrtime; | 794 | load += hdrtime; |
788 | 795 | ||
789 | if (tx->control->flags & IEEE80211_TXCTL_USE_RTS_CTS) | 796 | if (info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) |
790 | load += 2 * hdrtime; | 797 | load += 2 * hdrtime; |
791 | else if (tx->control->flags & IEEE80211_TXCTL_USE_CTS_PROTECT) | 798 | else if (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT) |
792 | load += hdrtime; | 799 | load += hdrtime; |
793 | 800 | ||
794 | /* TODO: optimise again */ | 801 | /* TODO: optimise again */ |
@@ -839,6 +846,7 @@ static ieee80211_tx_handler ieee80211_tx_handlers[] = | |||
839 | ieee80211_tx_h_rate_ctrl, | 846 | ieee80211_tx_h_rate_ctrl, |
840 | ieee80211_tx_h_misc, | 847 | ieee80211_tx_h_misc, |
841 | ieee80211_tx_h_fragment, | 848 | ieee80211_tx_h_fragment, |
849 | /* handlers after fragment must be aware of tx info fragmentation! */ | ||
842 | ieee80211_tx_h_encrypt, | 850 | ieee80211_tx_h_encrypt, |
843 | ieee80211_tx_h_stats, | 851 | ieee80211_tx_h_stats, |
844 | NULL | 852 | NULL |
@@ -867,12 +875,12 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, | |||
867 | (struct ieee80211_radiotap_header *) skb->data; | 875 | (struct ieee80211_radiotap_header *) skb->data; |
868 | struct ieee80211_supported_band *sband; | 876 | struct ieee80211_supported_band *sband; |
869 | int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); | 877 | int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); |
870 | struct ieee80211_tx_control *control = tx->control; | 878 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
871 | 879 | ||
872 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 880 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
873 | 881 | ||
874 | control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; | 882 | info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; |
875 | tx->flags |= IEEE80211_TX_INJECTED; | 883 | info->flags |= IEEE80211_TX_CTL_INJECTED; |
876 | tx->flags &= ~IEEE80211_TX_FRAGMENTED; | 884 | tx->flags &= ~IEEE80211_TX_FRAGMENTED; |
877 | 885 | ||
878 | /* | 886 | /* |
@@ -920,7 +928,7 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, | |||
920 | * radiotap uses 0 for 1st ant, mac80211 is 1 for | 928 | * radiotap uses 0 for 1st ant, mac80211 is 1 for |
921 | * 1st ant | 929 | * 1st ant |
922 | */ | 930 | */ |
923 | control->antenna_sel_tx = (*iterator.this_arg) + 1; | 931 | info->antenna_sel_tx = (*iterator.this_arg) + 1; |
924 | break; | 932 | break; |
925 | 933 | ||
926 | #if 0 | 934 | #if 0 |
@@ -944,8 +952,8 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, | |||
944 | skb_trim(skb, skb->len - FCS_LEN); | 952 | skb_trim(skb, skb->len - FCS_LEN); |
945 | } | 953 | } |
946 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP) | 954 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_WEP) |
947 | control->flags &= | 955 | info->flags &= |
948 | ~IEEE80211_TXCTL_DO_NOT_ENCRYPT; | 956 | ~IEEE80211_TX_CTL_DO_NOT_ENCRYPT; |
949 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) | 957 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FRAG) |
950 | tx->flags |= IEEE80211_TX_FRAGMENTED; | 958 | tx->flags |= IEEE80211_TX_FRAGMENTED; |
951 | break; | 959 | break; |
@@ -980,12 +988,12 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, | |||
980 | static ieee80211_tx_result | 988 | static ieee80211_tx_result |
981 | __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | 989 | __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, |
982 | struct sk_buff *skb, | 990 | struct sk_buff *skb, |
983 | struct net_device *dev, | 991 | struct net_device *dev) |
984 | struct ieee80211_tx_control *control) | ||
985 | { | 992 | { |
986 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 993 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
987 | struct ieee80211_hdr *hdr; | 994 | struct ieee80211_hdr *hdr; |
988 | struct ieee80211_sub_if_data *sdata; | 995 | struct ieee80211_sub_if_data *sdata; |
996 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
989 | 997 | ||
990 | int hdrlen; | 998 | int hdrlen; |
991 | 999 | ||
@@ -994,7 +1002,7 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
994 | tx->dev = dev; /* use original interface */ | 1002 | tx->dev = dev; /* use original interface */ |
995 | tx->local = local; | 1003 | tx->local = local; |
996 | tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1004 | tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
997 | tx->control = control; | 1005 | tx->channel = local->hw.conf.channel; |
998 | /* | 1006 | /* |
999 | * Set this flag (used below to indicate "automatic fragmentation"), | 1007 | * Set this flag (used below to indicate "automatic fragmentation"), |
1000 | * it will be cleared/left by radiotap as desired. | 1008 | * it will be cleared/left by radiotap as desired. |
@@ -1021,10 +1029,10 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
1021 | 1029 | ||
1022 | if (is_multicast_ether_addr(hdr->addr1)) { | 1030 | if (is_multicast_ether_addr(hdr->addr1)) { |
1023 | tx->flags &= ~IEEE80211_TX_UNICAST; | 1031 | tx->flags &= ~IEEE80211_TX_UNICAST; |
1024 | control->flags |= IEEE80211_TXCTL_NO_ACK; | 1032 | info->flags |= IEEE80211_TX_CTL_NO_ACK; |
1025 | } else { | 1033 | } else { |
1026 | tx->flags |= IEEE80211_TX_UNICAST; | 1034 | tx->flags |= IEEE80211_TX_UNICAST; |
1027 | control->flags &= ~IEEE80211_TXCTL_NO_ACK; | 1035 | info->flags &= ~IEEE80211_TX_CTL_NO_ACK; |
1028 | } | 1036 | } |
1029 | 1037 | ||
1030 | if (tx->flags & IEEE80211_TX_FRAGMENTED) { | 1038 | if (tx->flags & IEEE80211_TX_FRAGMENTED) { |
@@ -1037,16 +1045,16 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
1037 | } | 1045 | } |
1038 | 1046 | ||
1039 | if (!tx->sta) | 1047 | if (!tx->sta) |
1040 | control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT; | 1048 | info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; |
1041 | else if (test_and_clear_sta_flags(tx->sta, WLAN_STA_CLEAR_PS_FILT)) | 1049 | else if (test_and_clear_sta_flags(tx->sta, WLAN_STA_CLEAR_PS_FILT)) |
1042 | control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT; | 1050 | info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; |
1043 | 1051 | ||
1044 | hdrlen = ieee80211_get_hdrlen(tx->fc); | 1052 | hdrlen = ieee80211_get_hdrlen(tx->fc); |
1045 | if (skb->len > hdrlen + sizeof(rfc1042_header) + 2) { | 1053 | if (skb->len > hdrlen + sizeof(rfc1042_header) + 2) { |
1046 | u8 *pos = &skb->data[hdrlen + sizeof(rfc1042_header)]; | 1054 | u8 *pos = &skb->data[hdrlen + sizeof(rfc1042_header)]; |
1047 | tx->ethertype = (pos[0] << 8) | pos[1]; | 1055 | tx->ethertype = (pos[0] << 8) | pos[1]; |
1048 | } | 1056 | } |
1049 | control->flags |= IEEE80211_TXCTL_FIRST_FRAGMENT; | 1057 | info->flags |= IEEE80211_TX_CTL_FIRST_FRAGMENT; |
1050 | 1058 | ||
1051 | return TX_CONTINUE; | 1059 | return TX_CONTINUE; |
1052 | } | 1060 | } |
@@ -1056,14 +1064,12 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
1056 | */ | 1064 | */ |
1057 | static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | 1065 | static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx, |
1058 | struct sk_buff *skb, | 1066 | struct sk_buff *skb, |
1059 | struct net_device *mdev, | 1067 | struct net_device *mdev) |
1060 | struct ieee80211_tx_control *control) | ||
1061 | { | 1068 | { |
1062 | struct ieee80211_tx_packet_data *pkt_data; | 1069 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1063 | struct net_device *dev; | 1070 | struct net_device *dev; |
1064 | 1071 | ||
1065 | pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; | 1072 | dev = dev_get_by_index(&init_net, info->control.ifindex); |
1066 | dev = dev_get_by_index(&init_net, pkt_data->ifindex); | ||
1067 | if (unlikely(dev && !is_ieee80211_device(dev, mdev))) { | 1073 | if (unlikely(dev && !is_ieee80211_device(dev, mdev))) { |
1068 | dev_put(dev); | 1074 | dev_put(dev); |
1069 | dev = NULL; | 1075 | dev = NULL; |
@@ -1071,7 +1077,7 @@ static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
1071 | if (unlikely(!dev)) | 1077 | if (unlikely(!dev)) |
1072 | return -ENODEV; | 1078 | return -ENODEV; |
1073 | /* initialises tx with control */ | 1079 | /* initialises tx with control */ |
1074 | __ieee80211_tx_prepare(tx, skb, dev, control); | 1080 | __ieee80211_tx_prepare(tx, skb, dev); |
1075 | dev_put(dev); | 1081 | dev_put(dev); |
1076 | return 0; | 1082 | return 0; |
1077 | } | 1083 | } |
@@ -1079,7 +1085,7 @@ static int ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
1079 | static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | 1085 | static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, |
1080 | struct ieee80211_tx_data *tx) | 1086 | struct ieee80211_tx_data *tx) |
1081 | { | 1087 | { |
1082 | struct ieee80211_tx_control *control = tx->control; | 1088 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1083 | int ret, i; | 1089 | int ret, i; |
1084 | 1090 | ||
1085 | if (!ieee80211_qdisc_installed(local->mdev) && | 1091 | if (!ieee80211_qdisc_installed(local->mdev) && |
@@ -1090,39 +1096,39 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | |||
1090 | if (skb) { | 1096 | if (skb) { |
1091 | ieee80211_dump_frame(wiphy_name(local->hw.wiphy), | 1097 | ieee80211_dump_frame(wiphy_name(local->hw.wiphy), |
1092 | "TX to low-level driver", skb); | 1098 | "TX to low-level driver", skb); |
1093 | ret = local->ops->tx(local_to_hw(local), skb, control); | 1099 | ret = local->ops->tx(local_to_hw(local), skb); |
1094 | if (ret) | 1100 | if (ret) |
1095 | return IEEE80211_TX_AGAIN; | 1101 | return IEEE80211_TX_AGAIN; |
1096 | local->mdev->trans_start = jiffies; | 1102 | local->mdev->trans_start = jiffies; |
1097 | ieee80211_led_tx(local, 1); | 1103 | ieee80211_led_tx(local, 1); |
1098 | } | 1104 | } |
1099 | if (tx->extra_frag) { | 1105 | if (tx->extra_frag) { |
1100 | control->flags &= ~(IEEE80211_TXCTL_USE_RTS_CTS | | ||
1101 | IEEE80211_TXCTL_USE_CTS_PROTECT | | ||
1102 | IEEE80211_TXCTL_CLEAR_PS_FILT | | ||
1103 | IEEE80211_TXCTL_FIRST_FRAGMENT); | ||
1104 | for (i = 0; i < tx->num_extra_frag; i++) { | 1106 | for (i = 0; i < tx->num_extra_frag; i++) { |
1105 | if (!tx->extra_frag[i]) | 1107 | if (!tx->extra_frag[i]) |
1106 | continue; | 1108 | continue; |
1107 | if (__ieee80211_queue_stopped(local, control->queue)) | 1109 | info = IEEE80211_SKB_CB(tx->extra_frag[i]); |
1110 | info->flags &= ~(IEEE80211_TX_CTL_USE_RTS_CTS | | ||
1111 | IEEE80211_TX_CTL_USE_CTS_PROTECT | | ||
1112 | IEEE80211_TX_CTL_CLEAR_PS_FILT | | ||
1113 | IEEE80211_TX_CTL_FIRST_FRAGMENT); | ||
1114 | if (__ieee80211_queue_stopped(local, info->queue)) | ||
1108 | return IEEE80211_TX_FRAG_AGAIN; | 1115 | return IEEE80211_TX_FRAG_AGAIN; |
1109 | if (i == tx->num_extra_frag) { | 1116 | if (i == tx->num_extra_frag) { |
1110 | control->tx_rate_idx = tx->last_frag_rate_idx; | 1117 | info->tx_rate_idx = tx->last_frag_rate_idx; |
1111 | 1118 | ||
1112 | if (tx->flags & IEEE80211_TX_PROBE_LAST_FRAG) | 1119 | if (tx->flags & IEEE80211_TX_PROBE_LAST_FRAG) |
1113 | control->flags |= | 1120 | info->flags |= |
1114 | IEEE80211_TXCTL_RATE_CTRL_PROBE; | 1121 | IEEE80211_TX_CTL_RATE_CTRL_PROBE; |
1115 | else | 1122 | else |
1116 | control->flags &= | 1123 | info->flags &= |
1117 | ~IEEE80211_TXCTL_RATE_CTRL_PROBE; | 1124 | ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; |
1118 | } | 1125 | } |
1119 | 1126 | ||
1120 | ieee80211_dump_frame(wiphy_name(local->hw.wiphy), | 1127 | ieee80211_dump_frame(wiphy_name(local->hw.wiphy), |
1121 | "TX to low-level driver", | 1128 | "TX to low-level driver", |
1122 | tx->extra_frag[i]); | 1129 | tx->extra_frag[i]); |
1123 | ret = local->ops->tx(local_to_hw(local), | 1130 | ret = local->ops->tx(local_to_hw(local), |
1124 | tx->extra_frag[i], | 1131 | tx->extra_frag[i]); |
1125 | control); | ||
1126 | if (ret) | 1132 | if (ret) |
1127 | return IEEE80211_TX_FRAG_AGAIN; | 1133 | return IEEE80211_TX_FRAG_AGAIN; |
1128 | local->mdev->trans_start = jiffies; | 1134 | local->mdev->trans_start = jiffies; |
@@ -1135,17 +1141,18 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | |||
1135 | return IEEE80211_TX_OK; | 1141 | return IEEE80211_TX_OK; |
1136 | } | 1142 | } |
1137 | 1143 | ||
1138 | static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, | 1144 | static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb) |
1139 | struct ieee80211_tx_control *control) | ||
1140 | { | 1145 | { |
1141 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1146 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
1142 | struct sta_info *sta; | 1147 | struct sta_info *sta; |
1143 | ieee80211_tx_handler *handler; | 1148 | ieee80211_tx_handler *handler; |
1144 | struct ieee80211_tx_data tx; | 1149 | struct ieee80211_tx_data tx; |
1145 | ieee80211_tx_result res = TX_DROP, res_prepare; | 1150 | ieee80211_tx_result res = TX_DROP, res_prepare; |
1151 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
1146 | int ret, i; | 1152 | int ret, i; |
1153 | int queue = info->queue; | ||
1147 | 1154 | ||
1148 | WARN_ON(__ieee80211_queue_pending(local, control->queue)); | 1155 | WARN_ON(__ieee80211_queue_pending(local, queue)); |
1149 | 1156 | ||
1150 | if (unlikely(skb->len < 10)) { | 1157 | if (unlikely(skb->len < 10)) { |
1151 | dev_kfree_skb(skb); | 1158 | dev_kfree_skb(skb); |
@@ -1155,7 +1162,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, | |||
1155 | rcu_read_lock(); | 1162 | rcu_read_lock(); |
1156 | 1163 | ||
1157 | /* initialises tx */ | 1164 | /* initialises tx */ |
1158 | res_prepare = __ieee80211_tx_prepare(&tx, skb, dev, control); | 1165 | res_prepare = __ieee80211_tx_prepare(&tx, skb, dev); |
1159 | 1166 | ||
1160 | if (res_prepare == TX_DROP) { | 1167 | if (res_prepare == TX_DROP) { |
1161 | dev_kfree_skb(skb); | 1168 | dev_kfree_skb(skb); |
@@ -1165,7 +1172,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, | |||
1165 | 1172 | ||
1166 | sta = tx.sta; | 1173 | sta = tx.sta; |
1167 | tx.channel = local->hw.conf.channel; | 1174 | tx.channel = local->hw.conf.channel; |
1168 | control->band = tx.channel->band; | 1175 | info->band = tx.channel->band; |
1169 | 1176 | ||
1170 | for (handler = ieee80211_tx_handlers; *handler != NULL; | 1177 | for (handler = ieee80211_tx_handlers; *handler != NULL; |
1171 | handler++) { | 1178 | handler++) { |
@@ -1174,7 +1181,8 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb, | |||
1174 | break; | 1181 | break; |
1175 | } | 1182 | } |
1176 | 1183 | ||
1177 | skb = tx.skb; /* handlers are allowed to change skb */ | 1184 | if (WARN_ON(tx.skb != skb)) |
1185 | goto drop; | ||
1178 | 1186 | ||
1179 | if (unlikely(res == TX_DROP)) { | 1187 | if (unlikely(res == TX_DROP)) { |
1180 | I802_DEBUG_INC(local->tx_handlers_drop); | 1188 | I802_DEBUG_INC(local->tx_handlers_drop); |
@@ -1209,12 +1217,12 @@ retry: | |||
1209 | ret = __ieee80211_tx(local, skb, &tx); | 1217 | ret = __ieee80211_tx(local, skb, &tx); |
1210 | if (ret) { | 1218 | if (ret) { |
1211 | struct ieee80211_tx_stored_packet *store = | 1219 | struct ieee80211_tx_stored_packet *store = |
1212 | &local->pending_packet[control->queue]; | 1220 | &local->pending_packet[info->queue]; |
1213 | 1221 | ||
1214 | if (ret == IEEE80211_TX_FRAG_AGAIN) | 1222 | if (ret == IEEE80211_TX_FRAG_AGAIN) |
1215 | skb = NULL; | 1223 | skb = NULL; |
1216 | set_bit(IEEE80211_LINK_STATE_PENDING, | 1224 | set_bit(IEEE80211_LINK_STATE_PENDING, |
1217 | &local->state[control->queue]); | 1225 | &local->state[queue]); |
1218 | smp_mb(); | 1226 | smp_mb(); |
1219 | /* When the driver gets out of buffers during sending of | 1227 | /* When the driver gets out of buffers during sending of |
1220 | * fragments and calls ieee80211_stop_queue, there is | 1228 | * fragments and calls ieee80211_stop_queue, there is |
@@ -1225,13 +1233,11 @@ retry: | |||
1225 | * called with IEEE80211_LINK_STATE_PENDING. Prevent this by | 1233 | * called with IEEE80211_LINK_STATE_PENDING. Prevent this by |
1226 | * continuing transmitting here when that situation is | 1234 | * continuing transmitting here when that situation is |
1227 | * possible to have happened. */ | 1235 | * possible to have happened. */ |
1228 | if (!__ieee80211_queue_stopped(local, control->queue)) { | 1236 | if (!__ieee80211_queue_stopped(local, queue)) { |
1229 | clear_bit(IEEE80211_LINK_STATE_PENDING, | 1237 | clear_bit(IEEE80211_LINK_STATE_PENDING, |
1230 | &local->state[control->queue]); | 1238 | &local->state[queue]); |
1231 | goto retry; | 1239 | goto retry; |
1232 | } | 1240 | } |
1233 | memcpy(&store->control, control, | ||
1234 | sizeof(struct ieee80211_tx_control)); | ||
1235 | store->skb = skb; | 1241 | store->skb = skb; |
1236 | store->extra_frag = tx.extra_frag; | 1242 | store->extra_frag = tx.extra_frag; |
1237 | store->num_extra_frag = tx.num_extra_frag; | 1243 | store->num_extra_frag = tx.num_extra_frag; |
@@ -1258,21 +1264,14 @@ retry: | |||
1258 | int ieee80211_master_start_xmit(struct sk_buff *skb, | 1264 | int ieee80211_master_start_xmit(struct sk_buff *skb, |
1259 | struct net_device *dev) | 1265 | struct net_device *dev) |
1260 | { | 1266 | { |
1261 | struct ieee80211_tx_control control; | 1267 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1262 | struct ieee80211_tx_packet_data *pkt_data; | ||
1263 | struct net_device *odev = NULL; | 1268 | struct net_device *odev = NULL; |
1264 | struct ieee80211_sub_if_data *osdata; | 1269 | struct ieee80211_sub_if_data *osdata; |
1265 | int headroom; | 1270 | int headroom; |
1266 | int ret; | 1271 | int ret; |
1267 | 1272 | ||
1268 | /* | 1273 | if (info->control.ifindex) |
1269 | * copy control out of the skb so other people can use skb->cb | 1274 | odev = dev_get_by_index(&init_net, info->control.ifindex); |
1270 | */ | ||
1271 | pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; | ||
1272 | memset(&control, 0, sizeof(struct ieee80211_tx_control)); | ||
1273 | |||
1274 | if (pkt_data->ifindex) | ||
1275 | odev = dev_get_by_index(&init_net, pkt_data->ifindex); | ||
1276 | if (unlikely(odev && !is_ieee80211_device(odev, dev))) { | 1275 | if (unlikely(odev && !is_ieee80211_device(odev, dev))) { |
1277 | dev_put(odev); | 1276 | dev_put(odev); |
1278 | odev = NULL; | 1277 | odev = NULL; |
@@ -1285,6 +1284,7 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1285 | dev_kfree_skb(skb); | 1284 | dev_kfree_skb(skb); |
1286 | return 0; | 1285 | return 0; |
1287 | } | 1286 | } |
1287 | |||
1288 | osdata = IEEE80211_DEV_TO_SUB_IF(odev); | 1288 | osdata = IEEE80211_DEV_TO_SUB_IF(odev); |
1289 | 1289 | ||
1290 | headroom = osdata->local->tx_headroom + IEEE80211_ENCRYPT_HEADROOM; | 1290 | headroom = osdata->local->tx_headroom + IEEE80211_ENCRYPT_HEADROOM; |
@@ -1296,21 +1296,8 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, | |||
1296 | } | 1296 | } |
1297 | } | 1297 | } |
1298 | 1298 | ||
1299 | control.vif = &osdata->vif; | 1299 | info->control.vif = &osdata->vif; |
1300 | control.type = osdata->vif.type; | 1300 | ret = ieee80211_tx(odev, skb); |
1301 | if (pkt_data->flags & IEEE80211_TXPD_REQ_TX_STATUS) | ||
1302 | control.flags |= IEEE80211_TXCTL_REQ_TX_STATUS; | ||
1303 | if (pkt_data->flags & IEEE80211_TXPD_DO_NOT_ENCRYPT) | ||
1304 | control.flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; | ||
1305 | if (pkt_data->flags & IEEE80211_TXPD_REQUEUE) | ||
1306 | control.flags |= IEEE80211_TXCTL_REQUEUE; | ||
1307 | if (pkt_data->flags & IEEE80211_TXPD_EAPOL_FRAME) | ||
1308 | control.flags |= IEEE80211_TXCTL_EAPOL_FRAME; | ||
1309 | if (pkt_data->flags & IEEE80211_TXPD_AMPDU) | ||
1310 | control.flags |= IEEE80211_TXCTL_AMPDU; | ||
1311 | control.queue = pkt_data->queue; | ||
1312 | |||
1313 | ret = ieee80211_tx(odev, skb, &control); | ||
1314 | dev_put(odev); | 1301 | dev_put(odev); |
1315 | 1302 | ||
1316 | return ret; | 1303 | return ret; |
@@ -1320,7 +1307,7 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb, | |||
1320 | struct net_device *dev) | 1307 | struct net_device *dev) |
1321 | { | 1308 | { |
1322 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1309 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
1323 | struct ieee80211_tx_packet_data *pkt_data; | 1310 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1324 | struct ieee80211_radiotap_header *prthdr = | 1311 | struct ieee80211_radiotap_header *prthdr = |
1325 | (struct ieee80211_radiotap_header *)skb->data; | 1312 | (struct ieee80211_radiotap_header *)skb->data; |
1326 | u16 len_rthdr; | 1313 | u16 len_rthdr; |
@@ -1342,14 +1329,12 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb, | |||
1342 | 1329 | ||
1343 | skb->dev = local->mdev; | 1330 | skb->dev = local->mdev; |
1344 | 1331 | ||
1345 | pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; | ||
1346 | memset(pkt_data, 0, sizeof(*pkt_data)); | ||
1347 | /* needed because we set skb device to master */ | 1332 | /* needed because we set skb device to master */ |
1348 | pkt_data->ifindex = dev->ifindex; | 1333 | info->control.ifindex = dev->ifindex; |
1349 | 1334 | ||
1350 | pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; | 1335 | info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; |
1351 | /* Interfaces should always request a status report */ | 1336 | /* Interfaces should always request a status report */ |
1352 | pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; | 1337 | info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; |
1353 | 1338 | ||
1354 | /* | 1339 | /* |
1355 | * fix up the pointers accounting for the radiotap | 1340 | * fix up the pointers accounting for the radiotap |
@@ -1393,7 +1378,7 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1393 | struct net_device *dev) | 1378 | struct net_device *dev) |
1394 | { | 1379 | { |
1395 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1380 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
1396 | struct ieee80211_tx_packet_data *pkt_data; | 1381 | struct ieee80211_tx_info *info; |
1397 | struct ieee80211_sub_if_data *sdata; | 1382 | struct ieee80211_sub_if_data *sdata; |
1398 | int ret = 1, head_need; | 1383 | int ret = 1, head_need; |
1399 | u16 ethertype, hdrlen, meshhdrlen = 0, fc; | 1384 | u16 ethertype, hdrlen, meshhdrlen = 0, fc; |
@@ -1625,14 +1610,14 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1625 | nh_pos += hdrlen; | 1610 | nh_pos += hdrlen; |
1626 | h_pos += hdrlen; | 1611 | h_pos += hdrlen; |
1627 | 1612 | ||
1628 | pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; | 1613 | info = IEEE80211_SKB_CB(skb); |
1629 | memset(pkt_data, 0, sizeof(struct ieee80211_tx_packet_data)); | 1614 | memset(info, 0, sizeof(*info)); |
1630 | pkt_data->ifindex = dev->ifindex; | 1615 | info->control.ifindex = dev->ifindex; |
1631 | if (ethertype == ETH_P_PAE) | 1616 | if (ethertype == ETH_P_PAE) |
1632 | pkt_data->flags |= IEEE80211_TXPD_EAPOL_FRAME; | 1617 | info->flags |= IEEE80211_TX_CTL_EAPOL_FRAME; |
1633 | 1618 | ||
1634 | /* Interfaces should always request a status report */ | 1619 | /* Interfaces should always request a status report */ |
1635 | pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; | 1620 | info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; |
1636 | 1621 | ||
1637 | skb->dev = local->mdev; | 1622 | skb->dev = local->mdev; |
1638 | dev->stats.tx_packets++; | 1623 | dev->stats.tx_packets++; |
@@ -1693,7 +1678,6 @@ void ieee80211_tx_pending(unsigned long data) | |||
1693 | continue; | 1678 | continue; |
1694 | } | 1679 | } |
1695 | store = &local->pending_packet[i]; | 1680 | store = &local->pending_packet[i]; |
1696 | tx.control = &store->control; | ||
1697 | tx.extra_frag = store->extra_frag; | 1681 | tx.extra_frag = store->extra_frag; |
1698 | tx.num_extra_frag = store->num_extra_frag; | 1682 | tx.num_extra_frag = store->num_extra_frag; |
1699 | tx.last_frag_rate_idx = store->last_frag_rate_idx; | 1683 | tx.last_frag_rate_idx = store->last_frag_rate_idx; |
@@ -1786,11 +1770,11 @@ static void ieee80211_beacon_add_tim(struct ieee80211_local *local, | |||
1786 | } | 1770 | } |
1787 | 1771 | ||
1788 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | 1772 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, |
1789 | struct ieee80211_vif *vif, | 1773 | struct ieee80211_vif *vif) |
1790 | struct ieee80211_tx_control *control) | ||
1791 | { | 1774 | { |
1792 | struct ieee80211_local *local = hw_to_local(hw); | 1775 | struct ieee80211_local *local = hw_to_local(hw); |
1793 | struct sk_buff *skb; | 1776 | struct sk_buff *skb; |
1777 | struct ieee80211_tx_info *info; | ||
1794 | struct net_device *bdev; | 1778 | struct net_device *bdev; |
1795 | struct ieee80211_sub_if_data *sdata = NULL; | 1779 | struct ieee80211_sub_if_data *sdata = NULL; |
1796 | struct ieee80211_if_ap *ap = NULL; | 1780 | struct ieee80211_if_ap *ap = NULL; |
@@ -1896,31 +1880,32 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1896 | goto out; | 1880 | goto out; |
1897 | } | 1881 | } |
1898 | 1882 | ||
1899 | if (control) { | 1883 | info = IEEE80211_SKB_CB(skb); |
1900 | control->band = band; | 1884 | |
1901 | rate_control_get_rate(local->mdev, sband, skb, &rsel); | 1885 | info->band = band; |
1902 | if (unlikely(rsel.rate_idx < 0)) { | 1886 | rate_control_get_rate(local->mdev, sband, skb, &rsel); |
1903 | if (net_ratelimit()) { | ||
1904 | printk(KERN_DEBUG "%s: ieee80211_beacon_get: " | ||
1905 | "no rate found\n", | ||
1906 | wiphy_name(local->hw.wiphy)); | ||
1907 | } | ||
1908 | dev_kfree_skb(skb); | ||
1909 | skb = NULL; | ||
1910 | goto out; | ||
1911 | } | ||
1912 | 1887 | ||
1913 | control->vif = vif; | 1888 | if (unlikely(rsel.rate_idx < 0)) { |
1914 | control->tx_rate_idx = rsel.rate_idx; | 1889 | if (net_ratelimit()) { |
1915 | if (sdata->bss_conf.use_short_preamble && | 1890 | printk(KERN_DEBUG "%s: ieee80211_beacon_get: " |
1916 | sband->bitrates[rsel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) | 1891 | "no rate found\n", |
1917 | control->flags |= IEEE80211_TXCTL_SHORT_PREAMBLE; | 1892 | wiphy_name(local->hw.wiphy)); |
1918 | control->antenna_sel_tx = local->hw.conf.antenna_sel_tx; | 1893 | } |
1919 | control->flags |= IEEE80211_TXCTL_NO_ACK; | 1894 | dev_kfree_skb(skb); |
1920 | control->flags |= IEEE80211_TXCTL_DO_NOT_ENCRYPT; | 1895 | skb = NULL; |
1921 | control->retry_limit = 1; | 1896 | goto out; |
1922 | control->flags |= IEEE80211_TXCTL_CLEAR_PS_FILT; | ||
1923 | } | 1897 | } |
1898 | |||
1899 | info->control.vif = vif; | ||
1900 | info->tx_rate_idx = rsel.rate_idx; | ||
1901 | if (sdata->bss_conf.use_short_preamble && | ||
1902 | sband->bitrates[rsel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) | ||
1903 | info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE; | ||
1904 | info->antenna_sel_tx = local->hw.conf.antenna_sel_tx; | ||
1905 | info->flags |= IEEE80211_TX_CTL_NO_ACK; | ||
1906 | info->flags |= IEEE80211_TX_CTL_DO_NOT_ENCRYPT; | ||
1907 | info->control.retry_limit = 1; | ||
1908 | info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; | ||
1924 | (*num_beacons)++; | 1909 | (*num_beacons)++; |
1925 | out: | 1910 | out: |
1926 | rcu_read_unlock(); | 1911 | rcu_read_unlock(); |
@@ -1930,7 +1915,7 @@ EXPORT_SYMBOL(ieee80211_beacon_get); | |||
1930 | 1915 | ||
1931 | void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 1916 | void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1932 | const void *frame, size_t frame_len, | 1917 | const void *frame, size_t frame_len, |
1933 | const struct ieee80211_tx_control *frame_txctl, | 1918 | const struct ieee80211_tx_info *frame_txctl, |
1934 | struct ieee80211_rts *rts) | 1919 | struct ieee80211_rts *rts) |
1935 | { | 1920 | { |
1936 | const struct ieee80211_hdr *hdr = frame; | 1921 | const struct ieee80211_hdr *hdr = frame; |
@@ -1947,7 +1932,7 @@ EXPORT_SYMBOL(ieee80211_rts_get); | |||
1947 | 1932 | ||
1948 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 1933 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1949 | const void *frame, size_t frame_len, | 1934 | const void *frame, size_t frame_len, |
1950 | const struct ieee80211_tx_control *frame_txctl, | 1935 | const struct ieee80211_tx_info *frame_txctl, |
1951 | struct ieee80211_cts *cts) | 1936 | struct ieee80211_cts *cts) |
1952 | { | 1937 | { |
1953 | const struct ieee80211_hdr *hdr = frame; | 1938 | const struct ieee80211_hdr *hdr = frame; |
@@ -1963,8 +1948,7 @@ EXPORT_SYMBOL(ieee80211_ctstoself_get); | |||
1963 | 1948 | ||
1964 | struct sk_buff * | 1949 | struct sk_buff * |
1965 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | 1950 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, |
1966 | struct ieee80211_vif *vif, | 1951 | struct ieee80211_vif *vif) |
1967 | struct ieee80211_tx_control *control) | ||
1968 | { | 1952 | { |
1969 | struct ieee80211_local *local = hw_to_local(hw); | 1953 | struct ieee80211_local *local = hw_to_local(hw); |
1970 | struct sk_buff *skb; | 1954 | struct sk_buff *skb; |
@@ -1976,6 +1960,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
1976 | struct ieee80211_sub_if_data *sdata; | 1960 | struct ieee80211_sub_if_data *sdata; |
1977 | struct ieee80211_if_ap *bss = NULL; | 1961 | struct ieee80211_if_ap *bss = NULL; |
1978 | struct beacon_data *beacon; | 1962 | struct beacon_data *beacon; |
1963 | struct ieee80211_tx_info *info; | ||
1979 | 1964 | ||
1980 | sdata = vif_to_sdata(vif); | 1965 | sdata = vif_to_sdata(vif); |
1981 | bdev = sdata->dev; | 1966 | bdev = sdata->dev; |
@@ -1995,7 +1980,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
1995 | 1980 | ||
1996 | if (bss->dtim_count != 0) | 1981 | if (bss->dtim_count != 0) |
1997 | return NULL; /* send buffered bc/mc only after DTIM beacon */ | 1982 | return NULL; /* send buffered bc/mc only after DTIM beacon */ |
1998 | memset(control, 0, sizeof(*control)); | 1983 | |
1999 | while (1) { | 1984 | while (1) { |
2000 | skb = skb_dequeue(&bss->ps_bc_buf); | 1985 | skb = skb_dequeue(&bss->ps_bc_buf); |
2001 | if (!skb) | 1986 | if (!skb) |
@@ -2012,21 +1997,26 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
2012 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); | 1997 | cpu_to_le16(IEEE80211_FCTL_MOREDATA); |
2013 | } | 1998 | } |
2014 | 1999 | ||
2015 | if (!ieee80211_tx_prepare(&tx, skb, local->mdev, control)) | 2000 | if (!ieee80211_tx_prepare(&tx, skb, local->mdev)) |
2016 | break; | 2001 | break; |
2017 | dev_kfree_skb_any(skb); | 2002 | dev_kfree_skb_any(skb); |
2018 | } | 2003 | } |
2004 | |||
2005 | info = IEEE80211_SKB_CB(skb); | ||
2006 | |||
2019 | sta = tx.sta; | 2007 | sta = tx.sta; |
2020 | tx.flags |= IEEE80211_TX_PS_BUFFERED; | 2008 | tx.flags |= IEEE80211_TX_PS_BUFFERED; |
2021 | tx.channel = local->hw.conf.channel; | 2009 | tx.channel = local->hw.conf.channel; |
2022 | control->band = tx.channel->band; | 2010 | info->band = tx.channel->band; |
2023 | 2011 | ||
2024 | for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) { | 2012 | for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) { |
2025 | res = (*handler)(&tx); | 2013 | res = (*handler)(&tx); |
2026 | if (res == TX_DROP || res == TX_QUEUED) | 2014 | if (res == TX_DROP || res == TX_QUEUED) |
2027 | break; | 2015 | break; |
2028 | } | 2016 | } |
2029 | skb = tx.skb; /* handlers are allowed to change skb */ | 2017 | |
2018 | if (WARN_ON(tx.skb != skb)) | ||
2019 | return NULL; | ||
2030 | 2020 | ||
2031 | if (res == TX_DROP) { | 2021 | if (res == TX_DROP) { |
2032 | I802_DEBUG_INC(local->tx_handlers_drop); | 2022 | I802_DEBUG_INC(local->tx_handlers_drop); |