• Johannes Berg's avatar
    mac80211: handle power constraint/country IE better · 04b7b2ff
    Johannes Berg authored
    
    
    Currently, mac80211 uses the power constraint IE, and reduces
    the regulatory max TX power by it. This can cause issues if
    the AP is advertising a large power constraint value matching
    a high TX power in its country IE, for example in this case:
    
    ...
    Country: US  Environment: Indoor/Outdoor
        ...
        Channels [157 - 157] @ 30 dBm
        ...
    Power constraint: 13 dB
    ...
    
    What happened here is that our local regulatory TX power is
    15 dBm, and gets reduced by 13 dB so we end up with only
    2 dBm effective TX power, which is way too low.
    
    Instead, handle the country IE/power constraint IE combined
    and restrict our TX power to the max of the regulatory power
    and the maximum power advertised by the AP, in this case
    17 dBm (= 30 dBm - 13 dB).
    
    Also print a message when this happens to let the user know
    and help us debug issues with it.
    Reported-by: default avatarCarl A. Cook <CACook@quantum-equities.com>
    Tested-by: default avatarCarl A. Cook <CACook@quantum-equities.com>
    Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
    04b7b2ff