• Home
  • Raw
  • Download

Lines Matching +full:conf +full:- +full:ds

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright 2002-2005, Instant802 Networks, Inc.
4 * Copyright 2005-2006, Devicescape Software, Inc.
5 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
6 * Copyright 2013-2014 Intel Mobile Communications GmbH
8 * Copyright (C) 2018-2023 Intel Corporation
30 #include "driver-ops.h"
43 if (atomic_read(&local->iff_allmultis)) in ieee80211_configure_filter()
46 if (local->monitors || test_bit(SCAN_SW_SCANNING, &local->scanning) || in ieee80211_configure_filter()
47 test_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning)) in ieee80211_configure_filter()
50 if (local->fif_probe_req || local->probe_req_reg) in ieee80211_configure_filter()
53 if (local->fif_fcsfail) in ieee80211_configure_filter()
56 if (local->fif_plcpfail) in ieee80211_configure_filter()
59 if (local->fif_control) in ieee80211_configure_filter()
62 if (local->fif_other_bss) in ieee80211_configure_filter()
65 if (local->fif_pspoll) in ieee80211_configure_filter()
68 if (local->rx_mcast_action_reg) in ieee80211_configure_filter()
71 spin_lock_bh(&local->filter_lock); in ieee80211_configure_filter()
72 changed_flags = local->filter_flags ^ new_flags; in ieee80211_configure_filter()
74 mc = drv_prepare_multicast(local, &local->mc_list); in ieee80211_configure_filter()
75 spin_unlock_bh(&local->filter_lock); in ieee80211_configure_filter()
84 local->filter_flags = new_flags & ~(1<<31); in ieee80211_configure_filter()
103 offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; in ieee80211_hw_conf_chan()
105 if (local->scan_chandef.chan) { in ieee80211_hw_conf_chan()
106 chandef = local->scan_chandef; in ieee80211_hw_conf_chan()
107 } else if (local->tmp_channel) { in ieee80211_hw_conf_chan()
108 chandef.chan = local->tmp_channel; in ieee80211_hw_conf_chan()
110 chandef.center_freq1 = chandef.chan->center_freq; in ieee80211_hw_conf_chan()
111 chandef.freq1_offset = chandef.chan->freq_offset; in ieee80211_hw_conf_chan()
113 chandef = local->_oper_chandef; in ieee80211_hw_conf_chan()
117 chandef.chan->center_freq, chandef.chan->freq_offset, in ieee80211_hw_conf_chan()
121 if (!cfg80211_chandef_identical(&chandef, &local->_oper_chandef)) in ieee80211_hw_conf_chan()
122 local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; in ieee80211_hw_conf_chan()
124 local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL; in ieee80211_hw_conf_chan()
126 offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; in ieee80211_hw_conf_chan()
129 !cfg80211_chandef_identical(&local->hw.conf.chandef, in ieee80211_hw_conf_chan()
130 &local->_oper_chandef)) { in ieee80211_hw_conf_chan()
131 local->hw.conf.chandef = chandef; in ieee80211_hw_conf_chan()
135 if (!conf_is_ht(&local->hw.conf)) { in ieee80211_hw_conf_chan()
141 local->hw.conf.smps_mode = IEEE80211_SMPS_STATIC; in ieee80211_hw_conf_chan()
142 } else if (local->hw.conf.smps_mode != local->smps_mode) { in ieee80211_hw_conf_chan()
143 local->hw.conf.smps_mode = local->smps_mode; in ieee80211_hw_conf_chan()
150 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in ieee80211_hw_conf_chan()
151 if (!rcu_access_pointer(sdata->vif.bss_conf.chanctx_conf)) in ieee80211_hw_conf_chan()
153 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) in ieee80211_hw_conf_chan()
155 if (sdata->vif.bss_conf.txpower == INT_MIN) in ieee80211_hw_conf_chan()
157 power = min(power, sdata->vif.bss_conf.txpower); in ieee80211_hw_conf_chan()
161 if (local->hw.conf.power_level != power) { in ieee80211_hw_conf_chan()
163 local->hw.conf.power_level = power; in ieee80211_hw_conf_chan()
175 if (!local->use_chanctx) in ieee80211_hw_config()
182 if (changed && local->open_count) { in ieee80211_hw_config()
214 struct ieee80211_local *local = sdata->local; in ieee80211_bss_info_change_notify()
218 if (!changed || sdata->vif.type == NL80211_IFTYPE_AP_VLAN) in ieee80211_bss_info_change_notify()
223 sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_bss_info_change_notify()
224 sdata->vif.type != NL80211_IFTYPE_ADHOC && in ieee80211_bss_info_change_notify()
225 sdata->vif.type != NL80211_IFTYPE_MESH_POINT && in ieee80211_bss_info_change_notify()
226 sdata->vif.type != NL80211_IFTYPE_OCB)) in ieee80211_bss_info_change_notify()
229 if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE || in ieee80211_bss_info_change_notify()
230 sdata->vif.type == NL80211_IFTYPE_NAN || in ieee80211_bss_info_change_notify()
231 (sdata->vif.type == NL80211_IFTYPE_MONITOR && in ieee80211_bss_info_change_notify()
232 !sdata->vif.bss_conf.mu_mimo_owner && in ieee80211_bss_info_change_notify()
243 if (local->ops->vif_cfg_changed) in ieee80211_bss_info_change_notify()
244 local->ops->vif_cfg_changed(&local->hw, &sdata->vif, ch); in ieee80211_bss_info_change_notify()
251 trace_drv_link_info_changed(local, sdata, &sdata->vif.bss_conf, in ieee80211_bss_info_change_notify()
253 if (local->ops->link_info_changed) in ieee80211_bss_info_change_notify()
254 local->ops->link_info_changed(&local->hw, &sdata->vif, in ieee80211_bss_info_change_notify()
255 &sdata->vif.bss_conf, ch); in ieee80211_bss_info_change_notify()
258 if (local->ops->bss_info_changed) in ieee80211_bss_info_change_notify()
259 local->ops->bss_info_changed(&local->hw, &sdata->vif, in ieee80211_bss_info_change_notify()
260 &sdata->vif.bss_conf, changed); in ieee80211_bss_info_change_notify()
267 struct ieee80211_local *local = sdata->local; in ieee80211_vif_cfg_change_notify()
271 if (!changed || sdata->vif.type == NL80211_IFTYPE_AP_VLAN) in ieee80211_vif_cfg_change_notify()
281 struct ieee80211_local *local = sdata->local; in ieee80211_link_info_change_notify()
285 if (!changed || sdata->vif.type == NL80211_IFTYPE_AP_VLAN) in ieee80211_link_info_change_notify()
291 drv_link_info_changed(local, sdata, link->conf, link->link_id, changed); in ieee80211_link_info_change_notify()
296 sdata->vif.bss_conf.use_cts_prot = false; in ieee80211_reset_erp_info()
297 sdata->vif.bss_conf.use_short_preamble = false; in ieee80211_reset_erp_info()
298 sdata->vif.bss_conf.use_short_slot = false; in ieee80211_reset_erp_info()
309 while ((skb = skb_dequeue(&local->skb_queue)) || in ieee80211_tasklet_handler()
310 (skb = skb_dequeue(&local->skb_queue_unreliable))) { in ieee80211_tasklet_handler()
311 switch (skb->pkt_type) { in ieee80211_tasklet_handler()
313 /* Clear skb->pkt_type in order to not confuse kernel in ieee80211_tasklet_handler()
315 skb->pkt_type = 0; in ieee80211_tasklet_handler()
316 ieee80211_rx(&local->hw, skb); in ieee80211_tasklet_handler()
319 skb->pkt_type = 0; in ieee80211_tasklet_handler()
320 ieee80211_tx_status(&local->hw, skb); in ieee80211_tasklet_handler()
324 skb->pkt_type); in ieee80211_tasklet_handler()
338 flush_workqueue(local->workqueue); in ieee80211_restart_work()
342 wiphy_lock(local->hw.wiphy); in ieee80211_restart_work()
344 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning), in ieee80211_restart_work()
347 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_restart_work()
356 if (sdata->vif.type == NL80211_IFTYPE_STATION) { in ieee80211_restart_work()
364 wiphy_work_cancel(local->hw.wiphy, in ieee80211_restart_work()
365 &sdata->u.mgd.csa_connection_drop_work); in ieee80211_restart_work()
366 if (sdata->vif.bss_conf.csa_active) { in ieee80211_restart_work()
374 flush_delayed_work(&sdata->dec_tailroom_needed_wk); in ieee80211_restart_work()
378 /* make sure any new ROC will consider local->in_reconfig */ in ieee80211_restart_work()
379 wiphy_delayed_work_flush(local->hw.wiphy, &local->roc_work); in ieee80211_restart_work()
380 wiphy_work_flush(local->hw.wiphy, &local->hw_roc_done); in ieee80211_restart_work()
386 wiphy_unlock(local->hw.wiphy); in ieee80211_restart_work()
389 cfg80211_shutdown_all_interfaces(local->hw.wiphy); in ieee80211_restart_work()
400 wiphy_info(hw->wiphy, in ieee80211_restart_hw()
412 local->in_reconfig = true; in ieee80211_restart_hw()
415 queue_work(system_freezable_wq, &local->restart_work); in ieee80211_restart_hw()
427 struct net_device *ndev = ifa->ifa_dev->dev; in ieee80211_ifa_changed()
428 struct wireless_dev *wdev = ndev->ieee80211_ptr; in ieee80211_ifa_changed()
439 if (wdev->wiphy != local->hw.wiphy) in ieee80211_ifa_changed()
443 vif_cfg = &sdata->vif.cfg; in ieee80211_ifa_changed()
446 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_ifa_changed()
449 idev = __in_dev_get_rtnl(sdata->dev); in ieee80211_ifa_changed()
453 ifmgd = &sdata->u.mgd; in ieee80211_ifa_changed()
457 ifa = rtnl_dereference(idev->ifa_list); in ieee80211_ifa_changed()
460 vif_cfg->arp_addr_list[c] = ifa->ifa_address; in ieee80211_ifa_changed()
461 ifa = rtnl_dereference(ifa->ifa_next); in ieee80211_ifa_changed()
465 vif_cfg->arp_addr_cnt = c; in ieee80211_ifa_changed()
468 if (ifmgd->associated) in ieee80211_ifa_changed()
482 struct inet6_dev *idev = ifa->idev; in ieee80211_ifa6_changed()
483 struct net_device *ndev = ifa->idev->dev; in ieee80211_ifa6_changed()
486 struct wireless_dev *wdev = ndev->ieee80211_ptr; in ieee80211_ifa6_changed()
490 if (!wdev || wdev->wiphy != local->hw.wiphy) in ieee80211_ifa6_changed()
499 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_ifa6_changed()
630 if (WARN_ON(!ops->tx || !ops->start || !ops->stop || !ops->config || in ieee80211_alloc_hw_nm()
631 !ops->add_interface || !ops->remove_interface || in ieee80211_alloc_hw_nm()
632 !ops->configure_filter || !ops->wake_tx_queue)) in ieee80211_alloc_hw_nm()
635 if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove))) in ieee80211_alloc_hw_nm()
638 if (WARN_ON(!!ops->link_info_changed != !!ops->vif_cfg_changed || in ieee80211_alloc_hw_nm()
639 (ops->link_info_changed && ops->bss_info_changed))) in ieee80211_alloc_hw_nm()
643 i = !!ops->add_chanctx + !!ops->remove_chanctx + in ieee80211_alloc_hw_nm()
644 !!ops->change_chanctx + !!ops->assign_vif_chanctx + in ieee80211_alloc_hw_nm()
645 !!ops->unassign_vif_chanctx; in ieee80211_alloc_hw_nm()
650 /* Ensure 32-byte alignment of our private data and hw private data. in ieee80211_alloc_hw_nm()
656 * +-------------------------+ in ieee80211_alloc_hw_nm()
658 * +-------------------------+ in ieee80211_alloc_hw_nm()
660 * +-------------------------+ in ieee80211_alloc_hw_nm()
662 * +-------------------------+ in ieee80211_alloc_hw_nm()
672 wiphy->mgmt_stypes = ieee80211_default_mgmt_stypes; in ieee80211_alloc_hw_nm()
674 wiphy->privid = mac80211_wiphy_privid; in ieee80211_alloc_hw_nm()
676 wiphy->flags |= WIPHY_FLAG_NETNS_OK | in ieee80211_alloc_hw_nm()
682 if (!use_chanctx || ops->remain_on_channel) in ieee80211_alloc_hw_nm()
683 wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; in ieee80211_alloc_hw_nm()
685 wiphy->features |= NL80211_FEATURE_SK_TX_STATUS | in ieee80211_alloc_hw_nm()
704 if (!ops->hw_scan) { in ieee80211_alloc_hw_nm()
705 wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN | in ieee80211_alloc_hw_nm()
710 * supported even with hw scan - but let drivers opt in. in ieee80211_alloc_hw_nm()
718 if (!ops->set_key) in ieee80211_alloc_hw_nm()
719 wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in ieee80211_alloc_hw_nm()
724 wiphy->bss_priv_size = sizeof(struct ieee80211_bss); in ieee80211_alloc_hw_nm()
731 local->hw.wiphy = wiphy; in ieee80211_alloc_hw_nm()
733 local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN); in ieee80211_alloc_hw_nm()
735 local->ops = ops; in ieee80211_alloc_hw_nm()
736 local->use_chanctx = use_chanctx; in ieee80211_alloc_hw_nm()
741 * to be queued in the stack. The value is a bit-shift of 1 in ieee80211_alloc_hw_nm()
744 * This is the default, anyhow - drivers may need to override it in ieee80211_alloc_hw_nm()
748 local->hw.tx_sk_pacing_shift = 7; in ieee80211_alloc_hw_nm()
751 local->hw.queues = 1; in ieee80211_alloc_hw_nm()
752 local->hw.max_rates = 1; in ieee80211_alloc_hw_nm()
753 local->hw.max_report_rates = 0; in ieee80211_alloc_hw_nm()
754 local->hw.max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT; in ieee80211_alloc_hw_nm()
755 local->hw.max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT; in ieee80211_alloc_hw_nm()
756 local->hw.offchannel_tx_hw_queue = IEEE80211_INVAL_HW_QUEUE; in ieee80211_alloc_hw_nm()
757 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long; in ieee80211_alloc_hw_nm()
758 local->hw.conf.short_frame_max_tx_count = wiphy->retry_short; in ieee80211_alloc_hw_nm()
759 local->hw.radiotap_mcs_details = IEEE80211_RADIOTAP_MCS_HAVE_MCS | in ieee80211_alloc_hw_nm()
762 local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | in ieee80211_alloc_hw_nm()
764 local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES; in ieee80211_alloc_hw_nm()
765 local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN; in ieee80211_alloc_hw_nm()
766 local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; in ieee80211_alloc_hw_nm()
767 local->user_power_level = IEEE80211_UNSET_POWER_LEVEL; in ieee80211_alloc_hw_nm()
768 wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask; in ieee80211_alloc_hw_nm()
769 wiphy->vht_capa_mod_mask = &mac80211_vht_capa_mod_mask; in ieee80211_alloc_hw_nm()
771 local->ext_capa[7] = WLAN_EXT_CAPA8_OPMODE_NOTIF; in ieee80211_alloc_hw_nm()
773 wiphy->extended_capabilities = local->ext_capa; in ieee80211_alloc_hw_nm()
774 wiphy->extended_capabilities_mask = local->ext_capa; in ieee80211_alloc_hw_nm()
775 wiphy->extended_capabilities_len = in ieee80211_alloc_hw_nm()
776 ARRAY_SIZE(local->ext_capa); in ieee80211_alloc_hw_nm()
778 INIT_LIST_HEAD(&local->interfaces); in ieee80211_alloc_hw_nm()
779 INIT_LIST_HEAD(&local->mon_list); in ieee80211_alloc_hw_nm()
781 __hw_addr_init(&local->mc_list); in ieee80211_alloc_hw_nm()
783 mutex_init(&local->iflist_mtx); in ieee80211_alloc_hw_nm()
784 mutex_init(&local->mtx); in ieee80211_alloc_hw_nm()
786 mutex_init(&local->key_mtx); in ieee80211_alloc_hw_nm()
787 spin_lock_init(&local->filter_lock); in ieee80211_alloc_hw_nm()
788 spin_lock_init(&local->rx_path_lock); in ieee80211_alloc_hw_nm()
789 spin_lock_init(&local->queue_stop_reason_lock); in ieee80211_alloc_hw_nm()
792 INIT_LIST_HEAD(&local->active_txqs[i]); in ieee80211_alloc_hw_nm()
793 spin_lock_init(&local->active_txq_lock[i]); in ieee80211_alloc_hw_nm()
794 local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L; in ieee80211_alloc_hw_nm()
795 local->aql_txq_limit_high[i] = in ieee80211_alloc_hw_nm()
797 atomic_set(&local->aql_ac_pending_airtime[i], 0); in ieee80211_alloc_hw_nm()
800 local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX; in ieee80211_alloc_hw_nm()
801 local->aql_threshold = IEEE80211_AQL_THRESHOLD; in ieee80211_alloc_hw_nm()
802 atomic_set(&local->aql_total_pending_airtime, 0); in ieee80211_alloc_hw_nm()
804 spin_lock_init(&local->handle_wake_tx_queue_lock); in ieee80211_alloc_hw_nm()
806 INIT_LIST_HEAD(&local->chanctx_list); in ieee80211_alloc_hw_nm()
807 mutex_init(&local->chanctx_mtx); in ieee80211_alloc_hw_nm()
809 wiphy_delayed_work_init(&local->scan_work, ieee80211_scan_work); in ieee80211_alloc_hw_nm()
811 INIT_WORK(&local->restart_work, ieee80211_restart_work); in ieee80211_alloc_hw_nm()
813 wiphy_work_init(&local->radar_detected_work, in ieee80211_alloc_hw_nm()
816 INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter); in ieee80211_alloc_hw_nm()
817 local->smps_mode = IEEE80211_SMPS_OFF; in ieee80211_alloc_hw_nm()
819 INIT_WORK(&local->dynamic_ps_enable_work, in ieee80211_alloc_hw_nm()
821 INIT_WORK(&local->dynamic_ps_disable_work, in ieee80211_alloc_hw_nm()
823 timer_setup(&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, 0); in ieee80211_alloc_hw_nm()
825 wiphy_work_init(&local->sched_scan_stopped_work, in ieee80211_alloc_hw_nm()
828 spin_lock_init(&local->ack_status_lock); in ieee80211_alloc_hw_nm()
829 idr_init(&local->ack_status_frames); in ieee80211_alloc_hw_nm()
832 skb_queue_head_init(&local->pending[i]); in ieee80211_alloc_hw_nm()
833 atomic_set(&local->agg_queue_stop[i], 0); in ieee80211_alloc_hw_nm()
835 tasklet_setup(&local->tx_pending_tasklet, ieee80211_tx_pending); in ieee80211_alloc_hw_nm()
836 tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs); in ieee80211_alloc_hw_nm()
837 tasklet_setup(&local->tasklet, ieee80211_tasklet_handler); in ieee80211_alloc_hw_nm()
839 skb_queue_head_init(&local->skb_queue); in ieee80211_alloc_hw_nm()
840 skb_queue_head_init(&local->skb_queue_unreliable); in ieee80211_alloc_hw_nm()
846 local->hw.radiotap_timestamp.units_pos = -1; in ieee80211_alloc_hw_nm()
847 local->hw.radiotap_timestamp.accuracy = -1; in ieee80211_alloc_hw_nm()
849 return &local->hw; in ieee80211_alloc_hw_nm()
859 bool have_mfp = ieee80211_hw_check(&local->hw, MFP_CAPABLE); in ieee80211_init_cipher_suites()
872 /* keep last -- depends on hw flags! */ in ieee80211_init_cipher_suites()
879 if (ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL) || in ieee80211_init_cipher_suites()
880 local->hw.wiphy->cipher_suites) { in ieee80211_init_cipher_suites()
888 if (!local->hw.wiphy->n_cipher_suites) in ieee80211_init_cipher_suites()
892 suites = kmemdup(local->hw.wiphy->cipher_suites, in ieee80211_init_cipher_suites()
893 sizeof(u32) * local->hw.wiphy->n_cipher_suites, in ieee80211_init_cipher_suites()
896 return -ENOMEM; in ieee80211_init_cipher_suites()
898 for (r = 0; r < local->hw.wiphy->n_cipher_suites; r++) { in ieee80211_init_cipher_suites()
899 u32 suite = local->hw.wiphy->cipher_suites[r]; in ieee80211_init_cipher_suites()
910 local->hw.wiphy->cipher_suites = cipher_suites; in ieee80211_init_cipher_suites()
911 local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); in ieee80211_init_cipher_suites()
914 local->hw.wiphy->n_cipher_suites -= 4; in ieee80211_init_cipher_suites()
917 local->hw.wiphy->cipher_suites += 2; in ieee80211_init_cipher_suites()
918 local->hw.wiphy->n_cipher_suites -= 2; in ieee80211_init_cipher_suites()
925 local->hw.wiphy->cipher_suites = suites; in ieee80211_init_cipher_suites()
926 local->hw.wiphy->n_cipher_suites = w; in ieee80211_init_cipher_suites()
927 local->wiphy_ciphers_allocated = true; in ieee80211_init_cipher_suites()
942 (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE || in ieee80211_register_hw()
943 local->hw.offchannel_tx_hw_queue >= local->hw.queues)) in ieee80211_register_hw()
944 return -EINVAL; in ieee80211_register_hw()
946 if ((hw->wiphy->features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH) && in ieee80211_register_hw()
947 (!local->ops->tdls_channel_switch || in ieee80211_register_hw()
948 !local->ops->tdls_cancel_channel_switch || in ieee80211_register_hw()
949 !local->ops->tdls_recv_channel_switch)) in ieee80211_register_hw()
950 return -EOPNOTSUPP; in ieee80211_register_hw()
953 !local->ops->set_frag_threshold)) in ieee80211_register_hw()
954 return -EINVAL; in ieee80211_register_hw()
956 if (WARN_ON(local->hw.wiphy->interface_modes & in ieee80211_register_hw()
958 (!local->ops->start_nan || !local->ops->stop_nan))) in ieee80211_register_hw()
959 return -EINVAL; in ieee80211_register_hw()
961 if (hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) { in ieee80211_register_hw()
968 if (WARN_ON(!local->use_chanctx)) in ieee80211_register_hw()
969 return -EINVAL; in ieee80211_register_hw()
971 if (WARN_ON(!local->ops->link_info_changed)) in ieee80211_register_hw()
972 return -EINVAL; in ieee80211_register_hw()
975 return -EINVAL; in ieee80211_register_hw()
978 return -EINVAL; in ieee80211_register_hw()
981 return -EINVAL; in ieee80211_register_hw()
986 return -EINVAL; in ieee80211_register_hw()
989 return -EINVAL; in ieee80211_register_hw()
992 return -EINVAL; in ieee80211_register_hw()
995 return -EINVAL; in ieee80211_register_hw()
998 return -EINVAL; in ieee80211_register_hw()
1001 return -EINVAL; in ieee80211_register_hw()
1004 return -EINVAL; in ieee80211_register_hw()
1008 if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume)) in ieee80211_register_hw()
1009 return -EINVAL; in ieee80211_register_hw()
1012 if (!local->use_chanctx) { in ieee80211_register_hw()
1013 for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) { in ieee80211_register_hw()
1016 comb = &local->hw.wiphy->iface_combinations[i]; in ieee80211_register_hw()
1018 if (comb->num_different_channels > 1) in ieee80211_register_hw()
1019 return -EINVAL; in ieee80211_register_hw()
1022 /* DFS is not supported with multi-channel combinations yet */ in ieee80211_register_hw()
1023 for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) { in ieee80211_register_hw()
1026 comb = &local->hw.wiphy->iface_combinations[i]; in ieee80211_register_hw()
1028 if (comb->radar_detect_widths && in ieee80211_register_hw()
1029 comb->num_different_channels > 1) in ieee80211_register_hw()
1030 return -EINVAL; in ieee80211_register_hw()
1035 if (WARN_ON(hw->netdev_features & ~MAC80211_SUPPORTED_FEATURES)) in ieee80211_register_hw()
1036 return -EINVAL; in ieee80211_register_hw()
1038 if (hw->max_report_rates == 0) in ieee80211_register_hw()
1039 hw->max_report_rates = hw->max_rates; in ieee80211_register_hw()
1041 local->rx_chains = 1; in ieee80211_register_hw()
1046 * that hw.conf.channel is assigned in ieee80211_register_hw()
1057 sband = local->hw.wiphy->bands[band]; in ieee80211_register_hw()
1066 for (i = 0; i < sband->n_channels; i++) in ieee80211_register_hw()
1067 if (!(sband->channels[i].flags & in ieee80211_register_hw()
1071 if (i == sband->n_channels) in ieee80211_register_hw()
1074 &sband->channels[i], in ieee80211_register_hw()
1077 if (!local->use_chanctx && !local->_oper_chandef.chan) { in ieee80211_register_hw()
1078 local->hw.conf.chandef = dflt_chandef; in ieee80211_register_hw()
1079 local->_oper_chandef = dflt_chandef; in ieee80211_register_hw()
1081 local->monitor_chandef = dflt_chandef; in ieee80211_register_hw()
1084 channels += sband->n_channels; in ieee80211_register_hw()
1091 if (WARN_ON(sband->ht_cap.ht_supported && in ieee80211_register_hw()
1092 (sband->ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA) && in ieee80211_register_hw()
1093 hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO)) in ieee80211_register_hw()
1094 return -EINVAL; in ieee80211_register_hw()
1096 if (max_bitrates < sband->n_bitrates) in ieee80211_register_hw()
1097 max_bitrates = sband->n_bitrates; in ieee80211_register_hw()
1098 supp_ht = supp_ht || sband->ht_cap.ht_supported; in ieee80211_register_hw()
1099 supp_vht = supp_vht || sband->vht_cap.vht_supported; in ieee80211_register_hw()
1101 for (i = 0; i < sband->n_iftype_data; i++) { in ieee80211_register_hw()
1104 iftd = &sband->iftype_data[i]; in ieee80211_register_hw()
1106 supp_he = supp_he || iftd->he_cap.has_he; in ieee80211_register_hw()
1107 supp_eht = supp_eht || iftd->eht_cap.has_eht; in ieee80211_register_hw()
1111 if (WARN_ON(local->hw.queues < IEEE80211_NUM_ACS && in ieee80211_register_hw()
1113 return -EINVAL; in ieee80211_register_hw()
1117 return -EINVAL; in ieee80211_register_hw()
1119 if (!sband->ht_cap.ht_supported) in ieee80211_register_hw()
1123 local->rx_chains = in ieee80211_register_hw()
1124 max(ieee80211_mcs_to_chains(&sband->ht_cap.mcs), in ieee80211_register_hw()
1125 local->rx_chains); in ieee80211_register_hw()
1128 sband->ht_cap.cap |= WLAN_HT_CAP_SM_PS_DISABLED << in ieee80211_register_hw()
1132 /* if low-level driver supports AP, we also support VLAN. in ieee80211_register_hw()
1136 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP) && in ieee80211_register_hw()
1137 !ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL)) { in ieee80211_register_hw()
1138 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); in ieee80211_register_hw()
1139 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN); in ieee80211_register_hw()
1143 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); in ieee80211_register_hw()
1144 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR); in ieee80211_register_hw()
1147 for (i = 0; i < hw->wiphy->n_iface_combinations; i++) { in ieee80211_register_hw()
1151 c = &hw->wiphy->iface_combinations[i]; in ieee80211_register_hw()
1153 for (j = 0; j < c->n_limits; j++) in ieee80211_register_hw()
1154 if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) && in ieee80211_register_hw()
1155 c->limits[j].max > 1) in ieee80211_register_hw()
1156 return -EINVAL; in ieee80211_register_hw()
1159 local->int_scan_req = kzalloc(sizeof(*local->int_scan_req) + in ieee80211_register_hw()
1161 if (!local->int_scan_req) in ieee80211_register_hw()
1162 return -ENOMEM; in ieee80211_register_hw()
1164 eth_broadcast_addr(local->int_scan_req->bssid); in ieee80211_register_hw()
1167 if (!local->hw.wiphy->bands[band]) in ieee80211_register_hw()
1169 local->int_scan_req->rates[band] = (u32) -1; in ieee80211_register_hw()
1174 local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT); in ieee80211_register_hw()
1179 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_MESH_POINT)) in ieee80211_register_hw()
1180 local->hw.wiphy->flags |= WIPHY_FLAG_MESH_AUTH; in ieee80211_register_hw()
1183 local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL; in ieee80211_register_hw()
1185 if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) { in ieee80211_register_hw()
1186 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; in ieee80211_register_hw()
1187 } else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC)) { in ieee80211_register_hw()
1188 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; in ieee80211_register_hw()
1189 if (hw->max_signal <= 0) { in ieee80211_register_hw()
1190 result = -EINVAL; in ieee80211_register_hw()
1198 if (!local->ops->set_key) { in ieee80211_register_hw()
1199 wiphy_ext_feature_set(local->hw.wiphy, in ieee80211_register_hw()
1201 wiphy_ext_feature_set(local->hw.wiphy, in ieee80211_register_hw()
1205 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_ADHOC)) in ieee80211_register_hw()
1206 wiphy_ext_feature_set(local->hw.wiphy, in ieee80211_register_hw()
1210 * Calculate scan IE length -- we need this to alloc in ieee80211_register_hw()
1212 * includes the DS Params, (extended) supported rates, and HT in ieee80211_register_hw()
1213 * information -- SSID is the driver's responsibility. in ieee80211_register_hw()
1215 local->scan_ies_len = 4 + max_bitrates /* (ext) supp rates */ + in ieee80211_register_hw()
1216 3 /* DS Params */; in ieee80211_register_hw()
1218 local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap); in ieee80211_register_hw()
1221 local->scan_ies_len += in ieee80211_register_hw()
1225 * HE cap element is variable in size - set len to allow max size */ in ieee80211_register_hw()
1227 local->scan_ies_len += in ieee80211_register_hw()
1233 local->scan_ies_len += in ieee80211_register_hw()
1239 if (!local->ops->hw_scan) { in ieee80211_register_hw()
1241 local->hw.wiphy->max_scan_ssids = 4; in ieee80211_register_hw()
1242 local->hw.wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; in ieee80211_register_hw()
1252 if (local->hw.wiphy->max_scan_ie_len) in ieee80211_register_hw()
1253 local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len; in ieee80211_register_hw()
1259 if (!local->ops->remain_on_channel) in ieee80211_register_hw()
1260 local->hw.wiphy->max_remain_on_channel_duration = 5000; in ieee80211_register_hw()
1263 if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) in ieee80211_register_hw()
1264 local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP; in ieee80211_register_hw()
1267 if (ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA)) in ieee80211_register_hw()
1268 local->ext_capa[0] |= WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING; in ieee80211_register_hw()
1271 if (ieee80211_hw_check(&local->hw, SUPPORTS_MULTI_BSSID)) { in ieee80211_register_hw()
1272 local->hw.wiphy->support_mbssid = true; in ieee80211_register_hw()
1273 if (ieee80211_hw_check(&local->hw, in ieee80211_register_hw()
1275 local->hw.wiphy->support_only_he_mbssid = true; in ieee80211_register_hw()
1277 local->ext_capa[2] |= in ieee80211_register_hw()
1281 local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CNTDWN_COUNTERS_NUM; in ieee80211_register_hw()
1287 if (hw->queues > IEEE80211_MAX_QUEUES) in ieee80211_register_hw()
1288 hw->queues = IEEE80211_MAX_QUEUES; in ieee80211_register_hw()
1290 local->workqueue = in ieee80211_register_hw()
1291 alloc_ordered_workqueue("%s", 0, wiphy_name(local->hw.wiphy)); in ieee80211_register_hw()
1292 if (!local->workqueue) { in ieee80211_register_hw()
1293 result = -ENOMEM; in ieee80211_register_hw()
1302 local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, in ieee80211_register_hw()
1309 if (local->hw.max_listen_interval == 0) in ieee80211_register_hw()
1310 local->hw.max_listen_interval = 5; in ieee80211_register_hw()
1312 local->hw.conf.listen_interval = local->hw.max_listen_interval; in ieee80211_register_hw()
1314 local->dynamic_ps_forced_timeout = -1; in ieee80211_register_hw()
1316 if (!local->hw.max_nan_de_entries) in ieee80211_register_hw()
1317 local->hw.max_nan_de_entries = IEEE80211_MAX_NAN_INSTANCE_ID; in ieee80211_register_hw()
1319 if (!local->hw.weight_multiplier) in ieee80211_register_hw()
1320 local->hw.weight_multiplier = 1; in ieee80211_register_hw()
1324 local->hw.conf.flags = IEEE80211_CONF_IDLE; in ieee80211_register_hw()
1334 hw->rate_control_algorithm); in ieee80211_register_hw()
1337 wiphy_debug(local->hw.wiphy, in ieee80211_register_hw()
1342 if (local->rate_ctrl) { in ieee80211_register_hw()
1343 clear_bit(IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW, hw->flags); in ieee80211_register_hw()
1344 if (local->rate_ctrl->ops->capa & RATE_CTRL_CAPA_VHT_EXT_NSS_BW) in ieee80211_register_hw()
1356 BUILD_BUG_ON(NUM_NL80211_BANDS > 8 * sizeof(local->sband_allocated)); in ieee80211_register_hw()
1363 sband = local->hw.wiphy->bands[band]; in ieee80211_register_hw()
1364 if (!sband || !sband->vht_cap.vht_supported) in ieee80211_register_hw()
1367 ie_cap = !!(sband->vht_cap.vht_mcs.tx_highest & in ieee80211_register_hw()
1375 result = -ENOMEM; in ieee80211_register_hw()
1379 wiphy_dbg(hw->wiphy, "copying sband (band %d) due to VHT EXT NSS BW flag\n", in ieee80211_register_hw()
1382 sband->vht_cap.vht_mcs.tx_highest ^= in ieee80211_register_hw()
1385 local->hw.wiphy->bands[band] = sband; in ieee80211_register_hw()
1386 local->sband_allocated |= BIT(band); in ieee80211_register_hw()
1389 result = wiphy_register(local->hw.wiphy); in ieee80211_register_hw()
1397 wiphy_lock(hw->wiphy); in ieee80211_register_hw()
1400 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) && in ieee80211_register_hw()
1407 wiphy_warn(local->hw.wiphy, in ieee80211_register_hw()
1411 wiphy_unlock(hw->wiphy); in ieee80211_register_hw()
1415 local->ifa_notifier.notifier_call = ieee80211_ifa_changed; in ieee80211_register_hw()
1416 result = register_inetaddr_notifier(&local->ifa_notifier); in ieee80211_register_hw()
1422 local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; in ieee80211_register_hw()
1423 result = register_inet6addr_notifier(&local->ifa6_notifier); in ieee80211_register_hw()
1433 unregister_inetaddr_notifier(&local->ifa_notifier); in ieee80211_register_hw()
1439 wiphy_unregister(local->hw.wiphy); in ieee80211_register_hw()
1448 destroy_workqueue(local->workqueue); in ieee80211_register_hw()
1450 if (local->wiphy_ciphers_allocated) { in ieee80211_register_hw()
1451 kfree(local->hw.wiphy->cipher_suites); in ieee80211_register_hw()
1452 local->wiphy_ciphers_allocated = false; in ieee80211_register_hw()
1454 kfree(local->int_scan_req); in ieee80211_register_hw()
1463 tasklet_kill(&local->tx_pending_tasklet); in ieee80211_unregister_hw()
1464 tasklet_kill(&local->tasklet); in ieee80211_unregister_hw()
1467 unregister_inetaddr_notifier(&local->ifa_notifier); in ieee80211_unregister_hw()
1470 unregister_inet6addr_notifier(&local->ifa6_notifier); in ieee80211_unregister_hw()
1482 wiphy_lock(local->hw.wiphy); in ieee80211_unregister_hw()
1483 wiphy_delayed_work_cancel(local->hw.wiphy, &local->roc_work); in ieee80211_unregister_hw()
1484 wiphy_work_cancel(local->hw.wiphy, &local->sched_scan_stopped_work); in ieee80211_unregister_hw()
1485 wiphy_work_cancel(local->hw.wiphy, &local->radar_detected_work); in ieee80211_unregister_hw()
1486 wiphy_unlock(local->hw.wiphy); in ieee80211_unregister_hw()
1489 cancel_work_sync(&local->restart_work); in ieee80211_unregister_hw()
1490 cancel_work_sync(&local->reconfig_filter); in ieee80211_unregister_hw()
1495 if (skb_queue_len(&local->skb_queue) || in ieee80211_unregister_hw()
1496 skb_queue_len(&local->skb_queue_unreliable)) in ieee80211_unregister_hw()
1497 wiphy_warn(local->hw.wiphy, "skb_queue not empty\n"); in ieee80211_unregister_hw()
1498 skb_queue_purge(&local->skb_queue); in ieee80211_unregister_hw()
1499 skb_queue_purge(&local->skb_queue_unreliable); in ieee80211_unregister_hw()
1501 wiphy_unregister(local->hw.wiphy); in ieee80211_unregister_hw()
1502 destroy_workqueue(local->workqueue); in ieee80211_unregister_hw()
1504 kfree(local->int_scan_req); in ieee80211_unregister_hw()
1520 mutex_destroy(&local->iflist_mtx); in ieee80211_free_hw()
1521 mutex_destroy(&local->mtx); in ieee80211_free_hw()
1523 if (local->wiphy_ciphers_allocated) { in ieee80211_free_hw()
1524 kfree(local->hw.wiphy->cipher_suites); in ieee80211_free_hw()
1525 local->wiphy_ciphers_allocated = false; in ieee80211_free_hw()
1528 idr_for_each(&local->ack_status_frames, in ieee80211_free_hw()
1530 idr_destroy(&local->ack_status_frames); in ieee80211_free_hw()
1537 if (!(local->sband_allocated & BIT(band))) in ieee80211_free_hw()
1539 kfree(local->hw.wiphy->bands[band]); in ieee80211_free_hw()
1542 wiphy_free(local->hw.wiphy); in ieee80211_free_hw()
1573 BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb)); in ieee80211_init()
1575 IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb)); in ieee80211_init()