summaryrefslogtreecommitdiff
path: root/package/kernel/mac80211/patches
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-04-08 22:11:23 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-04-08 22:11:23 +0000
commit26b8bb615005ccd520ba2014534e6db5c0d5017b (patch)
tree8b568d88b2ac7b9dbc80a4aa0d1969e592e6ae1f /package/kernel/mac80211/patches
parentfe2c9b4e1dc0434ac1b7385c5eb2e024070c7a3d (diff)
downloadmtk-20170518-26b8bb615005ccd520ba2014534e6db5c0d5017b.zip
mtk-20170518-26b8bb615005ccd520ba2014534e6db5c0d5017b.tar.gz
mtk-20170518-26b8bb615005ccd520ba2014534e6db5c0d5017b.tar.bz2
mac80211: fix user antenna gain calculation
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40429
Diffstat (limited to 'package/kernel/mac80211/patches')
-rw-r--r--package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch20
1 files changed, 5 insertions, 15 deletions
diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
index f131f56..c94c1e1 100644
--- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
+++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch
@@ -102,34 +102,24 @@
struct cfg80211_chan_def chandef = {};
u32 changed = 0;
- int power;
-+ int power, ant_gain, max_power;
++ int power, max_power;
u32 offchannel_flag;
offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
-@@ -156,8 +156,21 @@ static u32 ieee80211_hw_conf_chan(struct
+@@ -156,6 +156,12 @@ static u32 ieee80211_hw_conf_chan(struct
}
rcu_read_unlock();
-- if (local->hw.conf.power_level != power) {
+ max_power = chandef.chan->max_reg_power;
-+ ant_gain = chandef.chan->max_antenna_gain;
+ if (local->user_antenna_gain > 0) {
-+ if (local->user_antenna_gain > ant_gain) {
-+ max_power -= local->user_antenna_gain - ant_gain;
-+ ant_gain = 0;
-+ } else
-+ ant_gain -= local->user_antenna_gain;
++ max_power -= local->user_antenna_gain;
+ power = min(power, max_power);
+ }
+
-+ if (local->hw.conf.power_level != power ||
-+ local->hw.conf.max_antenna_gain != ant_gain) {
+ if (local->hw.conf.power_level != power) {
changed |= IEEE80211_CONF_CHANGE_POWER;
-+ local->hw.conf.max_antenna_gain = ant_gain;
local->hw.cur_power_level = power;
- local->hw.conf.power_level = power;
- }
-@@ -584,6 +597,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(
+@@ -584,6 +590,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(
IEEE80211_RADIOTAP_MCS_HAVE_BW;
local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;