aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorLuis R. Rodriguez <rodrigue@qca.qualcomm.com>2011-12-07 11:20:07 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-12-16 09:30:42 -0500
commit061acaae76dfb760f4f3fddf0cde43915b7d673c (patch)
treed37eed5fb5cedaed30c325263f2be8f42550666d /net/wireless
parenta1910f9cad2b4b9cc0d5d326aa65632a23c16088 (diff)
cfg80211: allow following country IE power for custom regdom cards
By definition WIPHY_FLAG_STRICT_REGULATORY was intended to allow the wiphy to adjust itself to the country IE power information if the card had no regulatory data but we had no way to tell cfg80211 that if the card also had its own custom regulatory domain (these are typically custom world regulatory domains) that we want to follow the country IE's noted values for power for each channel. We add support for this and document it. This is not a critical fix but a performance optimization for cards with custom regulatory domains that associate to an AP with sends out country IEs with a higher EIRP than the one on the custom regulatory domain. In practice the only driver affected right now are the Atheros drivers as they are the only drivers using both WIPHY_FLAG_STRICT_REGULATORY and WIPHY_FLAG_CUSTOM_REGULATORY -- used on cards that have an Atheros world regulatory domain. Cards that have been programmed to follow a country specifically will not follow the country IE power. So although not a stable fix distributions should consider cherry picking this. Cc: compat@orbit-lab.org Cc: Paul Stewart <pstew@google.com> Cc: Rajkumar Manoharan <rmanohar@qca.qualcomm.com> Cc: Senthilkumar Balasubramanian <senthilb@qca.qualcomm.com> Reported-by: Rajkumar Manoharan <rmanohar@qca.qualcomm.com> Signed-off-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/reg.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 2f5b0505c95d..481caafc6ba5 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -873,10 +873,22 @@ static void handle_channel(struct wiphy *wiphy,
873 chan->flags = flags | bw_flags | map_regdom_flags(reg_rule->flags); 873 chan->flags = flags | bw_flags | map_regdom_flags(reg_rule->flags);
874 chan->max_antenna_gain = min(chan->orig_mag, 874 chan->max_antenna_gain = min(chan->orig_mag,
875 (int) MBI_TO_DBI(power_rule->max_antenna_gain)); 875 (int) MBI_TO_DBI(power_rule->max_antenna_gain));
876 if (chan->orig_mpwr) 876 if (chan->orig_mpwr) {
877 chan->max_power = min(chan->orig_mpwr, 877 /*
878 (int) MBM_TO_DBM(power_rule->max_eirp)); 878 * Devices that have their own custom regulatory domain
879 else 879 * but also use WIPHY_FLAG_STRICT_REGULATORY will follow the
880 * passed country IE power settings.
881 */
882 if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE &&
883 wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY &&
884 wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) {
885 chan->max_power =
886 MBM_TO_DBM(power_rule->max_eirp);
887 } else {
888 chan->max_power = min(chan->orig_mpwr,
889 (int) MBM_TO_DBM(power_rule->max_eirp));
890 }
891 } else
880 chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp); 892 chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
881} 893}
882 894