summaryrefslogtreecommitdiffstats
path: root/net/mac80211/chan.c
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2014-04-09 15:29:27 +0200
committerJohannes Berg <johannes.berg@intel.com>2014-04-25 17:08:29 +0200
commite3afb920227d37fe72914350c41621c028539077 (patch)
tree8a33d0983dd8db843e98ad52d590075f9c0fbc4e /net/mac80211/chan.c
parent484298ad1afaf249a4708a5091487132dae80bf9 (diff)
downloadlinux-stable-e3afb920227d37fe72914350c41621c028539077.tar.gz
linux-stable-e3afb920227d37fe72914350c41621c028539077.tar.bz2
linux-stable-e3afb920227d37fe72914350c41621c028539077.zip
mac80211: track reserved vifs in chanctx
This can be useful. Provides a more straghtforward way to iterate over interfaces taking part in chanctx reservation and allows tracking chanctx usage explicitly. The structure is protected by local->chanctx_mtx. Signed-off-by: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/chan.c')
-rw-r--r--net/mac80211/chan.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 504526c97867..79eac96d9e5f 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -277,6 +277,7 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&ctx->assigned_vifs);
+ INIT_LIST_HEAD(&ctx->reserved_vifs);
ctx->conf.def = *chandef;
ctx->conf.rx_chains_static = 1;
ctx->conf.rx_chains_dynamic = 1;
@@ -731,16 +732,19 @@ void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata,
int ieee80211_vif_unreserve_chanctx(struct ieee80211_sub_if_data *sdata)
{
+ struct ieee80211_chanctx *ctx = sdata->reserved_chanctx;
+
lockdep_assert_held(&sdata->local->chanctx_mtx);
- if (WARN_ON(!sdata->reserved_chanctx))
+ if (WARN_ON(!ctx))
return -EINVAL;
- if (--sdata->reserved_chanctx->refcount == 0)
- ieee80211_free_chanctx(sdata->local, sdata->reserved_chanctx);
-
+ list_del(&sdata->reserved_chanctx_list);
sdata->reserved_chanctx = NULL;
+ if (--ctx->refcount == 0)
+ ieee80211_free_chanctx(sdata->local, ctx);
+
return 0;
}
@@ -788,6 +792,7 @@ int ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata,
}
}
+ list_add(&sdata->reserved_chanctx_list, &new_ctx->reserved_vifs);
new_ctx->refcount++;
sdata->reserved_chanctx = new_ctx;
sdata->reserved_chandef = *chandef;
@@ -837,6 +842,7 @@ int ieee80211_vif_use_reserved_context(struct ieee80211_sub_if_data *sdata,
ctx->refcount--;
sdata->reserved_chanctx = NULL;
sdata->radar_required = sdata->reserved_radar_required;
+ list_del(&sdata->reserved_chanctx_list);
if (old_ctx == ctx) {
/* This is our own context, just change it */