aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2014-04-09 09:29:26 -0400
committerJohannes Berg <johannes.berg@intel.com>2014-04-25 11:08:29 -0400
commit484298ad1afaf249a4708a5091487132dae80bf9 (patch)
treedfed80a1d4dd5b6877877203a6da37f24af21462 /net/mac80211
parent093324816b91c9f4a3dd8c78930e43d0a2ef2508 (diff)
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: Michal Kazior <michal.kazior@tieto.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/chan.c4
-rw-r--r--net/mac80211/ieee80211_i.h4
-rw-r--r--net/mac80211/iface.c1
3 files changed, 9 insertions, 0 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 4ed229c0966a..504526c97867 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -276,6 +276,7 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
276 if (!ctx) 276 if (!ctx)
277 return ERR_PTR(-ENOMEM); 277 return ERR_PTR(-ENOMEM);
278 278
279 INIT_LIST_HEAD(&ctx->assigned_vifs);
279 ctx->conf.def = *chandef; 280 ctx->conf.def = *chandef;
280 ctx->conf.rx_chains_static = 1; 281 ctx->conf.rx_chains_static = 1;
281 ctx->conf.rx_chains_dynamic = 1; 282 ctx->conf.rx_chains_dynamic = 1;
@@ -420,6 +421,7 @@ static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata,
420 curr_ctx->refcount--; 421 curr_ctx->refcount--;
421 drv_unassign_vif_chanctx(local, sdata, curr_ctx); 422 drv_unassign_vif_chanctx(local, sdata, curr_ctx);
422 conf = NULL; 423 conf = NULL;
424 list_del(&sdata->assigned_chanctx_list);
423 } 425 }
424 426
425 if (new_ctx) { 427 if (new_ctx) {
@@ -429,6 +431,8 @@ static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata,
429 431
430 new_ctx->refcount++; 432 new_ctx->refcount++;
431 conf = &new_ctx->conf; 433 conf = &new_ctx->conf;
434 list_add(&sdata->assigned_chanctx_list,
435 &new_ctx->assigned_vifs);
432 } 436 }
433 437
434out: 438out:
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 4018ba13c028..3b3b45a21501 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -691,6 +691,8 @@ struct ieee80211_chanctx {
691 struct list_head list; 691 struct list_head list;
692 struct rcu_head rcu_head; 692 struct rcu_head rcu_head;
693 693
694 struct list_head assigned_vifs;
695
694 enum ieee80211_chanctx_mode mode; 696 enum ieee80211_chanctx_mode mode;
695 int refcount; 697 int refcount;
696 bool driver_present; 698 bool driver_present;
@@ -756,6 +758,8 @@ struct ieee80211_sub_if_data {
756 bool csa_radar_required; 758 bool csa_radar_required;
757 struct cfg80211_chan_def csa_chandef; 759 struct cfg80211_chan_def csa_chandef;
758 760
761 struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */
762
759 /* context reservation -- protected with chanctx_mtx */ 763 /* context reservation -- protected with chanctx_mtx */
760 struct ieee80211_chanctx *reserved_chanctx; 764 struct ieee80211_chanctx *reserved_chanctx;
761 struct cfg80211_chan_def reserved_chandef; 765 struct cfg80211_chan_def reserved_chandef;
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 90b60633a27a..a562d0f489e1 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -1291,6 +1291,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
1291 INIT_WORK(&sdata->work, ieee80211_iface_work); 1291 INIT_WORK(&sdata->work, ieee80211_iface_work);
1292 INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work); 1292 INIT_WORK(&sdata->recalc_smps, ieee80211_recalc_smps_work);
1293 INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work); 1293 INIT_WORK(&sdata->csa_finalize_work, ieee80211_csa_finalize_work);
1294 INIT_LIST_HEAD(&sdata->assigned_chanctx_list);
1294 1295
1295 switch (type) { 1296 switch (type) {
1296 case NL80211_IFTYPE_P2P_GO: 1297 case NL80211_IFTYPE_P2P_GO: