Lines Matching refs:wiphy
73 int get_wiphy_idx(struct wiphy *wiphy)
75 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
80 struct wiphy *wiphy_idx_to_wiphy(int wiphy_idx)
89 return &rdev->wiphy;
120 if (strcmp(newname, wiphy_name(&rdev2->wiphy)) == 0)
132 lockdep_assert_wiphy(&rdev->wiphy);
135 if (strcmp(newname, wiphy_name(&rdev->wiphy)) == 0)
142 result = device_rename(&rdev->wiphy.dev, newname);
146 if (!IS_ERR_OR_NULL(rdev->wiphy.debugfsdir))
147 debugfs_rename(rdev->wiphy.debugfsdir->d_parent,
148 rdev->wiphy.debugfsdir,
149 rdev->wiphy.debugfsdir->d_parent, newname);
162 if (!(rdev->wiphy.flags & WIPHY_FLAG_NETNS_OK))
165 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
177 net = wiphy_net(&rdev->wiphy);
180 &rdev->wiphy.wdev_list,
194 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
200 wiphy_lock(&rdev->wiphy);
203 wiphy_net_set(&rdev->wiphy, net);
205 err = device_rename(&rdev->wiphy.dev, dev_name(&rdev->wiphy.dev));
209 wiphy_unlock(&rdev->wiphy);
211 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
224 wiphy_lock(&rdev->wiphy);
226 wiphy_unlock(&rdev->wiphy);
232 lockdep_assert_held(&rdev->wiphy.mtx);
257 lockdep_assert_held(&rdev->wiphy.mtx);
271 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy)
273 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
278 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
286 wiphy_lock(wiphy);
299 wiphy_unlock(wiphy);
312 cfg80211_shutdown_all_interfaces(&rdev->wiphy);
334 wiphy_lock(&rdev->wiphy);
336 wiphy_unlock(&rdev->wiphy);
345 list_for_each_entry_safe(wdev, tmp, &rdev->wiphy.wdev_list, list) {
350 wiphy_lock(&rdev->wiphy);
353 wiphy_unlock(&rdev->wiphy);
370 static void cfg80211_sched_scan_stop_wk(struct wiphy *wiphy,
394 regulatory_propagate_dfs_state(&rdev->wiphy, &rdev->radar_chandef,
410 regulatory_propagate_dfs_state(&rdev->wiphy, &rdev->cac_done_chandef,
424 wiphy_lock(&rdev->wiphy);
437 wk->func(&rdev->wiphy, wk);
442 wiphy_unlock(&rdev->wiphy);
447 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
504 rv = dev_set_name(&rdev->wiphy.dev, "%s", requested_name);
518 rv = dev_set_name(&rdev->wiphy.dev, PHY_NAME "%d", rdev->wiphy_idx);
525 mutex_init(&rdev->wiphy.mtx);
526 INIT_LIST_HEAD(&rdev->wiphy.wdev_list);
536 rdev->wiphy.wext = &cfg80211_wext_handler;
539 device_initialize(&rdev->wiphy.dev);
540 rdev->wiphy.dev.class = &ieee80211_class;
541 rdev->wiphy.dev.platform_data = rdev;
542 device_enable_async_suspend(&rdev->wiphy.dev);
555 rdev->wiphy.flags |= WIPHY_FLAG_PS_ON_BY_DEFAULT;
558 wiphy_net_set(&rdev->wiphy, &init_net);
561 rdev->wiphy.rfkill = rfkill_alloc(dev_name(&rdev->wiphy.dev),
562 &rdev->wiphy.dev, RFKILL_TYPE_WLAN,
565 if (!rdev->wiphy.rfkill) {
566 wiphy_free(&rdev->wiphy);
584 * Initialize wiphy parameters to IEEE 802.11 MIB default values.
588 rdev->wiphy.retry_short = 7;
589 rdev->wiphy.retry_long = 4;
590 rdev->wiphy.frag_threshold = (u32) -1;
591 rdev->wiphy.rts_threshold = (u32) -1;
592 rdev->wiphy.coverage_class = 0;
594 rdev->wiphy.max_num_csa_counters = 1;
596 rdev->wiphy.max_sched_scan_plans = 1;
597 rdev->wiphy.max_sched_scan_plan_interval = U32_MAX;
599 return &rdev->wiphy;
603 static int wiphy_verify_combinations(struct wiphy *wiphy)
608 for (i = 0; i < wiphy->n_iface_combinations; i++) {
612 c = &wiphy->iface_combinations[i];
645 if (WARN_ON(wiphy->software_iftypes & types))
678 if (WARN_ON((wiphy->interface_modes & types) != types))
693 int wiphy_register(struct wiphy *wiphy)
695 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
701 u16 ifmodes = wiphy->interface_modes;
704 if (WARN_ON(wiphy->wowlan &&
705 (wiphy->wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) &&
706 !(wiphy->wowlan->flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY)))
708 if (WARN_ON(wiphy->wowlan &&
709 !wiphy->wowlan->flags && !wiphy->wowlan->n_patterns &&
710 !wiphy->wowlan->tcp))
713 if (WARN_ON((wiphy->features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH) &&
718 if (WARN_ON((wiphy->interface_modes & BIT(NL80211_IFTYPE_NAN)) &&
721 !(wiphy->nan_supported_bands & BIT(NL80211_BAND_2GHZ)))))
724 if (WARN_ON(wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS)))
727 if (WARN_ON(wiphy->pmsr_capa && !wiphy->pmsr_capa->ftm.supported))
730 if (wiphy->pmsr_capa && wiphy->pmsr_capa->ftm.supported) {
731 if (WARN_ON(!wiphy->pmsr_capa->ftm.asap &&
732 !wiphy->pmsr_capa->ftm.non_asap))
734 if (WARN_ON(!wiphy->pmsr_capa->ftm.preambles ||
735 !wiphy->pmsr_capa->ftm.bandwidths))
737 if (WARN_ON(wiphy->pmsr_capa->ftm.preambles &
744 if (WARN_ON((wiphy->pmsr_capa->ftm.trigger_based ||
745 wiphy->pmsr_capa->ftm.non_trigger_based) &&
746 !(wiphy->pmsr_capa->ftm.preambles &
749 if (WARN_ON(wiphy->pmsr_capa->ftm.bandwidths &
761 if (WARN_ON((wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) &&
762 (wiphy->regulatory_flags &
769 if (WARN_ON(wiphy->coalesce &&
770 (!wiphy->coalesce->n_rules ||
771 !wiphy->coalesce->n_patterns) &&
772 (!wiphy->coalesce->pattern_min_len ||
773 wiphy->coalesce->pattern_min_len >
774 wiphy->coalesce->pattern_max_len)))
777 if (WARN_ON(wiphy->ap_sme_capa &&
778 !(wiphy->flags & WIPHY_FLAG_HAVE_AP_SME)))
781 if (WARN_ON(wiphy->addresses && !wiphy->n_addresses))
784 if (WARN_ON(wiphy->addresses &&
785 !is_zero_ether_addr(wiphy->perm_addr) &&
786 memcmp(wiphy->perm_addr, wiphy->addresses[0].addr,
790 if (WARN_ON(wiphy->max_acl_mac_addrs &&
791 (!(wiphy->flags & WIPHY_FLAG_HAVE_AP_SME) ||
798 if (WARN_ON(wiphy->bss_select_support &&
799 (wiphy->bss_select_support & ~(BIT(__NL80211_BSS_SELECT_ATTR_AFTER_LAST) - 2))))
802 if (WARN_ON(wiphy_ext_feature_isset(&rdev->wiphy,
807 if (WARN_ON(!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) &&
811 if (wiphy->addresses)
812 memcpy(wiphy->perm_addr, wiphy->addresses[0].addr, ETH_ALEN);
817 if (WARN_ON(ifmodes != wiphy->interface_modes))
818 wiphy->interface_modes = ifmodes;
820 res = wiphy_verify_combinations(wiphy);
829 sband = wiphy->bands[band];
932 for (i = 0; i < rdev->wiphy.n_vendor_commands; i++) {
938 if (WARN_ON(!rdev->wiphy.vendor_commands[i].policy))
940 if (WARN_ON(!rdev->wiphy.vendor_commands[i].doit &&
941 !rdev->wiphy.vendor_commands[i].dumpit))
946 if (WARN_ON(rdev->wiphy.wowlan && rdev->wiphy.wowlan->n_patterns &&
947 (!rdev->wiphy.wowlan->pattern_min_len ||
948 rdev->wiphy.wowlan->pattern_min_len >
949 rdev->wiphy.wowlan->pattern_max_len)))
953 if (!wiphy->max_num_akm_suites)
954 wiphy->max_num_akm_suites = NL80211_MAX_NR_AKM_SUITES;
955 else if (wiphy->max_num_akm_suites < NL80211_MAX_NR_AKM_SUITES ||
956 wiphy->max_num_akm_suites > CFG80211_MAX_NUM_AKM_SUITES)
960 ieee80211_set_bitrate_flags(wiphy);
962 rdev->wiphy.features |= NL80211_FEATURE_SCAN_FLUSH;
965 wiphy_lock(&rdev->wiphy);
966 res = device_add(&rdev->wiphy.dev);
968 wiphy_unlock(&rdev->wiphy);
977 rdev->wiphy.debugfsdir = debugfs_create_dir(wiphy_name(&rdev->wiphy),
982 wiphy_unlock(&rdev->wiphy);
985 wiphy_regulatory_register(wiphy);
987 if (wiphy->regulatory_flags & REGULATORY_CUSTOM_REG) {
990 request.wiphy_idx = get_wiphy_idx(wiphy);
1001 if (wiphy->extended_capabilities_len &&
1002 wiphy->num_iftype_ext_capab &&
1003 wiphy->iftype_ext_capab) {
1007 capab = wiphy->iftype_ext_capab;
1008 for (j = 0; j < wiphy->extended_capabilities_len; j++) {
1014 for (i = 1; i < wiphy->num_iftype_ext_capab; i++) {
1022 if (WARN_ON(wiphy->extended_capabilities[j] &
1028 rdev->wiphy.registered = true;
1031 res = rfkill_register(rdev->wiphy.rfkill);
1033 rfkill_destroy(rdev->wiphy.rfkill);
1034 rdev->wiphy.rfkill = NULL;
1035 wiphy_unregister(&rdev->wiphy);
1043 void wiphy_rfkill_start_polling(struct wiphy *wiphy)
1045 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
1050 rfkill_resume_polling(wiphy->rfkill);
1060 lockdep_assert_held(&rdev->wiphy.mtx);
1071 wk->func(&rdev->wiphy, wk);
1084 void wiphy_unregister(struct wiphy *wiphy)
1086 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
1090 wiphy_lock(&rdev->wiphy);
1092 wiphy_unlock(&rdev->wiphy);
1095 if (rdev->wiphy.rfkill)
1096 rfkill_unregister(rdev->wiphy.rfkill);
1099 wiphy_lock(&rdev->wiphy);
1101 rdev->wiphy.registered = false;
1103 WARN_ON(!list_empty(&rdev->wiphy.wdev_list));
1109 debugfs_remove_recursive(rdev->wiphy.debugfsdir);
1117 wiphy_regulatory_deregister(wiphy);
1120 device_del(&rdev->wiphy.dev);
1123 if (rdev->wiphy.wowlan_config && rdev->ops->set_wakeup)
1129 wiphy_unlock(&rdev->wiphy);
1154 rfkill_destroy(rdev->wiphy.rfkill);
1160 cfg80211_put_bss(&rdev->wiphy, &scan->pub);
1161 mutex_destroy(&rdev->wiphy.mtx);
1165 * initializing the wiphy and thus never went through the
1170 kfree(rcu_dereference_raw(rdev->wiphy.regd));
1175 void wiphy_free(struct wiphy *wiphy)
1177 put_device(&wiphy->dev);
1181 void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
1184 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
1186 if (rfkill_set_hw_state_reason(wiphy->rfkill, blocked, reason))
1194 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
1199 lockdep_assert_held(&rdev->wiphy.mtx);
1232 wiphy_work_cancel(wdev->wiphy, &wdev->cqm_rssi_work);
1252 cfg80211_put_bss(wdev->wiphy, &curbss->pub);
1274 lockdep_assert_held(&rdev->wiphy.mtx);
1287 lockdep_assert_held(&rdev->wiphy.mtx);
1349 void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
1352 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
1356 trace_cfg80211_stop_iface(wiphy, wdev);
1389 if (wdev->wiphy->flags & WIPHY_FLAG_PS_ON_BY_DEFAULT)
1408 lockdep_assert_held(&rdev->wiphy.mtx);
1419 list_add_rcu(&wdev->list, &rdev->wiphy.wdev_list);
1424 sysfs_create_link(&wdev->netdev->dev.kobj, &rdev->wiphy.dev.kobj,
1442 rdev = wiphy_to_rdev(wdev->wiphy);
1444 lockdep_assert_held(&rdev->wiphy.mtx);
1474 rdev = wiphy_to_rdev(wdev->wiphy);
1482 /* can only change netns with wiphy */
1489 wiphy_lock(&rdev->wiphy);
1491 wiphy_unlock(&rdev->wiphy);
1500 wiphy_lock(&rdev->wiphy);
1502 wiphy_unlock(&rdev->wiphy);
1506 wiphy_lock(&rdev->wiphy);
1509 wiphy_unlock(&rdev->wiphy);
1515 wiphy_lock(&rdev->wiphy);
1532 wiphy_unlock(&rdev->wiphy);
1536 wiphy_lock(&rdev->wiphy);
1583 wiphy_unlock(&rdev->wiphy);
1586 if (!cfg80211_iftype_allowed(wdev->wiphy, wdev->iftype,
1590 if (rfkill_blocked(rdev->wiphy.rfkill))
1612 if (net_eq(wiphy_net(&rdev->wiphy), net))
1622 void wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *work)
1624 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
1636 void wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *work)
1638 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
1641 lockdep_assert_held(&wiphy->mtx);
1650 void wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *work)
1652 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
1669 wiphy_work_queue(dwork->wiphy, &dwork->work);
1673 void wiphy_delayed_work_queue(struct wiphy *wiphy,
1679 wiphy_work_queue(wiphy, &dwork->work);
1683 dwork->wiphy = wiphy;
1688 void wiphy_delayed_work_cancel(struct wiphy *wiphy,
1691 lockdep_assert_held(&wiphy->mtx);
1694 wiphy_work_cancel(wiphy, &dwork->work);
1698 void wiphy_delayed_work_flush(struct wiphy *wiphy,
1701 lockdep_assert_held(&wiphy->mtx);
1704 wiphy_work_flush(wiphy, &dwork->work);