Lines Matching refs:wiphy
145 const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy) in get_wiphy_regdom() argument
147 return rtnl_dereference(wiphy->regd); in get_wiphy_regdom()
165 enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy) in reg_get_dfs_region() argument
171 if (!wiphy) in reg_get_dfs_region()
174 wiphy_regd = get_wiphy_regdom(wiphy); in reg_get_dfs_region()
184 dev_name(&wiphy->dev), in reg_get_dfs_region()
630 static const struct ieee80211_regdomain *reg_get_regdomain(struct wiphy *wiphy) in reg_get_regdomain() argument
640 wiphy->regd) in reg_get_regdomain()
641 return get_wiphy_regdom(wiphy); in reg_get_regdomain()
1055 freq_reg_info_regd(struct wiphy *wiphy, u32 center_freq, in freq_reg_info_regd() argument
1093 __freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 min_bw) in __freq_reg_info() argument
1095 const struct ieee80211_regdomain *regd = reg_get_regdomain(wiphy); in __freq_reg_info()
1100 reg_rule = freq_reg_info_regd(wiphy, center_freq, regd, bw); in __freq_reg_info()
1108 const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, in freq_reg_info() argument
1111 return __freq_reg_info(wiphy, center_freq, MHZ_TO_KHZ(20)); in freq_reg_info()
1174 static void handle_channel(struct wiphy *wiphy, in handle_channel() argument
1182 struct wiphy *request_wiphy = NULL; in handle_channel()
1191 reg_rule = freq_reg_info(wiphy, MHZ_TO_KHZ(chan->center_freq)); in handle_channel()
1208 request_wiphy && request_wiphy == wiphy && in handle_channel()
1222 regd = reg_get_regdomain(wiphy); in handle_channel()
1253 request_wiphy && request_wiphy == wiphy && in handle_channel()
1299 wiphy->regulatory_flags & REGULATORY_COUNTRY_IE_FOLLOW_POWER) in handle_channel()
1308 static void handle_band(struct wiphy *wiphy, in handle_band() argument
1318 handle_channel(wiphy, initiator, &sband->channels[i]); in handle_band()
1351 static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy) in reg_dev_ignore_cell_hint() argument
1353 return !(wiphy->features & NL80211_FEATURE_CELL_BASE_REG_HINTS); in reg_dev_ignore_cell_hint()
1362 static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy) in reg_dev_ignore_cell_hint() argument
1368 static bool wiphy_strict_alpha2_regd(struct wiphy *wiphy) in wiphy_strict_alpha2_regd() argument
1370 if (wiphy->regulatory_flags & REGULATORY_STRICT_REG && in wiphy_strict_alpha2_regd()
1371 !(wiphy->regulatory_flags & REGULATORY_CUSTOM_REG)) in wiphy_strict_alpha2_regd()
1376 static bool ignore_reg_update(struct wiphy *wiphy, in ignore_reg_update() argument
1381 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in ignore_reg_update()
1392 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) { in ignore_reg_update()
1404 if (wiphy_strict_alpha2_regd(wiphy) && !wiphy->regd && in ignore_reg_update()
1415 return reg_dev_ignore_cell_hint(wiphy); in ignore_reg_update()
1420 static bool reg_is_world_roaming(struct wiphy *wiphy) in reg_is_world_roaming() argument
1423 const struct ieee80211_regdomain *wr = get_wiphy_regdom(wiphy); in reg_is_world_roaming()
1430 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) in reg_is_world_roaming()
1436 static void handle_reg_beacon(struct wiphy *wiphy, unsigned int chan_idx, in handle_reg_beacon() argument
1444 sband = wiphy->bands[reg_beacon->chan.band]; in handle_reg_beacon()
1455 if (!reg_is_world_roaming(wiphy)) in handle_reg_beacon()
1458 if (wiphy->regulatory_flags & REGULATORY_DISABLE_BEACON_HINTS) in handle_reg_beacon()
1470 nl80211_send_beacon_hint_event(wiphy, &chan_before, chan); in handle_reg_beacon()
1477 static void wiphy_update_new_beacon(struct wiphy *wiphy, in wiphy_update_new_beacon() argument
1483 if (!wiphy->bands[reg_beacon->chan.band]) in wiphy_update_new_beacon()
1486 sband = wiphy->bands[reg_beacon->chan.band]; in wiphy_update_new_beacon()
1489 handle_reg_beacon(wiphy, i, reg_beacon); in wiphy_update_new_beacon()
1495 static void wiphy_update_beacon_reg(struct wiphy *wiphy) in wiphy_update_beacon_reg() argument
1502 if (!wiphy->bands[reg_beacon->chan.band]) in wiphy_update_beacon_reg()
1504 sband = wiphy->bands[reg_beacon->chan.band]; in wiphy_update_beacon_reg()
1506 handle_reg_beacon(wiphy, i, reg_beacon); in wiphy_update_beacon_reg()
1511 static void reg_process_beacons(struct wiphy *wiphy) in reg_process_beacons() argument
1519 wiphy_update_beacon_reg(wiphy); in reg_process_beacons()
1534 static void reg_process_ht_flags_channel(struct wiphy *wiphy, in reg_process_ht_flags_channel() argument
1537 struct ieee80211_supported_band *sband = wiphy->bands[channel->band]; in reg_process_ht_flags_channel()
1575 static void reg_process_ht_flags_band(struct wiphy *wiphy, in reg_process_ht_flags_band() argument
1584 reg_process_ht_flags_channel(wiphy, &sband->channels[i]); in reg_process_ht_flags_band()
1587 static void reg_process_ht_flags(struct wiphy *wiphy) in reg_process_ht_flags() argument
1591 if (!wiphy) in reg_process_ht_flags()
1595 reg_process_ht_flags_band(wiphy, wiphy->bands[band]); in reg_process_ht_flags()
1598 static void reg_call_notifier(struct wiphy *wiphy, in reg_call_notifier() argument
1601 if (wiphy->reg_notifier) in reg_call_notifier()
1602 wiphy->reg_notifier(wiphy, request); in reg_call_notifier()
1605 static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) in reg_wdev_chan_valid() argument
1608 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in reg_wdev_chan_valid()
1659 return cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype); in reg_wdev_chan_valid()
1662 return cfg80211_chandef_usable(wiphy, &chandef, in reg_wdev_chan_valid()
1675 static void reg_leave_invalid_chans(struct wiphy *wiphy) in reg_leave_invalid_chans() argument
1678 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in reg_leave_invalid_chans()
1683 if (!reg_wdev_chan_valid(wiphy, wdev)) in reg_leave_invalid_chans()
1695 if (!(rdev->wiphy.regulatory_flags & in reg_check_chans_work()
1697 reg_leave_invalid_chans(&rdev->wiphy); in reg_check_chans_work()
1713 static void wiphy_update_regulatory(struct wiphy *wiphy, in wiphy_update_regulatory() argument
1719 if (ignore_reg_update(wiphy, initiator)) { in wiphy_update_regulatory()
1726 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) in wiphy_update_regulatory()
1727 reg_call_notifier(wiphy, lr); in wiphy_update_regulatory()
1734 handle_band(wiphy, initiator, wiphy->bands[band]); in wiphy_update_regulatory()
1736 reg_process_beacons(wiphy); in wiphy_update_regulatory()
1737 reg_process_ht_flags(wiphy); in wiphy_update_regulatory()
1738 reg_call_notifier(wiphy, lr); in wiphy_update_regulatory()
1744 struct wiphy *wiphy; in update_all_wiphy_regulatory() local
1749 wiphy = &rdev->wiphy; in update_all_wiphy_regulatory()
1750 wiphy_update_regulatory(wiphy, initiator); in update_all_wiphy_regulatory()
1756 static void handle_channel_custom(struct wiphy *wiphy, in handle_channel_custom() argument
1768 reg_rule = freq_reg_info_regd(wiphy, in handle_channel_custom()
1778 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) { in handle_channel_custom()
1821 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in handle_channel_custom()
1841 static void handle_band_custom(struct wiphy *wiphy, in handle_band_custom() argument
1851 handle_channel_custom(wiphy, &sband->channels[i], regd); in handle_band_custom()
1855 void wiphy_apply_custom_regulatory(struct wiphy *wiphy, in wiphy_apply_custom_regulatory() argument
1861 WARN(!(wiphy->regulatory_flags & REGULATORY_CUSTOM_REG), in wiphy_apply_custom_regulatory()
1863 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; in wiphy_apply_custom_regulatory()
1866 if (!wiphy->bands[band]) in wiphy_apply_custom_regulatory()
1868 handle_band_custom(wiphy, wiphy->bands[band], regd); in wiphy_apply_custom_regulatory()
2017 reg_process_hint_driver(struct wiphy *wiphy, in reg_process_hint_driver() argument
2036 tmp = get_wiphy_regdom(wiphy); in reg_process_hint_driver()
2037 rcu_assign_pointer(wiphy->regd, regd); in reg_process_hint_driver()
2066 __reg_process_hint_country_ie(struct wiphy *wiphy, in __reg_process_hint_country_ie() argument
2069 struct wiphy *last_wiphy = NULL; in __reg_process_hint_country_ie()
2078 if (wiphy->regulatory_flags & REGULATORY_COUNTRY_IE_IGNORE) in __reg_process_hint_country_ie()
2090 if (last_wiphy != wiphy) { in __reg_process_hint_country_ie()
2117 reg_process_hint_country_ie(struct wiphy *wiphy, in reg_process_hint_country_ie() argument
2122 treatment = __reg_process_hint_country_ie(wiphy, country_ie_request); in reg_process_hint_country_ie()
2155 struct wiphy *wiphy = NULL; in reg_process_hint() local
2159 wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); in reg_process_hint()
2169 if (!wiphy) in reg_process_hint()
2171 treatment = reg_process_hint_driver(wiphy, reg_request); in reg_process_hint()
2174 if (!wiphy) in reg_process_hint()
2176 treatment = reg_process_hint_country_ie(wiphy, reg_request); in reg_process_hint()
2192 if (treatment == REG_REQ_ALREADY_SET && wiphy && in reg_process_hint()
2193 wiphy->regulatory_flags & REGULATORY_STRICT_REG) { in reg_process_hint()
2194 wiphy_update_regulatory(wiphy, reg_request->initiator); in reg_process_hint()
2207 struct wiphy *wiphy; in reg_only_self_managed_wiphys() local
2213 wiphy = &rdev->wiphy; in reg_only_self_managed_wiphys()
2214 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in reg_only_self_managed_wiphys()
2285 wiphy_update_new_beacon(&rdev->wiphy, pending_beacon); in reg_process_pending_beacon_hints()
2297 struct wiphy *wiphy; in reg_process_self_managed_hints() local
2304 wiphy = &rdev->wiphy; in reg_process_self_managed_hints()
2314 tmp = get_wiphy_regdom(wiphy); in reg_process_self_managed_hints()
2315 rcu_assign_pointer(wiphy->regd, regd); in reg_process_self_managed_hints()
2319 handle_band_custom(wiphy, wiphy->bands[band], regd); in reg_process_self_managed_hints()
2321 reg_process_ht_flags(wiphy); in reg_process_self_managed_hints()
2323 request.wiphy_idx = get_wiphy_idx(wiphy); in reg_process_self_managed_hints()
2448 int regulatory_hint(struct wiphy *wiphy, const char *alpha2) in regulatory_hint() argument
2452 if (WARN_ON(!alpha2 || !wiphy)) in regulatory_hint()
2455 wiphy->regulatory_flags &= ~REGULATORY_CUSTOM_REG; in regulatory_hint()
2461 request->wiphy_idx = get_wiphy_idx(wiphy); in regulatory_hint()
2476 void regulatory_hint_country_ie(struct wiphy *wiphy, enum ieee80211_band band, in regulatory_hint_country_ie() argument
2517 request->wiphy_idx = get_wiphy_idx(wiphy); in regulatory_hint_country_ie()
2573 static void restore_custom_reg_settings(struct wiphy *wiphy) in restore_custom_reg_settings() argument
2581 sband = wiphy->bands[band]; in restore_custom_reg_settings()
2662 if (rdev->wiphy.regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in restore_regulatory_settings()
2664 if (rdev->wiphy.regulatory_flags & REGULATORY_CUSTOM_REG) in restore_regulatory_settings()
2665 restore_custom_reg_settings(&rdev->wiphy); in restore_regulatory_settings()
2713 int regulatory_hint_found_beacon(struct wiphy *wiphy, in regulatory_hint_found_beacon() argument
2740 wiphy_name(wiphy)); in regulatory_hint_found_beacon()
2910 struct wiphy *request_wiphy; in reg_set_rd_driver()
2964 struct wiphy *request_wiphy; in reg_set_rd_country_ie()
3066 static int __regulatory_set_wiphy_regd(struct wiphy *wiphy, in __regulatory_set_wiphy_regd() argument
3073 if (WARN_ON(!wiphy || !rd)) in __regulatory_set_wiphy_regd()
3076 if (WARN(!(wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED), in __regulatory_set_wiphy_regd()
3089 rdev = wiphy_to_rdev(wiphy); in __regulatory_set_wiphy_regd()
3100 int regulatory_set_wiphy_regd(struct wiphy *wiphy, in regulatory_set_wiphy_regd() argument
3103 int ret = __regulatory_set_wiphy_regd(wiphy, rd); in regulatory_set_wiphy_regd()
3113 int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, in regulatory_set_wiphy_regd_sync_rtnl() argument
3120 ret = __regulatory_set_wiphy_regd(wiphy, rd); in regulatory_set_wiphy_regd_sync_rtnl()
3130 void wiphy_regulatory_register(struct wiphy *wiphy) in wiphy_regulatory_register() argument
3135 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in wiphy_regulatory_register()
3136 wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS | in wiphy_regulatory_register()
3139 if (!reg_dev_ignore_cell_hint(wiphy)) in wiphy_regulatory_register()
3143 wiphy_update_regulatory(wiphy, lr->initiator); in wiphy_regulatory_register()
3146 void wiphy_regulatory_deregister(struct wiphy *wiphy) in wiphy_regulatory_deregister() argument
3148 struct wiphy *request_wiphy = NULL; in wiphy_regulatory_deregister()
3153 if (!reg_dev_ignore_cell_hint(wiphy)) in wiphy_regulatory_deregister()
3156 rcu_free_regdom(get_wiphy_regdom(wiphy)); in wiphy_regulatory_deregister()
3157 RCU_INIT_POINTER(wiphy->regd, NULL); in wiphy_regulatory_deregister()
3162 if (!request_wiphy || request_wiphy != wiphy) in wiphy_regulatory_deregister()