Commit e979e33c authored by Johannes Berg's avatar Johannes Berg

mac80211: allow cancelling dependent ROCs

In my redesign of remain-on-channel I forgot
that an item could be cancelled when it's a
dependent item that is part of another item.
Allow cancelling such items by removing them
from the dependents list.

Note that when we cancel the main item, all
its dependents are also cancelled. It would
be possible to not do that, but would need
tricks to promote an item from dependent to
top-level and is tricky in the HW ROC case.
Reported-by: default avatarIlan Peer <ilan.peer@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 535588e6
...@@ -2305,6 +2305,21 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local, ...@@ -2305,6 +2305,21 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
mutex_lock(&local->mtx); mutex_lock(&local->mtx);
list_for_each_entry_safe(roc, tmp, &local->roc_list, list) { list_for_each_entry_safe(roc, tmp, &local->roc_list, list) {
struct ieee80211_roc_work *dep, *tmp2;
list_for_each_entry_safe(dep, tmp2, &roc->dependents, list) {
if (!mgmt_tx && (unsigned long)dep != cookie)
continue;
else if (mgmt_tx && dep->mgmt_tx_cookie != cookie)
continue;
/* found dependent item -- just remove it */
list_del(&dep->list);
mutex_unlock(&local->mtx);
ieee80211_roc_notify_destroy(dep);
return 0;
}
if (!mgmt_tx && (unsigned long)roc != cookie) if (!mgmt_tx && (unsigned long)roc != cookie)
continue; continue;
else if (mgmt_tx && roc->mgmt_tx_cookie != cookie) else if (mgmt_tx && roc->mgmt_tx_cookie != cookie)
...@@ -2319,6 +2334,13 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local, ...@@ -2319,6 +2334,13 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
return -ENOENT; return -ENOENT;
} }
/*
* We found the item to cancel, so do that. Note that it
* may have dependents, which we also cancel (and send
* the expired signal for.) Not doing so would be quite
* tricky here, but we may need to fix it later.
*/
if (local->ops->remain_on_channel) { if (local->ops->remain_on_channel) {
if (found->started) { if (found->started) {
ret = drv_cancel_remain_on_channel(local); ret = drv_cancel_remain_on_channel(local);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment