diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-02-06 18:14:51 -0500 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-02-11 12:45:01 -0500 |
commit | fd0f979a1b67f0889aea24a7c7d2a54d6706a1cf (patch) | |
tree | fce94dd9fa9783eb4dc8b0ed6a2c322650889991 /net/mac80211/chan.c | |
parent | f1e3e0515646dd0f4c783c1c39839d2706501344 (diff) |
mac80211: simplify idle handling
Now that we have channel contexts, idle is (pretty
much) equivalent to not having a channel context.
Change the code to use this relation so that there
no longer is a need for a lot of idle recalculate
calls everywhere.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/chan.c')
-rw-r--r-- | net/mac80211/chan.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index b5b50762f03e..038f249966d6 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c | |||
@@ -91,6 +91,10 @@ ieee80211_new_chanctx(struct ieee80211_local *local, | |||
91 | 91 | ||
92 | list_add_rcu(&ctx->list, &local->chanctx_list); | 92 | list_add_rcu(&ctx->list, &local->chanctx_list); |
93 | 93 | ||
94 | mutex_lock(&local->mtx); | ||
95 | ieee80211_recalc_idle(local); | ||
96 | mutex_unlock(&local->mtx); | ||
97 | |||
94 | return ctx; | 98 | return ctx; |
95 | } | 99 | } |
96 | 100 | ||
@@ -110,6 +114,10 @@ static void ieee80211_free_chanctx(struct ieee80211_local *local, | |||
110 | 114 | ||
111 | list_del_rcu(&ctx->list); | 115 | list_del_rcu(&ctx->list); |
112 | kfree_rcu(ctx, rcu_head); | 116 | kfree_rcu(ctx, rcu_head); |
117 | |||
118 | mutex_lock(&local->mtx); | ||
119 | ieee80211_recalc_idle(local); | ||
120 | mutex_unlock(&local->mtx); | ||
113 | } | 121 | } |
114 | 122 | ||
115 | static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata, | 123 | static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata, |
@@ -128,6 +136,8 @@ static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata, | |||
128 | ctx->refcount++; | 136 | ctx->refcount++; |
129 | 137 | ||
130 | ieee80211_recalc_txpower(sdata); | 138 | ieee80211_recalc_txpower(sdata); |
139 | sdata->vif.bss_conf.idle = false; | ||
140 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IDLE); | ||
131 | 141 | ||
132 | return 0; | 142 | return 0; |
133 | } | 143 | } |
@@ -175,6 +185,9 @@ static void ieee80211_unassign_vif_chanctx(struct ieee80211_sub_if_data *sdata, | |||
175 | ctx->refcount--; | 185 | ctx->refcount--; |
176 | rcu_assign_pointer(sdata->vif.chanctx_conf, NULL); | 186 | rcu_assign_pointer(sdata->vif.chanctx_conf, NULL); |
177 | 187 | ||
188 | sdata->vif.bss_conf.idle = true; | ||
189 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_IDLE); | ||
190 | |||
178 | drv_unassign_vif_chanctx(local, sdata, ctx); | 191 | drv_unassign_vif_chanctx(local, sdata, ctx); |
179 | 192 | ||
180 | if (ctx->refcount > 0) { | 193 | if (ctx->refcount > 0) { |