diff options
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r-- | net/mac80211/cfg.c | 59 |
1 files changed, 11 insertions, 48 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 265e42721a66..ff347a0eebd4 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -2495,51 +2495,22 @@ static bool ieee80211_coalesce_started_roc(struct ieee80211_local *local, | |||
2495 | struct ieee80211_roc_work *new_roc, | 2495 | struct ieee80211_roc_work *new_roc, |
2496 | struct ieee80211_roc_work *cur_roc) | 2496 | struct ieee80211_roc_work *cur_roc) |
2497 | { | 2497 | { |
2498 | unsigned long j = jiffies; | 2498 | unsigned long now = jiffies; |
2499 | unsigned long cur_roc_end = cur_roc->hw_start_time + | 2499 | unsigned long remaining = cur_roc->hw_start_time + |
2500 | msecs_to_jiffies(cur_roc->duration); | 2500 | msecs_to_jiffies(cur_roc->duration) - |
2501 | struct ieee80211_roc_work *next_roc; | 2501 | now; |
2502 | int new_dur; | ||
2503 | 2502 | ||
2504 | if (WARN_ON(!cur_roc->started || !cur_roc->hw_begun)) | 2503 | if (WARN_ON(!cur_roc->started || !cur_roc->hw_begun)) |
2505 | return false; | 2504 | return false; |
2506 | 2505 | ||
2507 | if (time_after(j + IEEE80211_ROC_MIN_LEFT, cur_roc_end)) | 2506 | /* if it doesn't fit entirely, schedule a new one */ |
2507 | if (new_roc->duration > jiffies_to_msecs(remaining)) | ||
2508 | return false; | 2508 | return false; |
2509 | 2509 | ||
2510 | ieee80211_handle_roc_started(new_roc); | 2510 | ieee80211_handle_roc_started(new_roc); |
2511 | 2511 | ||
2512 | new_dur = new_roc->duration - jiffies_to_msecs(cur_roc_end - j); | 2512 | /* add to dependents so we send the expired event properly */ |
2513 | 2513 | list_add_tail(&new_roc->list, &cur_roc->dependents); | |
2514 | /* cur_roc is long enough - add new_roc to the dependents list. */ | ||
2515 | if (new_dur <= 0) { | ||
2516 | list_add_tail(&new_roc->list, &cur_roc->dependents); | ||
2517 | return true; | ||
2518 | } | ||
2519 | |||
2520 | new_roc->duration = new_dur; | ||
2521 | |||
2522 | /* | ||
2523 | * if cur_roc was already coalesced before, we might | ||
2524 | * want to extend the next roc instead of adding | ||
2525 | * a new one. | ||
2526 | */ | ||
2527 | next_roc = list_entry(cur_roc->list.next, | ||
2528 | struct ieee80211_roc_work, list); | ||
2529 | if (&next_roc->list != &local->roc_list && | ||
2530 | next_roc->chan == new_roc->chan && | ||
2531 | next_roc->sdata == new_roc->sdata && | ||
2532 | !WARN_ON(next_roc->started)) { | ||
2533 | list_add_tail(&new_roc->list, &next_roc->dependents); | ||
2534 | next_roc->duration = max(next_roc->duration, | ||
2535 | new_roc->duration); | ||
2536 | next_roc->type = max(next_roc->type, new_roc->type); | ||
2537 | return true; | ||
2538 | } | ||
2539 | |||
2540 | /* add right after cur_roc */ | ||
2541 | list_add(&new_roc->list, &cur_roc->list); | ||
2542 | |||
2543 | return true; | 2514 | return true; |
2544 | } | 2515 | } |
2545 | 2516 | ||
@@ -2652,17 +2623,9 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local, | |||
2652 | * In the offloaded ROC case, if it hasn't begun, add | 2623 | * In the offloaded ROC case, if it hasn't begun, add |
2653 | * this new one to the dependent list to be handled | 2624 | * this new one to the dependent list to be handled |
2654 | * when the master one begins. If it has begun, | 2625 | * when the master one begins. If it has begun, |
2655 | * check that there's still a minimum time left and | 2626 | * check if it fits entirely within the existing one, |
2656 | * if so, start this one, transmitting the frame, but | 2627 | * in which case it will just be dependent as well. |
2657 | * add it to the list directly after this one with | 2628 | * Otherwise, schedule it by itself. |
2658 | * a reduced time so we'll ask the driver to execute | ||
2659 | * it right after finishing the previous one, in the | ||
2660 | * hope that it'll also be executed right afterwards, | ||
2661 | * effectively extending the old one. | ||
2662 | * If there's no minimum time left, just add it to the | ||
2663 | * normal list. | ||
2664 | * TODO: the ROC type is ignored here, assuming that it | ||
2665 | * is better to immediately use the current ROC. | ||
2666 | */ | 2629 | */ |
2667 | if (!tmp->hw_begun) { | 2630 | if (!tmp->hw_begun) { |
2668 | list_add_tail(&roc->list, &tmp->dependents); | 2631 | list_add_tail(&roc->list, &tmp->dependents); |