diff options
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r-- | net/mac80211/tx.c | 462 |
1 files changed, 231 insertions, 231 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 1460537faf33..a4af3a124cce 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -46,13 +46,20 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
46 | struct ieee80211_local *local = tx->local; | 46 | struct ieee80211_local *local = tx->local; |
47 | struct ieee80211_supported_band *sband; | 47 | struct ieee80211_supported_band *sband; |
48 | struct ieee80211_hdr *hdr; | 48 | struct ieee80211_hdr *hdr; |
49 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
50 | |||
51 | /* assume HW handles this */ | ||
52 | if (info->control.rates[0].flags & IEEE80211_TX_RC_MCS) | ||
53 | return 0; | ||
54 | |||
55 | /* uh huh? */ | ||
56 | if (WARN_ON_ONCE(info->control.rates[0].idx < 0)) | ||
57 | return 0; | ||
49 | 58 | ||
50 | sband = local->hw.wiphy->bands[tx->channel->band]; | 59 | sband = local->hw.wiphy->bands[tx->channel->band]; |
51 | txrate = &sband->bitrates[tx->rate_idx]; | 60 | txrate = &sband->bitrates[info->control.rates[0].idx]; |
52 | 61 | ||
53 | erp = 0; | 62 | erp = txrate->flags & IEEE80211_RATE_ERP_G; |
54 | if (tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) | ||
55 | erp = txrate->flags & IEEE80211_RATE_ERP_G; | ||
56 | 63 | ||
57 | /* | 64 | /* |
58 | * data and mgmt (except PS Poll): | 65 | * data and mgmt (except PS Poll): |
@@ -116,7 +123,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
116 | if (r->bitrate > txrate->bitrate) | 123 | if (r->bitrate > txrate->bitrate) |
117 | break; | 124 | break; |
118 | 125 | ||
119 | if (tx->sdata->bss_conf.basic_rates & BIT(i)) | 126 | if (tx->sdata->vif.bss_conf.basic_rates & BIT(i)) |
120 | rate = r->bitrate; | 127 | rate = r->bitrate; |
121 | 128 | ||
122 | switch (sband->band) { | 129 | switch (sband->band) { |
@@ -150,7 +157,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
150 | * to closest integer */ | 157 | * to closest integer */ |
151 | 158 | ||
152 | dur = ieee80211_frame_duration(local, 10, rate, erp, | 159 | dur = ieee80211_frame_duration(local, 10, rate, erp, |
153 | tx->sdata->bss_conf.use_short_preamble); | 160 | tx->sdata->vif.bss_conf.use_short_preamble); |
154 | 161 | ||
155 | if (next_frag_len) { | 162 | if (next_frag_len) { |
156 | /* Frame is fragmented: duration increases with time needed to | 163 | /* Frame is fragmented: duration increases with time needed to |
@@ -159,7 +166,7 @@ static __le16 ieee80211_duration(struct ieee80211_tx_data *tx, int group_addr, | |||
159 | /* next fragment */ | 166 | /* next fragment */ |
160 | dur += ieee80211_frame_duration(local, next_frag_len, | 167 | dur += ieee80211_frame_duration(local, next_frag_len, |
161 | txrate->bitrate, erp, | 168 | txrate->bitrate, erp, |
162 | tx->sdata->bss_conf.use_short_preamble); | 169 | tx->sdata->vif.bss_conf.use_short_preamble); |
163 | } | 170 | } |
164 | 171 | ||
165 | return cpu_to_le16(dur); | 172 | return cpu_to_le16(dur); |
@@ -201,10 +208,9 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
201 | tx->sdata->vif.type != NL80211_IFTYPE_ADHOC && | 208 | tx->sdata->vif.type != NL80211_IFTYPE_ADHOC && |
202 | ieee80211_is_data(hdr->frame_control))) { | 209 | ieee80211_is_data(hdr->frame_control))) { |
203 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 210 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
204 | DECLARE_MAC_BUF(mac); | ||
205 | printk(KERN_DEBUG "%s: dropped data frame to not " | 211 | printk(KERN_DEBUG "%s: dropped data frame to not " |
206 | "associated station %s\n", | 212 | "associated station %pM\n", |
207 | tx->dev->name, print_mac(mac, hdr->addr1)); | 213 | tx->dev->name, hdr->addr1); |
208 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 214 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
209 | I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); | 215 | I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); |
210 | return TX_DROP; | 216 | return TX_DROP; |
@@ -331,7 +337,6 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
331 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | 337 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
332 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; | 338 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; |
333 | u32 staflags; | 339 | u32 staflags; |
334 | DECLARE_MAC_BUF(mac); | ||
335 | 340 | ||
336 | if (unlikely(!sta || ieee80211_is_probe_resp(hdr->frame_control))) | 341 | if (unlikely(!sta || ieee80211_is_probe_resp(hdr->frame_control))) |
337 | return TX_CONTINUE; | 342 | return TX_CONTINUE; |
@@ -341,9 +346,9 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
341 | if (unlikely((staflags & WLAN_STA_PS) && | 346 | if (unlikely((staflags & WLAN_STA_PS) && |
342 | !(staflags & WLAN_STA_PSPOLL))) { | 347 | !(staflags & WLAN_STA_PSPOLL))) { |
343 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 348 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
344 | printk(KERN_DEBUG "STA %s aid %d: PS buffer (entries " | 349 | printk(KERN_DEBUG "STA %pM aid %d: PS buffer (entries " |
345 | "before %d)\n", | 350 | "before %d)\n", |
346 | print_mac(mac, sta->sta.addr), sta->sta.aid, | 351 | sta->sta.addr, sta->sta.aid, |
347 | skb_queue_len(&sta->ps_tx_buf)); | 352 | skb_queue_len(&sta->ps_tx_buf)); |
348 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 353 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
349 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) | 354 | if (tx->local->total_ps_buffered >= TOTAL_MAX_TX_BUFFER) |
@@ -352,9 +357,9 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
352 | struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf); | 357 | struct sk_buff *old = skb_dequeue(&sta->ps_tx_buf); |
353 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 358 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
354 | if (net_ratelimit()) { | 359 | if (net_ratelimit()) { |
355 | printk(KERN_DEBUG "%s: STA %s TX " | 360 | printk(KERN_DEBUG "%s: STA %pM TX " |
356 | "buffer full - dropping oldest frame\n", | 361 | "buffer full - dropping oldest frame\n", |
357 | tx->dev->name, print_mac(mac, sta->sta.addr)); | 362 | tx->dev->name, sta->sta.addr); |
358 | } | 363 | } |
359 | #endif | 364 | #endif |
360 | dev_kfree_skb(old); | 365 | dev_kfree_skb(old); |
@@ -371,9 +376,9 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
371 | } | 376 | } |
372 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 377 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
373 | else if (unlikely(test_sta_flags(sta, WLAN_STA_PS))) { | 378 | else if (unlikely(test_sta_flags(sta, WLAN_STA_PS))) { |
374 | printk(KERN_DEBUG "%s: STA %s in PS mode, but pspoll " | 379 | printk(KERN_DEBUG "%s: STA %pM in PS mode, but pspoll " |
375 | "set -> send frame\n", tx->dev->name, | 380 | "set -> send frame\n", tx->dev->name, |
376 | print_mac(mac, sta->sta.addr)); | 381 | sta->sta.addr); |
377 | } | 382 | } |
378 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 383 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
379 | clear_sta_flags(sta, WLAN_STA_PSPOLL); | 384 | clear_sta_flags(sta, WLAN_STA_PSPOLL); |
@@ -439,140 +444,154 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | |||
439 | static ieee80211_tx_result debug_noinline | 444 | static ieee80211_tx_result debug_noinline |
440 | ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | 445 | ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) |
441 | { | 446 | { |
442 | struct rate_selection rsel; | ||
443 | struct ieee80211_supported_band *sband; | ||
444 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | 447 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); |
448 | struct ieee80211_hdr *hdr = (void *)tx->skb->data; | ||
449 | struct ieee80211_supported_band *sband; | ||
450 | struct ieee80211_rate *rate; | ||
451 | int i, len; | ||
452 | bool inval = false, rts = false, short_preamble = false; | ||
453 | struct ieee80211_tx_rate_control txrc; | ||
445 | 454 | ||
446 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 455 | memset(&txrc, 0, sizeof(txrc)); |
447 | 456 | ||
448 | if (likely(tx->rate_idx < 0)) { | 457 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
449 | rate_control_get_rate(tx->sdata, sband, tx->sta, | ||
450 | tx->skb, &rsel); | ||
451 | if (tx->sta) | ||
452 | tx->sta->last_txrate_idx = rsel.rate_idx; | ||
453 | tx->rate_idx = rsel.rate_idx; | ||
454 | if (unlikely(rsel.probe_idx >= 0)) { | ||
455 | info->flags |= IEEE80211_TX_CTL_RATE_CTRL_PROBE; | ||
456 | tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; | ||
457 | info->control.retries[0].rate_idx = tx->rate_idx; | ||
458 | info->control.retries[0].limit = tx->local->hw.max_altrate_tries; | ||
459 | tx->rate_idx = rsel.probe_idx; | ||
460 | } else if (info->control.retries[0].limit == 0) | ||
461 | info->control.retries[0].rate_idx = -1; | ||
462 | |||
463 | if (unlikely(tx->rate_idx < 0)) | ||
464 | return TX_DROP; | ||
465 | } else | ||
466 | info->control.retries[0].rate_idx = -1; | ||
467 | 458 | ||
468 | if (tx->sdata->bss_conf.use_cts_prot && | 459 | len = min_t(int, tx->skb->len + FCS_LEN, |
469 | (tx->flags & IEEE80211_TX_FRAGMENTED) && (rsel.nonerp_idx >= 0)) { | 460 | tx->local->fragmentation_threshold); |
470 | tx->last_frag_rate_idx = tx->rate_idx; | 461 | |
471 | if (rsel.probe_idx >= 0) | 462 | /* set up the tx rate control struct we give the RC algo */ |
472 | tx->flags &= ~IEEE80211_TX_PROBE_LAST_FRAG; | 463 | txrc.hw = local_to_hw(tx->local); |
473 | else | 464 | txrc.sband = sband; |
474 | tx->flags |= IEEE80211_TX_PROBE_LAST_FRAG; | 465 | txrc.bss_conf = &tx->sdata->vif.bss_conf; |
475 | tx->rate_idx = rsel.nonerp_idx; | 466 | txrc.skb = tx->skb; |
476 | info->tx_rate_idx = rsel.nonerp_idx; | 467 | txrc.reported_rate.idx = -1; |
477 | info->flags &= ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; | 468 | txrc.max_rate_idx = tx->sdata->max_ratectrl_rateidx; |
478 | } else { | 469 | |
479 | tx->last_frag_rate_idx = tx->rate_idx; | 470 | /* set up RTS protection if desired */ |
480 | info->tx_rate_idx = tx->rate_idx; | 471 | if (tx->local->rts_threshold < IEEE80211_MAX_RTS_THRESHOLD && |
472 | len > tx->local->rts_threshold) { | ||
473 | txrc.rts = rts = true; | ||
481 | } | 474 | } |
482 | info->tx_rate_idx = tx->rate_idx; | ||
483 | 475 | ||
484 | return TX_CONTINUE; | 476 | /* |
485 | } | 477 | * Use short preamble if the BSS can handle it, but not for |
478 | * management frames unless we know the receiver can handle | ||
479 | * that -- the management frame might be to a station that | ||
480 | * just wants a probe response. | ||
481 | */ | ||
482 | if (tx->sdata->vif.bss_conf.use_short_preamble && | ||
483 | (ieee80211_is_data(hdr->frame_control) || | ||
484 | (tx->sta && test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE)))) | ||
485 | txrc.short_preamble = short_preamble = true; | ||
486 | 486 | ||
487 | static ieee80211_tx_result debug_noinline | ||
488 | ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | ||
489 | { | ||
490 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; | ||
491 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
492 | struct ieee80211_supported_band *sband; | ||
493 | 487 | ||
494 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 488 | rate_control_get_rate(tx->sdata, tx->sta, &txrc); |
489 | |||
490 | if (unlikely(info->control.rates[0].idx < 0)) | ||
491 | return TX_DROP; | ||
492 | |||
493 | if (txrc.reported_rate.idx < 0) | ||
494 | txrc.reported_rate = info->control.rates[0]; | ||
495 | 495 | ||
496 | if (tx->sta) | 496 | if (tx->sta) |
497 | info->control.sta = &tx->sta->sta; | 497 | tx->sta->last_tx_rate = txrc.reported_rate; |
498 | 498 | ||
499 | if (!info->control.retry_limit) { | 499 | if (unlikely(!info->control.rates[0].count)) |
500 | if (!is_multicast_ether_addr(hdr->addr1)) { | 500 | info->control.rates[0].count = 1; |
501 | int len = min_t(int, tx->skb->len + FCS_LEN, | ||
502 | tx->local->fragmentation_threshold); | ||
503 | if (len > tx->local->rts_threshold | ||
504 | && tx->local->rts_threshold < | ||
505 | IEEE80211_MAX_RTS_THRESHOLD) { | ||
506 | info->flags |= IEEE80211_TX_CTL_USE_RTS_CTS; | ||
507 | info->flags |= | ||
508 | IEEE80211_TX_CTL_LONG_RETRY_LIMIT; | ||
509 | info->control.retry_limit = | ||
510 | tx->local->long_retry_limit; | ||
511 | } else { | ||
512 | info->control.retry_limit = | ||
513 | tx->local->short_retry_limit; | ||
514 | } | ||
515 | } else { | ||
516 | info->control.retry_limit = 1; | ||
517 | } | ||
518 | } | ||
519 | 501 | ||
520 | if (tx->flags & IEEE80211_TX_FRAGMENTED) { | 502 | if (is_multicast_ether_addr(hdr->addr1)) { |
521 | /* Do not use multiple retry rates when sending fragmented | 503 | /* |
522 | * frames. | 504 | * XXX: verify the rate is in the basic rateset |
523 | * TODO: The last fragment could still use multiple retry | 505 | */ |
524 | * rates. */ | 506 | return TX_CONTINUE; |
525 | info->control.retries[0].rate_idx = -1; | ||
526 | } | 507 | } |
527 | 508 | ||
528 | /* Use CTS protection for unicast frames sent using extended rates if | 509 | /* |
529 | * there are associated non-ERP stations and RTS/CTS is not configured | 510 | * set up the RTS/CTS rate as the fastest basic rate |
530 | * for the frame. */ | 511 | * that is not faster than the data rate |
531 | if ((tx->sdata->flags & IEEE80211_SDATA_OPERATING_GMODE) && | 512 | * |
532 | (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_ERP_G) && | 513 | * XXX: Should this check all retry rates? |
533 | (tx->flags & IEEE80211_TX_UNICAST) && | 514 | */ |
534 | tx->sdata->bss_conf.use_cts_prot && | 515 | if (!(info->control.rates[0].flags & IEEE80211_TX_RC_MCS)) { |
535 | !(info->flags & IEEE80211_TX_CTL_USE_RTS_CTS)) | 516 | s8 baserate = 0; |
536 | info->flags |= IEEE80211_TX_CTL_USE_CTS_PROTECT; | 517 | |
537 | 518 | rate = &sband->bitrates[info->control.rates[0].idx]; | |
538 | /* Transmit data frames using short preambles if the driver supports | 519 | |
539 | * short preambles at the selected rate and short preambles are | 520 | for (i = 0; i < sband->n_bitrates; i++) { |
540 | * available on the network at the current point in time. */ | 521 | /* must be a basic rate */ |
541 | if (ieee80211_is_data(hdr->frame_control) && | 522 | if (!(tx->sdata->vif.bss_conf.basic_rates & BIT(i))) |
542 | (sband->bitrates[tx->rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) && | 523 | continue; |
543 | tx->sdata->bss_conf.use_short_preamble && | 524 | /* must not be faster than the data rate */ |
544 | (!tx->sta || test_sta_flags(tx->sta, WLAN_STA_SHORT_PREAMBLE))) { | 525 | if (sband->bitrates[i].bitrate > rate->bitrate) |
545 | info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE; | 526 | continue; |
527 | /* maximum */ | ||
528 | if (sband->bitrates[baserate].bitrate < | ||
529 | sband->bitrates[i].bitrate) | ||
530 | baserate = i; | ||
531 | } | ||
532 | |||
533 | info->control.rts_cts_rate_idx = baserate; | ||
546 | } | 534 | } |
547 | 535 | ||
548 | if ((info->flags & IEEE80211_TX_CTL_USE_RTS_CTS) || | 536 | for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { |
549 | (info->flags & IEEE80211_TX_CTL_USE_CTS_PROTECT)) { | 537 | /* |
550 | struct ieee80211_rate *rate; | 538 | * make sure there's no valid rate following |
551 | s8 baserate = -1; | 539 | * an invalid one, just in case drivers don't |
552 | int idx; | 540 | * take the API seriously to stop at -1. |
541 | */ | ||
542 | if (inval) { | ||
543 | info->control.rates[i].idx = -1; | ||
544 | continue; | ||
545 | } | ||
546 | if (info->control.rates[i].idx < 0) { | ||
547 | inval = true; | ||
548 | continue; | ||
549 | } | ||
553 | 550 | ||
554 | /* Do not use multiple retry rates when using RTS/CTS */ | 551 | /* |
555 | info->control.retries[0].rate_idx = -1; | 552 | * For now assume MCS is already set up correctly, this |
553 | * needs to be fixed. | ||
554 | */ | ||
555 | if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS) { | ||
556 | WARN_ON(info->control.rates[i].idx > 76); | ||
557 | continue; | ||
558 | } | ||
556 | 559 | ||
557 | /* Use min(data rate, max base rate) as CTS/RTS rate */ | 560 | /* set up RTS protection if desired */ |
558 | rate = &sband->bitrates[tx->rate_idx]; | 561 | if (rts) |
562 | info->control.rates[i].flags |= | ||
563 | IEEE80211_TX_RC_USE_RTS_CTS; | ||
559 | 564 | ||
560 | for (idx = 0; idx < sband->n_bitrates; idx++) { | 565 | /* RC is busted */ |
561 | if (sband->bitrates[idx].bitrate > rate->bitrate) | 566 | if (WARN_ON_ONCE(info->control.rates[i].idx >= |
562 | continue; | 567 | sband->n_bitrates)) { |
563 | if (tx->sdata->bss_conf.basic_rates & BIT(idx) && | 568 | info->control.rates[i].idx = -1; |
564 | (baserate < 0 || | 569 | continue; |
565 | (sband->bitrates[baserate].bitrate | ||
566 | < sband->bitrates[idx].bitrate))) | ||
567 | baserate = idx; | ||
568 | } | 570 | } |
569 | 571 | ||
570 | if (baserate >= 0) | 572 | rate = &sband->bitrates[info->control.rates[i].idx]; |
571 | info->control.rts_cts_rate_idx = baserate; | 573 | |
572 | else | 574 | /* set up short preamble */ |
573 | info->control.rts_cts_rate_idx = 0; | 575 | if (short_preamble && |
576 | rate->flags & IEEE80211_RATE_SHORT_PREAMBLE) | ||
577 | info->control.rates[i].flags |= | ||
578 | IEEE80211_TX_RC_USE_SHORT_PREAMBLE; | ||
579 | |||
580 | /* set up G protection */ | ||
581 | if (!rts && tx->sdata->vif.bss_conf.use_cts_prot && | ||
582 | rate->flags & IEEE80211_RATE_ERP_G) | ||
583 | info->control.rates[i].flags |= | ||
584 | IEEE80211_TX_RC_USE_CTS_PROTECT; | ||
574 | } | 585 | } |
575 | 586 | ||
587 | return TX_CONTINUE; | ||
588 | } | ||
589 | |||
590 | static ieee80211_tx_result debug_noinline | ||
591 | ieee80211_tx_h_misc(struct ieee80211_tx_data *tx) | ||
592 | { | ||
593 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
594 | |||
576 | if (tx->sta) | 595 | if (tx->sta) |
577 | info->control.sta = &tx->sta->sta; | 596 | info->control.sta = &tx->sta->sta; |
578 | 597 | ||
@@ -602,8 +621,18 @@ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) | |||
602 | if (ieee80211_hdrlen(hdr->frame_control) < 24) | 621 | if (ieee80211_hdrlen(hdr->frame_control) < 24) |
603 | return TX_CONTINUE; | 622 | return TX_CONTINUE; |
604 | 623 | ||
624 | /* | ||
625 | * Anything but QoS data that has a sequence number field | ||
626 | * (is long enough) gets a sequence number from the global | ||
627 | * counter. | ||
628 | */ | ||
605 | if (!ieee80211_is_data_qos(hdr->frame_control)) { | 629 | if (!ieee80211_is_data_qos(hdr->frame_control)) { |
630 | /* driver should assign sequence number */ | ||
606 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; | 631 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; |
632 | /* for pure STA mode without beacons, we can do it */ | ||
633 | hdr->seq_ctrl = cpu_to_le16(tx->sdata->sequence_number); | ||
634 | tx->sdata->sequence_number += 0x10; | ||
635 | tx->sdata->sequence_number &= IEEE80211_SCTL_SEQ; | ||
607 | return TX_CONTINUE; | 636 | return TX_CONTINUE; |
608 | } | 637 | } |
609 | 638 | ||
@@ -632,6 +661,7 @@ ieee80211_tx_h_sequence(struct ieee80211_tx_data *tx) | |||
632 | static ieee80211_tx_result debug_noinline | 661 | static ieee80211_tx_result debug_noinline |
633 | ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) | 662 | ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) |
634 | { | 663 | { |
664 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); | ||
635 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; | 665 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb->data; |
636 | size_t hdrlen, per_fragm, num_fragm, payload_len, left; | 666 | size_t hdrlen, per_fragm, num_fragm, payload_len, left; |
637 | struct sk_buff **frags, *first, *frag; | 667 | struct sk_buff **frags, *first, *frag; |
@@ -648,9 +678,7 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) | |||
648 | * This scenario is handled in __ieee80211_tx_prepare but extra | 678 | * This scenario is handled in __ieee80211_tx_prepare but extra |
649 | * caution taken here as fragmented ampdu may cause Tx stop. | 679 | * caution taken here as fragmented ampdu may cause Tx stop. |
650 | */ | 680 | */ |
651 | if (WARN_ON(tx->flags & IEEE80211_TX_CTL_AMPDU || | 681 | if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) |
652 | skb_get_queue_mapping(tx->skb) >= | ||
653 | ieee80211_num_regular_queues(&tx->local->hw))) | ||
654 | return TX_DROP; | 682 | return TX_DROP; |
655 | 683 | ||
656 | first = tx->skb; | 684 | first = tx->skb; |
@@ -684,20 +712,45 @@ ieee80211_tx_h_fragment(struct ieee80211_tx_data *tx) | |||
684 | IEEE80211_ENCRYPT_TAILROOM); | 712 | IEEE80211_ENCRYPT_TAILROOM); |
685 | if (!frag) | 713 | if (!frag) |
686 | goto fail; | 714 | goto fail; |
715 | |||
687 | /* Make sure that all fragments use the same priority so | 716 | /* Make sure that all fragments use the same priority so |
688 | * that they end up using the same TX queue */ | 717 | * that they end up using the same TX queue */ |
689 | frag->priority = first->priority; | 718 | frag->priority = first->priority; |
719 | |||
690 | skb_reserve(frag, tx->local->tx_headroom + | 720 | skb_reserve(frag, tx->local->tx_headroom + |
691 | IEEE80211_ENCRYPT_HEADROOM); | 721 | IEEE80211_ENCRYPT_HEADROOM); |
722 | |||
723 | /* copy TX information */ | ||
724 | info = IEEE80211_SKB_CB(frag); | ||
725 | memcpy(info, first->cb, sizeof(frag->cb)); | ||
726 | |||
727 | /* copy/fill in 802.11 header */ | ||
692 | fhdr = (struct ieee80211_hdr *) skb_put(frag, hdrlen); | 728 | fhdr = (struct ieee80211_hdr *) skb_put(frag, hdrlen); |
693 | memcpy(fhdr, first->data, hdrlen); | 729 | memcpy(fhdr, first->data, hdrlen); |
694 | if (i == num_fragm - 2) | ||
695 | fhdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREFRAGS); | ||
696 | fhdr->seq_ctrl = cpu_to_le16(seq | ((i + 1) & IEEE80211_SCTL_FRAG)); | 730 | fhdr->seq_ctrl = cpu_to_le16(seq | ((i + 1) & IEEE80211_SCTL_FRAG)); |
731 | |||
732 | if (i == num_fragm - 2) { | ||
733 | /* clear MOREFRAGS bit for the last fragment */ | ||
734 | fhdr->frame_control &= cpu_to_le16(~IEEE80211_FCTL_MOREFRAGS); | ||
735 | } else { | ||
736 | /* | ||
737 | * No multi-rate retries for fragmented frames, that | ||
738 | * would completely throw off the NAV at other STAs. | ||
739 | */ | ||
740 | info->control.rates[1].idx = -1; | ||
741 | info->control.rates[2].idx = -1; | ||
742 | info->control.rates[3].idx = -1; | ||
743 | info->control.rates[4].idx = -1; | ||
744 | BUILD_BUG_ON(IEEE80211_TX_MAX_RATES != 5); | ||
745 | info->flags &= ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; | ||
746 | } | ||
747 | |||
748 | /* copy data */ | ||
697 | copylen = left > per_fragm ? per_fragm : left; | 749 | copylen = left > per_fragm ? per_fragm : left; |
698 | memcpy(skb_put(frag, copylen), pos, copylen); | 750 | memcpy(skb_put(frag, copylen), pos, copylen); |
699 | memcpy(frag->cb, first->cb, sizeof(frag->cb)); | 751 | |
700 | skb_copy_queue_mapping(frag, first); | 752 | skb_copy_queue_mapping(frag, first); |
753 | |||
701 | frag->do_not_encrypt = first->do_not_encrypt; | 754 | frag->do_not_encrypt = first->do_not_encrypt; |
702 | 755 | ||
703 | pos += copylen; | 756 | pos += copylen; |
@@ -757,12 +810,10 @@ ieee80211_tx_h_calculate_duration(struct ieee80211_tx_data *tx) | |||
757 | tx->extra_frag[0]->len); | 810 | tx->extra_frag[0]->len); |
758 | 811 | ||
759 | for (i = 0; i < tx->num_extra_frag; i++) { | 812 | for (i = 0; i < tx->num_extra_frag; i++) { |
760 | if (i + 1 < tx->num_extra_frag) { | 813 | if (i + 1 < tx->num_extra_frag) |
761 | next_len = tx->extra_frag[i + 1]->len; | 814 | next_len = tx->extra_frag[i + 1]->len; |
762 | } else { | 815 | else |
763 | next_len = 0; | 816 | next_len = 0; |
764 | tx->rate_idx = tx->last_frag_rate_idx; | ||
765 | } | ||
766 | 817 | ||
767 | hdr = (struct ieee80211_hdr *)tx->extra_frag[i]->data; | 818 | hdr = (struct ieee80211_hdr *)tx->extra_frag[i]->data; |
768 | hdr->duration_id = ieee80211_duration(tx, 0, next_len); | 819 | hdr->duration_id = ieee80211_duration(tx, 0, next_len); |
@@ -815,7 +866,6 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, | |||
815 | (struct ieee80211_radiotap_header *) skb->data; | 866 | (struct ieee80211_radiotap_header *) skb->data; |
816 | struct ieee80211_supported_band *sband; | 867 | struct ieee80211_supported_band *sband; |
817 | int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); | 868 | int ret = ieee80211_radiotap_iterator_init(&iterator, rthdr, skb->len); |
818 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | ||
819 | 869 | ||
820 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; | 870 | sband = tx->local->hw.wiphy->bands[tx->channel->band]; |
821 | 871 | ||
@@ -829,8 +879,6 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, | |||
829 | */ | 879 | */ |
830 | 880 | ||
831 | while (!ret) { | 881 | while (!ret) { |
832 | int i, target_rate; | ||
833 | |||
834 | ret = ieee80211_radiotap_iterator_next(&iterator); | 882 | ret = ieee80211_radiotap_iterator_next(&iterator); |
835 | 883 | ||
836 | if (ret) | 884 | if (ret) |
@@ -844,38 +892,6 @@ __ieee80211_parse_tx_radiotap(struct ieee80211_tx_data *tx, | |||
844 | * get_unaligned((type *)iterator.this_arg) to dereference | 892 | * get_unaligned((type *)iterator.this_arg) to dereference |
845 | * iterator.this_arg for type "type" safely on all arches. | 893 | * iterator.this_arg for type "type" safely on all arches. |
846 | */ | 894 | */ |
847 | case IEEE80211_RADIOTAP_RATE: | ||
848 | /* | ||
849 | * radiotap rate u8 is in 500kbps units eg, 0x02=1Mbps | ||
850 | * ieee80211 rate int is in 100kbps units eg, 0x0a=1Mbps | ||
851 | */ | ||
852 | target_rate = (*iterator.this_arg) * 5; | ||
853 | for (i = 0; i < sband->n_bitrates; i++) { | ||
854 | struct ieee80211_rate *r; | ||
855 | |||
856 | r = &sband->bitrates[i]; | ||
857 | |||
858 | if (r->bitrate == target_rate) { | ||
859 | tx->rate_idx = i; | ||
860 | break; | ||
861 | } | ||
862 | } | ||
863 | break; | ||
864 | |||
865 | case IEEE80211_RADIOTAP_ANTENNA: | ||
866 | /* | ||
867 | * radiotap uses 0 for 1st ant, mac80211 is 1 for | ||
868 | * 1st ant | ||
869 | */ | ||
870 | info->antenna_sel_tx = (*iterator.this_arg) + 1; | ||
871 | break; | ||
872 | |||
873 | #if 0 | ||
874 | case IEEE80211_RADIOTAP_DBM_TX_POWER: | ||
875 | control->power_level = *iterator.this_arg; | ||
876 | break; | ||
877 | #endif | ||
878 | |||
879 | case IEEE80211_RADIOTAP_FLAGS: | 895 | case IEEE80211_RADIOTAP_FLAGS: |
880 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) { | 896 | if (*iterator.this_arg & IEEE80211_RADIOTAP_F_FCS) { |
881 | /* | 897 | /* |
@@ -933,7 +949,8 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
933 | struct ieee80211_sub_if_data *sdata; | 949 | struct ieee80211_sub_if_data *sdata; |
934 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 950 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
935 | 951 | ||
936 | int hdrlen; | 952 | int hdrlen, tid; |
953 | u8 *qc, *state; | ||
937 | 954 | ||
938 | memset(tx, 0, sizeof(*tx)); | 955 | memset(tx, 0, sizeof(*tx)); |
939 | tx->skb = skb; | 956 | tx->skb = skb; |
@@ -941,8 +958,6 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
941 | tx->local = local; | 958 | tx->local = local; |
942 | tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 959 | tx->sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
943 | tx->channel = local->hw.conf.channel; | 960 | tx->channel = local->hw.conf.channel; |
944 | tx->rate_idx = -1; | ||
945 | tx->last_frag_rate_idx = -1; | ||
946 | /* | 961 | /* |
947 | * Set this flag (used below to indicate "automatic fragmentation"), | 962 | * Set this flag (used below to indicate "automatic fragmentation"), |
948 | * it will be cleared/left by radiotap as desired. | 963 | * it will be cleared/left by radiotap as desired. |
@@ -966,6 +981,15 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
966 | 981 | ||
967 | tx->sta = sta_info_get(local, hdr->addr1); | 982 | tx->sta = sta_info_get(local, hdr->addr1); |
968 | 983 | ||
984 | if (tx->sta && ieee80211_is_data_qos(hdr->frame_control)) { | ||
985 | qc = ieee80211_get_qos_ctl(hdr); | ||
986 | tid = *qc & IEEE80211_QOS_CTL_TID_MASK; | ||
987 | |||
988 | state = &tx->sta->ampdu_mlme.tid_state_tx[tid]; | ||
989 | if (*state == HT_AGG_STATE_OPERATIONAL) | ||
990 | info->flags |= IEEE80211_TX_CTL_AMPDU; | ||
991 | } | ||
992 | |||
969 | if (is_multicast_ether_addr(hdr->addr1)) { | 993 | if (is_multicast_ether_addr(hdr->addr1)) { |
970 | tx->flags &= ~IEEE80211_TX_UNICAST; | 994 | tx->flags &= ~IEEE80211_TX_UNICAST; |
971 | info->flags |= IEEE80211_TX_CTL_NO_ACK; | 995 | info->flags |= IEEE80211_TX_CTL_NO_ACK; |
@@ -977,7 +1001,6 @@ __ieee80211_tx_prepare(struct ieee80211_tx_data *tx, | |||
977 | if (tx->flags & IEEE80211_TX_FRAGMENTED) { | 1001 | if (tx->flags & IEEE80211_TX_FRAGMENTED) { |
978 | if ((tx->flags & IEEE80211_TX_UNICAST) && | 1002 | if ((tx->flags & IEEE80211_TX_UNICAST) && |
979 | skb->len + FCS_LEN > local->fragmentation_threshold && | 1003 | skb->len + FCS_LEN > local->fragmentation_threshold && |
980 | !local->ops->set_frag_threshold && | ||
981 | !(info->flags & IEEE80211_TX_CTL_AMPDU)) | 1004 | !(info->flags & IEEE80211_TX_CTL_AMPDU)) |
982 | tx->flags |= IEEE80211_TX_FRAGMENTED; | 1005 | tx->flags |= IEEE80211_TX_FRAGMENTED; |
983 | else | 1006 | else |
@@ -1043,23 +1066,11 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb, | |||
1043 | if (!tx->extra_frag[i]) | 1066 | if (!tx->extra_frag[i]) |
1044 | continue; | 1067 | continue; |
1045 | info = IEEE80211_SKB_CB(tx->extra_frag[i]); | 1068 | info = IEEE80211_SKB_CB(tx->extra_frag[i]); |
1046 | info->flags &= ~(IEEE80211_TX_CTL_USE_RTS_CTS | | 1069 | info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT | |
1047 | IEEE80211_TX_CTL_USE_CTS_PROTECT | | ||
1048 | IEEE80211_TX_CTL_CLEAR_PS_FILT | | ||
1049 | IEEE80211_TX_CTL_FIRST_FRAGMENT); | 1070 | IEEE80211_TX_CTL_FIRST_FRAGMENT); |
1050 | if (netif_subqueue_stopped(local->mdev, | 1071 | if (netif_subqueue_stopped(local->mdev, |
1051 | tx->extra_frag[i])) | 1072 | tx->extra_frag[i])) |
1052 | return IEEE80211_TX_FRAG_AGAIN; | 1073 | return IEEE80211_TX_FRAG_AGAIN; |
1053 | if (i == tx->num_extra_frag) { | ||
1054 | info->tx_rate_idx = tx->last_frag_rate_idx; | ||
1055 | |||
1056 | if (tx->flags & IEEE80211_TX_PROBE_LAST_FRAG) | ||
1057 | info->flags |= | ||
1058 | IEEE80211_TX_CTL_RATE_CTRL_PROBE; | ||
1059 | else | ||
1060 | info->flags &= | ||
1061 | ~IEEE80211_TX_CTL_RATE_CTRL_PROBE; | ||
1062 | } | ||
1063 | 1074 | ||
1064 | ret = local->ops->tx(local_to_hw(local), | 1075 | ret = local->ops->tx(local_to_hw(local), |
1065 | tx->extra_frag[i]); | 1076 | tx->extra_frag[i]); |
@@ -1168,7 +1179,7 @@ retry: | |||
1168 | * queues, there's no reason for a driver to reject | 1179 | * queues, there's no reason for a driver to reject |
1169 | * a frame there, warn and drop it. | 1180 | * a frame there, warn and drop it. |
1170 | */ | 1181 | */ |
1171 | if (WARN_ON(queue >= ieee80211_num_regular_queues(&local->hw))) | 1182 | if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU)) |
1172 | goto drop; | 1183 | goto drop; |
1173 | 1184 | ||
1174 | store = &local->pending_packet[queue]; | 1185 | store = &local->pending_packet[queue]; |
@@ -1196,9 +1207,6 @@ retry: | |||
1196 | store->skb = skb; | 1207 | store->skb = skb; |
1197 | store->extra_frag = tx.extra_frag; | 1208 | store->extra_frag = tx.extra_frag; |
1198 | store->num_extra_frag = tx.num_extra_frag; | 1209 | store->num_extra_frag = tx.num_extra_frag; |
1199 | store->last_frag_rate_idx = tx.last_frag_rate_idx; | ||
1200 | store->last_frag_rate_ctrl_probe = | ||
1201 | !!(tx.flags & IEEE80211_TX_PROBE_LAST_FRAG); | ||
1202 | } | 1210 | } |
1203 | out: | 1211 | out: |
1204 | rcu_read_unlock(); | 1212 | rcu_read_unlock(); |
@@ -1465,6 +1473,19 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1465 | goto fail; | 1473 | goto fail; |
1466 | } | 1474 | } |
1467 | 1475 | ||
1476 | if (!(local->hw.flags & IEEE80211_HW_NO_STACK_DYNAMIC_PS) && | ||
1477 | local->dynamic_ps_timeout > 0) { | ||
1478 | if (local->hw.conf.flags & IEEE80211_CONF_PS) { | ||
1479 | ieee80211_stop_queues_by_reason(&local->hw, | ||
1480 | IEEE80211_QUEUE_STOP_REASON_PS); | ||
1481 | queue_work(local->hw.workqueue, | ||
1482 | &local->dynamic_ps_disable_work); | ||
1483 | } | ||
1484 | |||
1485 | mod_timer(&local->dynamic_ps_timer, jiffies + | ||
1486 | msecs_to_jiffies(local->dynamic_ps_timeout)); | ||
1487 | } | ||
1488 | |||
1468 | nh_pos = skb_network_header(skb) - skb->data; | 1489 | nh_pos = skb_network_header(skb) - skb->data; |
1469 | h_pos = skb_transport_header(skb) - skb->data; | 1490 | h_pos = skb_transport_header(skb) - skb->data; |
1470 | 1491 | ||
@@ -1593,12 +1614,10 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1593 | compare_ether_addr(dev->dev_addr, | 1614 | compare_ether_addr(dev->dev_addr, |
1594 | skb->data + ETH_ALEN) == 0))) { | 1615 | skb->data + ETH_ALEN) == 0))) { |
1595 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1616 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1596 | DECLARE_MAC_BUF(mac); | ||
1597 | |||
1598 | if (net_ratelimit()) | 1617 | if (net_ratelimit()) |
1599 | printk(KERN_DEBUG "%s: dropped frame to %s" | 1618 | printk(KERN_DEBUG "%s: dropped frame to %pM" |
1600 | " (unauthorized port)\n", dev->name, | 1619 | " (unauthorized port)\n", dev->name, |
1601 | print_mac(mac, hdr.addr1)); | 1620 | hdr.addr1); |
1602 | #endif | 1621 | #endif |
1603 | 1622 | ||
1604 | I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); | 1623 | I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); |
@@ -1757,10 +1776,7 @@ void ieee80211_tx_pending(unsigned long data) | |||
1757 | store = &local->pending_packet[i]; | 1776 | store = &local->pending_packet[i]; |
1758 | tx.extra_frag = store->extra_frag; | 1777 | tx.extra_frag = store->extra_frag; |
1759 | tx.num_extra_frag = store->num_extra_frag; | 1778 | tx.num_extra_frag = store->num_extra_frag; |
1760 | tx.last_frag_rate_idx = store->last_frag_rate_idx; | ||
1761 | tx.flags = 0; | 1779 | tx.flags = 0; |
1762 | if (store->last_frag_rate_ctrl_probe) | ||
1763 | tx.flags |= IEEE80211_TX_PROBE_LAST_FRAG; | ||
1764 | ret = __ieee80211_tx(local, store->skb, &tx); | 1780 | ret = __ieee80211_tx(local, store->skb, &tx); |
1765 | if (ret) { | 1781 | if (ret) { |
1766 | if (ret == IEEE80211_TX_FRAG_AGAIN) | 1782 | if (ret == IEEE80211_TX_FRAG_AGAIN) |
@@ -1775,8 +1791,7 @@ void ieee80211_tx_pending(unsigned long data) | |||
1775 | 1791 | ||
1776 | /* functions for drivers to get certain frames */ | 1792 | /* functions for drivers to get certain frames */ |
1777 | 1793 | ||
1778 | static void ieee80211_beacon_add_tim(struct ieee80211_local *local, | 1794 | static void ieee80211_beacon_add_tim(struct ieee80211_if_ap *bss, |
1779 | struct ieee80211_if_ap *bss, | ||
1780 | struct sk_buff *skb, | 1795 | struct sk_buff *skb, |
1781 | struct beacon_data *beacon) | 1796 | struct beacon_data *beacon) |
1782 | { | 1797 | { |
@@ -1844,11 +1859,9 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1844 | struct ieee80211_local *local = hw_to_local(hw); | 1859 | struct ieee80211_local *local = hw_to_local(hw); |
1845 | struct sk_buff *skb = NULL; | 1860 | struct sk_buff *skb = NULL; |
1846 | struct ieee80211_tx_info *info; | 1861 | struct ieee80211_tx_info *info; |
1847 | struct net_device *bdev; | ||
1848 | struct ieee80211_sub_if_data *sdata = NULL; | 1862 | struct ieee80211_sub_if_data *sdata = NULL; |
1849 | struct ieee80211_if_ap *ap = NULL; | 1863 | struct ieee80211_if_ap *ap = NULL; |
1850 | struct ieee80211_if_sta *ifsta = NULL; | 1864 | struct ieee80211_if_sta *ifsta = NULL; |
1851 | struct rate_selection rsel; | ||
1852 | struct beacon_data *beacon; | 1865 | struct beacon_data *beacon; |
1853 | struct ieee80211_supported_band *sband; | 1866 | struct ieee80211_supported_band *sband; |
1854 | enum ieee80211_band band = local->hw.conf.channel->band; | 1867 | enum ieee80211_band band = local->hw.conf.channel->band; |
@@ -1858,7 +1871,6 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1858 | rcu_read_lock(); | 1871 | rcu_read_lock(); |
1859 | 1872 | ||
1860 | sdata = vif_to_sdata(vif); | 1873 | sdata = vif_to_sdata(vif); |
1861 | bdev = sdata->dev; | ||
1862 | 1874 | ||
1863 | if (sdata->vif.type == NL80211_IFTYPE_AP) { | 1875 | if (sdata->vif.type == NL80211_IFTYPE_AP) { |
1864 | ap = &sdata->u.ap; | 1876 | ap = &sdata->u.ap; |
@@ -1886,12 +1898,12 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1886 | * of the tim bitmap in mac80211 and the driver. | 1898 | * of the tim bitmap in mac80211 and the driver. |
1887 | */ | 1899 | */ |
1888 | if (local->tim_in_locked_section) { | 1900 | if (local->tim_in_locked_section) { |
1889 | ieee80211_beacon_add_tim(local, ap, skb, beacon); | 1901 | ieee80211_beacon_add_tim(ap, skb, beacon); |
1890 | } else { | 1902 | } else { |
1891 | unsigned long flags; | 1903 | unsigned long flags; |
1892 | 1904 | ||
1893 | spin_lock_irqsave(&local->sta_lock, flags); | 1905 | spin_lock_irqsave(&local->sta_lock, flags); |
1894 | ieee80211_beacon_add_tim(local, ap, skb, beacon); | 1906 | ieee80211_beacon_add_tim(ap, skb, beacon); |
1895 | spin_unlock_irqrestore(&local->sta_lock, flags); | 1907 | spin_unlock_irqrestore(&local->sta_lock, flags); |
1896 | } | 1908 | } |
1897 | 1909 | ||
@@ -1952,33 +1964,23 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1952 | skb->do_not_encrypt = 1; | 1964 | skb->do_not_encrypt = 1; |
1953 | 1965 | ||
1954 | info->band = band; | 1966 | info->band = band; |
1955 | rate_control_get_rate(sdata, sband, NULL, skb, &rsel); | 1967 | /* |
1956 | 1968 | * XXX: For now, always use the lowest rate | |
1957 | if (unlikely(rsel.rate_idx < 0)) { | 1969 | */ |
1958 | if (net_ratelimit()) { | 1970 | info->control.rates[0].idx = 0; |
1959 | printk(KERN_DEBUG "%s: ieee80211_beacon_get: " | 1971 | info->control.rates[0].count = 1; |
1960 | "no rate found\n", | 1972 | info->control.rates[1].idx = -1; |
1961 | wiphy_name(local->hw.wiphy)); | 1973 | info->control.rates[2].idx = -1; |
1962 | } | 1974 | info->control.rates[3].idx = -1; |
1963 | dev_kfree_skb_any(skb); | 1975 | info->control.rates[4].idx = -1; |
1964 | skb = NULL; | 1976 | BUILD_BUG_ON(IEEE80211_TX_MAX_RATES != 5); |
1965 | goto out; | ||
1966 | } | ||
1967 | 1977 | ||
1968 | info->control.vif = vif; | 1978 | info->control.vif = vif; |
1969 | info->tx_rate_idx = rsel.rate_idx; | ||
1970 | 1979 | ||
1971 | info->flags |= IEEE80211_TX_CTL_NO_ACK; | 1980 | info->flags |= IEEE80211_TX_CTL_NO_ACK; |
1972 | info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; | 1981 | info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; |
1973 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; | 1982 | info->flags |= IEEE80211_TX_CTL_ASSIGN_SEQ; |
1974 | if (sdata->bss_conf.use_short_preamble && | 1983 | out: |
1975 | sband->bitrates[rsel.rate_idx].flags & IEEE80211_RATE_SHORT_PREAMBLE) | ||
1976 | info->flags |= IEEE80211_TX_CTL_SHORT_PREAMBLE; | ||
1977 | |||
1978 | info->antenna_sel_tx = local->hw.conf.antenna_sel_tx; | ||
1979 | info->control.retry_limit = 1; | ||
1980 | |||
1981 | out: | ||
1982 | rcu_read_unlock(); | 1984 | rcu_read_unlock(); |
1983 | return skb; | 1985 | return skb; |
1984 | } | 1986 | } |
@@ -2023,14 +2025,12 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
2023 | struct sk_buff *skb = NULL; | 2025 | struct sk_buff *skb = NULL; |
2024 | struct sta_info *sta; | 2026 | struct sta_info *sta; |
2025 | struct ieee80211_tx_data tx; | 2027 | struct ieee80211_tx_data tx; |
2026 | struct net_device *bdev; | ||
2027 | struct ieee80211_sub_if_data *sdata; | 2028 | struct ieee80211_sub_if_data *sdata; |
2028 | struct ieee80211_if_ap *bss = NULL; | 2029 | struct ieee80211_if_ap *bss = NULL; |
2029 | struct beacon_data *beacon; | 2030 | struct beacon_data *beacon; |
2030 | struct ieee80211_tx_info *info; | 2031 | struct ieee80211_tx_info *info; |
2031 | 2032 | ||
2032 | sdata = vif_to_sdata(vif); | 2033 | sdata = vif_to_sdata(vif); |
2033 | bdev = sdata->dev; | ||
2034 | bss = &sdata->u.ap; | 2034 | bss = &sdata->u.ap; |
2035 | 2035 | ||
2036 | if (!bss) | 2036 | if (!bss) |