diff options
-rw-r--r-- | drivers/net/wireless/ath/regd.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmsmac/channel.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/3945-mac.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlegacy/4965-mac.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/dvm/mac80211.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mac80211.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/mac80211_hwsim.c | 25 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/rtlwifi/regd.c | 6 | ||||
-rw-r--r-- | include/net/cfg80211.h | 33 | ||||
-rw-r--r-- | include/net/regulatory.h | 59 | ||||
-rw-r--r-- | net/wireless/core.c | 2 | ||||
-rw-r--r-- | net/wireless/reg.c | 32 |
14 files changed, 108 insertions, 88 deletions
diff --git a/drivers/net/wireless/ath/regd.c b/drivers/net/wireless/ath/regd.c index e93e517a699f..aba782cd09a2 100644 --- a/drivers/net/wireless/ath/regd.c +++ b/drivers/net/wireless/ath/regd.c | |||
@@ -601,7 +601,7 @@ ath_regd_init_wiphy(struct ath_regulatory *reg, | |||
601 | const struct ieee80211_regdomain *regd; | 601 | const struct ieee80211_regdomain *regd; |
602 | 602 | ||
603 | wiphy->reg_notifier = reg_notifier; | 603 | wiphy->reg_notifier = reg_notifier; |
604 | wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; | 604 | wiphy->regulatory_flags |= REGULATORY_STRICT_REG; |
605 | 605 | ||
606 | if (ath_is_world_regd(reg)) { | 606 | if (ath_is_world_regd(reg)) { |
607 | /* | 607 | /* |
@@ -609,7 +609,7 @@ 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->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; | 612 | wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; |
613 | } else { | 613 | } else { |
614 | /* | 614 | /* |
615 | * This gets applied in the case of the absence of CRDA, | 615 | * This gets applied in the case of the absence of CRDA, |
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c index b6a09f97f9a3..1850efa83cf8 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | |||
@@ -4341,7 +4341,7 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev) | |||
4341 | wiphy->max_remain_on_channel_duration = 5000; | 4341 | wiphy->max_remain_on_channel_duration = 5000; |
4342 | brcmf_wiphy_pno_params(wiphy); | 4342 | brcmf_wiphy_pno_params(wiphy); |
4343 | brcmf_dbg(INFO, "Registering custom regulatory\n"); | 4343 | brcmf_dbg(INFO, "Registering custom regulatory\n"); |
4344 | wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; | 4344 | wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; |
4345 | wiphy_apply_custom_regulatory(wiphy, &brcmf_regdom); | 4345 | wiphy_apply_custom_regulatory(wiphy, &brcmf_regdom); |
4346 | err = wiphy_register(wiphy); | 4346 | err = wiphy_register(wiphy); |
4347 | if (err < 0) { | 4347 | if (err < 0) { |
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/brcm80211/brcmsmac/channel.c index 7d8f3fd69a87..ef05df04136b 100644 --- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c +++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c | |||
@@ -766,8 +766,8 @@ void brcms_c_regd_init(struct brcms_c_info *wlc) | |||
766 | } | 766 | } |
767 | 767 | ||
768 | wlc->wiphy->reg_notifier = brcms_reg_notifier; | 768 | wlc->wiphy->reg_notifier = brcms_reg_notifier; |
769 | wlc->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | | 769 | wlc->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | |
770 | WIPHY_FLAG_STRICT_REGULATORY; | 770 | REGULATORY_STRICT_REG; |
771 | wiphy_apply_custom_regulatory(wlc->wiphy, regd->regdomain); | 771 | wiphy_apply_custom_regulatory(wlc->wiphy, regd->regdomain); |
772 | brcms_reg_apply_beaconing_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER); | 772 | brcms_reg_apply_beaconing_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER); |
773 | } | 773 | } |
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c index 5a66595b0faf..5c3bcedd679b 100644 --- a/drivers/net/wireless/iwlegacy/3945-mac.c +++ b/drivers/net/wireless/iwlegacy/3945-mac.c | |||
@@ -3575,9 +3575,9 @@ il3945_setup_mac(struct il_priv *il) | |||
3575 | hw->wiphy->interface_modes = | 3575 | hw->wiphy->interface_modes = |
3576 | BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); | 3576 | BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); |
3577 | 3577 | ||
3578 | hw->wiphy->flags |= | 3578 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
3579 | WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_DISABLE_BEACON_HINTS | | 3579 | hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | |
3580 | WIPHY_FLAG_IBSS_RSN; | 3580 | REGULATORY_DISABLE_BEACON_HINTS; |
3581 | 3581 | ||
3582 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; | 3582 | hw->wiphy->flags &= ~WIPHY_FLAG_PS_ON_BY_DEFAULT; |
3583 | 3583 | ||
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c index 1c5f8cdbd3a5..43f488a8cda2 100644 --- a/drivers/net/wireless/iwlegacy/4965-mac.c +++ b/drivers/net/wireless/iwlegacy/4965-mac.c | |||
@@ -5778,9 +5778,9 @@ il4965_mac_setup_register(struct il_priv *il, u32 max_probe_length) | |||
5778 | hw->wiphy->interface_modes = | 5778 | hw->wiphy->interface_modes = |
5779 | BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); | 5779 | BIT(NL80211_IFTYPE_STATION) | BIT(NL80211_IFTYPE_ADHOC); |
5780 | 5780 | ||
5781 | hw->wiphy->flags |= | 5781 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
5782 | WIPHY_FLAG_CUSTOM_REGULATORY | WIPHY_FLAG_DISABLE_BEACON_HINTS | | 5782 | hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | |
5783 | WIPHY_FLAG_IBSS_RSN; | 5783 | REGULATORY_DISABLE_BEACON_HINTS; |
5784 | 5784 | ||
5785 | /* | 5785 | /* |
5786 | * For now, disable PS by default because it affects | 5786 | * For now, disable PS by default because it affects |
diff --git a/drivers/net/wireless/iwlwifi/dvm/mac80211.c b/drivers/net/wireless/iwlwifi/dvm/mac80211.c index cae4d3182e33..217f1ca321a0 100644 --- a/drivers/net/wireless/iwlwifi/dvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/dvm/mac80211.c | |||
@@ -155,9 +155,9 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv, | |||
155 | ARRAY_SIZE(iwlagn_iface_combinations_dualmode); | 155 | ARRAY_SIZE(iwlagn_iface_combinations_dualmode); |
156 | } | 156 | } |
157 | 157 | ||
158 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | | 158 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
159 | WIPHY_FLAG_DISABLE_BEACON_HINTS | | 159 | hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | |
160 | WIPHY_FLAG_IBSS_RSN; | 160 | REGULATORY_DISABLE_BEACON_HINTS; |
161 | 161 | ||
162 | #ifdef CONFIG_PM_SLEEP | 162 | #ifdef CONFIG_PM_SLEEP |
163 | if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len && | 163 | if (priv->fw->img[IWL_UCODE_WOWLAN].sec[0].len && |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c index 74bc2c8af06d..b56c989ad784 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c +++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c | |||
@@ -199,9 +199,9 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm) | |||
199 | if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 8) | 199 | if (IWL_UCODE_API(mvm->fw->ucode_ver) >= 8) |
200 | hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); | 200 | hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_ADHOC); |
201 | 201 | ||
202 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY | | 202 | hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN; |
203 | WIPHY_FLAG_DISABLE_BEACON_HINTS | | 203 | hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG | |
204 | WIPHY_FLAG_IBSS_RSN; | 204 | REGULATORY_DISABLE_BEACON_HINTS; |
205 | 205 | ||
206 | hw->wiphy->iface_combinations = iwl_mvm_iface_combinations; | 206 | hw->wiphy->iface_combinations = iwl_mvm_iface_combinations; |
207 | hw->wiphy->n_iface_combinations = | 207 | hw->wiphy->n_iface_combinations = |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 8c7f4ab70d29..bcc7d8208f23 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -2456,46 +2456,53 @@ static int __init init_mac80211_hwsim(void) | |||
2456 | break; | 2456 | break; |
2457 | case HWSIM_REGTEST_WORLD_ROAM: | 2457 | case HWSIM_REGTEST_WORLD_ROAM: |
2458 | if (i == 0) { | 2458 | if (i == 0) { |
2459 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; | 2459 | hw->wiphy->regulatory_flags |= |
2460 | REGULATORY_CUSTOM_REG; | ||
2460 | wiphy_apply_custom_regulatory(hw->wiphy, | 2461 | wiphy_apply_custom_regulatory(hw->wiphy, |
2461 | &hwsim_world_regdom_custom_01); | 2462 | &hwsim_world_regdom_custom_01); |
2462 | } | 2463 | } |
2463 | break; | 2464 | break; |
2464 | case HWSIM_REGTEST_CUSTOM_WORLD: | 2465 | case HWSIM_REGTEST_CUSTOM_WORLD: |
2465 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; | 2466 | hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; |
2466 | wiphy_apply_custom_regulatory(hw->wiphy, | 2467 | wiphy_apply_custom_regulatory(hw->wiphy, |
2467 | &hwsim_world_regdom_custom_01); | 2468 | &hwsim_world_regdom_custom_01); |
2468 | break; | 2469 | break; |
2469 | case HWSIM_REGTEST_CUSTOM_WORLD_2: | 2470 | case HWSIM_REGTEST_CUSTOM_WORLD_2: |
2470 | if (i == 0) { | 2471 | if (i == 0) { |
2471 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; | 2472 | hw->wiphy->regulatory_flags |= |
2473 | REGULATORY_CUSTOM_REG; | ||
2472 | wiphy_apply_custom_regulatory(hw->wiphy, | 2474 | wiphy_apply_custom_regulatory(hw->wiphy, |
2473 | &hwsim_world_regdom_custom_01); | 2475 | &hwsim_world_regdom_custom_01); |
2474 | } else if (i == 1) { | 2476 | } else if (i == 1) { |
2475 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; | 2477 | hw->wiphy->regulatory_flags |= |
2478 | REGULATORY_CUSTOM_REG; | ||
2476 | wiphy_apply_custom_regulatory(hw->wiphy, | 2479 | wiphy_apply_custom_regulatory(hw->wiphy, |
2477 | &hwsim_world_regdom_custom_02); | 2480 | &hwsim_world_regdom_custom_02); |
2478 | } | 2481 | } |
2479 | break; | 2482 | break; |
2480 | case HWSIM_REGTEST_STRICT_ALL: | 2483 | case HWSIM_REGTEST_STRICT_ALL: |
2481 | hw->wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; | 2484 | hw->wiphy->regulatory_flags |= REGULATORY_STRICT_REG; |
2482 | break; | 2485 | break; |
2483 | case HWSIM_REGTEST_STRICT_FOLLOW: | 2486 | case HWSIM_REGTEST_STRICT_FOLLOW: |
2484 | case HWSIM_REGTEST_STRICT_AND_DRIVER_REG: | 2487 | case HWSIM_REGTEST_STRICT_AND_DRIVER_REG: |
2485 | if (i == 0) | 2488 | if (i == 0) |
2486 | hw->wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; | 2489 | hw->wiphy->regulatory_flags |= |
2490 | REGULATORY_STRICT_REG; | ||
2487 | break; | 2491 | break; |
2488 | case HWSIM_REGTEST_ALL: | 2492 | case HWSIM_REGTEST_ALL: |
2489 | if (i == 0) { | 2493 | if (i == 0) { |
2490 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; | 2494 | hw->wiphy->regulatory_flags |= |
2495 | REGULATORY_CUSTOM_REG; | ||
2491 | wiphy_apply_custom_regulatory(hw->wiphy, | 2496 | wiphy_apply_custom_regulatory(hw->wiphy, |
2492 | &hwsim_world_regdom_custom_01); | 2497 | &hwsim_world_regdom_custom_01); |
2493 | } else if (i == 1) { | 2498 | } else if (i == 1) { |
2494 | hw->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; | 2499 | hw->wiphy->regulatory_flags |= |
2500 | REGULATORY_CUSTOM_REG; | ||
2495 | wiphy_apply_custom_regulatory(hw->wiphy, | 2501 | wiphy_apply_custom_regulatory(hw->wiphy, |
2496 | &hwsim_world_regdom_custom_02); | 2502 | &hwsim_world_regdom_custom_02); |
2497 | } else if (i == 4) | 2503 | } else if (i == 4) |
2498 | hw->wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; | 2504 | hw->wiphy->regulatory_flags |= |
2505 | REGULATORY_STRICT_REG; | ||
2499 | break; | 2506 | break; |
2500 | default: | 2507 | default: |
2501 | break; | 2508 | break; |
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 7f68943f02c2..d6d1d91a26dc 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -2687,9 +2687,10 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) | |||
2687 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME | | 2687 | wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME | |
2688 | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD | | 2688 | WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD | |
2689 | WIPHY_FLAG_AP_UAPSD | | 2689 | WIPHY_FLAG_AP_UAPSD | |
2690 | WIPHY_FLAG_CUSTOM_REGULATORY | | ||
2691 | WIPHY_FLAG_STRICT_REGULATORY | | ||
2692 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; | 2690 | WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; |
2691 | wiphy->regulatory_flags |= | ||
2692 | REGULATORY_CUSTOM_REG | | ||
2693 | REGULATORY_STRICT_REG; | ||
2693 | 2694 | ||
2694 | wiphy_apply_custom_regulatory(wiphy, &mwifiex_world_regdom_custom); | 2695 | wiphy_apply_custom_regulatory(wiphy, &mwifiex_world_regdom_custom); |
2695 | 2696 | ||
diff --git a/drivers/net/wireless/rtlwifi/regd.c b/drivers/net/wireless/rtlwifi/regd.c index 8453c53143f5..89e36568e70f 100644 --- a/drivers/net/wireless/rtlwifi/regd.c +++ b/drivers/net/wireless/rtlwifi/regd.c | |||
@@ -344,9 +344,9 @@ static int _rtl_regd_init_wiphy(struct rtl_regulatory *reg, | |||
344 | 344 | ||
345 | wiphy->reg_notifier = reg_notifier; | 345 | wiphy->reg_notifier = reg_notifier; |
346 | 346 | ||
347 | wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; | 347 | wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; |
348 | wiphy->flags &= ~WIPHY_FLAG_STRICT_REGULATORY; | 348 | wiphy->regulatory_flags &= ~REGULATORY_STRICT_REG; |
349 | wiphy->flags &= ~WIPHY_FLAG_DISABLE_BEACON_HINTS; | 349 | wiphy->regulatory_flags &= ~REGULATORY_DISABLE_BEACON_HINTS; |
350 | 350 | ||
351 | regd = _rtl_regdomain_select(reg); | 351 | regd = _rtl_regdomain_select(reg); |
352 | wiphy_apply_custom_regulatory(wiphy, regd); | 352 | wiphy_apply_custom_regulatory(wiphy, regd); |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 968f2ad40ccd..bacc5033f0b6 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -2437,29 +2437,6 @@ struct cfg80211_ops { | |||
2437 | /** | 2437 | /** |
2438 | * enum wiphy_flags - wiphy capability flags | 2438 | * enum wiphy_flags - wiphy capability flags |
2439 | * | 2439 | * |
2440 | * @WIPHY_FLAG_CUSTOM_REGULATORY: tells us the driver for this device | ||
2441 | * has its own custom regulatory domain and cannot identify the | ||
2442 | * ISO / IEC 3166 alpha2 it belongs to. When this is enabled | ||
2443 | * we will disregard the first regulatory hint (when the | ||
2444 | * initiator is %REGDOM_SET_BY_CORE). Drivers that use | ||
2445 | * wiphy_apply_custom_regulatory() should have this flag set | ||
2446 | * or the regulatory core will set it for wiphy. | ||
2447 | * @WIPHY_FLAG_STRICT_REGULATORY: tells us the driver for this device will | ||
2448 | * ignore regulatory domain settings until it gets its own regulatory | ||
2449 | * domain via its regulatory_hint() unless the regulatory hint is | ||
2450 | * from a country IE. After its gets its own regulatory domain it will | ||
2451 | * only allow further regulatory domain settings to further enhance | ||
2452 | * compliance. For example if channel 13 and 14 are disabled by this | ||
2453 | * regulatory domain no user regulatory domain can enable these channels | ||
2454 | * at a later time. This can be used for devices which do not have | ||
2455 | * calibration information guaranteed for frequencies or settings | ||
2456 | * outside of its regulatory domain. If used in combination with | ||
2457 | * WIPHY_FLAG_CUSTOM_REGULATORY the inspected country IE power settings | ||
2458 | * will be followed. | ||
2459 | * @WIPHY_FLAG_DISABLE_BEACON_HINTS: enable this if your driver needs to ensure | ||
2460 | * that passive scan flags and beaconing flags may not be lifted by | ||
2461 | * cfg80211 due to regulatory beacon hints. For more information on beacon | ||
2462 | * hints read the documenation for regulatory_hint_found_beacon() | ||
2463 | * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this | 2440 | * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this |
2464 | * wiphy at all | 2441 | * wiphy at all |
2465 | * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled | 2442 | * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled |
@@ -2498,9 +2475,9 @@ struct cfg80211_ops { | |||
2498 | * beaconing mode (AP, IBSS, Mesh, ...). | 2475 | * beaconing mode (AP, IBSS, Mesh, ...). |
2499 | */ | 2476 | */ |
2500 | enum wiphy_flags { | 2477 | enum wiphy_flags { |
2501 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), | 2478 | /* use hole at 0 */ |
2502 | WIPHY_FLAG_STRICT_REGULATORY = BIT(1), | 2479 | /* use hole at 1 */ |
2503 | WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), | 2480 | /* use hole at 2 */ |
2504 | WIPHY_FLAG_NETNS_OK = BIT(3), | 2481 | WIPHY_FLAG_NETNS_OK = BIT(3), |
2505 | WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), | 2482 | WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), |
2506 | WIPHY_FLAG_4ADDR_AP = BIT(5), | 2483 | WIPHY_FLAG_4ADDR_AP = BIT(5), |
@@ -2722,6 +2699,8 @@ struct wiphy_coalesce_support { | |||
2722 | * @software_iftypes: bitmask of software interface types, these are not | 2699 | * @software_iftypes: bitmask of software interface types, these are not |
2723 | * subject to any restrictions since they are purely managed in SW. | 2700 | * subject to any restrictions since they are purely managed in SW. |
2724 | * @flags: wiphy flags, see &enum wiphy_flags | 2701 | * @flags: wiphy flags, see &enum wiphy_flags |
2702 | * @regulatory_flags: wiphy regulatory flags, see | ||
2703 | * &enum ieee80211_regulatory_flags | ||
2725 | * @features: features advertised to nl80211, see &enum nl80211_feature_flags. | 2704 | * @features: features advertised to nl80211, see &enum nl80211_feature_flags. |
2726 | * @bss_priv_size: each BSS struct has private data allocated with it, | 2705 | * @bss_priv_size: each BSS struct has private data allocated with it, |
2727 | * this variable determines its size | 2706 | * this variable determines its size |
@@ -2810,7 +2789,7 @@ struct wiphy { | |||
2810 | 2789 | ||
2811 | u16 max_acl_mac_addrs; | 2790 | u16 max_acl_mac_addrs; |
2812 | 2791 | ||
2813 | u32 flags, features; | 2792 | u32 flags, regulatory_flags, features; |
2814 | 2793 | ||
2815 | u32 ap_sme_capa; | 2794 | u32 ap_sme_capa; |
2816 | 2795 | ||
diff --git a/include/net/regulatory.h b/include/net/regulatory.h index f17ed590d64a..a6a20e2a54c4 100644 --- a/include/net/regulatory.h +++ b/include/net/regulatory.h | |||
@@ -38,17 +38,17 @@ enum environment_cap { | |||
38 | * | 38 | * |
39 | * @rcu_head: RCU head struct used to free the request | 39 | * @rcu_head: RCU head struct used to free the request |
40 | * @wiphy_idx: this is set if this request's initiator is | 40 | * @wiphy_idx: this is set if this request's initiator is |
41 | * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This | 41 | * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This |
42 | * can be used by the wireless core to deal with conflicts | 42 | * can be used by the wireless core to deal with conflicts |
43 | * and potentially inform users of which devices specifically | 43 | * and potentially inform users of which devices specifically |
44 | * cased the conflicts. | 44 | * cased the conflicts. |
45 | * @initiator: indicates who sent this request, could be any of | 45 | * @initiator: indicates who sent this request, could be any of |
46 | * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*) | 46 | * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*) |
47 | * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested | 47 | * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested |
48 | * regulatory domain. We have a few special codes: | 48 | * regulatory domain. We have a few special codes: |
49 | * 00 - World regulatory domain | 49 | * 00 - World regulatory domain |
50 | * 99 - built by driver but a specific alpha2 cannot be determined | 50 | * 99 - built by driver but a specific alpha2 cannot be determined |
51 | * 98 - result of an intersection between two regulatory domains | 51 | * 98 - result of an intersection between two regulatory domains |
52 | * 97 - regulatory domain has not yet been configured | 52 | * 97 - regulatory domain has not yet been configured |
53 | * @dfs_region: If CRDA responded with a regulatory domain that requires | 53 | * @dfs_region: If CRDA responded with a regulatory domain that requires |
54 | * DFS master operation on a known DFS region (NL80211_DFS_*), | 54 | * DFS master operation on a known DFS region (NL80211_DFS_*), |
@@ -59,8 +59,8 @@ enum environment_cap { | |||
59 | * of hint passed. This could be any of the %NL80211_USER_REG_HINT_* | 59 | * of hint passed. This could be any of the %NL80211_USER_REG_HINT_* |
60 | * types. | 60 | * types. |
61 | * @intersect: indicates whether the wireless core should intersect | 61 | * @intersect: indicates whether the wireless core should intersect |
62 | * the requested regulatory domain with the presently set regulatory | 62 | * the requested regulatory domain with the presently set regulatory |
63 | * domain. | 63 | * domain. |
64 | * @processed: indicates whether or not this requests has already been | 64 | * @processed: indicates whether or not this requests has already been |
65 | * processed. When the last request is processed it means that the | 65 | * processed. When the last request is processed it means that the |
66 | * currently regulatory domain set on cfg80211 is updated from | 66 | * currently regulatory domain set on cfg80211 is updated from |
@@ -68,9 +68,9 @@ enum environment_cap { | |||
68 | * the last request is not yet processed we must yield until it | 68 | * the last request is not yet processed we must yield until it |
69 | * is processed before processing any new requests. | 69 | * is processed before processing any new requests. |
70 | * @country_ie_checksum: checksum of the last processed and accepted | 70 | * @country_ie_checksum: checksum of the last processed and accepted |
71 | * country IE | 71 | * country IE |
72 | * @country_ie_env: lets us know if the AP is telling us we are outdoor, | 72 | * @country_ie_env: lets us know if the AP is telling us we are outdoor, |
73 | * indoor, or if it doesn't matter | 73 | * indoor, or if it doesn't matter |
74 | * @list: used to insert into the reg_requests_list linked list | 74 | * @list: used to insert into the reg_requests_list linked list |
75 | */ | 75 | */ |
76 | struct regulatory_request { | 76 | struct regulatory_request { |
@@ -86,6 +86,39 @@ struct regulatory_request { | |||
86 | struct list_head list; | 86 | struct list_head list; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | /** | ||
90 | * enum ieee80211_regulatory_flags - device regulatory flags | ||
91 | * | ||
92 | * @REGULATORY_CUSTOM_REG: tells us the driver for this device | ||
93 | * has its own custom regulatory domain and cannot identify the | ||
94 | * ISO / IEC 3166 alpha2 it belongs to. When this is enabled | ||
95 | * we will disregard the first regulatory hint (when the | ||
96 | * initiator is %REGDOM_SET_BY_CORE). Drivers that use | ||
97 | * wiphy_apply_custom_regulatory() should have this flag set | ||
98 | * or the regulatory core will set it for the wiphy. | ||
99 | * @REGULATORY_STRICT_REG: tells us the driver for this device will | ||
100 | * ignore regulatory domain settings until it gets its own regulatory | ||
101 | * domain via its regulatory_hint() unless the regulatory hint is | ||
102 | * from a country IE. After its gets its own regulatory domain it will | ||
103 | * only allow further regulatory domain settings to further enhance | ||
104 | * compliance. For example if channel 13 and 14 are disabled by this | ||
105 | * regulatory domain no user regulatory domain can enable these channels | ||
106 | * at a later time. This can be used for devices which do not have | ||
107 | * calibration information guaranteed for frequencies or settings | ||
108 | * outside of its regulatory domain. If used in combination with | ||
109 | * REGULATORY_FLAG_CUSTOM_REG the inspected country IE power settings | ||
110 | * will be followed. | ||
111 | * @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 | ||
113 | * cfg80211 due to regulatory beacon hints. For more information on beacon | ||
114 | * hints read the documenation for regulatory_hint_found_beacon() | ||
115 | */ | ||
116 | enum ieee80211_regulatory_flags { | ||
117 | REGULATORY_CUSTOM_REG = BIT(0), | ||
118 | REGULATORY_STRICT_REG = BIT(1), | ||
119 | REGULATORY_DISABLE_BEACON_HINTS = BIT(2), | ||
120 | }; | ||
121 | |||
89 | struct ieee80211_freq_range { | 122 | struct ieee80211_freq_range { |
90 | u32 start_freq_khz; | 123 | u32 start_freq_khz; |
91 | u32 end_freq_khz; | 124 | u32 end_freq_khz; |
diff --git a/net/wireless/core.c b/net/wireless/core.c index 9dca0925a1a9..fc968c861ee4 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -586,7 +586,7 @@ int wiphy_register(struct wiphy *wiphy) | |||
586 | if (IS_ERR(rdev->wiphy.debugfsdir)) | 586 | if (IS_ERR(rdev->wiphy.debugfsdir)) |
587 | rdev->wiphy.debugfsdir = NULL; | 587 | rdev->wiphy.debugfsdir = NULL; |
588 | 588 | ||
589 | if (wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) { | 589 | if (wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) { |
590 | struct regulatory_request request; | 590 | struct regulatory_request request; |
591 | 591 | ||
592 | request.wiphy_idx = get_wiphy_idx(wiphy); | 592 | request.wiphy_idx = get_wiphy_idx(wiphy); |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index a75c5eddd25f..e44b4bb20b92 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -868,7 +868,7 @@ static void handle_channel(struct wiphy *wiphy, | |||
868 | 868 | ||
869 | if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER && | 869 | if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER && |
870 | request_wiphy && request_wiphy == wiphy && | 870 | request_wiphy && request_wiphy == wiphy && |
871 | request_wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) { | 871 | request_wiphy->regulatory_flags & REGULATORY_STRICT_REG) { |
872 | REG_DBG_PRINT("Disabling freq %d MHz for good\n", | 872 | REG_DBG_PRINT("Disabling freq %d MHz for good\n", |
873 | chan->center_freq); | 873 | chan->center_freq); |
874 | chan->orig_flags |= IEEE80211_CHAN_DISABLED; | 874 | chan->orig_flags |= IEEE80211_CHAN_DISABLED; |
@@ -895,7 +895,7 @@ static void handle_channel(struct wiphy *wiphy, | |||
895 | 895 | ||
896 | if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER && | 896 | if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER && |
897 | request_wiphy && request_wiphy == wiphy && | 897 | request_wiphy && request_wiphy == wiphy && |
898 | request_wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) { | 898 | request_wiphy->regulatory_flags & REGULATORY_STRICT_REG) { |
899 | /* | 899 | /* |
900 | * This guarantees the driver's requested regulatory domain | 900 | * This guarantees the driver's requested regulatory domain |
901 | * will always be used as a base for further regulatory | 901 | * will always be used as a base for further regulatory |
@@ -922,12 +922,12 @@ static void handle_channel(struct wiphy *wiphy, | |||
922 | if (chan->orig_mpwr) { | 922 | if (chan->orig_mpwr) { |
923 | /* | 923 | /* |
924 | * Devices that have their own custom regulatory domain | 924 | * Devices that have their own custom regulatory domain |
925 | * but also use WIPHY_FLAG_STRICT_REGULATORY will follow the | 925 | * but also use REGULATORY_STRICT_REG will follow the |
926 | * passed country IE power settings. | 926 | * passed country IE power settings. |
927 | */ | 927 | */ |
928 | if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE && | 928 | if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE && |
929 | wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY && | 929 | wiphy->regulatory_flags & REGULATORY_CUSTOM_REG && |
930 | wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) | 930 | wiphy->regulatory_flags & REGULATORY_STRICT_REG) |
931 | chan->max_power = chan->max_reg_power; | 931 | chan->max_power = chan->max_reg_power; |
932 | else | 932 | else |
933 | chan->max_power = min(chan->orig_mpwr, | 933 | chan->max_power = min(chan->orig_mpwr, |
@@ -997,8 +997,8 @@ static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy) | |||
997 | 997 | ||
998 | static bool wiphy_strict_alpha2_regd(struct wiphy *wiphy) | 998 | static bool wiphy_strict_alpha2_regd(struct wiphy *wiphy) |
999 | { | 999 | { |
1000 | if (wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY && | 1000 | if (wiphy->regulatory_flags & REGULATORY_STRICT_REG && |
1001 | !(wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY)) | 1001 | !(wiphy->regulatory_flags & REGULATORY_CUSTOM_REG)) |
1002 | return true; | 1002 | return true; |
1003 | return false; | 1003 | return false; |
1004 | } | 1004 | } |
@@ -1016,7 +1016,7 @@ static bool ignore_reg_update(struct wiphy *wiphy, | |||
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | if (initiator == NL80211_REGDOM_SET_BY_CORE && | 1018 | if (initiator == NL80211_REGDOM_SET_BY_CORE && |
1019 | wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) { | 1019 | wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) { |
1020 | REG_DBG_PRINT("Ignoring regulatory request set by %s " | 1020 | REG_DBG_PRINT("Ignoring regulatory request set by %s " |
1021 | "since the driver uses its own custom " | 1021 | "since the driver uses its own custom " |
1022 | "regulatory domain\n", | 1022 | "regulatory domain\n", |
@@ -1054,7 +1054,7 @@ static bool reg_is_world_roaming(struct wiphy *wiphy) | |||
1054 | return true; | 1054 | return true; |
1055 | 1055 | ||
1056 | if (lr && lr->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && | 1056 | if (lr && lr->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE && |
1057 | wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) | 1057 | wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) |
1058 | return true; | 1058 | return true; |
1059 | 1059 | ||
1060 | return false; | 1060 | return false; |
@@ -1082,7 +1082,7 @@ static void handle_reg_beacon(struct wiphy *wiphy, unsigned int chan_idx, | |||
1082 | if (!reg_is_world_roaming(wiphy)) | 1082 | if (!reg_is_world_roaming(wiphy)) |
1083 | return; | 1083 | return; |
1084 | 1084 | ||
1085 | if (wiphy->flags & WIPHY_FLAG_DISABLE_BEACON_HINTS) | 1085 | if (wiphy->regulatory_flags & REGULATORY_DISABLE_BEACON_HINTS) |
1086 | return; | 1086 | return; |
1087 | 1087 | ||
1088 | chan_before.center_freq = chan->center_freq; | 1088 | chan_before.center_freq = chan->center_freq; |
@@ -1242,7 +1242,7 @@ static void wiphy_update_regulatory(struct wiphy *wiphy, | |||
1242 | * as some drivers used this to restore its orig_* reg domain. | 1242 | * as some drivers used this to restore its orig_* reg domain. |
1243 | */ | 1243 | */ |
1244 | if (initiator == NL80211_REGDOM_SET_BY_CORE && | 1244 | if (initiator == NL80211_REGDOM_SET_BY_CORE && |
1245 | wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) | 1245 | wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) |
1246 | reg_call_notifier(wiphy, lr); | 1246 | reg_call_notifier(wiphy, lr); |
1247 | return; | 1247 | return; |
1248 | } | 1248 | } |
@@ -1328,9 +1328,9 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy, | |||
1328 | enum ieee80211_band band; | 1328 | enum ieee80211_band band; |
1329 | unsigned int bands_set = 0; | 1329 | unsigned int bands_set = 0; |
1330 | 1330 | ||
1331 | WARN(!(wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY), | 1331 | WARN(!(wiphy->regulatory_flags & REGULATORY_CUSTOM_REG), |
1332 | "wiphy should have WIPHY_FLAG_CUSTOM_REGULATORY\n"); | 1332 | "wiphy should have REGULATORY_CUSTOM_REG\n"); |
1333 | wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; | 1333 | wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; |
1334 | 1334 | ||
1335 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | 1335 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { |
1336 | if (!wiphy->bands[band]) | 1336 | if (!wiphy->bands[band]) |
@@ -1659,7 +1659,7 @@ static void reg_process_hint(struct regulatory_request *reg_request) | |||
1659 | 1659 | ||
1660 | /* This is required so that the orig_* parameters are saved */ | 1660 | /* This is required so that the orig_* parameters are saved */ |
1661 | if (treatment == REG_REQ_ALREADY_SET && wiphy && | 1661 | if (treatment == REG_REQ_ALREADY_SET && wiphy && |
1662 | wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) | 1662 | wiphy->regulatory_flags & REGULATORY_STRICT_REG) |
1663 | wiphy_update_regulatory(wiphy, reg_request->initiator); | 1663 | wiphy_update_regulatory(wiphy, reg_request->initiator); |
1664 | } | 1664 | } |
1665 | 1665 | ||
@@ -1986,7 +1986,7 @@ static void restore_regulatory_settings(bool reset_user) | |||
1986 | world_alpha2[1] = cfg80211_world_regdom->alpha2[1]; | 1986 | world_alpha2[1] = cfg80211_world_regdom->alpha2[1]; |
1987 | 1987 | ||
1988 | list_for_each_entry(rdev, &cfg80211_rdev_list, list) { | 1988 | list_for_each_entry(rdev, &cfg80211_rdev_list, list) { |
1989 | if (rdev->wiphy.flags & WIPHY_FLAG_CUSTOM_REGULATORY) | 1989 | if (rdev->wiphy.regulatory_flags & REGULATORY_CUSTOM_REG) |
1990 | restore_custom_reg_settings(&rdev->wiphy); | 1990 | restore_custom_reg_settings(&rdev->wiphy); |
1991 | } | 1991 | } |
1992 | 1992 | ||