| 1 | --- a/include/net/mac80211.h |
| 2 | +++ b/include/net/mac80211.h |
| 3 | @@ -1508,6 +1508,7 @@ struct ieee80211_hw { |
| 4 | u8 max_tx_aggregation_subframes; |
| 5 | u8 offchannel_tx_hw_queue; |
| 6 | u8 radiotap_mcs_details; |
| 7 | + s8 cur_power_level; |
| 8 | u16 radiotap_vht_details; |
| 9 | netdev_features_t netdev_features; |
| 10 | }; |
| 11 | --- a/net/mac80211/cfg.c |
| 12 | +++ b/net/mac80211/cfg.c |
| 13 | @@ -2105,7 +2105,9 @@ static int ieee80211_get_tx_power(struct |
| 14 | struct ieee80211_local *local = wiphy_priv(wiphy); |
| 15 | struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); |
| 16 | |
| 17 | - if (!local->use_chanctx) |
| 18 | + if (local->hw.cur_power_level) |
| 19 | + *dbm = local->hw.cur_power_level; |
| 20 | + else if (!local->use_chanctx) |
| 21 | *dbm = local->hw.conf.power_level; |
| 22 | else |
| 23 | *dbm = sdata->vif.bss_conf.txpower; |
| 24 | --- a/net/mac80211/main.c |
| 25 | +++ b/net/mac80211/main.c |
| 26 | @@ -167,6 +167,7 @@ static u32 ieee80211_hw_conf_chan(struct |
| 27 | |
| 28 | if (local->hw.conf.power_level != power) { |
| 29 | changed |= IEEE80211_CONF_CHANGE_POWER; |
| 30 | + local->hw.cur_power_level = power; |
| 31 | local->hw.conf.power_level = power; |
| 32 | } |
| 33 | |
| 34 | |