Lines Matching refs:wiphy

150 const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy)  in get_wiphy_regdom()  argument
152 return rcu_dereference_check(wiphy->regd, in get_wiphy_regdom()
153 lockdep_is_held(&wiphy->mtx) || in get_wiphy_regdom()
173 enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy) in reg_get_dfs_region() argument
183 if (!wiphy) in reg_get_dfs_region()
186 wiphy_regd = get_wiphy_regdom(wiphy); in reg_get_dfs_region()
190 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) { in reg_get_dfs_region()
199 dev_name(&wiphy->dev), in reg_get_dfs_region()
1144 static const struct ieee80211_regdomain *reg_get_regdomain(struct wiphy *wiphy) in reg_get_regdomain() argument
1154 wiphy->regd) in reg_get_regdomain()
1155 return get_wiphy_regdom(wiphy); in reg_get_regdomain()
1647 __freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 min_bw) in __freq_reg_info() argument
1649 const struct ieee80211_regdomain *regd = reg_get_regdomain(wiphy); in __freq_reg_info()
1664 const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, in freq_reg_info() argument
1669 return __freq_reg_info(wiphy, center_freq, MHZ_TO_KHZ(min_bw)); in freq_reg_info()
1773 static void handle_channel_single_rule(struct wiphy *wiphy, in handle_channel_single_rule() argument
1778 struct wiphy *request_wiphy, in handle_channel_single_rule()
1785 regd = reg_get_regdomain(wiphy); in handle_channel_single_rule()
1791 request_wiphy && request_wiphy == wiphy && in handle_channel_single_rule()
1843 wiphy->regulatory_flags & REGULATORY_COUNTRY_IE_FOLLOW_POWER) in handle_channel_single_rule()
1852 static void handle_channel_adjacent_rules(struct wiphy *wiphy, in handle_channel_adjacent_rules() argument
1857 struct wiphy *request_wiphy, in handle_channel_adjacent_rules()
1868 regd = reg_get_regdomain(wiphy); in handle_channel_adjacent_rules()
1876 request_wiphy && request_wiphy == wiphy && in handle_channel_adjacent_rules()
1958 wiphy->regulatory_flags & REGULATORY_COUNTRY_IE_FOLLOW_POWER) in handle_channel_adjacent_rules()
1972 static void handle_channel(struct wiphy *wiphy, in handle_channel() argument
1978 struct wiphy *request_wiphy = wiphy_idx_to_wiphy(lr->wiphy_idx); in handle_channel()
1985 rrule = freq_reg_info(wiphy, orig_chan_freq); in handle_channel()
1991 rrule1 = freq_reg_info(wiphy, in handle_channel()
1993 rrule2 = freq_reg_info(wiphy, in handle_channel()
2016 handle_channel_adjacent_rules(wiphy, initiator, chan, in handle_channel()
2038 request_wiphy && request_wiphy == wiphy && in handle_channel()
2052 handle_channel_single_rule(wiphy, initiator, chan, flags, lr, in handle_channel()
2056 static void handle_band(struct wiphy *wiphy, in handle_band() argument
2066 handle_channel(wiphy, initiator, &sband->channels[i]); in handle_band()
2099 static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy) in reg_dev_ignore_cell_hint() argument
2101 return !(wiphy->features & NL80211_FEATURE_CELL_BASE_REG_HINTS); in reg_dev_ignore_cell_hint()
2110 static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy) in reg_dev_ignore_cell_hint() argument
2116 static bool wiphy_strict_alpha2_regd(struct wiphy *wiphy) in wiphy_strict_alpha2_regd() argument
2118 if (wiphy->regulatory_flags & REGULATORY_STRICT_REG && in wiphy_strict_alpha2_regd()
2119 !(wiphy->regulatory_flags & REGULATORY_CUSTOM_REG)) in wiphy_strict_alpha2_regd()
2124 static bool ignore_reg_update(struct wiphy *wiphy, in ignore_reg_update() argument
2129 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in ignore_reg_update()
2139 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) { in ignore_reg_update()
2149 if (wiphy_strict_alpha2_regd(wiphy) && !wiphy->regd && in ignore_reg_update()
2158 return reg_dev_ignore_cell_hint(wiphy); in ignore_reg_update()
2163 static bool reg_is_world_roaming(struct wiphy *wiphy) in reg_is_world_roaming() argument
2166 const struct ieee80211_regdomain *wr = get_wiphy_regdom(wiphy); in reg_is_world_roaming()
2173 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) in reg_is_world_roaming()
2179 static void reg_call_notifier(struct wiphy *wiphy, in reg_call_notifier() argument
2182 if (wiphy->reg_notifier) in reg_call_notifier()
2183 wiphy->reg_notifier(wiphy, request); in reg_call_notifier()
2186 static void handle_reg_beacon(struct wiphy *wiphy, unsigned int chan_idx, in handle_reg_beacon() argument
2195 sband = wiphy->bands[reg_beacon->chan.band]; in handle_reg_beacon()
2206 if (!reg_is_world_roaming(wiphy)) in handle_reg_beacon()
2209 if (wiphy->regulatory_flags & REGULATORY_DISABLE_BEACON_HINTS) in handle_reg_beacon()
2220 nl80211_send_beacon_hint_event(wiphy, &chan_before, chan); in handle_reg_beacon()
2221 if (wiphy->flags & WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON) in handle_reg_beacon()
2222 reg_call_notifier(wiphy, lr); in handle_reg_beacon()
2230 static void wiphy_update_new_beacon(struct wiphy *wiphy, in wiphy_update_new_beacon() argument
2236 if (!wiphy->bands[reg_beacon->chan.band]) in wiphy_update_new_beacon()
2239 sband = wiphy->bands[reg_beacon->chan.band]; in wiphy_update_new_beacon()
2242 handle_reg_beacon(wiphy, i, reg_beacon); in wiphy_update_new_beacon()
2248 static void wiphy_update_beacon_reg(struct wiphy *wiphy) in wiphy_update_beacon_reg() argument
2255 if (!wiphy->bands[reg_beacon->chan.band]) in wiphy_update_beacon_reg()
2257 sband = wiphy->bands[reg_beacon->chan.band]; in wiphy_update_beacon_reg()
2259 handle_reg_beacon(wiphy, i, reg_beacon); in wiphy_update_beacon_reg()
2264 static void reg_process_beacons(struct wiphy *wiphy) in reg_process_beacons() argument
2272 wiphy_update_beacon_reg(wiphy); in reg_process_beacons()
2287 static void reg_process_ht_flags_channel(struct wiphy *wiphy, in reg_process_ht_flags_channel() argument
2290 struct ieee80211_supported_band *sband = wiphy->bands[channel->band]; in reg_process_ht_flags_channel()
2315 regd = get_wiphy_regdom(wiphy); in reg_process_ht_flags_channel()
2343 static void reg_process_ht_flags_band(struct wiphy *wiphy, in reg_process_ht_flags_band() argument
2352 reg_process_ht_flags_channel(wiphy, &sband->channels[i]); in reg_process_ht_flags_band()
2355 static void reg_process_ht_flags(struct wiphy *wiphy) in reg_process_ht_flags() argument
2359 if (!wiphy) in reg_process_ht_flags()
2363 reg_process_ht_flags_band(wiphy, wiphy->bands[band]); in reg_process_ht_flags()
2366 static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) in reg_wdev_chan_valid() argument
2369 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in reg_wdev_chan_valid()
2443 ret = cfg80211_reg_can_beacon_relax(wiphy, &chandef, in reg_wdev_chan_valid()
2450 ret = cfg80211_chandef_usable(wiphy, &chandef, in reg_wdev_chan_valid()
2463 static void reg_leave_invalid_chans(struct wiphy *wiphy) in reg_leave_invalid_chans() argument
2466 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in reg_leave_invalid_chans()
2468 wiphy_lock(wiphy); in reg_leave_invalid_chans()
2469 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) in reg_leave_invalid_chans()
2470 if (!reg_wdev_chan_valid(wiphy, wdev)) in reg_leave_invalid_chans()
2472 wiphy_unlock(wiphy); in reg_leave_invalid_chans()
2483 reg_leave_invalid_chans(&rdev->wiphy); in reg_check_chans_work()
2499 static void wiphy_update_regulatory(struct wiphy *wiphy, in wiphy_update_regulatory() argument
2505 if (ignore_reg_update(wiphy, initiator)) { in wiphy_update_regulatory()
2512 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG && in wiphy_update_regulatory()
2513 !(wiphy->regulatory_flags & in wiphy_update_regulatory()
2515 reg_call_notifier(wiphy, lr); in wiphy_update_regulatory()
2522 handle_band(wiphy, initiator, wiphy->bands[band]); in wiphy_update_regulatory()
2524 reg_process_beacons(wiphy); in wiphy_update_regulatory()
2525 reg_process_ht_flags(wiphy); in wiphy_update_regulatory()
2526 reg_call_notifier(wiphy, lr); in wiphy_update_regulatory()
2532 struct wiphy *wiphy; in update_all_wiphy_regulatory() local
2537 wiphy = &rdev->wiphy; in update_all_wiphy_regulatory()
2538 wiphy_update_regulatory(wiphy, initiator); in update_all_wiphy_regulatory()
2544 static void handle_channel_custom(struct wiphy *wiphy, in handle_channel_custom() argument
2564 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) { in handle_channel_custom()
2581 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in handle_channel_custom()
2604 static void handle_band_custom(struct wiphy *wiphy, in handle_band_custom() argument
2619 handle_channel_custom(wiphy, &sband->channels[i], regd, in handle_band_custom()
2624 void wiphy_apply_custom_regulatory(struct wiphy *wiphy, in wiphy_apply_custom_regulatory() argument
2631 WARN(!(wiphy->regulatory_flags & REGULATORY_CUSTOM_REG), in wiphy_apply_custom_regulatory()
2633 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; in wiphy_apply_custom_regulatory()
2636 if (!wiphy->bands[band]) in wiphy_apply_custom_regulatory()
2638 handle_band_custom(wiphy, wiphy->bands[band], regd); in wiphy_apply_custom_regulatory()
2652 wiphy_lock(wiphy); in wiphy_apply_custom_regulatory()
2654 tmp = get_wiphy_regdom(wiphy); in wiphy_apply_custom_regulatory()
2655 rcu_assign_pointer(wiphy->regd, new_regd); in wiphy_apply_custom_regulatory()
2658 wiphy_unlock(wiphy); in wiphy_apply_custom_regulatory()
2807 reg_process_hint_driver(struct wiphy *wiphy, in reg_process_hint_driver() argument
2826 tmp = get_wiphy_regdom(wiphy); in reg_process_hint_driver()
2828 wiphy_lock(wiphy); in reg_process_hint_driver()
2829 rcu_assign_pointer(wiphy->regd, regd); in reg_process_hint_driver()
2830 wiphy_unlock(wiphy); in reg_process_hint_driver()
2859 __reg_process_hint_country_ie(struct wiphy *wiphy, in __reg_process_hint_country_ie() argument
2862 struct wiphy *last_wiphy = NULL; in __reg_process_hint_country_ie()
2871 if (wiphy->regulatory_flags & REGULATORY_COUNTRY_IE_IGNORE) in __reg_process_hint_country_ie()
2883 if (last_wiphy != wiphy) { in __reg_process_hint_country_ie()
2911 reg_process_hint_country_ie(struct wiphy *wiphy, in reg_process_hint_country_ie() argument
2916 treatment = __reg_process_hint_country_ie(wiphy, country_ie_request); in reg_process_hint_country_ie()
2946 bool reg_dfs_domain_same(struct wiphy *wiphy1, struct wiphy *wiphy2) in reg_dfs_domain_same()
2989 static void wiphy_share_dfs_chan_state(struct wiphy *dst_wiphy, in wiphy_share_dfs_chan_state()
2990 struct wiphy *src_wiphy) in wiphy_share_dfs_chan_state()
3015 static void wiphy_all_share_dfs_chan_state(struct wiphy *wiphy) in wiphy_all_share_dfs_chan_state() argument
3022 if (wiphy == &rdev->wiphy) in wiphy_all_share_dfs_chan_state()
3024 wiphy_share_dfs_chan_state(wiphy, &rdev->wiphy); in wiphy_all_share_dfs_chan_state()
3031 struct wiphy *wiphy = NULL; in reg_process_hint() local
3036 wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); in reg_process_hint()
3046 if (!wiphy) in reg_process_hint()
3048 treatment = reg_process_hint_driver(wiphy, reg_request); in reg_process_hint()
3051 if (!wiphy) in reg_process_hint()
3053 treatment = reg_process_hint_country_ie(wiphy, reg_request); in reg_process_hint()
3069 if (treatment == REG_REQ_ALREADY_SET && wiphy && in reg_process_hint()
3070 wiphy->regulatory_flags & REGULATORY_STRICT_REG) { in reg_process_hint()
3071 wiphy_update_regulatory(wiphy, initiator); in reg_process_hint()
3072 wiphy_all_share_dfs_chan_state(wiphy); in reg_process_hint()
3085 struct wiphy *wiphy; in notify_self_managed_wiphys() local
3088 wiphy = &rdev->wiphy; in notify_self_managed_wiphys()
3089 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED && in notify_self_managed_wiphys()
3091 reg_call_notifier(wiphy, request); in notify_self_managed_wiphys()
3153 wiphy_update_new_beacon(&rdev->wiphy, pending_beacon); in reg_process_pending_beacon_hints()
3162 static void reg_process_self_managed_hint(struct wiphy *wiphy) in reg_process_self_managed_hint() argument
3164 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in reg_process_self_managed_hint()
3171 lockdep_assert_wiphy(wiphy); in reg_process_self_managed_hint()
3181 tmp = get_wiphy_regdom(wiphy); in reg_process_self_managed_hint()
3182 rcu_assign_pointer(wiphy->regd, regd); in reg_process_self_managed_hint()
3186 handle_band_custom(wiphy, wiphy->bands[band], regd); in reg_process_self_managed_hint()
3188 reg_process_ht_flags(wiphy); in reg_process_self_managed_hint()
3190 request.wiphy_idx = get_wiphy_idx(wiphy); in reg_process_self_managed_hint()
3195 if (wiphy->flags & WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER) in reg_process_self_managed_hint()
3196 reg_call_notifier(wiphy, &request); in reg_process_self_managed_hint()
3208 wiphy_lock(&rdev->wiphy); in reg_process_self_managed_hints()
3209 reg_process_self_managed_hint(&rdev->wiphy); in reg_process_self_managed_hints()
3210 wiphy_unlock(&rdev->wiphy); in reg_process_self_managed_hints()
3332 int regulatory_hint(struct wiphy *wiphy, const char *alpha2) in regulatory_hint() argument
3336 if (WARN_ON(!alpha2 || !wiphy)) in regulatory_hint()
3339 wiphy->regulatory_flags &= ~REGULATORY_CUSTOM_REG; in regulatory_hint()
3345 request->wiphy_idx = get_wiphy_idx(wiphy); in regulatory_hint()
3360 void regulatory_hint_country_ie(struct wiphy *wiphy, enum nl80211_band band, in regulatory_hint_country_ie() argument
3401 request->wiphy_idx = get_wiphy_idx(wiphy); in regulatory_hint_country_ie()
3457 static void restore_custom_reg_settings(struct wiphy *wiphy) in restore_custom_reg_settings() argument
3465 sband = wiphy->bands[band]; in restore_custom_reg_settings()
3546 if (rdev->wiphy.regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in restore_regulatory_settings()
3548 if (rdev->wiphy.regulatory_flags & REGULATORY_CUSTOM_REG) in restore_regulatory_settings()
3549 restore_custom_reg_settings(&rdev->wiphy); in restore_regulatory_settings()
3603 wiphy_lock(&rdev->wiphy); in is_wiphy_all_set_reg_flag()
3604 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in is_wiphy_all_set_reg_flag()
3605 if (!(wdev->wiphy->regulatory_flags & flag)) { in is_wiphy_all_set_reg_flag()
3606 wiphy_unlock(&rdev->wiphy); in is_wiphy_all_set_reg_flag()
3610 wiphy_unlock(&rdev->wiphy); in is_wiphy_all_set_reg_flag()
3669 void regulatory_hint_found_beacon(struct wiphy *wiphy, in regulatory_hint_found_beacon() argument
3697 wiphy_name(wiphy)); in regulatory_hint_found_beacon()
3865 struct wiphy *request_wiphy; in reg_set_rd_driver()
3926 struct wiphy *request_wiphy; in reg_set_rd_country_ie()
4033 static int __regulatory_set_wiphy_regd(struct wiphy *wiphy, in __regulatory_set_wiphy_regd() argument
4040 if (WARN_ON(!wiphy || !rd)) in __regulatory_set_wiphy_regd()
4043 if (WARN(!(wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED), in __regulatory_set_wiphy_regd()
4058 rdev = wiphy_to_rdev(wiphy); in __regulatory_set_wiphy_regd()
4069 int regulatory_set_wiphy_regd(struct wiphy *wiphy, in regulatory_set_wiphy_regd() argument
4072 int ret = __regulatory_set_wiphy_regd(wiphy, rd); in regulatory_set_wiphy_regd()
4082 int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, in regulatory_set_wiphy_regd_sync() argument
4089 ret = __regulatory_set_wiphy_regd(wiphy, rd); in regulatory_set_wiphy_regd_sync()
4094 reg_process_self_managed_hint(wiphy); in regulatory_set_wiphy_regd_sync()
4100 void wiphy_regulatory_register(struct wiphy *wiphy) in wiphy_regulatory_register() argument
4105 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) { in wiphy_regulatory_register()
4106 wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS | in wiphy_regulatory_register()
4115 reg_call_notifier(wiphy, lr); in wiphy_regulatory_register()
4118 if (!reg_dev_ignore_cell_hint(wiphy)) in wiphy_regulatory_register()
4121 wiphy_update_regulatory(wiphy, lr->initiator); in wiphy_regulatory_register()
4122 wiphy_all_share_dfs_chan_state(wiphy); in wiphy_regulatory_register()
4126 void wiphy_regulatory_deregister(struct wiphy *wiphy) in wiphy_regulatory_deregister() argument
4128 struct wiphy *request_wiphy = NULL; in wiphy_regulatory_deregister()
4133 if (!reg_dev_ignore_cell_hint(wiphy)) in wiphy_regulatory_deregister()
4136 rcu_free_regdom(get_wiphy_regdom(wiphy)); in wiphy_regulatory_deregister()
4137 RCU_INIT_POINTER(wiphy->regd, NULL); in wiphy_regulatory_deregister()
4142 if (!request_wiphy || request_wiphy != wiphy) in wiphy_regulatory_deregister()
4200 bool regulatory_pre_cac_allowed(struct wiphy *wiphy) in regulatory_pre_cac_allowed() argument
4209 wiphy_regd = rcu_dereference(wiphy->regd); in regulatory_pre_cac_allowed()
4243 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in cfg80211_check_and_end_cac()
4254 if (!cfg80211_chandef_dfs_usable(&rdev->wiphy, chandef)) in cfg80211_check_and_end_cac()
4260 void regulatory_propagate_dfs_state(struct wiphy *wiphy, in regulatory_propagate_dfs_state() argument
4273 if (wiphy == &rdev->wiphy) in regulatory_propagate_dfs_state()
4276 if (!reg_dfs_domain_same(wiphy, &rdev->wiphy)) in regulatory_propagate_dfs_state()
4279 if (!ieee80211_get_channel(&rdev->wiphy, in regulatory_propagate_dfs_state()
4283 cfg80211_set_dfs_state(&rdev->wiphy, chandef, dfs_state); in regulatory_propagate_dfs_state()