diff mbox series

mac80211: fix user-power when emulating chanctx

Message ID 20241010203954.1219686-1-greearb@candelatech.com (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series mac80211: fix user-power when emulating chanctx | expand

Commit Message

Ben Greear Oct. 10, 2024, 8:39 p.m. UTC
From: Ben Greear <greearb@candelatech.com>

ieee80211_calc_hw_conf_chan was ignoring the configured
user_txpower.  If it is set, use it to potentially decrease
txpower as requested.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 net/mac80211/main.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index bac640310d86..ca20d08a9d21 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -167,6 +167,8 @@  static u32 ieee80211_calc_hw_conf_chan(struct ieee80211_local *local,
 	}
 
 	power = ieee80211_chandef_max_power(&chandef);
+	if (local->user_power_level != IEEE80211_UNSET_POWER_LEVEL)
+		power = min(local->user_power_level, power);
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(sdata, &local->interfaces, list) {