diff options
author | Luis R. Rodriguez <lrodriguez@atheros.com> | 2009-01-22 18:05:52 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 16:01:18 -0500 |
commit | f976376de0d6a9697fb635369f12ae00251f4566 (patch) | |
tree | 11e94926ba6da6ed420bce7c82276e705838dca5 /net/wireless/reg.c | |
parent | 716f9392e2b84cacc18cc11f7427cb98adeb1c3d (diff) |
cfg80211: Allow for strict regulatory settings
This allows drivers to request strict regulatory settings to
be applied to its devices. This is desirable for devices where
proper calibration and compliance can only be gauranteed for
for the device's programmed regulatory domain. Regulatory
domain settings will be ignored until the device's own
regulatory domain is properly configured. If no regulatory
domain is received only the world regulatory domain will be
applied -- if OLD_REG (default to "US") is not enabled. If
OLD_REG behaviour is not acceptable to drivers they must
update their wiphy with a custom reuglatory prior to wiphy
registration.
Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r-- | net/wireless/reg.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index cad4daadba0d..89e0d8b3cf1e 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -867,6 +867,22 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band, | |||
867 | 867 | ||
868 | power_rule = ®_rule->power_rule; | 868 | power_rule = ®_rule->power_rule; |
869 | 869 | ||
870 | if (last_request->initiator == REGDOM_SET_BY_DRIVER && | ||
871 | last_request->wiphy && last_request->wiphy == wiphy && | ||
872 | last_request->wiphy->strict_regulatory) { | ||
873 | /* This gaurantees the driver's requested regulatory domain | ||
874 | * will always be used as a base for further regulatory | ||
875 | * settings */ | ||
876 | chan->flags = chan->orig_flags = | ||
877 | map_regdom_flags(reg_rule->flags); | ||
878 | chan->max_antenna_gain = chan->orig_mag = | ||
879 | (int) MBI_TO_DBI(power_rule->max_antenna_gain); | ||
880 | chan->max_bandwidth = KHZ_TO_MHZ(max_bandwidth); | ||
881 | chan->max_power = chan->orig_mpwr = | ||
882 | (int) MBM_TO_DBM(power_rule->max_eirp); | ||
883 | return; | ||
884 | } | ||
885 | |||
870 | chan->flags = flags | map_regdom_flags(reg_rule->flags); | 886 | chan->flags = flags | map_regdom_flags(reg_rule->flags); |
871 | chan->max_antenna_gain = min(chan->orig_mag, | 887 | chan->max_antenna_gain = min(chan->orig_mag, |
872 | (int) MBI_TO_DBI(power_rule->max_antenna_gain)); | 888 | (int) MBI_TO_DBI(power_rule->max_antenna_gain)); |
@@ -897,6 +913,11 @@ static bool ignore_reg_update(struct wiphy *wiphy, enum reg_set_by setby) | |||
897 | if (setby == REGDOM_SET_BY_CORE && | 913 | if (setby == REGDOM_SET_BY_CORE && |
898 | wiphy->custom_regulatory) | 914 | wiphy->custom_regulatory) |
899 | return true; | 915 | return true; |
916 | /* wiphy->regd will be set once the device has its own | ||
917 | * desired regulatory domain set */ | ||
918 | if (wiphy->strict_regulatory && !wiphy->regd && | ||
919 | !is_world_regdom(last_request->alpha2)) | ||
920 | return true; | ||
900 | return false; | 921 | return false; |
901 | } | 922 | } |
902 | 923 | ||
@@ -1155,10 +1176,15 @@ new_request: | |||
1155 | 1176 | ||
1156 | void regulatory_hint(struct wiphy *wiphy, const char *alpha2) | 1177 | void regulatory_hint(struct wiphy *wiphy, const char *alpha2) |
1157 | { | 1178 | { |
1179 | int r; | ||
1158 | BUG_ON(!alpha2); | 1180 | BUG_ON(!alpha2); |
1159 | 1181 | ||
1160 | mutex_lock(&cfg80211_drv_mutex); | 1182 | mutex_lock(&cfg80211_drv_mutex); |
1161 | __regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER, alpha2, 0, ENVIRON_ANY); | 1183 | r = __regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER, |
1184 | alpha2, 0, ENVIRON_ANY); | ||
1185 | /* This is required so that the orig_* parameters are saved */ | ||
1186 | if (r == -EALREADY && wiphy->strict_regulatory) | ||
1187 | wiphy_update_regulatory(wiphy, REGDOM_SET_BY_DRIVER); | ||
1162 | mutex_unlock(&cfg80211_drv_mutex); | 1188 | mutex_unlock(&cfg80211_drv_mutex); |
1163 | } | 1189 | } |
1164 | EXPORT_SYMBOL(regulatory_hint); | 1190 | EXPORT_SYMBOL(regulatory_hint); |