diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 818aa0060349..ca513e94be9e 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c @@ -2415,6 +2415,8 @@ static int ieee80211_set_tx_power(struct wiphy *wiphy, bool update_txp_type = false; bool has_monitor = false; + printk("%s mbm %d\n", __func__, mbm); + if (wdev) { sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 3a0171a65db3..022874bf49f3 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c @@ -49,19 +49,23 @@ static void ieee80211_iface_work(struct work_struct *work); bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata) { + struct ieee80211_local *local = sdata->local; struct ieee80211_chanctx_conf *chanctx_conf; int power; - rcu_read_lock(); - chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); - if (!chanctx_conf) { + if (local->use_chanctx) { + rcu_read_lock(); + chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); + if (!chanctx_conf) { + rcu_read_unlock(); + return false; + } + power = ieee80211_chandef_max_power(&chanctx_conf->def); rcu_read_unlock(); - return false; + } else { + power = ieee80211_chandef_max_power(&local->hw.conf.chandef); } - power = ieee80211_chandef_max_power(&chanctx_conf->def); - rcu_read_unlock(); - if (sdata->user_power_level != IEEE80211_UNSET_POWER_LEVEL) power = min(power, sdata->user_power_level); diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 7b8320d4a8e4..6005c5e09be6 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -144,10 +144,14 @@ static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local) rcu_read_lock(); list_for_each_entry_rcu(sdata, &local->interfaces, list) { - if (!rcu_access_pointer(sdata->vif.chanctx_conf)) - continue; if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) continue; + if (sdata->user_power_level != IEEE80211_UNSET_POWER_LEVEL) + power = min(power, sdata->user_power_level); + if (sdata->ap_power_level != IEEE80211_UNSET_POWER_LEVEL) + power = min(power, sdata->ap_power_level); + if (!rcu_access_pointer(sdata->vif.chanctx_conf)) + continue; power = min(power, sdata->vif.bss_conf.txpower); } rcu_read_unlock();