diff options
Diffstat (limited to 'net/mac80211/util.c')
| -rw-r--r-- | net/mac80211/util.c | 73 | 
1 files changed, 22 insertions, 51 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 0f38f43ac62..b7a856e3281 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -1357,6 +1357,25 @@ void ieee80211_stop_device(struct ieee80211_local *local)  	drv_stop(local);  } +static void ieee80211_assign_chanctx(struct ieee80211_local *local, +				     struct ieee80211_sub_if_data *sdata) +{ +	struct ieee80211_chanctx_conf *conf; +	struct ieee80211_chanctx *ctx; + +	if (!local->use_chanctx) +		return; + +	mutex_lock(&local->chanctx_mtx); +	conf = rcu_dereference_protected(sdata->vif.chanctx_conf, +					 lockdep_is_held(&local->chanctx_mtx)); +	if (conf) { +		ctx = container_of(conf, struct ieee80211_chanctx, conf); +		drv_assign_vif_chanctx(local, sdata, ctx); +	} +	mutex_unlock(&local->chanctx_mtx); +} +  int ieee80211_reconfig(struct ieee80211_local *local)  {  	struct ieee80211_hw *hw = &local->hw; @@ -1445,36 +1464,14 @@ int ieee80211_reconfig(struct ieee80211_local *local)  	}  	list_for_each_entry(sdata, &local->interfaces, list) { -		struct ieee80211_chanctx_conf *ctx_conf; -  		if (!ieee80211_sdata_running(sdata))  			continue; - -		mutex_lock(&local->chanctx_mtx); -		ctx_conf = rcu_dereference_protected(sdata->vif.chanctx_conf, -				lockdep_is_held(&local->chanctx_mtx)); -		if (ctx_conf) { -			ctx = container_of(ctx_conf, struct ieee80211_chanctx, -					   conf); -			drv_assign_vif_chanctx(local, sdata, ctx); -		} -		mutex_unlock(&local->chanctx_mtx); +		ieee80211_assign_chanctx(local, sdata);  	}  	sdata = rtnl_dereference(local->monitor_sdata); -	if (sdata && local->use_chanctx && ieee80211_sdata_running(sdata)) { -		struct ieee80211_chanctx_conf *ctx_conf; - -		mutex_lock(&local->chanctx_mtx); -		ctx_conf = rcu_dereference_protected(sdata->vif.chanctx_conf, -				lockdep_is_held(&local->chanctx_mtx)); -		if (ctx_conf) { -			ctx = container_of(ctx_conf, struct ieee80211_chanctx, -					   conf); -			drv_assign_vif_chanctx(local, sdata, ctx); -		} -		mutex_unlock(&local->chanctx_mtx); -	} +	if (sdata && ieee80211_sdata_running(sdata)) +		ieee80211_assign_chanctx(local, sdata);  	/* add STAs back */  	mutex_lock(&local->sta_mtx); @@ -1534,11 +1531,6 @@ int ieee80211_reconfig(struct ieee80211_local *local)  			  BSS_CHANGED_IDLE |  			  BSS_CHANGED_TXPOWER; -#ifdef CONFIG_PM -		if (local->resuming && !reconfig_due_to_wowlan) -			sdata->vif.bss_conf = sdata->suspend_bss_conf; -#endif -  		switch (sdata->vif.type) {  		case NL80211_IFTYPE_STATION:  			changed |= BSS_CHANGED_ASSOC | @@ -1678,28 +1670,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)  	mb();  	local->resuming = false; -	list_for_each_entry(sdata, &local->interfaces, list) { -		switch(sdata->vif.type) { -		case NL80211_IFTYPE_STATION: -			ieee80211_sta_restart(sdata); -			break; -		case NL80211_IFTYPE_ADHOC: -			ieee80211_ibss_restart(sdata); -			break; -		case NL80211_IFTYPE_MESH_POINT: -			ieee80211_mesh_restart(sdata); -			break; -		default: -			break; -		} -	} -  	mod_timer(&local->sta_cleanup, jiffies + 1); - -	mutex_lock(&local->sta_mtx); -	list_for_each_entry(sta, &local->sta_list, list) -		mesh_plink_restart(sta); -	mutex_unlock(&local->sta_mtx);  #else  	WARN_ON(1);  #endif  |