diff options
author | Johannes Berg <johannes.berg@intel.com> | 2015-05-19 07:36:38 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-05-20 09:09:22 -0400 |
commit | 252ec2b3aa6f6a9ac29c6539027db600c11bf45e (patch) | |
tree | aa99419180f9711834e4142e8c3c261d8ebdb85a /net | |
parent | 22d3a3c829fa9ecdb493d1f1f2838d543f8d86a3 (diff) |
mac80211: don't split remain-on-channel for coalescing
Due to remain-on-channel scheduling delays, when we split an ROC
while coalescing, we'll usually get a picture like this:
existing ROC: |------------------|
current time: ^
new ROC: |------| |-------|
If the expected response frames are then transmitted by the peer
in the hole between the two fragments of the new ROC, we miss
them and the process (e.g. ANQP query) fails.
mac80211 expects that the window to miss something is small:
existing ROC: |------------------|
new ROC: |------||-------|
but that's normally not the case.
To avoid this problem, coalesce only if the new ROC's duration
is <= the remaining time on the existing one:
existing ROC: |------------------|
new ROC: |-----|
and never split a new one but schedule it afterwards instead:
existing ROC: |------------------|
new ROC: |-------------|
type=bugfix
bug=not-tracked
fixes=unknown
Reported-by: Matti Gottlieb <matti.gottlieb@intel.com>
Reviewed-by: EliadX Peller <eliad@wizery.com>
Reviewed-by: Matti Gottlieb <matti.gottlieb@intel.com>
Tested-by: Matti Gottlieb <matti.gottlieb@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/cfg.c | 59 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 6 |
2 files changed, 11 insertions, 54 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); |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index cdc374296245..c0a9187bc3a9 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -328,12 +328,6 @@ struct mesh_preq_queue { | |||
328 | u8 flags; | 328 | u8 flags; |
329 | }; | 329 | }; |
330 | 330 | ||
331 | #if HZ/100 == 0 | ||
332 | #define IEEE80211_ROC_MIN_LEFT 1 | ||
333 | #else | ||
334 | #define IEEE80211_ROC_MIN_LEFT (HZ/100) | ||
335 | #endif | ||
336 | |||
337 | struct ieee80211_roc_work { | 331 | struct ieee80211_roc_work { |
338 | struct list_head list; | 332 | struct list_head list; |
339 | struct list_head dependents; | 333 | struct list_head dependents; |