Commit 484298ad authored by Michal Kazior's avatar Michal Kazior Committed by Johannes Berg

mac80211: track assigned vifs in chanctx

This can be useful. Provides a more straghtforward
way to iterate over interfaces bound to a given
chanctx and allows tracking chanctx usage
explicitly.

The structure is protected by local->chanctx_mtx.
Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 09332481
...@@ -276,6 +276,7 @@ ieee80211_new_chanctx(struct ieee80211_local *local, ...@@ -276,6 +276,7 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
if (!ctx) if (!ctx)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&ctx->assigned_vifs);
ctx->conf.def = *chandef; ctx->conf.def = *chandef;
ctx->conf.rx_chains_static = 1; ctx->conf.rx_chains_static = 1;
ctx->conf.rx_chains_dynamic = 1; ctx->conf.rx_chains_dynamic = 1;
...@@ -420,6 +421,7 @@ static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata, ...@@ -420,6 +421,7 @@ static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata,
curr_ctx->refcount--; curr_ctx->refcount--;
drv_unassign_vif_chanctx(local, sdata, curr_ctx); drv_unassign_vif_chanctx(local, sdata, curr_ctx);
conf = NULL; conf = NULL;
list_del(&sdata->assigned_chanctx_list);
} }
if (new_ctx) { if (new_ctx) {
...@@ -429,6 +431,8 @@ static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata, ...@@ -429,6 +431,8 @@ static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata,
new_ctx->refcount++; new_ctx->refcount++;
conf = &new_ctx->conf; conf = &new_ctx->conf;
list_add(&sdata->assigned_chanctx_list,
&new_ctx->assigned_vifs);
} }
out: out:
......
...@@ -691,6 +691,8 @@ struct ieee80211_chanctx { ...@@ -691,6 +691,8 @@ struct ieee80211_chanctx {
struct list_head list; struct list_head list;
struct rcu_head rcu_head; struct rcu_head rcu_head;
struct list_head assigned_vifs;
enum ieee80211_chanctx_mode mode; enum ieee80211_chanctx_mode mode;
int refcount; int refcount;
bool driver_present; bool driver_present;
...@@ -756,6 +758,8 @@ struct ieee80211_sub_if_data { ...@@ -756,6 +758,8 @@ struct ieee80211_sub_if_data {
bool csa_radar_required; bool csa_radar_required;
struct cfg80211_chan_def csa_chandef; struct cfg80211_chan_def csa_chandef;
struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */
/* context reservation -- protected with chanctx_mtx */ /* context reservation -- protected with chanctx_mtx */
struct ieee80211_chanctx *reserved_chanctx; struct ieee80211_chanctx *reserved_chanctx;
struct cfg80211_chan_def reserved_chandef; struct cfg80211_chan_def reserved_chandef;
......
...@@ -1291,6 +1291,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata, ...@@ -1291,6 +1291,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
INIT_WORK(&sdata->work, ieee80211_iface_work); INIT_WORK(&sdata->work, ieee80211_iface_work);
INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work); INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work);
INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work);
INIT_LIST_HEAD(&sdata->assigned_chanctx_list);
switch (type) { switch (type) {
case NL80211_IFTYPE_P2P_GO: case NL80211_IFTYPE_P2P_GO:
......
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