Changeset 40429


Ignore:
Timestamp:
2014-04-09T00:11:23+02:00 (4 years ago)
Author:
nbd
Message:

mac80211: fix user antenna gain calculation

Signed-off-by: Felix Fietkau <nbd@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch

    r40393 r40429  
    103103        u32 changed = 0; 
    104104-       int power; 
    105 +       int power, ant_gain, max_power; 
     105+       int power, max_power; 
    106106        u32 offchannel_flag; 
    107107  
    108108        offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; 
    109 @@ -156,8 +156,21 @@ static u32 ieee80211_hw_conf_chan(struct 
     109@@ -156,6 +156,12 @@ static u32 ieee80211_hw_conf_chan(struct 
    110110        } 
    111111        rcu_read_unlock(); 
    112112  
    113 -       if (local->hw.conf.power_level != power) { 
    114113+       max_power = chandef.chan->max_reg_power; 
    115 +       ant_gain = chandef.chan->max_antenna_gain; 
    116114+       if (local->user_antenna_gain > 0) { 
    117 +               if (local->user_antenna_gain > ant_gain) { 
    118 +                       max_power -= local->user_antenna_gain - ant_gain; 
    119 +                       ant_gain = 0; 
    120 +               } else 
    121 +                       ant_gain -= local->user_antenna_gain; 
     115+               max_power -= local->user_antenna_gain; 
    122116+               power = min(power, max_power); 
    123117+       } 
    124118+ 
    125 +       if (local->hw.conf.power_level != power || 
    126 +           local->hw.conf.max_antenna_gain != ant_gain) { 
     119        if (local->hw.conf.power_level != power) { 
    127120                changed |= IEEE80211_CONF_CHANGE_POWER; 
    128 +               local->hw.conf.max_antenna_gain = ant_gain; 
    129121                local->hw.cur_power_level = power; 
    130                 local->hw.conf.power_level = power; 
    131         } 
    132 @@ -584,6 +597,7 @@ struct ieee80211_hw *ieee80211_alloc_hw( 
     122@@ -584,6 +590,7 @@ struct ieee80211_hw *ieee80211_alloc_hw( 
    133123                                         IEEE80211_RADIOTAP_MCS_HAVE_BW; 
    134124        local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | 
Note: See TracChangeset for help on using the changeset viewer.