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 (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()
262 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy) in cfg80211_shutdown_all_interfaces() argument
264 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in cfg80211_shutdown_all_interfaces()
269 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { in cfg80211_shutdown_all_interfaces()
297 cfg80211_shutdown_all_interfaces(&rdev->wiphy); in cfg80211_rfkill_set_block()
330 list_for_each_entry_safe(wdev, tmp, &rdev->wiphy.wdev_list, list) { in cfg80211_destroy_ifaces()
373 regulatory_propagate_dfs_state(&rdev->wiphy, &rdev->radar_chandef, in cfg80211_propagate_radar_detect_wk()
389 regulatory_propagate_dfs_state(&rdev->wiphy, &rdev->cac_done_chandef, in cfg80211_propagate_cac_done_wk()
398 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv, in wiphy_new_nm()
455 rv = dev_set_name(&rdev->wiphy.dev, "%s", requested_name); in wiphy_new_nm()
469 rv = dev_set_name(&rdev->wiphy.dev, PHY_NAME "%d", rdev->wiphy_idx); in wiphy_new_nm()
476 INIT_LIST_HEAD(&rdev->wiphy.wdev_list); in wiphy_new_nm()
489 rdev->wiphy.wext = &cfg80211_wext_handler; in wiphy_new_nm()
492 device_initialize(&rdev->wiphy.dev); in wiphy_new_nm()
493 rdev->wiphy.dev.class = &ieee80211_class; in wiphy_new_nm()
494 rdev->wiphy.dev.platform_data = rdev; in wiphy_new_nm()
495 device_enable_async_suspend(&rdev->wiphy.dev); in wiphy_new_nm()
505 rdev->wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT; in wiphy_new_nm()
508 wiphy_net_set(&rdev->wiphy, &init_net); in wiphy_new_nm()
511 rdev->rfkill = rfkill_alloc(dev_name(&rdev->wiphy.dev), in wiphy_new_nm()
512 &rdev->wiphy.dev, RFKILL_TYPE_WLAN, in wiphy_new_nm()
516 wiphy_free(&rdev->wiphy); in wiphy_new_nm()
531 rdev->wiphy.retry_short = 7; in wiphy_new_nm()
532 rdev->wiphy.retry_long = 4; in wiphy_new_nm()
533 rdev->wiphy.frag_threshold = (u32) -1; in wiphy_new_nm()
534 rdev->wiphy.rts_threshold = (u32) -1; in wiphy_new_nm()
535 rdev->wiphy.coverage_class = 0; in wiphy_new_nm()
537 rdev->wiphy.max_num_csa_counters = 1; in wiphy_new_nm()
539 rdev->wiphy.max_sched_scan_plans = 1; in wiphy_new_nm()
540 rdev->wiphy.max_sched_scan_plan_interval = U32_MAX; in wiphy_new_nm()
542 return &rdev->wiphy; in wiphy_new_nm()
546 static int wiphy_verify_combinations(struct wiphy *wiphy) in wiphy_verify_combinations() argument
551 for (i = 0; i < wiphy->n_iface_combinations; i++) { in wiphy_verify_combinations()
555 c = &wiphy->iface_combinations[i]; in wiphy_verify_combinations()
596 if (WARN_ON(wiphy->software_iftypes & types)) in wiphy_verify_combinations()
629 if (WARN_ON((wiphy->interface_modes & types) != types)) in wiphy_verify_combinations()
646 int wiphy_register(struct wiphy *wiphy) in wiphy_register() argument
648 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in wiphy_register()
654 u16 ifmodes = wiphy->interface_modes; in wiphy_register()
657 if (WARN_ON(wiphy->wowlan && in wiphy_register()
658 (wiphy->wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && in wiphy_register()
659 !(wiphy->wowlan->flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY))) in wiphy_register()
661 if (WARN_ON(wiphy->wowlan && in wiphy_register()
662 !wiphy->wowlan->flags && !wiphy->wowlan->n_patterns && in wiphy_register()
663 !wiphy->wowlan->tcp)) in wiphy_register()
666 if (WARN_ON((wiphy->features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH) && in wiphy_register()
671 if (WARN_ON((wiphy->interface_modes & BIT(NL80211_IFTYPE_NAN)) && in wiphy_register()
674 !(wiphy->nan_supported_bands & BIT(NL80211_BAND_2GHZ))))) in wiphy_register()
678 if (WARN_ON(wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS))) in wiphy_register()
682 if (WARN_ON(wiphy->pmsr_capa && !wiphy->pmsr_capa->ftm.supported)) in wiphy_register()
685 if (wiphy->pmsr_capa && wiphy->pmsr_capa->ftm.supported) { in wiphy_register()
686 if (WARN_ON(!wiphy->pmsr_capa->ftm.asap && in wiphy_register()
687 !wiphy->pmsr_capa->ftm.non_asap)) in wiphy_register()
689 if (WARN_ON(!wiphy->pmsr_capa->ftm.preambles || in wiphy_register()
690 !wiphy->pmsr_capa->ftm.bandwidths)) in wiphy_register()
692 if (WARN_ON(wiphy->pmsr_capa->ftm.preambles & in wiphy_register()
698 if (WARN_ON(wiphy->pmsr_capa->ftm.bandwidths & in wiphy_register()
714 if (wiphy->interface_modes & ~(BIT(NL80211_IFTYPE_STATION) | in wiphy_register()
723 wiphy->regulatory_flags |= REGULATORY_IGNORE_STALE_KICKOFF; in wiphy_register()
725 if (WARN_ON((wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) && in wiphy_register()
726 (wiphy->regulatory_flags & in wiphy_register()
733 if (WARN_ON(wiphy->coalesce && in wiphy_register()
734 (!wiphy->coalesce->n_rules || in wiphy_register()
735 !wiphy->coalesce->n_patterns) && in wiphy_register()
736 (!wiphy->coalesce->pattern_min_len || in wiphy_register()
737 wiphy->coalesce->pattern_min_len > in wiphy_register()
738 wiphy->coalesce->pattern_max_len))) in wiphy_register()
741 if (WARN_ON(wiphy->ap_sme_capa && in wiphy_register()
742 !(wiphy->flags & WIPHY_FLAG_HAVE_AP_SME))) in wiphy_register()
745 if (WARN_ON(wiphy->addresses && !wiphy->n_addresses)) in wiphy_register()
748 if (WARN_ON(wiphy->addresses && in wiphy_register()
749 !is_zero_ether_addr(wiphy->perm_addr) && in wiphy_register()
750 memcmp(wiphy->perm_addr, wiphy->addresses[0].addr, in wiphy_register()
754 if (WARN_ON(wiphy->max_acl_mac_addrs && in wiphy_register()
755 (!(wiphy->flags & WIPHY_FLAG_HAVE_AP_SME) || in wiphy_register()
762 if (WARN_ON(wiphy->bss_select_support && in wiphy_register()
763 (wiphy->bss_select_support & ~(BIT(__NL80211_BSS_SELECT_ATTR_AFTER_LAST) - 2)))) in wiphy_register()
766 if (WARN_ON(wiphy_ext_feature_isset(&rdev->wiphy, in wiphy_register()
771 if (WARN_ON(!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) && in wiphy_register()
775 if (wiphy->addresses) in wiphy_register()
776 memcpy(wiphy->perm_addr, wiphy->addresses[0].addr, ETH_ALEN); in wiphy_register()
781 if (WARN_ON(ifmodes != wiphy->interface_modes)) in wiphy_register()
782 wiphy->interface_modes = ifmodes; in wiphy_register()
784 res = wiphy_verify_combinations(wiphy); in wiphy_register()
792 sband = wiphy->bands[band]; in wiphy_register()
861 for (i = 0; i < rdev->wiphy.n_vendor_commands; i++) { in wiphy_register()
867 if (WARN_ON(!rdev->wiphy.vendor_commands[i].policy)) in wiphy_register()
869 if (WARN_ON(!rdev->wiphy.vendor_commands[i].doit && in wiphy_register()
870 !rdev->wiphy.vendor_commands[i].dumpit)) in wiphy_register()
875 if (WARN_ON(rdev->wiphy.wowlan && rdev->wiphy.wowlan->n_patterns && in wiphy_register()
876 (!rdev->wiphy.wowlan->pattern_min_len || in wiphy_register()
877 rdev->wiphy.wowlan->pattern_min_len > in wiphy_register()
878 rdev->wiphy.wowlan->pattern_max_len))) in wiphy_register()
883 ieee80211_set_bitrate_flags(wiphy); in wiphy_register()
885 rdev->wiphy.features |= NL80211_FEATURE_SCAN_FLUSH; in wiphy_register()
888 res = device_add(&rdev->wiphy.dev); in wiphy_register()
895 wiphy_regulatory_register(wiphy); in wiphy_register()
901 rdev->wiphy.debugfsdir = debugfs_create_dir(wiphy_name(&rdev->wiphy), in wiphy_register()
907 if (wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) { in wiphy_register()
910 request.wiphy_idx = get_wiphy_idx(wiphy); in wiphy_register()
921 if (wiphy->extended_capabilities_len && in wiphy_register()
922 wiphy->num_iftype_ext_capab && in wiphy_register()
923 wiphy->iftype_ext_capab) { in wiphy_register()
927 capab = wiphy->iftype_ext_capab; in wiphy_register()
928 for (j = 0; j < wiphy->extended_capabilities_len; j++) { in wiphy_register()
934 for (i = 1; i < wiphy->num_iftype_ext_capab; i++) { in wiphy_register()
942 if (WARN_ON(wiphy->extended_capabilities[j] & in wiphy_register()
948 rdev->wiphy.registered = true; in wiphy_register()
955 wiphy_unregister(&rdev->wiphy); in wiphy_register()
963 void wiphy_rfkill_start_polling(struct wiphy *wiphy) in wiphy_rfkill_start_polling() argument
965 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in wiphy_rfkill_start_polling()
974 void wiphy_rfkill_stop_polling(struct wiphy *wiphy) in wiphy_rfkill_stop_polling() argument
976 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in wiphy_rfkill_stop_polling()
982 void wiphy_unregister(struct wiphy *wiphy) in wiphy_unregister() argument
984 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in wiphy_unregister()
998 rdev->wiphy.registered = false; in wiphy_unregister()
1000 WARN_ON(!list_empty(&rdev->wiphy.wdev_list)); in wiphy_unregister()
1006 debugfs_remove_recursive(rdev->wiphy.debugfsdir); in wiphy_unregister()
1014 wiphy_regulatory_deregister(wiphy); in wiphy_unregister()
1017 device_del(&rdev->wiphy.dev); in wiphy_unregister()
1032 if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup) in wiphy_unregister()
1050 cfg80211_put_bss(&rdev->wiphy, &scan->pub); in cfg80211_dev_free()
1054 void wiphy_free(struct wiphy *wiphy) in wiphy_free() argument
1056 put_device(&wiphy->dev); in wiphy_free()
1060 void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked) in wiphy_rfkill_set_hw_state() argument
1062 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in wiphy_rfkill_set_hw_state()
1077 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); in __cfg80211_unregister_wdev()
1204 void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev, in cfg80211_stop_iface() argument
1207 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); in cfg80211_stop_iface()
1211 trace_cfg80211_stop_iface(wiphy, wdev); in cfg80211_stop_iface()
1247 list_add_rcu(&wdev->list, &rdev->wiphy.wdev_list); in cfg80211_init_wdev()
1264 rdev = wiphy_to_rdev(wdev->wiphy); in cfg80211_netdev_notifier_call()
1281 if (sysfs_create_link(&dev->dev.kobj, &rdev->wiphy.dev.kobj, in cfg80211_netdev_notifier_call()
1292 if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT) in cfg80211_netdev_notifier_call()
1404 cfg80211_put_bss(wdev->wiphy, &wdev->current_bss->pub); in cfg80211_netdev_notifier_call()
1409 if (!cfg80211_iftype_allowed(wdev->wiphy, wdev->iftype, in cfg80211_netdev_notifier_call()
1435 if (net_eq(wiphy_net(&rdev->wiphy), net)) in cfg80211_pernet_exit()