diff options
-rw-r--r-- | drivers/net/wireless/ath9k/main.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/regd.c | 31 | ||||
-rw-r--r-- | drivers/net/wireless/ath9k/regd.h | 3 | ||||
-rw-r--r-- | include/linux/nl80211.h | 19 | ||||
-rw-r--r-- | include/net/cfg80211.h | 24 | ||||
-rw-r--r-- | net/wireless/core.c | 2 | ||||
-rw-r--r-- | net/wireless/core.h | 3 | ||||
-rw-r--r-- | net/wireless/reg.c | 82 |
8 files changed, 90 insertions, 76 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c index 1d6b05c0d800..e9b3f365f099 100644 --- a/drivers/net/wireless/ath9k/main.c +++ b/drivers/net/wireless/ath9k/main.c | |||
@@ -1670,7 +1670,7 @@ int ath_attach(u16 devid, struct ath_softc *sc) | |||
1670 | } | 1670 | } |
1671 | wiphy_apply_custom_regulatory(hw->wiphy, regd); | 1671 | wiphy_apply_custom_regulatory(hw->wiphy, regd); |
1672 | ath9k_reg_apply_radar_flags(hw->wiphy); | 1672 | ath9k_reg_apply_radar_flags(hw->wiphy); |
1673 | ath9k_reg_apply_world_flags(hw->wiphy, REGDOM_SET_BY_DRIVER); | 1673 | ath9k_reg_apply_world_flags(hw->wiphy, NL80211_REGDOM_SET_BY_DRIVER); |
1674 | 1674 | ||
1675 | INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work); | 1675 | INIT_WORK(&sc->chan_work, ath9k_wiphy_chan_work); |
1676 | INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work); | 1676 | INIT_DELAYED_WORK(&sc->wiphy_work, ath9k_wiphy_work); |
diff --git a/drivers/net/wireless/ath9k/regd.c b/drivers/net/wireless/ath9k/regd.c index ff0afc02f3ce..b8f9b6d6bec4 100644 --- a/drivers/net/wireless/ath9k/regd.c +++ b/drivers/net/wireless/ath9k/regd.c | |||
@@ -168,8 +168,9 @@ static bool ath9k_is_radar_freq(u16 center_freq) | |||
168 | * received a beacon on a channel we can enable active scan and | 168 | * received a beacon on a channel we can enable active scan and |
169 | * adhoc (or beaconing). | 169 | * adhoc (or beaconing). |
170 | */ | 170 | */ |
171 | static void ath9k_reg_apply_beaconing_flags(struct wiphy *wiphy, | 171 | static void ath9k_reg_apply_beaconing_flags( |
172 | enum reg_set_by setby) | 172 | struct wiphy *wiphy, |
173 | enum nl80211_reg_initiator initiator) | ||
173 | { | 174 | { |
174 | enum ieee80211_band band; | 175 | enum ieee80211_band band; |
175 | struct ieee80211_supported_band *sband; | 176 | struct ieee80211_supported_band *sband; |
@@ -194,7 +195,7 @@ static void ath9k_reg_apply_beaconing_flags(struct wiphy *wiphy, | |||
194 | (ch->flags & IEEE80211_CHAN_RADAR)) | 195 | (ch->flags & IEEE80211_CHAN_RADAR)) |
195 | continue; | 196 | continue; |
196 | 197 | ||
197 | if (setby == REGDOM_SET_BY_COUNTRY_IE) { | 198 | if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) { |
198 | r = freq_reg_info(wiphy, ch->center_freq, | 199 | r = freq_reg_info(wiphy, ch->center_freq, |
199 | &bandwidth, ®_rule); | 200 | &bandwidth, ®_rule); |
200 | if (r) | 201 | if (r) |
@@ -226,8 +227,9 @@ static void ath9k_reg_apply_beaconing_flags(struct wiphy *wiphy, | |||
226 | } | 227 | } |
227 | 228 | ||
228 | /* Allows active scan scan on Ch 12 and 13 */ | 229 | /* Allows active scan scan on Ch 12 and 13 */ |
229 | static void ath9k_reg_apply_active_scan_flags(struct wiphy *wiphy, | 230 | static void ath9k_reg_apply_active_scan_flags( |
230 | enum reg_set_by setby) | 231 | struct wiphy *wiphy, |
232 | enum nl80211_reg_initiator initiator) | ||
231 | { | 233 | { |
232 | struct ieee80211_supported_band *sband; | 234 | struct ieee80211_supported_band *sband; |
233 | struct ieee80211_channel *ch; | 235 | struct ieee80211_channel *ch; |
@@ -241,7 +243,7 @@ static void ath9k_reg_apply_active_scan_flags(struct wiphy *wiphy, | |||
241 | * If no country IE has been received always enable active scan | 243 | * If no country IE has been received always enable active scan |
242 | * on these channels. This is only done for specific regulatory SKUs | 244 | * on these channels. This is only done for specific regulatory SKUs |
243 | */ | 245 | */ |
244 | if (setby != REGDOM_SET_BY_COUNTRY_IE) { | 246 | if (initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE) { |
245 | ch = &sband->channels[11]; /* CH 12 */ | 247 | ch = &sband->channels[11]; /* CH 12 */ |
246 | if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) | 248 | if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN) |
247 | ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; | 249 | ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN; |
@@ -308,7 +310,8 @@ void ath9k_reg_apply_radar_flags(struct wiphy *wiphy) | |||
308 | } | 310 | } |
309 | } | 311 | } |
310 | 312 | ||
311 | void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby) | 313 | void ath9k_reg_apply_world_flags(struct wiphy *wiphy, |
314 | enum nl80211_reg_initiator initiator) | ||
312 | { | 315 | { |
313 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); | 316 | struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy); |
314 | struct ath_wiphy *aphy = hw->priv; | 317 | struct ath_wiphy *aphy = hw->priv; |
@@ -320,11 +323,11 @@ void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby) | |||
320 | case 0x63: | 323 | case 0x63: |
321 | case 0x66: | 324 | case 0x66: |
322 | case 0x67: | 325 | case 0x67: |
323 | ath9k_reg_apply_beaconing_flags(wiphy, setby); | 326 | ath9k_reg_apply_beaconing_flags(wiphy, initiator); |
324 | break; | 327 | break; |
325 | case 0x68: | 328 | case 0x68: |
326 | ath9k_reg_apply_beaconing_flags(wiphy, setby); | 329 | ath9k_reg_apply_beaconing_flags(wiphy, initiator); |
327 | ath9k_reg_apply_active_scan_flags(wiphy, setby); | 330 | ath9k_reg_apply_active_scan_flags(wiphy, initiator); |
328 | break; | 331 | break; |
329 | } | 332 | } |
330 | return; | 333 | return; |
@@ -340,11 +343,11 @@ int ath9k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request) | |||
340 | ath9k_reg_apply_radar_flags(wiphy); | 343 | ath9k_reg_apply_radar_flags(wiphy); |
341 | 344 | ||
342 | switch (request->initiator) { | 345 | switch (request->initiator) { |
343 | case REGDOM_SET_BY_DRIVER: | 346 | case NL80211_REGDOM_SET_BY_DRIVER: |
344 | case REGDOM_SET_BY_CORE: | 347 | case NL80211_REGDOM_SET_BY_CORE: |
345 | case REGDOM_SET_BY_USER: | 348 | case NL80211_REGDOM_SET_BY_USER: |
346 | break; | 349 | break; |
347 | case REGDOM_SET_BY_COUNTRY_IE: | 350 | case NL80211_REGDOM_SET_BY_COUNTRY_IE: |
348 | if (ath9k_is_world_regd(sc->sc_ah)) | 351 | if (ath9k_is_world_regd(sc->sc_ah)) |
349 | ath9k_reg_apply_world_flags(wiphy, request->initiator); | 352 | ath9k_reg_apply_world_flags(wiphy, request->initiator); |
350 | break; | 353 | break; |
diff --git a/drivers/net/wireless/ath9k/regd.h b/drivers/net/wireless/ath9k/regd.h index d48160d0c0e9..8f885f3bc8df 100644 --- a/drivers/net/wireless/ath9k/regd.h +++ b/drivers/net/wireless/ath9k/regd.h | |||
@@ -236,7 +236,8 @@ enum CountryCode { | |||
236 | bool ath9k_is_world_regd(struct ath_hw *ah); | 236 | bool ath9k_is_world_regd(struct ath_hw *ah); |
237 | const struct ieee80211_regdomain *ath9k_world_regdomain(struct ath_hw *ah); | 237 | const struct ieee80211_regdomain *ath9k_world_regdomain(struct ath_hw *ah); |
238 | const struct ieee80211_regdomain *ath9k_default_world_regdomain(void); | 238 | const struct ieee80211_regdomain *ath9k_default_world_regdomain(void); |
239 | void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby); | 239 | void ath9k_reg_apply_world_flags(struct wiphy *wiphy, |
240 | enum nl80211_reg_initiator initiator); | ||
240 | void ath9k_reg_apply_radar_flags(struct wiphy *wiphy); | 241 | void ath9k_reg_apply_radar_flags(struct wiphy *wiphy); |
241 | int ath9k_regd_init(struct ath_hw *ah); | 242 | int ath9k_regd_init(struct ath_hw *ah); |
242 | bool ath9k_regd_is_eeprom_valid(struct ath_hw *ah); | 243 | bool ath9k_regd_is_eeprom_valid(struct ath_hw *ah); |
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index f6e56370ea65..c0fd432b57dc 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -673,6 +673,25 @@ enum nl80211_bitrate_attr { | |||
673 | }; | 673 | }; |
674 | 674 | ||
675 | /** | 675 | /** |
676 | * enum nl80211_initiator - Indicates the initiator of a reg domain request | ||
677 | * @NL80211_REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world | ||
678 | * regulatory domain. | ||
679 | * @NL80211_REGDOM_SET_BY_USER: User asked the wireless core to set the | ||
680 | * regulatory domain. | ||
681 | * @NL80211_REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the | ||
682 | * wireless core it thinks its knows the regulatory domain we should be in. | ||
683 | * @NL80211_REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an | ||
684 | * 802.11 country information element with regulatory information it | ||
685 | * thinks we should consider. | ||
686 | */ | ||
687 | enum nl80211_reg_initiator { | ||
688 | NL80211_REGDOM_SET_BY_CORE, | ||
689 | NL80211_REGDOM_SET_BY_USER, | ||
690 | NL80211_REGDOM_SET_BY_DRIVER, | ||
691 | NL80211_REGDOM_SET_BY_COUNTRY_IE, | ||
692 | }; | ||
693 | |||
694 | /** | ||
676 | * enum nl80211_reg_rule_attr - regulatory rule attributes | 695 | * enum nl80211_reg_rule_attr - regulatory rule attributes |
677 | * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional | 696 | * @NL80211_ATTR_REG_RULE_FLAGS: a set of flags which specify additional |
678 | * considerations for a given frequency range. These are the | 697 | * considerations for a given frequency range. These are the |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index f195ea460811..50f3fd9ff524 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -349,27 +349,9 @@ struct bss_parameters { | |||
349 | }; | 349 | }; |
350 | 350 | ||
351 | /** | 351 | /** |
352 | * enum reg_set_by - Indicates who is trying to set the regulatory domain | ||
353 | * @REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world regulatory domain. | ||
354 | * @REGDOM_SET_BY_USER: User asked the wireless core to set the | ||
355 | * regulatory domain. | ||
356 | * @REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the wireless core | ||
357 | * it thinks its knows the regulatory domain we should be in. | ||
358 | * @REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an 802.11 country | ||
359 | * information element with regulatory information it thinks we | ||
360 | * should consider. | ||
361 | */ | ||
362 | enum reg_set_by { | ||
363 | REGDOM_SET_BY_CORE, | ||
364 | REGDOM_SET_BY_USER, | ||
365 | REGDOM_SET_BY_DRIVER, | ||
366 | REGDOM_SET_BY_COUNTRY_IE, | ||
367 | }; | ||
368 | |||
369 | /** | ||
370 | * enum environment_cap - Environment parsed from country IE | 352 | * enum environment_cap - Environment parsed from country IE |
371 | * @ENVIRON_ANY: indicates country IE applies to both indoor and | 353 | * @ENVIRON_ANY: indicates country IE applies to both indoor and |
372 | * outdoor operation. | 354 | * outdoor operation. |
373 | * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation | 355 | * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation |
374 | * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation | 356 | * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation |
375 | */ | 357 | */ |
@@ -388,7 +370,7 @@ enum environment_cap { | |||
388 | * and potentially inform users of which devices specifically | 370 | * and potentially inform users of which devices specifically |
389 | * cased the conflicts. | 371 | * cased the conflicts. |
390 | * @initiator: indicates who sent this request, could be any of | 372 | * @initiator: indicates who sent this request, could be any of |
391 | * of those set in reg_set_by, %REGDOM_SET_BY_* | 373 | * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*) |
392 | * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested | 374 | * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested |
393 | * regulatory domain. We have a few special codes: | 375 | * regulatory domain. We have a few special codes: |
394 | * 00 - World regulatory domain | 376 | * 00 - World regulatory domain |
@@ -405,7 +387,7 @@ enum environment_cap { | |||
405 | */ | 387 | */ |
406 | struct regulatory_request { | 388 | struct regulatory_request { |
407 | int wiphy_idx; | 389 | int wiphy_idx; |
408 | enum reg_set_by initiator; | 390 | enum nl80211_reg_initiator initiator; |
409 | char alpha2[2]; | 391 | char alpha2[2]; |
410 | bool intersect; | 392 | bool intersect; |
411 | u32 country_ie_checksum; | 393 | u32 country_ie_checksum; |
diff --git a/net/wireless/core.c b/net/wireless/core.c index dd7f222919fe..c939f5ee065e 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -350,7 +350,7 @@ int wiphy_register(struct wiphy *wiphy) | |||
350 | mutex_lock(&cfg80211_mutex); | 350 | mutex_lock(&cfg80211_mutex); |
351 | 351 | ||
352 | /* set up regulatory info */ | 352 | /* set up regulatory info */ |
353 | wiphy_update_regulatory(wiphy, REGDOM_SET_BY_CORE); | 353 | wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE); |
354 | 354 | ||
355 | res = device_add(&drv->wiphy.dev); | 355 | res = device_add(&drv->wiphy.dev); |
356 | if (res) | 356 | if (res) |
diff --git a/net/wireless/core.h b/net/wireless/core.h index f6c53f5807f4..6acd483a61f8 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -136,7 +136,8 @@ extern int cfg80211_dev_rename(struct cfg80211_registered_device *drv, | |||
136 | char *newname); | 136 | char *newname); |
137 | 137 | ||
138 | void ieee80211_set_bitrate_flags(struct wiphy *wiphy); | 138 | void ieee80211_set_bitrate_flags(struct wiphy *wiphy); |
139 | void wiphy_update_regulatory(struct wiphy *wiphy, enum reg_set_by setby); | 139 | void wiphy_update_regulatory(struct wiphy *wiphy, |
140 | enum nl80211_reg_initiator setby); | ||
140 | 141 | ||
141 | void cfg80211_bss_expire(struct cfg80211_registered_device *dev); | 142 | void cfg80211_bss_expire(struct cfg80211_registered_device *dev); |
142 | void cfg80211_bss_age(struct cfg80211_registered_device *dev, | 143 | void cfg80211_bss_age(struct cfg80211_registered_device *dev, |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 47ff44751b70..68fde6d33dc3 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -857,8 +857,8 @@ static int freq_reg_info_regd(struct wiphy *wiphy, | |||
857 | * Follow the driver's regulatory domain, if present, unless a country | 857 | * Follow the driver's regulatory domain, if present, unless a country |
858 | * IE has been processed or a user wants to help complaince further | 858 | * IE has been processed or a user wants to help complaince further |
859 | */ | 859 | */ |
860 | if (last_request->initiator != REGDOM_SET_BY_COUNTRY_IE && | 860 | if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && |
861 | last_request->initiator != REGDOM_SET_BY_USER && | 861 | last_request->initiator != NL80211_REGDOM_SET_BY_USER && |
862 | wiphy->regd) | 862 | wiphy->regd) |
863 | regd = wiphy->regd; | 863 | regd = wiphy->regd; |
864 | 864 | ||
@@ -943,7 +943,8 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band, | |||
943 | * http://tinyurl.com/11d-clarification | 943 | * http://tinyurl.com/11d-clarification |
944 | */ | 944 | */ |
945 | if (r == -ERANGE && | 945 | if (r == -ERANGE && |
946 | last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) { | 946 | last_request->initiator == |
947 | NL80211_REGDOM_SET_BY_COUNTRY_IE) { | ||
947 | #ifdef CONFIG_CFG80211_REG_DEBUG | 948 | #ifdef CONFIG_CFG80211_REG_DEBUG |
948 | printk(KERN_DEBUG "cfg80211: Leaving channel %d MHz " | 949 | printk(KERN_DEBUG "cfg80211: Leaving channel %d MHz " |
949 | "intact on %s - no rule found in band on " | 950 | "intact on %s - no rule found in band on " |
@@ -956,7 +957,8 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band, | |||
956 | * for the band so we respect its band definitions | 957 | * for the band so we respect its band definitions |
957 | */ | 958 | */ |
958 | #ifdef CONFIG_CFG80211_REG_DEBUG | 959 | #ifdef CONFIG_CFG80211_REG_DEBUG |
959 | if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) | 960 | if (last_request->initiator == |
961 | NL80211_REGDOM_SET_BY_COUNTRY_IE) | ||
960 | printk(KERN_DEBUG "cfg80211: Disabling " | 962 | printk(KERN_DEBUG "cfg80211: Disabling " |
961 | "channel %d MHz on %s due to " | 963 | "channel %d MHz on %s due to " |
962 | "Country IE\n", | 964 | "Country IE\n", |
@@ -970,7 +972,7 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band, | |||
970 | 972 | ||
971 | power_rule = ®_rule->power_rule; | 973 | power_rule = ®_rule->power_rule; |
972 | 974 | ||
973 | if (last_request->initiator == REGDOM_SET_BY_DRIVER && | 975 | if (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER && |
974 | request_wiphy && request_wiphy == wiphy && | 976 | request_wiphy && request_wiphy == wiphy && |
975 | request_wiphy->strict_regulatory) { | 977 | request_wiphy->strict_regulatory) { |
976 | /* | 978 | /* |
@@ -1011,11 +1013,12 @@ static void handle_band(struct wiphy *wiphy, enum ieee80211_band band) | |||
1011 | handle_channel(wiphy, band, i); | 1013 | handle_channel(wiphy, band, i); |
1012 | } | 1014 | } |
1013 | 1015 | ||
1014 | static bool ignore_reg_update(struct wiphy *wiphy, enum reg_set_by setby) | 1016 | static bool ignore_reg_update(struct wiphy *wiphy, |
1017 | enum nl80211_reg_initiator initiator) | ||
1015 | { | 1018 | { |
1016 | if (!last_request) | 1019 | if (!last_request) |
1017 | return true; | 1020 | return true; |
1018 | if (setby == REGDOM_SET_BY_CORE && | 1021 | if (initiator == NL80211_REGDOM_SET_BY_CORE && |
1019 | wiphy->custom_regulatory) | 1022 | wiphy->custom_regulatory) |
1020 | return true; | 1023 | return true; |
1021 | /* | 1024 | /* |
@@ -1028,12 +1031,12 @@ static bool ignore_reg_update(struct wiphy *wiphy, enum reg_set_by setby) | |||
1028 | return false; | 1031 | return false; |
1029 | } | 1032 | } |
1030 | 1033 | ||
1031 | static void update_all_wiphy_regulatory(enum reg_set_by setby) | 1034 | static void update_all_wiphy_regulatory(enum nl80211_reg_initiator initiator) |
1032 | { | 1035 | { |
1033 | struct cfg80211_registered_device *drv; | 1036 | struct cfg80211_registered_device *drv; |
1034 | 1037 | ||
1035 | list_for_each_entry(drv, &cfg80211_drv_list, list) | 1038 | list_for_each_entry(drv, &cfg80211_drv_list, list) |
1036 | wiphy_update_regulatory(&drv->wiphy, setby); | 1039 | wiphy_update_regulatory(&drv->wiphy, initiator); |
1037 | } | 1040 | } |
1038 | 1041 | ||
1039 | static void handle_reg_beacon(struct wiphy *wiphy, | 1042 | static void handle_reg_beacon(struct wiphy *wiphy, |
@@ -1124,7 +1127,7 @@ static bool reg_is_world_roaming(struct wiphy *wiphy) | |||
1124 | if (is_world_regdom(cfg80211_regdomain->alpha2) || | 1127 | if (is_world_regdom(cfg80211_regdomain->alpha2) || |
1125 | (wiphy->regd && is_world_regdom(wiphy->regd->alpha2))) | 1128 | (wiphy->regd && is_world_regdom(wiphy->regd->alpha2))) |
1126 | return true; | 1129 | return true; |
1127 | if (last_request->initiator != REGDOM_SET_BY_COUNTRY_IE && | 1130 | if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && |
1128 | wiphy->custom_regulatory) | 1131 | wiphy->custom_regulatory) |
1129 | return true; | 1132 | return true; |
1130 | return false; | 1133 | return false; |
@@ -1138,11 +1141,12 @@ static void reg_process_beacons(struct wiphy *wiphy) | |||
1138 | wiphy_update_beacon_reg(wiphy); | 1141 | wiphy_update_beacon_reg(wiphy); |
1139 | } | 1142 | } |
1140 | 1143 | ||
1141 | void wiphy_update_regulatory(struct wiphy *wiphy, enum reg_set_by setby) | 1144 | void wiphy_update_regulatory(struct wiphy *wiphy, |
1145 | enum nl80211_reg_initiator initiator) | ||
1142 | { | 1146 | { |
1143 | enum ieee80211_band band; | 1147 | enum ieee80211_band band; |
1144 | 1148 | ||
1145 | if (ignore_reg_update(wiphy, setby)) | 1149 | if (ignore_reg_update(wiphy, initiator)) |
1146 | goto out; | 1150 | goto out; |
1147 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | 1151 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { |
1148 | if (wiphy->bands[band]) | 1152 | if (wiphy->bands[band]) |
@@ -1255,15 +1259,16 @@ static int ignore_request(struct wiphy *wiphy, | |||
1255 | return 0; | 1259 | return 0; |
1256 | 1260 | ||
1257 | switch (pending_request->initiator) { | 1261 | switch (pending_request->initiator) { |
1258 | case REGDOM_SET_BY_CORE: | 1262 | case NL80211_REGDOM_SET_BY_CORE: |
1259 | return -EINVAL; | 1263 | return -EINVAL; |
1260 | case REGDOM_SET_BY_COUNTRY_IE: | 1264 | case NL80211_REGDOM_SET_BY_COUNTRY_IE: |
1261 | 1265 | ||
1262 | last_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); | 1266 | last_wiphy = wiphy_idx_to_wiphy(last_request->wiphy_idx); |
1263 | 1267 | ||
1264 | if (unlikely(!is_an_alpha2(pending_request->alpha2))) | 1268 | if (unlikely(!is_an_alpha2(pending_request->alpha2))) |
1265 | return -EINVAL; | 1269 | return -EINVAL; |
1266 | if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) { | 1270 | if (last_request->initiator == |
1271 | NL80211_REGDOM_SET_BY_COUNTRY_IE) { | ||
1267 | if (last_wiphy != wiphy) { | 1272 | if (last_wiphy != wiphy) { |
1268 | /* | 1273 | /* |
1269 | * Two cards with two APs claiming different | 1274 | * Two cards with two APs claiming different |
@@ -1284,8 +1289,8 @@ static int ignore_request(struct wiphy *wiphy, | |||
1284 | return -EALREADY; | 1289 | return -EALREADY; |
1285 | } | 1290 | } |
1286 | return REG_INTERSECT; | 1291 | return REG_INTERSECT; |
1287 | case REGDOM_SET_BY_DRIVER: | 1292 | case NL80211_REGDOM_SET_BY_DRIVER: |
1288 | if (last_request->initiator == REGDOM_SET_BY_CORE) { | 1293 | if (last_request->initiator == NL80211_REGDOM_SET_BY_CORE) { |
1289 | if (is_old_static_regdom(cfg80211_regdomain)) | 1294 | if (is_old_static_regdom(cfg80211_regdomain)) |
1290 | return 0; | 1295 | return 0; |
1291 | if (regdom_changes(pending_request->alpha2)) | 1296 | if (regdom_changes(pending_request->alpha2)) |
@@ -1298,28 +1303,28 @@ static int ignore_request(struct wiphy *wiphy, | |||
1298 | * back in or if you add a new device for which the previously | 1303 | * back in or if you add a new device for which the previously |
1299 | * loaded card also agrees on the regulatory domain. | 1304 | * loaded card also agrees on the regulatory domain. |
1300 | */ | 1305 | */ |
1301 | if (last_request->initiator == REGDOM_SET_BY_DRIVER && | 1306 | if (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER && |
1302 | !regdom_changes(pending_request->alpha2)) | 1307 | !regdom_changes(pending_request->alpha2)) |
1303 | return -EALREADY; | 1308 | return -EALREADY; |
1304 | 1309 | ||
1305 | return REG_INTERSECT; | 1310 | return REG_INTERSECT; |
1306 | case REGDOM_SET_BY_USER: | 1311 | case NL80211_REGDOM_SET_BY_USER: |
1307 | if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) | 1312 | if (last_request->initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) |
1308 | return REG_INTERSECT; | 1313 | return REG_INTERSECT; |
1309 | /* | 1314 | /* |
1310 | * If the user knows better the user should set the regdom | 1315 | * If the user knows better the user should set the regdom |
1311 | * to their country before the IE is picked up | 1316 | * to their country before the IE is picked up |
1312 | */ | 1317 | */ |
1313 | if (last_request->initiator == REGDOM_SET_BY_USER && | 1318 | if (last_request->initiator == NL80211_REGDOM_SET_BY_USER && |
1314 | last_request->intersect) | 1319 | last_request->intersect) |
1315 | return -EOPNOTSUPP; | 1320 | return -EOPNOTSUPP; |
1316 | /* | 1321 | /* |
1317 | * Process user requests only after previous user/driver/core | 1322 | * Process user requests only after previous user/driver/core |
1318 | * requests have been processed | 1323 | * requests have been processed |
1319 | */ | 1324 | */ |
1320 | if (last_request->initiator == REGDOM_SET_BY_CORE || | 1325 | if (last_request->initiator == NL80211_REGDOM_SET_BY_CORE || |
1321 | last_request->initiator == REGDOM_SET_BY_DRIVER || | 1326 | last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER || |
1322 | last_request->initiator == REGDOM_SET_BY_USER) { | 1327 | last_request->initiator == NL80211_REGDOM_SET_BY_USER) { |
1323 | if (regdom_changes(last_request->alpha2)) | 1328 | if (regdom_changes(last_request->alpha2)) |
1324 | return -EAGAIN; | 1329 | return -EAGAIN; |
1325 | } | 1330 | } |
@@ -1359,7 +1364,8 @@ static int __regulatory_hint(struct wiphy *wiphy, | |||
1359 | r = ignore_request(wiphy, pending_request); | 1364 | r = ignore_request(wiphy, pending_request); |
1360 | 1365 | ||
1361 | if (r == REG_INTERSECT) { | 1366 | if (r == REG_INTERSECT) { |
1362 | if (pending_request->initiator == REGDOM_SET_BY_DRIVER) { | 1367 | if (pending_request->initiator == |
1368 | NL80211_REGDOM_SET_BY_DRIVER) { | ||
1363 | r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain); | 1369 | r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain); |
1364 | if (r) { | 1370 | if (r) { |
1365 | kfree(pending_request); | 1371 | kfree(pending_request); |
@@ -1374,7 +1380,8 @@ static int __regulatory_hint(struct wiphy *wiphy, | |||
1374 | * wiphy | 1380 | * wiphy |
1375 | */ | 1381 | */ |
1376 | if (r == -EALREADY && | 1382 | if (r == -EALREADY && |
1377 | pending_request->initiator == REGDOM_SET_BY_DRIVER) { | 1383 | pending_request->initiator == |
1384 | NL80211_REGDOM_SET_BY_DRIVER) { | ||
1378 | r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain); | 1385 | r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain); |
1379 | if (r) { | 1386 | if (r) { |
1380 | kfree(pending_request); | 1387 | kfree(pending_request); |
@@ -1425,7 +1432,7 @@ static void reg_process_hint(struct regulatory_request *reg_request) | |||
1425 | if (wiphy_idx_valid(reg_request->wiphy_idx)) | 1432 | if (wiphy_idx_valid(reg_request->wiphy_idx)) |
1426 | wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); | 1433 | wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); |
1427 | 1434 | ||
1428 | if (reg_request->initiator == REGDOM_SET_BY_DRIVER && | 1435 | if (reg_request->initiator == NL80211_REGDOM_SET_BY_DRIVER && |
1429 | !wiphy) { | 1436 | !wiphy) { |
1430 | kfree(reg_request); | 1437 | kfree(reg_request); |
1431 | goto out; | 1438 | goto out; |
@@ -1439,7 +1446,7 @@ out: | |||
1439 | mutex_unlock(&cfg80211_mutex); | 1446 | mutex_unlock(&cfg80211_mutex); |
1440 | } | 1447 | } |
1441 | 1448 | ||
1442 | /* Processes regulatory hints, this is all the REGDOM_SET_BY_* */ | 1449 | /* Processes regulatory hints, this is all the NL80211_REGDOM_SET_BY_* */ |
1443 | static void reg_process_pending_hints(void) | 1450 | static void reg_process_pending_hints(void) |
1444 | { | 1451 | { |
1445 | struct regulatory_request *reg_request; | 1452 | struct regulatory_request *reg_request; |
@@ -1523,7 +1530,7 @@ static int regulatory_hint_core(const char *alpha2) | |||
1523 | 1530 | ||
1524 | request->alpha2[0] = alpha2[0]; | 1531 | request->alpha2[0] = alpha2[0]; |
1525 | request->alpha2[1] = alpha2[1]; | 1532 | request->alpha2[1] = alpha2[1]; |
1526 | request->initiator = REGDOM_SET_BY_CORE; | 1533 | request->initiator = NL80211_REGDOM_SET_BY_CORE; |
1527 | 1534 | ||
1528 | queue_regulatory_request(request); | 1535 | queue_regulatory_request(request); |
1529 | 1536 | ||
@@ -1544,7 +1551,7 @@ int regulatory_hint_user(const char *alpha2) | |||
1544 | request->wiphy_idx = WIPHY_IDX_STALE; | 1551 | request->wiphy_idx = WIPHY_IDX_STALE; |
1545 | request->alpha2[0] = alpha2[0]; | 1552 | request->alpha2[0] = alpha2[0]; |
1546 | request->alpha2[1] = alpha2[1]; | 1553 | request->alpha2[1] = alpha2[1]; |
1547 | request->initiator = REGDOM_SET_BY_USER, | 1554 | request->initiator = NL80211_REGDOM_SET_BY_USER, |
1548 | 1555 | ||
1549 | queue_regulatory_request(request); | 1556 | queue_regulatory_request(request); |
1550 | 1557 | ||
@@ -1570,7 +1577,7 @@ int regulatory_hint(struct wiphy *wiphy, const char *alpha2) | |||
1570 | 1577 | ||
1571 | request->alpha2[0] = alpha2[0]; | 1578 | request->alpha2[0] = alpha2[0]; |
1572 | request->alpha2[1] = alpha2[1]; | 1579 | request->alpha2[1] = alpha2[1]; |
1573 | request->initiator = REGDOM_SET_BY_DRIVER; | 1580 | request->initiator = NL80211_REGDOM_SET_BY_DRIVER; |
1574 | 1581 | ||
1575 | queue_regulatory_request(request); | 1582 | queue_regulatory_request(request); |
1576 | 1583 | ||
@@ -1719,7 +1726,7 @@ void regulatory_hint_11d(struct wiphy *wiphy, | |||
1719 | request->wiphy_idx = get_wiphy_idx(wiphy); | 1726 | request->wiphy_idx = get_wiphy_idx(wiphy); |
1720 | request->alpha2[0] = rd->alpha2[0]; | 1727 | request->alpha2[0] = rd->alpha2[0]; |
1721 | request->alpha2[1] = rd->alpha2[1]; | 1728 | request->alpha2[1] = rd->alpha2[1]; |
1722 | request->initiator = REGDOM_SET_BY_COUNTRY_IE; | 1729 | request->initiator = NL80211_REGDOM_SET_BY_COUNTRY_IE; |
1723 | request->country_ie_checksum = checksum; | 1730 | request->country_ie_checksum = checksum; |
1724 | request->country_ie_env = env; | 1731 | request->country_ie_env = env; |
1725 | 1732 | ||
@@ -1827,7 +1834,8 @@ static void print_regdomain(const struct ieee80211_regdomain *rd) | |||
1827 | 1834 | ||
1828 | if (is_intersected_alpha2(rd->alpha2)) { | 1835 | if (is_intersected_alpha2(rd->alpha2)) { |
1829 | 1836 | ||
1830 | if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) { | 1837 | if (last_request->initiator == |
1838 | NL80211_REGDOM_SET_BY_COUNTRY_IE) { | ||
1831 | struct cfg80211_registered_device *drv; | 1839 | struct cfg80211_registered_device *drv; |
1832 | drv = cfg80211_drv_by_wiphy_idx( | 1840 | drv = cfg80211_drv_by_wiphy_idx( |
1833 | last_request->wiphy_idx); | 1841 | last_request->wiphy_idx); |
@@ -1919,7 +1927,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
1919 | * rd is non static (it means CRDA was present and was used last) | 1927 | * rd is non static (it means CRDA was present and was used last) |
1920 | * and the pending request came in from a country IE | 1928 | * and the pending request came in from a country IE |
1921 | */ | 1929 | */ |
1922 | if (last_request->initiator != REGDOM_SET_BY_COUNTRY_IE) { | 1930 | if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE) { |
1923 | /* | 1931 | /* |
1924 | * If someone else asked us to change the rd lets only bother | 1932 | * If someone else asked us to change the rd lets only bother |
1925 | * checking if the alpha2 changes if CRDA was already called | 1933 | * checking if the alpha2 changes if CRDA was already called |
@@ -1951,7 +1959,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
1951 | if (!last_request->intersect) { | 1959 | if (!last_request->intersect) { |
1952 | int r; | 1960 | int r; |
1953 | 1961 | ||
1954 | if (last_request->initiator != REGDOM_SET_BY_DRIVER) { | 1962 | if (last_request->initiator != NL80211_REGDOM_SET_BY_DRIVER) { |
1955 | reset_regdomains(); | 1963 | reset_regdomains(); |
1956 | cfg80211_regdomain = rd; | 1964 | cfg80211_regdomain = rd; |
1957 | return 0; | 1965 | return 0; |
@@ -1975,7 +1983,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
1975 | 1983 | ||
1976 | /* Intersection requires a bit more work */ | 1984 | /* Intersection requires a bit more work */ |
1977 | 1985 | ||
1978 | if (last_request->initiator != REGDOM_SET_BY_COUNTRY_IE) { | 1986 | if (last_request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE) { |
1979 | 1987 | ||
1980 | intersected_rd = regdom_intersect(rd, cfg80211_regdomain); | 1988 | intersected_rd = regdom_intersect(rd, cfg80211_regdomain); |
1981 | if (!intersected_rd) | 1989 | if (!intersected_rd) |
@@ -1986,7 +1994,7 @@ static int __set_regdom(const struct ieee80211_regdomain *rd) | |||
1986 | * However if a driver requested this specific regulatory | 1994 | * However if a driver requested this specific regulatory |
1987 | * domain we keep it for its private use | 1995 | * domain we keep it for its private use |
1988 | */ | 1996 | */ |
1989 | if (last_request->initiator == REGDOM_SET_BY_DRIVER) | 1997 | if (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER) |
1990 | request_wiphy->regd = rd; | 1998 | request_wiphy->regd = rd; |
1991 | else | 1999 | else |
1992 | kfree(rd); | 2000 | kfree(rd); |