Lines Matching refs:wiphy

148 const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy)  in get_wiphy_regdom()  argument
150 return rtnl_dereference(wiphy->regd); in get_wiphy_regdom()
168 enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy) in reg_get_dfs_region() argument
174 if (!wiphy) in reg_get_dfs_region()
177 wiphy_regd = get_wiphy_regdom(wiphy); in reg_get_dfs_region()
187 dev_name(&wiphy->dev), in reg_get_dfs_region()
581 static const struct ieee80211_regdomain *reg_get_regdomain(struct wiphy *wiphy) in reg_get_regdomain() argument
591 wiphy->regd) in reg_get_regdomain()
592 return get_wiphy_regdom(wiphy); in reg_get_regdomain()
1006 freq_reg_info_regd(struct wiphy *wiphy, u32 center_freq, in freq_reg_info_regd() argument
1043 const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, in freq_reg_info() argument
1048 regd = reg_get_regdomain(wiphy); in freq_reg_info()
1050 return freq_reg_info_regd(wiphy, center_freq, regd); in freq_reg_info()
1120 static void handle_channel(struct wiphy *wiphy, in handle_channel() argument
1128 struct wiphy *request_wiphy = NULL; in handle_channel()
1137 reg_rule = freq_reg_info(wiphy, MHZ_TO_KHZ(chan->center_freq)); in handle_channel()
1154 request_wiphy && request_wiphy == wiphy && in handle_channel()
1168 regd = reg_get_regdomain(wiphy); in handle_channel()
1187 request_wiphy && request_wiphy == wiphy && in handle_channel()
1233 wiphy->regulatory_flags & REGULATORY_COUNTRY_IE_FOLLOW_POWER) in handle_channel()
1242 static void handle_band(struct wiphy *wiphy, in handle_band() argument
1252 handle_channel(wiphy, initiator, &sband->channels[i]); in handle_band()
1285 static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy) in reg_dev_ignore_cell_hint() argument
1287 return !(wiphy->features & NL80211_FEATURE_CELL_BASE_REG_HINTS); in reg_dev_ignore_cell_hint()
1295 static bool reg_dev_ignore_cell_hint(struct wiphy *wiphy) in reg_dev_ignore_cell_hint() argument
1301 static bool wiphy_strict_alpha2_regd(struct wiphy *wiphy) in wiphy_strict_alpha2_regd() argument
1303 if (wiphy->regulatory_flags & REGULATORY_STRICT_REG && in wiphy_strict_alpha2_regd()
1304 !(wiphy->regulatory_flags & REGULATORY_CUSTOM_REG)) in wiphy_strict_alpha2_regd()
1309 static bool ignore_reg_update(struct wiphy *wiphy, in ignore_reg_update() argument
1314 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in ignore_reg_update()
1325 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) { in ignore_reg_update()
1337 if (wiphy_strict_alpha2_regd(wiphy) && !wiphy->regd && in ignore_reg_update()
1348 return reg_dev_ignore_cell_hint(wiphy); in ignore_reg_update()
1353 static bool reg_is_world_roaming(struct wiphy *wiphy) in reg_is_world_roaming() argument
1356 const struct ieee80211_regdomain *wr = get_wiphy_regdom(wiphy); in reg_is_world_roaming()
1363 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) in reg_is_world_roaming()
1369 static void handle_reg_beacon(struct wiphy *wiphy, unsigned int chan_idx, in handle_reg_beacon() argument
1377 sband = wiphy->bands[reg_beacon->chan.band]; in handle_reg_beacon()
1388 if (!reg_is_world_roaming(wiphy)) in handle_reg_beacon()
1391 if (wiphy->regulatory_flags & REGULATORY_DISABLE_BEACON_HINTS) in handle_reg_beacon()
1403 nl80211_send_beacon_hint_event(wiphy, &chan_before, chan); in handle_reg_beacon()
1410 static void wiphy_update_new_beacon(struct wiphy *wiphy, in wiphy_update_new_beacon() argument
1416 if (!wiphy->bands[reg_beacon->chan.band]) in wiphy_update_new_beacon()
1419 sband = wiphy->bands[reg_beacon->chan.band]; in wiphy_update_new_beacon()
1422 handle_reg_beacon(wiphy, i, reg_beacon); in wiphy_update_new_beacon()
1428 static void wiphy_update_beacon_reg(struct wiphy *wiphy) in wiphy_update_beacon_reg() argument
1435 if (!wiphy->bands[reg_beacon->chan.band]) in wiphy_update_beacon_reg()
1437 sband = wiphy->bands[reg_beacon->chan.band]; in wiphy_update_beacon_reg()
1439 handle_reg_beacon(wiphy, i, reg_beacon); in wiphy_update_beacon_reg()
1444 static void reg_process_beacons(struct wiphy *wiphy) in reg_process_beacons() argument
1452 wiphy_update_beacon_reg(wiphy); in reg_process_beacons()
1467 static void reg_process_ht_flags_channel(struct wiphy *wiphy, in reg_process_ht_flags_channel() argument
1470 struct ieee80211_supported_band *sband = wiphy->bands[channel->band]; in reg_process_ht_flags_channel()
1508 static void reg_process_ht_flags_band(struct wiphy *wiphy, in reg_process_ht_flags_band() argument
1517 reg_process_ht_flags_channel(wiphy, &sband->channels[i]); in reg_process_ht_flags_band()
1520 static void reg_process_ht_flags(struct wiphy *wiphy) in reg_process_ht_flags() argument
1524 if (!wiphy) in reg_process_ht_flags()
1528 reg_process_ht_flags_band(wiphy, wiphy->bands[band]); in reg_process_ht_flags()
1531 static void reg_call_notifier(struct wiphy *wiphy, in reg_call_notifier() argument
1534 if (wiphy->reg_notifier) in reg_call_notifier()
1535 wiphy->reg_notifier(wiphy, request); in reg_call_notifier()
1538 static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) in reg_wdev_chan_valid() argument
1541 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in reg_wdev_chan_valid()
1592 return cfg80211_reg_can_beacon(wiphy, &chandef, iftype); in reg_wdev_chan_valid()
1595 return cfg80211_chandef_usable(wiphy, &chandef, in reg_wdev_chan_valid()
1608 static void reg_leave_invalid_chans(struct wiphy *wiphy) in reg_leave_invalid_chans() argument
1611 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in reg_leave_invalid_chans()
1616 if (!reg_wdev_chan_valid(wiphy, wdev)) in reg_leave_invalid_chans()
1628 if (!(rdev->wiphy.regulatory_flags & in reg_check_chans_work()
1630 reg_leave_invalid_chans(&rdev->wiphy); in reg_check_chans_work()
1646 static void wiphy_update_regulatory(struct wiphy *wiphy, in wiphy_update_regulatory() argument
1652 if (ignore_reg_update(wiphy, initiator)) { in wiphy_update_regulatory()
1659 wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) in wiphy_update_regulatory()
1660 reg_call_notifier(wiphy, lr); in wiphy_update_regulatory()
1667 handle_band(wiphy, initiator, wiphy->bands[band]); in wiphy_update_regulatory()
1669 reg_process_beacons(wiphy); in wiphy_update_regulatory()
1670 reg_process_ht_flags(wiphy); in wiphy_update_regulatory()
1671 reg_call_notifier(wiphy, lr); in wiphy_update_regulatory()
1677 struct wiphy *wiphy; in update_all_wiphy_regulatory() local
1682 wiphy = &rdev->wiphy; in update_all_wiphy_regulatory()
1683 wiphy_update_regulatory(wiphy, initiator); in update_all_wiphy_regulatory()
1689 static void handle_channel_custom(struct wiphy *wiphy, in handle_channel_custom() argument
1699 reg_rule = freq_reg_info_regd(wiphy, MHZ_TO_KHZ(chan->center_freq), in handle_channel_custom()
1705 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) { in handle_channel_custom()
1736 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in handle_channel_custom()
1756 static void handle_band_custom(struct wiphy *wiphy, in handle_band_custom() argument
1766 handle_channel_custom(wiphy, &sband->channels[i], regd); in handle_band_custom()
1770 void wiphy_apply_custom_regulatory(struct wiphy *wiphy, in wiphy_apply_custom_regulatory() argument
1776 WARN(!(wiphy->regulatory_flags & REGULATORY_CUSTOM_REG), in wiphy_apply_custom_regulatory()
1778 wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; in wiphy_apply_custom_regulatory()
1781 if (!wiphy->bands[band]) in wiphy_apply_custom_regulatory()
1783 handle_band_custom(wiphy, wiphy->bands[band], regd); in wiphy_apply_custom_regulatory()
1935 reg_process_hint_driver(struct wiphy *wiphy, in reg_process_hint_driver() argument
1958 tmp = get_wiphy_regdom(wiphy); in reg_process_hint_driver()
1959 rcu_assign_pointer(wiphy->regd, regd); in reg_process_hint_driver()
1984 __reg_process_hint_country_ie(struct wiphy *wiphy, in __reg_process_hint_country_ie() argument
1987 struct wiphy *last_wiphy = NULL; in __reg_process_hint_country_ie()
1996 if (wiphy->regulatory_flags & REGULATORY_COUNTRY_IE_IGNORE) in __reg_process_hint_country_ie()
2008 if (last_wiphy != wiphy) { in __reg_process_hint_country_ie()
2035 reg_process_hint_country_ie(struct wiphy *wiphy, in reg_process_hint_country_ie() argument
2040 treatment = __reg_process_hint_country_ie(wiphy, country_ie_request); in reg_process_hint_country_ie()
2071 struct wiphy *wiphy = NULL; in reg_process_hint() local
2075 wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); in reg_process_hint()
2088 if (!wiphy) in reg_process_hint()
2090 treatment = reg_process_hint_driver(wiphy, reg_request); in reg_process_hint()
2093 if (!wiphy) in reg_process_hint()
2095 treatment = reg_process_hint_country_ie(wiphy, reg_request); in reg_process_hint()
2103 if (treatment == REG_REQ_ALREADY_SET && wiphy && in reg_process_hint()
2104 wiphy->regulatory_flags & REGULATORY_STRICT_REG) { in reg_process_hint()
2105 wiphy_update_regulatory(wiphy, reg_request->initiator); in reg_process_hint()
2118 struct wiphy *wiphy; in reg_only_self_managed_wiphys() local
2124 wiphy = &rdev->wiphy; in reg_only_self_managed_wiphys()
2125 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in reg_only_self_managed_wiphys()
2196 wiphy_update_new_beacon(&rdev->wiphy, pending_beacon); in reg_process_pending_beacon_hints()
2208 struct wiphy *wiphy; in reg_process_self_managed_hints() local
2215 wiphy = &rdev->wiphy; in reg_process_self_managed_hints()
2225 tmp = get_wiphy_regdom(wiphy); in reg_process_self_managed_hints()
2226 rcu_assign_pointer(wiphy->regd, regd); in reg_process_self_managed_hints()
2230 handle_band_custom(wiphy, wiphy->bands[band], regd); in reg_process_self_managed_hints()
2232 reg_process_ht_flags(wiphy); in reg_process_self_managed_hints()
2234 request.wiphy_idx = get_wiphy_idx(wiphy); in reg_process_self_managed_hints()
2359 int regulatory_hint(struct wiphy *wiphy, const char *alpha2) in regulatory_hint() argument
2363 if (WARN_ON(!alpha2 || !wiphy)) in regulatory_hint()
2366 wiphy->regulatory_flags &= ~REGULATORY_CUSTOM_REG; in regulatory_hint()
2372 request->wiphy_idx = get_wiphy_idx(wiphy); in regulatory_hint()
2387 void regulatory_hint_country_ie(struct wiphy *wiphy, enum ieee80211_band band, in regulatory_hint_country_ie() argument
2428 request->wiphy_idx = get_wiphy_idx(wiphy); in regulatory_hint_country_ie()
2484 static void restore_custom_reg_settings(struct wiphy *wiphy) in restore_custom_reg_settings() argument
2492 sband = wiphy->bands[band]; in restore_custom_reg_settings()
2573 if (rdev->wiphy.regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in restore_regulatory_settings()
2575 if (rdev->wiphy.regulatory_flags & REGULATORY_CUSTOM_REG) in restore_regulatory_settings()
2576 restore_custom_reg_settings(&rdev->wiphy); in restore_regulatory_settings()
2624 int regulatory_hint_found_beacon(struct wiphy *wiphy, in regulatory_hint_found_beacon() argument
2651 wiphy_name(wiphy)); in regulatory_hint_found_beacon()
2821 struct wiphy *request_wiphy; in reg_set_rd_driver()
2878 struct wiphy *request_wiphy; in reg_set_rd_country_ie()
2982 static int __regulatory_set_wiphy_regd(struct wiphy *wiphy, in __regulatory_set_wiphy_regd() argument
2989 if (WARN_ON(!wiphy || !rd)) in __regulatory_set_wiphy_regd()
2992 if (WARN(!(wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED), in __regulatory_set_wiphy_regd()
3005 rdev = wiphy_to_rdev(wiphy); in __regulatory_set_wiphy_regd()
3016 int regulatory_set_wiphy_regd(struct wiphy *wiphy, in regulatory_set_wiphy_regd() argument
3019 int ret = __regulatory_set_wiphy_regd(wiphy, rd); in regulatory_set_wiphy_regd()
3029 int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, in regulatory_set_wiphy_regd_sync_rtnl() argument
3036 ret = __regulatory_set_wiphy_regd(wiphy, rd); in regulatory_set_wiphy_regd_sync_rtnl()
3046 void wiphy_regulatory_register(struct wiphy *wiphy) in wiphy_regulatory_register() argument
3051 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) in wiphy_regulatory_register()
3052 wiphy->regulatory_flags |= REGULATORY_DISABLE_BEACON_HINTS | in wiphy_regulatory_register()
3055 if (!reg_dev_ignore_cell_hint(wiphy)) in wiphy_regulatory_register()
3059 wiphy_update_regulatory(wiphy, lr->initiator); in wiphy_regulatory_register()
3062 void wiphy_regulatory_deregister(struct wiphy *wiphy) in wiphy_regulatory_deregister() argument
3064 struct wiphy *request_wiphy = NULL; in wiphy_regulatory_deregister()
3069 if (!reg_dev_ignore_cell_hint(wiphy)) in wiphy_regulatory_deregister()
3072 rcu_free_regdom(get_wiphy_regdom(wiphy)); in wiphy_regulatory_deregister()
3073 RCU_INIT_POINTER(wiphy->regd, NULL); in wiphy_regulatory_deregister()
3078 if (!request_wiphy || request_wiphy != wiphy) in wiphy_regulatory_deregister()