aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis R. Rodriguez <mcgrof@do-not-panic.com>2013-11-11 16:15:30 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-11-25 14:51:49 -0500
commita09a85a013523a8b572dc5732b5c30e0785195f3 (patch)
tree19c69de381b4b7649ec8606cdea872632d969334
parenta2f73b6c5db3c272d87eaebb5bed355d75a0f25f (diff)
cfg80211: add flags to define country IE processing rules
802.11 cards may have different country IE parsing behavioural preferences and vendors may want to support these. These preferences were managed by the REGULATORY_CUSTOM_REG and the REGULATORY_STRICT_REG flags and their combination. Instead of using this existing notation, split out the country IE behavioural preferences as a new flag. This will allow us to add more customizations easily and make the code more maintainable. Cc: Mihir Shete <smihir@qti.qualcomm.com> Cc: Henri Bahini <hbahini@qca.qualcomm.com> Cc: Tushnim Bhattacharyya <tushnimb@qca.qualcomm.com> Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com> [fix up conflicts] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/ath/regd.c3
-rw-r--r--include/net/regulatory.h36
-rw-r--r--net/wireless/reg.c8
3 files changed, 29 insertions, 18 deletions
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c
index aba782cd09a2..bef5539192c6 100644
--- a/drivers/net/wireless/ath/regd.c
+++ b/drivers/net/wireless/ath/regd.c
@@ -609,7 +609,8 @@ ath_regd_init_wiphy(struct ath_regulatory *reg,
609 * saved on the wiphy orig_* parameters 609 * saved on the wiphy orig_* parameters
610 */ 610 */
611 regd = ath_world_regdomain(reg); 611 regd = ath_world_regdomain(reg);
612 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; 612 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG |
613 REGULATORY_COUNTRY_IE_FOLLOW_POWER;
613 } else { 614 } else {
614 /* 615 /*
615 * This gets applied in the case of the absence of CRDA, 616 * This gets applied in the case of the absence of CRDA,
diff --git a/include/net/regulatory.h b/include/net/regulatory.h
index a6a20e2a54c4..b03ddee3341d 100644
--- a/include/net/regulatory.h
+++ b/include/net/regulatory.h
@@ -96,27 +96,39 @@ struct regulatory_request {
96 * initiator is %REGDOM_SET_BY_CORE). Drivers that use 96 * initiator is %REGDOM_SET_BY_CORE). Drivers that use
97 * wiphy_apply_custom_regulatory() should have this flag set 97 * wiphy_apply_custom_regulatory() should have this flag set
98 * or the regulatory core will set it for the wiphy. 98 * or the regulatory core will set it for the wiphy.
99 * @REGULATORY_STRICT_REG: tells us the driver for this device will 99 * @REGULATORY_STRICT_REG: tells us that the wiphy for this device
100 * ignore regulatory domain settings until it gets its own regulatory 100 * has regulatory domain that it wishes to be considered as the
101 * domain via its regulatory_hint() unless the regulatory hint is 101 * superset for regulatory rules. After this device gets its regulatory
102 * from a country IE. After its gets its own regulatory domain it will 102 * domain programmed further regulatory hints shall only be considered
103 * only allow further regulatory domain settings to further enhance 103 * for this device to enhance regulatory compliance, forcing the
104 * compliance. For example if channel 13 and 14 are disabled by this 104 * device to only possibly use subsets of the original regulatory
105 * regulatory domain no user regulatory domain can enable these channels 105 * rules. For example if channel 13 and 14 are disabled by this
106 * at a later time. This can be used for devices which do not have 106 * device's regulatory domain no user specified regulatory hint which
107 * calibration information guaranteed for frequencies or settings 107 * has these channels enabled would enable them for this wiphy,
108 * outside of its regulatory domain. If used in combination with 108 * the device's original regulatory domain will be trusted as the
109 * REGULATORY_FLAG_CUSTOM_REG the inspected country IE power settings 109 * base. You can program the superset of regulatory rules for this
110 * will be followed. 110 * wiphy with regulatory_hint() for cards programmed with an
111 * ISO3166-alpha2 country code. wiphys that use regulatory_hint()
112 * will have their wiphy->regd programmed once the regulatory
113 * domain is set, and all other regulatory hints will be ignored
114 * until their own regulatory domain gets programmed.
111 * @REGULATORY_DISABLE_BEACON_HINTS: enable this if your driver needs to 115 * @REGULATORY_DISABLE_BEACON_HINTS: enable this if your driver needs to
112 * ensure that passive scan flags and beaconing flags may not be lifted by 116 * ensure that passive scan flags and beaconing flags may not be lifted by
113 * cfg80211 due to regulatory beacon hints. For more information on beacon 117 * cfg80211 due to regulatory beacon hints. For more information on beacon
114 * hints read the documenation for regulatory_hint_found_beacon() 118 * hints read the documenation for regulatory_hint_found_beacon()
119 * @REGULATORY_COUNTRY_IE_FOLLOW_POWER: for devices that have a preference
120 * that even though they may have programmed their own custom power
121 * setting prior to wiphy registration, they want to ensure their channel
122 * power settings are updated for this connection with the power settings
123 * derived from the regulatory domain. The regulatory domain used will be
124 * based on the ISO3166-alpha2 from country IE provided through
125 * regulatory_hint_country_ie()
115 */ 126 */
116enum ieee80211_regulatory_flags { 127enum ieee80211_regulatory_flags {
117 REGULATORY_CUSTOM_REG = BIT(0), 128 REGULATORY_CUSTOM_REG = BIT(0),
118 REGULATORY_STRICT_REG = BIT(1), 129 REGULATORY_STRICT_REG = BIT(1),
119 REGULATORY_DISABLE_BEACON_HINTS = BIT(2), 130 REGULATORY_DISABLE_BEACON_HINTS = BIT(2),
131 REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(3),
120}; 132};
121 133
122struct ieee80211_freq_range { 134struct ieee80211_freq_range {
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index e44b4bb20b92..6b3051f6a8a7 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -921,13 +921,11 @@ static void handle_channel(struct wiphy *wiphy,
921 chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp); 921 chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp);
922 if (chan->orig_mpwr) { 922 if (chan->orig_mpwr) {
923 /* 923 /*
924 * Devices that have their own custom regulatory domain 924 * Devices that use REGULATORY_COUNTRY_IE_FOLLOW_POWER
925 * but also use REGULATORY_STRICT_REG will follow the 925 * will always follow the passed country IE power settings.
926 * passed country IE power settings.
927 */ 926 */
928 if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE && 927 if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE &&
929 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG && 928 wiphy->regulatory_flags & REGULATORY_COUNTRY_IE_FOLLOW_POWER)
930 wiphy->regulatory_flags & REGULATORY_STRICT_REG)
931 chan->max_power = chan->max_reg_power; 929 chan->max_power = chan->max_reg_power;
932 else 930 else
933 chan->max_power = min(chan->orig_mpwr, 931 chan->max_power = min(chan->orig_mpwr,