Lines Matching refs:wiphy

73 int get_wiphy_idx(struct wiphy *wiphy)  in get_wiphy_idx()  argument
75 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in get_wiphy_idx()
80 struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx) in wiphy_idx_to_wiphy()
89 return &rdev->wiphy; in wiphy_idx_to_wiphy()
120 if (strcmp(newname, wiphy_name(&rdev2->wiphy)) == 0) in cfg80211_dev_check_name()
134 if (strcmp(newname, wiphy_name(&rdev->wiphy)) == 0) in cfg80211_dev_rename()
141 result = device_rename(&rdev->wiphy.dev, newname); in cfg80211_dev_rename()
145 if (!IS_ERR_OR_NULL(rdev->wiphy.debugfsdir)) in cfg80211_dev_rename()
146 debugfs_rename(rdev->wiphy.debugfsdir->d_parent, in cfg80211_dev_rename()
147 rdev->wiphy.debugfsdir, in cfg80211_dev_rename()
148 rdev->wiphy.debugfsdir->d_parent, newname); in cfg80211_dev_rename()
161 if (!(rdev->wiphy.flags & WIPHY_FLAG_NETNS_OK)) in cfg80211_switch_netns()
164 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in cfg80211_switch_netns()
176 net = wiphy_net(&rdev->wiphy); in cfg80211_switch_netns()
179 &rdev->wiphy.wdev_list, in cfg80211_switch_netns()
193 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in cfg80211_switch_netns()
200 wiphy_net_set(&rdev->wiphy, net); in cfg80211_switch_netns()
202 err = device_rename(&rdev->wiphy.dev, dev_name(&rdev->wiphy.dev)); in cfg80211_switch_netns()
206 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in cfg80211_switch_netns()
264 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy) in cfg80211_shutdown_all_interfaces() argument
266 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in cfg80211_shutdown_all_interfaces()
271 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in cfg80211_shutdown_all_interfaces()
299 cfg80211_shutdown_all_interfaces(&rdev->wiphy); in cfg80211_rfkill_set_block()
332 list_for_each_entry_safe(wdev, tmp, &rdev->wiphy.wdev_list, list) { in cfg80211_destroy_ifaces()
375 regulatory_propagate_dfs_state(&rdev->wiphy, &rdev->radar_chandef, in cfg80211_propagate_radar_detect_wk()
391 regulatory_propagate_dfs_state(&rdev->wiphy, &rdev->cac_done_chandef, in cfg80211_propagate_cac_done_wk()
400 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, in wiphy_new_nm()
457 rv = dev_set_name(&rdev->wiphy.dev, "%s", requested_name); in wiphy_new_nm()
471 rv = dev_set_name(&rdev->wiphy.dev, PHY_NAME "%d", rdev->wiphy_idx); in wiphy_new_nm()
478 INIT_LIST_HEAD(&rdev->wiphy.wdev_list); in wiphy_new_nm()
488 rdev->wiphy.wext = &cfg80211_wext_handler; in wiphy_new_nm()
491 device_initialize(&rdev->wiphy.dev); in wiphy_new_nm()
492 rdev->wiphy.dev.class = &ieee80211_class; in wiphy_new_nm()
493 rdev->wiphy.dev.platform_data = rdev; in wiphy_new_nm()
494 device_enable_async_suspend(&rdev->wiphy.dev); in wiphy_new_nm()
507 rdev->wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; in wiphy_new_nm()
510 wiphy_net_set(&rdev->wiphy, &init_net); in wiphy_new_nm()
513 rdev->rfkill = rfkill_alloc(dev_name(&rdev->wiphy.dev), in wiphy_new_nm()
514 &rdev->wiphy.dev, RFKILL_TYPE_WLAN, in wiphy_new_nm()
518 wiphy_free(&rdev->wiphy); in wiphy_new_nm()
533 rdev->wiphy.retry_short = 7; in wiphy_new_nm()
534 rdev->wiphy.retry_long = 4; in wiphy_new_nm()
535 rdev->wiphy.frag_threshold = (u32) -1; in wiphy_new_nm()
536 rdev->wiphy.rts_threshold = (u32) -1; in wiphy_new_nm()
537 rdev->wiphy.coverage_class = 0; in wiphy_new_nm()
539 rdev->wiphy.max_num_csa_counters = 1; in wiphy_new_nm()
541 rdev->wiphy.max_sched_scan_plans = 1; in wiphy_new_nm()
542 rdev->wiphy.max_sched_scan_plan_interval = U32_MAX; in wiphy_new_nm()
544 return &rdev->wiphy; in wiphy_new_nm()
548 static int wiphy_verify_combinations(struct wiphy *wiphy) in wiphy_verify_combinations() argument
553 for (i = 0; i < wiphy->n_iface_combinations; i++) { in wiphy_verify_combinations()
557 c = &wiphy->iface_combinations[i]; in wiphy_verify_combinations()
598 if (WARN_ON(wiphy->software_iftypes & types)) in wiphy_verify_combinations()
631 if (WARN_ON((wiphy->interface_modes & types) != types)) in wiphy_verify_combinations()
648 int wiphy_register(struct wiphy *wiphy) in wiphy_register() argument
650 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in wiphy_register()
656 u16 ifmodes = wiphy->interface_modes; in wiphy_register()
659 if (WARN_ON(wiphy->wowlan && in wiphy_register()
660 (wiphy->wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && in wiphy_register()
661 !(wiphy->wowlan->flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY))) in wiphy_register()
663 if (WARN_ON(wiphy->wowlan && in wiphy_register()
664 !wiphy->wowlan->flags && !wiphy->wowlan->n_patterns && in wiphy_register()
665 !wiphy->wowlan->tcp)) in wiphy_register()
668 if (WARN_ON((wiphy->features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH) && in wiphy_register()
673 if (WARN_ON((wiphy->interface_modes & BIT(NL80211_IFTYPE_NAN)) && in wiphy_register()
676 !(wiphy->nan_supported_bands & BIT(NL80211_BAND_2GHZ))))) in wiphy_register()
680 if (WARN_ON(wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS))) in wiphy_register()
684 if (WARN_ON(wiphy->pmsr_capa && !wiphy->pmsr_capa->ftm.supported)) in wiphy_register()
687 if (wiphy->pmsr_capa && wiphy->pmsr_capa->ftm.supported) { in wiphy_register()
688 if (WARN_ON(!wiphy->pmsr_capa->ftm.asap && in wiphy_register()
689 !wiphy->pmsr_capa->ftm.non_asap)) in wiphy_register()
691 if (WARN_ON(!wiphy->pmsr_capa->ftm.preambles || in wiphy_register()
692 !wiphy->pmsr_capa->ftm.bandwidths)) in wiphy_register()
694 if (WARN_ON(wiphy->pmsr_capa->ftm.preambles & in wiphy_register()
701 if (WARN_ON((wiphy->pmsr_capa->ftm.trigger_based || in wiphy_register()
702 wiphy->pmsr_capa->ftm.non_trigger_based) && in wiphy_register()
703 !(wiphy->pmsr_capa->ftm.preambles & in wiphy_register()
706 if (WARN_ON(wiphy->pmsr_capa->ftm.bandwidths & in wiphy_register()
722 if (wiphy->interface_modes & ~(BIT(NL80211_IFTYPE_STATION) | in wiphy_register()
731 wiphy->regulatory_flags |= REGULATORY_IGNORE_STALE_KICKOFF; in wiphy_register()
733 if (WARN_ON((wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) && in wiphy_register()
734 (wiphy->regulatory_flags & in wiphy_register()
741 if (WARN_ON(wiphy->coalesce && in wiphy_register()
742 (!wiphy->coalesce->n_rules || in wiphy_register()
743 !wiphy->coalesce->n_patterns) && in wiphy_register()
744 (!wiphy->coalesce->pattern_min_len || in wiphy_register()
745 wiphy->coalesce->pattern_min_len > in wiphy_register()
746 wiphy->coalesce->pattern_max_len))) in wiphy_register()
749 if (WARN_ON(wiphy->ap_sme_capa && in wiphy_register()
750 !(wiphy->flags & WIPHY_FLAG_HAVE_AP_SME))) in wiphy_register()
753 if (WARN_ON(wiphy->addresses && !wiphy->n_addresses)) in wiphy_register()
756 if (WARN_ON(wiphy->addresses && in wiphy_register()
757 !is_zero_ether_addr(wiphy->perm_addr) && in wiphy_register()
758 memcmp(wiphy->perm_addr, wiphy->addresses[0].addr, in wiphy_register()
762 if (WARN_ON(wiphy->max_acl_mac_addrs && in wiphy_register()
763 (!(wiphy->flags & WIPHY_FLAG_HAVE_AP_SME) || in wiphy_register()
770 if (WARN_ON(wiphy->bss_select_support && in wiphy_register()
771 (wiphy->bss_select_support & ~(BIT(__NL80211_BSS_SELECT_ATTR_AFTER_LAST) - 2)))) in wiphy_register()
774 if (WARN_ON(wiphy_ext_feature_isset(&rdev->wiphy, in wiphy_register()
779 if (WARN_ON(!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) && in wiphy_register()
783 if (wiphy->addresses) in wiphy_register()
784 memcpy(wiphy->perm_addr, wiphy->addresses[0].addr, ETH_ALEN); in wiphy_register()
789 if (WARN_ON(ifmodes != wiphy->interface_modes)) in wiphy_register()
790 wiphy->interface_modes = ifmodes; in wiphy_register()
792 res = wiphy_verify_combinations(wiphy); in wiphy_register()
801 sband = wiphy->bands[band]; in wiphy_register()
888 for (i = 0; i < rdev->wiphy.n_vendor_commands; i++) { in wiphy_register()
894 if (WARN_ON(!rdev->wiphy.vendor_commands[i].policy)) in wiphy_register()
896 if (WARN_ON(!rdev->wiphy.vendor_commands[i].doit && in wiphy_register()
897 !rdev->wiphy.vendor_commands[i].dumpit)) in wiphy_register()
902 if (WARN_ON(rdev->wiphy.wowlan && rdev->wiphy.wowlan->n_patterns && in wiphy_register()
903 (!rdev->wiphy.wowlan->pattern_min_len || in wiphy_register()
904 rdev->wiphy.wowlan->pattern_min_len > in wiphy_register()
905 rdev->wiphy.wowlan->pattern_max_len))) in wiphy_register()
910 ieee80211_set_bitrate_flags(wiphy); in wiphy_register()
912 rdev->wiphy.features |= NL80211_FEATURE_SCAN_FLUSH; in wiphy_register()
915 res = device_add(&rdev->wiphy.dev); in wiphy_register()
925 rdev->wiphy.debugfsdir = debugfs_create_dir(wiphy_name(&rdev->wiphy), in wiphy_register()
932 wiphy_regulatory_register(wiphy); in wiphy_register()
934 if (wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) { in wiphy_register()
937 request.wiphy_idx = get_wiphy_idx(wiphy); in wiphy_register()
948 if (wiphy->extended_capabilities_len && in wiphy_register()
949 wiphy->num_iftype_ext_capab && in wiphy_register()
950 wiphy->iftype_ext_capab) { in wiphy_register()
954 capab = wiphy->iftype_ext_capab; in wiphy_register()
955 for (j = 0; j < wiphy->extended_capabilities_len; j++) { in wiphy_register()
961 for (i = 1; i < wiphy->num_iftype_ext_capab; i++) { in wiphy_register()
969 if (WARN_ON(wiphy->extended_capabilities[j] & in wiphy_register()
975 rdev->wiphy.registered = true; in wiphy_register()
982 wiphy_unregister(&rdev->wiphy); in wiphy_register()
990 void wiphy_rfkill_start_polling(struct wiphy *wiphy) in wiphy_rfkill_start_polling() argument
992 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in wiphy_rfkill_start_polling()
1001 void wiphy_rfkill_stop_polling(struct wiphy *wiphy) in wiphy_rfkill_stop_polling() argument
1003 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in wiphy_rfkill_stop_polling()
1009 void wiphy_unregister(struct wiphy *wiphy) in wiphy_unregister() argument
1011 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in wiphy_unregister()
1025 rdev->wiphy.registered = false; in wiphy_unregister()
1027 WARN_ON(!list_empty(&rdev->wiphy.wdev_list)); in wiphy_unregister()
1033 debugfs_remove_recursive(rdev->wiphy.debugfsdir); in wiphy_unregister()
1041 wiphy_regulatory_deregister(wiphy); in wiphy_unregister()
1044 device_del(&rdev->wiphy.dev); in wiphy_unregister()
1059 if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup) in wiphy_unregister()
1077 cfg80211_put_bss(&rdev->wiphy, &scan->pub); in cfg80211_dev_free()
1081 void wiphy_free(struct wiphy *wiphy) in wiphy_free() argument
1083 put_device(&wiphy->dev); in wiphy_free()
1087 void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked) in wiphy_rfkill_set_hw_state() argument
1089 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in wiphy_rfkill_set_hw_state()
1104 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in __cfg80211_unregister_wdev()
1232 void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, in cfg80211_stop_iface() argument
1235 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in cfg80211_stop_iface()
1239 trace_cfg80211_stop_iface(wiphy, wdev); in cfg80211_stop_iface()
1270 if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT) in cfg80211_init_wdev()
1297 list_add_rcu(&wdev->list, &rdev->wiphy.wdev_list); in cfg80211_register_wdev()
1314 rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_netdev_notifier_call()
1333 if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj, in cfg80211_netdev_notifier_call()
1438 cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub); in cfg80211_netdev_notifier_call()
1443 if (!cfg80211_iftype_allowed(wdev->wiphy, wdev->iftype, in cfg80211_netdev_notifier_call()
1469 if (net_eq(wiphy_net(&rdev->wiphy), net)) in cfg80211_pernet_exit()