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;
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;
}
}
}
+ list_add(&sdata->reserved_chanctx_list, &new_ctx->reserved_vifs);
new_ctx->refcount++;
sdata->reserved_chanctx = new_ctx;
sdata->reserved_chandef = *chandef;
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 */
struct rcu_head rcu_head;
struct list_head assigned_vifs;
+ struct list_head reserved_vifs;
enum ieee80211_chanctx_mode mode;
int refcount;
struct cfg80211_chan_def csa_chandef;
struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */
+ struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */
/* context reservation -- protected with chanctx_mtx */
struct ieee80211_chanctx *reserved_chanctx;
INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work);
INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work);
INIT_LIST_HEAD(&sdata->assigned_chanctx_list);
+ INIT_LIST_HEAD(&sdata->reserved_chanctx_list);
switch (type) {
case NL80211_IFTYPE_P2P_GO: