Lines Matching +full:conf +full:- +full:rx

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-2025 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()
107 if (!local->emulate_chanctx) in ieee80211_calc_hw_conf_chan()
110 offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; in ieee80211_calc_hw_conf_chan()
112 if (ctx && !WARN_ON(!ctx->def.chan)) { in ieee80211_calc_hw_conf_chan()
113 oper = &ctx->def; in ieee80211_calc_hw_conf_chan()
114 if (ctx->rx_chains_static > 1) in ieee80211_calc_hw_conf_chan()
116 else if (ctx->rx_chains_dynamic > 1) in ieee80211_calc_hw_conf_chan()
122 if (local->scan_chandef.chan) { in ieee80211_calc_hw_conf_chan()
123 chandef = local->scan_chandef; in ieee80211_calc_hw_conf_chan()
124 } else if (local->tmp_channel) { in ieee80211_calc_hw_conf_chan()
125 chandef.chan = local->tmp_channel; in ieee80211_calc_hw_conf_chan()
127 chandef.center_freq1 = chandef.chan->center_freq; in ieee80211_calc_hw_conf_chan()
128 chandef.freq1_offset = chandef.chan->freq_offset; in ieee80211_calc_hw_conf_chan()
132 chandef = local->dflt_chandef; in ieee80211_calc_hw_conf_chan()
137 chandef.chan ? chandef.chan->center_freq : -1, in ieee80211_calc_hw_conf_chan()
138 chandef.chan ? chandef.chan->freq_offset : 0, in ieee80211_calc_hw_conf_chan()
144 local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL; in ieee80211_calc_hw_conf_chan()
146 local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL; in ieee80211_calc_hw_conf_chan()
148 offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL; in ieee80211_calc_hw_conf_chan()
151 if (offchannel_flag || local->scanning || local->in_reconfig || in ieee80211_calc_hw_conf_chan()
152 !cfg80211_chandef_identical(&local->hw.conf.chandef, &chandef)) { in ieee80211_calc_hw_conf_chan()
153 local->hw.conf.chandef = chandef; in ieee80211_calc_hw_conf_chan()
157 if (!conf_is_ht(&local->hw.conf)) { in ieee80211_calc_hw_conf_chan()
163 local->hw.conf.smps_mode = IEEE80211_SMPS_STATIC; in ieee80211_calc_hw_conf_chan()
164 } else if (local->hw.conf.smps_mode != smps_mode) { in ieee80211_calc_hw_conf_chan()
165 local->hw.conf.smps_mode = smps_mode; in ieee80211_calc_hw_conf_chan()
170 if (local->user_power_level != IEEE80211_UNSET_POWER_LEVEL) in ieee80211_calc_hw_conf_chan()
171 power = min(local->user_power_level, power); in ieee80211_calc_hw_conf_chan()
174 list_for_each_entry_rcu(sdata, &local->interfaces, list) { in ieee80211_calc_hw_conf_chan()
175 if (!rcu_access_pointer(sdata->vif.bss_conf.chanctx_conf)) in ieee80211_calc_hw_conf_chan()
177 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) in ieee80211_calc_hw_conf_chan()
179 if (sdata->vif.bss_conf.txpower == INT_MIN) in ieee80211_calc_hw_conf_chan()
181 power = min(power, sdata->vif.bss_conf.txpower); in ieee80211_calc_hw_conf_chan()
185 if (local->hw.conf.power_level != power) { in ieee80211_calc_hw_conf_chan()
187 local->hw.conf.power_level = power; in ieee80211_calc_hw_conf_chan()
204 if (changed && local->open_count) { in ieee80211_hw_config()
232 if (!local->open_count) in _ieee80211_hw_conf_chan()
239 return drv_config(local, -1, changed); in _ieee80211_hw_conf_chan()
246 ctx = list_first_entry_or_null(&local->chanctx_list, in ieee80211_hw_conf_chan()
250 return _ieee80211_hw_conf_chan(local, ctx ? &ctx->conf : NULL); in ieee80211_hw_conf_chan()
259 if (WARN_ON(!local->open_count)) in ieee80211_hw_conf_init()
262 if (local->emulate_chanctx) { in ieee80211_hw_conf_init()
265 ctx = list_first_entry_or_null(&local->chanctx_list, in ieee80211_hw_conf_init()
270 ctx ? &ctx->conf : NULL); in ieee80211_hw_conf_init()
273 WARN_ON(drv_config(local, -1, changed)); in ieee80211_hw_conf_init()
281 local->hw.conf.radar_enabled = ctx->radar_enabled; in ieee80211_emulate_add_chanctx()
292 local->hw.conf.radar_enabled = false; in ieee80211_emulate_remove_chanctx()
304 local->hw.conf.radar_enabled = ctx->radar_enabled; in ieee80211_emulate_change_chanctx()
318 return -EINVAL; in ieee80211_emulate_switch_vif_chanctx()
320 local->hw.conf.radar_enabled = vifs[0].new_ctx->radar_enabled; in ieee80211_emulate_switch_vif_chanctx()
339 struct ieee80211_local *local = sdata->local; in ieee80211_bss_info_change_notify()
343 WARN_ON_ONCE(ieee80211_vif_is_mld(&sdata->vif)); in ieee80211_bss_info_change_notify()
345 if (!changed || sdata->vif.type == NL80211_IFTYPE_AP_VLAN) in ieee80211_bss_info_change_notify()
350 sdata->vif.type != NL80211_IFTYPE_AP && in ieee80211_bss_info_change_notify()
351 sdata->vif.type != NL80211_IFTYPE_ADHOC && in ieee80211_bss_info_change_notify()
352 sdata->vif.type != NL80211_IFTYPE_MESH_POINT && in ieee80211_bss_info_change_notify()
353 sdata->vif.type != NL80211_IFTYPE_OCB)) in ieee80211_bss_info_change_notify()
356 if (WARN_ON_ONCE(sdata->vif.type == NL80211_IFTYPE_P2P_DEVICE || in ieee80211_bss_info_change_notify()
357 sdata->vif.type == NL80211_IFTYPE_NAN || in ieee80211_bss_info_change_notify()
358 (sdata->vif.type == NL80211_IFTYPE_MONITOR && in ieee80211_bss_info_change_notify()
359 !sdata->vif.bss_conf.mu_mimo_owner && in ieee80211_bss_info_change_notify()
370 if (local->ops->vif_cfg_changed) in ieee80211_bss_info_change_notify()
371 local->ops->vif_cfg_changed(&local->hw, &sdata->vif, ch); in ieee80211_bss_info_change_notify()
377 trace_drv_link_info_changed(local, sdata, &sdata->vif.bss_conf, in ieee80211_bss_info_change_notify()
379 if (local->ops->link_info_changed) in ieee80211_bss_info_change_notify()
380 local->ops->link_info_changed(&local->hw, &sdata->vif, in ieee80211_bss_info_change_notify()
381 &sdata->vif.bss_conf, ch); in ieee80211_bss_info_change_notify()
384 if (local->ops->bss_info_changed) in ieee80211_bss_info_change_notify()
385 local->ops->bss_info_changed(&local->hw, &sdata->vif, in ieee80211_bss_info_change_notify()
386 &sdata->vif.bss_conf, changed); in ieee80211_bss_info_change_notify()
393 struct ieee80211_local *local = sdata->local; in ieee80211_vif_cfg_change_notify()
397 if (!changed || sdata->vif.type == NL80211_IFTYPE_AP_VLAN) in ieee80211_vif_cfg_change_notify()
407 struct ieee80211_local *local = sdata->local; in ieee80211_link_info_change_notify()
414 switch (sdata->vif.type) { in ieee80211_link_info_change_notify()
418 if (!ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF)) in ieee80211_link_info_change_notify()
428 drv_link_info_changed(local, sdata, link->conf, link->link_id, changed); in ieee80211_link_info_change_notify()
433 sdata->vif.bss_conf.use_cts_prot = false; in ieee80211_reset_erp_info()
434 sdata->vif.bss_conf.use_short_preamble = false; in ieee80211_reset_erp_info()
435 sdata->vif.bss_conf.use_short_slot = false; in ieee80211_reset_erp_info()
446 while ((skb = skb_dequeue(&local->skb_queue)) || in ieee80211_handle_queued_frames()
447 (skb = skb_dequeue(&local->skb_queue_unreliable))) { in ieee80211_handle_queued_frames()
448 switch (skb->pkt_type) { in ieee80211_handle_queued_frames()
450 /* Clear skb->pkt_type in order to not confuse kernel in ieee80211_handle_queued_frames()
452 skb->pkt_type = 0; in ieee80211_handle_queued_frames()
453 ieee80211_rx(&local->hw, skb); in ieee80211_handle_queued_frames()
456 skb->pkt_type = 0; in ieee80211_handle_queued_frames()
457 ieee80211_tx_status_skb(&local->hw, skb); in ieee80211_handle_queued_frames()
461 skb->pkt_type); in ieee80211_handle_queued_frames()
482 flush_workqueue(local->workqueue); in ieee80211_restart_work()
486 wiphy_lock(local->hw.wiphy); in ieee80211_restart_work()
487 wiphy_work_flush(local->hw.wiphy, NULL); in ieee80211_restart_work()
489 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning), in ieee80211_restart_work()
492 list_for_each_entry(sdata, &local->interfaces, list) { in ieee80211_restart_work()
501 if (sdata->vif.type == NL80211_IFTYPE_STATION) { in ieee80211_restart_work()
509 wiphy_work_cancel(local->hw.wiphy, in ieee80211_restart_work()
510 &sdata->u.mgd.csa_connection_drop_work); in ieee80211_restart_work()
511 if (sdata->vif.bss_conf.csa_active) in ieee80211_restart_work()
516 wiphy_delayed_work_flush(local->hw.wiphy, in ieee80211_restart_work()
517 &sdata->dec_tailroom_needed_wk); in ieee80211_restart_work()
521 /* make sure any new ROC will consider local->in_reconfig */ in ieee80211_restart_work()
522 wiphy_delayed_work_flush(local->hw.wiphy, &local->roc_work); in ieee80211_restart_work()
523 wiphy_work_flush(local->hw.wiphy, &local->hw_roc_done); in ieee80211_restart_work()
529 wiphy_unlock(local->hw.wiphy); in ieee80211_restart_work()
532 cfg80211_shutdown_all_interfaces(local->hw.wiphy); in ieee80211_restart_work()
543 wiphy_info(hw->wiphy, in ieee80211_restart_hw()
552 * Stop all Rx during the reconfig. We don't want state changes in ieee80211_restart_hw()
555 local->in_reconfig = true; in ieee80211_restart_hw()
558 queue_work(system_freezable_wq, &local->restart_work); in ieee80211_restart_hw()
570 struct net_device *ndev = ifa->ifa_dev->dev; in ieee80211_ifa_changed()
571 struct wireless_dev *wdev = ndev->ieee80211_ptr; in ieee80211_ifa_changed()
582 if (wdev->wiphy != local->hw.wiphy || !wdev->registered) in ieee80211_ifa_changed()
586 vif_cfg = &sdata->vif.cfg; in ieee80211_ifa_changed()
589 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_ifa_changed()
592 idev = __in_dev_get_rtnl(sdata->dev); in ieee80211_ifa_changed()
596 ifmgd = &sdata->u.mgd; in ieee80211_ifa_changed()
612 * by the !wdev->registered check above. in ieee80211_ifa_changed()
614 mutex_lock_nested(&local->hw.wiphy->mtx, 1); in ieee80211_ifa_changed()
615 __acquire(&local->hw.wiphy->mtx); in ieee80211_ifa_changed()
618 ifa = rtnl_dereference(idev->ifa_list); in ieee80211_ifa_changed()
621 vif_cfg->arp_addr_list[c] = ifa->ifa_address; in ieee80211_ifa_changed()
622 ifa = rtnl_dereference(ifa->ifa_next); in ieee80211_ifa_changed()
626 vif_cfg->arp_addr_cnt = c; in ieee80211_ifa_changed()
629 if (ifmgd->associated) in ieee80211_ifa_changed()
632 wiphy_unlock(local->hw.wiphy); in ieee80211_ifa_changed()
643 struct inet6_dev *idev = ifa->idev; in ieee80211_ifa6_changed()
644 struct net_device *ndev = ifa->idev->dev; in ieee80211_ifa6_changed()
647 struct wireless_dev *wdev = ndev->ieee80211_ptr; in ieee80211_ifa6_changed()
651 if (!wdev || wdev->wiphy != local->hw.wiphy) in ieee80211_ifa6_changed()
660 if (sdata->vif.type != NL80211_IFTYPE_STATION) in ieee80211_ifa6_changed()
674 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
684 * Rx authentication frames, so that the user space logic would
688 * for Rx authentication frames, i.e., only when PASN is used
693 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
699 .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
710 .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
720 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
725 .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
735 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
742 * To support P2P PASN pairing let user space register to rx
745 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
751 .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
801 if (WARN_ON(!ops->tx || !ops->start || !ops->stop || !ops->config || in ieee80211_alloc_hw_nm()
802 !ops->add_interface || !ops->remove_interface || in ieee80211_alloc_hw_nm()
803 !ops->configure_filter || !ops->wake_tx_queue)) in ieee80211_alloc_hw_nm()
806 if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove))) in ieee80211_alloc_hw_nm()
809 if (WARN_ON(!!ops->link_info_changed != !!ops->vif_cfg_changed || in ieee80211_alloc_hw_nm()
810 (ops->link_info_changed && ops->bss_info_changed))) in ieee80211_alloc_hw_nm()
814 if (ops->add_chanctx == ieee80211_emulate_add_chanctx && in ieee80211_alloc_hw_nm()
815 ops->remove_chanctx == ieee80211_emulate_remove_chanctx && in ieee80211_alloc_hw_nm()
816 ops->change_chanctx == ieee80211_emulate_change_chanctx) { in ieee80211_alloc_hw_nm()
817 if (WARN_ON(ops->assign_vif_chanctx || in ieee80211_alloc_hw_nm()
818 ops->unassign_vif_chanctx)) in ieee80211_alloc_hw_nm()
822 if (WARN_ON(ops->add_chanctx == ieee80211_emulate_add_chanctx || in ieee80211_alloc_hw_nm()
823 ops->remove_chanctx == ieee80211_emulate_remove_chanctx || in ieee80211_alloc_hw_nm()
824 ops->change_chanctx == ieee80211_emulate_change_chanctx)) in ieee80211_alloc_hw_nm()
826 if (WARN_ON(!ops->add_chanctx || in ieee80211_alloc_hw_nm()
827 !ops->remove_chanctx || in ieee80211_alloc_hw_nm()
828 !ops->change_chanctx || in ieee80211_alloc_hw_nm()
829 !ops->assign_vif_chanctx || in ieee80211_alloc_hw_nm()
830 !ops->unassign_vif_chanctx)) in ieee80211_alloc_hw_nm()
835 /* Ensure 32-byte alignment of our private data and hw private data. in ieee80211_alloc_hw_nm()
841 * +-------------------------+ in ieee80211_alloc_hw_nm()
843 * +-------------------------+ in ieee80211_alloc_hw_nm()
845 * +-------------------------+ in ieee80211_alloc_hw_nm()
847 * +-------------------------+ in ieee80211_alloc_hw_nm()
857 wiphy->mgmt_stypes = ieee80211_default_mgmt_stypes; in ieee80211_alloc_hw_nm()
859 wiphy->privid = mac80211_wiphy_privid; in ieee80211_alloc_hw_nm()
861 wiphy->flags |= WIPHY_FLAG_NETNS_OK | in ieee80211_alloc_hw_nm()
867 if (emulate_chanctx || ops->remain_on_channel) in ieee80211_alloc_hw_nm()
868 wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL; in ieee80211_alloc_hw_nm()
870 wiphy->bss_param_support = WIPHY_BSS_PARAM_CTS_PROT | in ieee80211_alloc_hw_nm()
878 wiphy->features |= NL80211_FEATURE_SK_TX_STATUS | in ieee80211_alloc_hw_nm()
897 if (!ops->hw_scan) { in ieee80211_alloc_hw_nm()
898 wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN | in ieee80211_alloc_hw_nm()
903 * supported even with hw scan - but let drivers opt in. in ieee80211_alloc_hw_nm()
911 if (!ops->set_key) { in ieee80211_alloc_hw_nm()
912 wiphy->flags |= WIPHY_FLAG_IBSS_RSN; in ieee80211_alloc_hw_nm()
920 wiphy->bss_priv_size = sizeof(struct ieee80211_bss); in ieee80211_alloc_hw_nm()
927 local->hw.wiphy = wiphy; in ieee80211_alloc_hw_nm()
929 local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN); in ieee80211_alloc_hw_nm()
931 local->ops = ops; in ieee80211_alloc_hw_nm()
932 local->emulate_chanctx = emulate_chanctx; in ieee80211_alloc_hw_nm()
935 ieee80211_hw_set(&local->hw, CHANCTX_STA_CSA); in ieee80211_alloc_hw_nm()
940 * to be queued in the stack. The value is a bit-shift of 1 in ieee80211_alloc_hw_nm()
943 * This is the default, anyhow - drivers may need to override it in ieee80211_alloc_hw_nm()
947 local->hw.tx_sk_pacing_shift = 7; in ieee80211_alloc_hw_nm()
950 local->hw.queues = 1; in ieee80211_alloc_hw_nm()
951 local->hw.max_rates = 1; in ieee80211_alloc_hw_nm()
952 local->hw.max_report_rates = 0; in ieee80211_alloc_hw_nm()
953 local->hw.max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT; in ieee80211_alloc_hw_nm()
954 local->hw.max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT; in ieee80211_alloc_hw_nm()
955 local->hw.offchannel_tx_hw_queue = IEEE80211_INVAL_HW_QUEUE; in ieee80211_alloc_hw_nm()
956 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long; in ieee80211_alloc_hw_nm()
957 local->hw.conf.short_frame_max_tx_count = wiphy->retry_short; in ieee80211_alloc_hw_nm()
958 local->hw.radiotap_mcs_details = IEEE80211_RADIOTAP_MCS_HAVE_MCS | in ieee80211_alloc_hw_nm()
961 local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI | in ieee80211_alloc_hw_nm()
963 local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES; in ieee80211_alloc_hw_nm()
964 local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN; in ieee80211_alloc_hw_nm()
965 local->hw.max_mtu = IEEE80211_MAX_DATA_LEN; in ieee80211_alloc_hw_nm()
966 local->user_power_level = IEEE80211_UNSET_POWER_LEVEL; in ieee80211_alloc_hw_nm()
967 wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask; in ieee80211_alloc_hw_nm()
968 wiphy->vht_capa_mod_mask = &mac80211_vht_capa_mod_mask; in ieee80211_alloc_hw_nm()
970 local->ext_capa[7] = WLAN_EXT_CAPA8_OPMODE_NOTIF; in ieee80211_alloc_hw_nm()
972 wiphy->extended_capabilities = local->ext_capa; in ieee80211_alloc_hw_nm()
973 wiphy->extended_capabilities_mask = local->ext_capa; in ieee80211_alloc_hw_nm()
974 wiphy->extended_capabilities_len = in ieee80211_alloc_hw_nm()
975 ARRAY_SIZE(local->ext_capa); in ieee80211_alloc_hw_nm()
977 INIT_LIST_HEAD(&local->interfaces); in ieee80211_alloc_hw_nm()
978 INIT_LIST_HEAD(&local->mon_list); in ieee80211_alloc_hw_nm()
980 __hw_addr_init(&local->mc_list); in ieee80211_alloc_hw_nm()
982 mutex_init(&local->iflist_mtx); in ieee80211_alloc_hw_nm()
983 spin_lock_init(&local->filter_lock); in ieee80211_alloc_hw_nm()
984 spin_lock_init(&local->rx_path_lock); in ieee80211_alloc_hw_nm()
985 spin_lock_init(&local->queue_stop_reason_lock); in ieee80211_alloc_hw_nm()
988 INIT_LIST_HEAD(&local->active_txqs[i]); in ieee80211_alloc_hw_nm()
989 spin_lock_init(&local->active_txq_lock[i]); in ieee80211_alloc_hw_nm()
990 local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L; in ieee80211_alloc_hw_nm()
991 local->aql_txq_limit_high[i] = in ieee80211_alloc_hw_nm()
993 atomic_set(&local->aql_ac_pending_airtime[i], 0); in ieee80211_alloc_hw_nm()
996 local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX; in ieee80211_alloc_hw_nm()
997 local->aql_threshold = IEEE80211_AQL_THRESHOLD; in ieee80211_alloc_hw_nm()
998 atomic_set(&local->aql_total_pending_airtime, 0); in ieee80211_alloc_hw_nm()
1000 spin_lock_init(&local->handle_wake_tx_queue_lock); in ieee80211_alloc_hw_nm()
1002 INIT_LIST_HEAD(&local->chanctx_list); in ieee80211_alloc_hw_nm()
1004 wiphy_delayed_work_init(&local->scan_work, ieee80211_scan_work); in ieee80211_alloc_hw_nm()
1006 INIT_WORK(&local->restart_work, ieee80211_restart_work); in ieee80211_alloc_hw_nm()
1008 wiphy_work_init(&local->radar_detected_work, in ieee80211_alloc_hw_nm()
1011 wiphy_work_init(&local->reconfig_filter, ieee80211_reconfig_filter); in ieee80211_alloc_hw_nm()
1013 wiphy_work_init(&local->dynamic_ps_enable_work, in ieee80211_alloc_hw_nm()
1015 wiphy_work_init(&local->dynamic_ps_disable_work, in ieee80211_alloc_hw_nm()
1017 timer_setup(&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, 0); in ieee80211_alloc_hw_nm()
1019 wiphy_work_init(&local->sched_scan_stopped_work, in ieee80211_alloc_hw_nm()
1022 spin_lock_init(&local->ack_status_lock); in ieee80211_alloc_hw_nm()
1023 idr_init(&local->ack_status_frames); in ieee80211_alloc_hw_nm()
1026 skb_queue_head_init(&local->pending[i]); in ieee80211_alloc_hw_nm()
1027 atomic_set(&local->agg_queue_stop[i], 0); in ieee80211_alloc_hw_nm()
1029 tasklet_setup(&local->tx_pending_tasklet, ieee80211_tx_pending); in ieee80211_alloc_hw_nm()
1030 tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs); in ieee80211_alloc_hw_nm()
1031 tasklet_setup(&local->tasklet, ieee80211_tasklet_handler); in ieee80211_alloc_hw_nm()
1033 skb_queue_head_init(&local->skb_queue); in ieee80211_alloc_hw_nm()
1034 skb_queue_head_init(&local->skb_queue_unreliable); in ieee80211_alloc_hw_nm()
1040 local->hw.radiotap_timestamp.units_pos = -1; in ieee80211_alloc_hw_nm()
1041 local->hw.radiotap_timestamp.accuracy = -1; in ieee80211_alloc_hw_nm()
1043 return &local->hw; in ieee80211_alloc_hw_nm()
1052 bool have_mfp = ieee80211_hw_check(&local->hw, MFP_CAPABLE); in ieee80211_init_cipher_suites()
1063 /* keep last -- depends on hw flags! */ in ieee80211_init_cipher_suites()
1070 if (ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL) && fips_enabled) { in ieee80211_init_cipher_suites()
1071 dev_err(local->hw.wiphy->dev.parent, in ieee80211_init_cipher_suites()
1073 return -EINVAL; in ieee80211_init_cipher_suites()
1076 if (WARN_ON(ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL) && in ieee80211_init_cipher_suites()
1077 !local->hw.wiphy->cipher_suites)) in ieee80211_init_cipher_suites()
1078 return -EINVAL; in ieee80211_init_cipher_suites()
1080 if (fips_enabled || !local->hw.wiphy->cipher_suites) { in ieee80211_init_cipher_suites()
1084 local->hw.wiphy->cipher_suites = cipher_suites; in ieee80211_init_cipher_suites()
1085 local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); in ieee80211_init_cipher_suites()
1088 local->hw.wiphy->n_cipher_suites -= 4; in ieee80211_init_cipher_suites()
1092 local->hw.wiphy->cipher_suites += 3; in ieee80211_init_cipher_suites()
1093 local->hw.wiphy->n_cipher_suites -= 3; in ieee80211_init_cipher_suites()
1106 /* DFS is not supported with multi-channel combinations yet */ in ieee80211_ifcomb_check()
1107 if (c->radar_detect_widths && in ieee80211_ifcomb_check()
1108 c->num_different_channels > 1) in ieee80211_ifcomb_check()
1112 for (j = 0; j < c->n_limits; j++) in ieee80211_ifcomb_check()
1113 if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) && in ieee80211_ifcomb_check()
1114 c->limits[j].max > 1) in ieee80211_ifcomb_check()
1131 (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE || in ieee80211_register_hw()
1132 local->hw.offchannel_tx_hw_queue >= local->hw.queues)) in ieee80211_register_hw()
1133 return -EINVAL; in ieee80211_register_hw()
1135 if ((hw->wiphy->features & NL80211_FEATURE_TDLS_CHANNEL_SWITCH) && in ieee80211_register_hw()
1136 (!local->ops->tdls_channel_switch || in ieee80211_register_hw()
1137 !local->ops->tdls_cancel_channel_switch || in ieee80211_register_hw()
1138 !local->ops->tdls_recv_channel_switch)) in ieee80211_register_hw()
1139 return -EOPNOTSUPP; in ieee80211_register_hw()
1142 !local->ops->set_frag_threshold)) in ieee80211_register_hw()
1143 return -EINVAL; in ieee80211_register_hw()
1145 if (WARN_ON(local->hw.wiphy->interface_modes & in ieee80211_register_hw()
1147 (!local->ops->start_nan || !local->ops->stop_nan))) in ieee80211_register_hw()
1148 return -EINVAL; in ieee80211_register_hw()
1150 if (hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO) { in ieee80211_register_hw()
1157 if (WARN_ON(local->emulate_chanctx)) in ieee80211_register_hw()
1158 return -EINVAL; in ieee80211_register_hw()
1160 if (WARN_ON(!local->ops->link_info_changed)) in ieee80211_register_hw()
1161 return -EINVAL; in ieee80211_register_hw()
1164 return -EINVAL; in ieee80211_register_hw()
1167 return -EINVAL; in ieee80211_register_hw()
1170 return -EINVAL; in ieee80211_register_hw()
1175 return -EINVAL; in ieee80211_register_hw()
1178 return -EINVAL; in ieee80211_register_hw()
1181 return -EINVAL; in ieee80211_register_hw()
1184 return -EINVAL; in ieee80211_register_hw()
1187 return -EINVAL; in ieee80211_register_hw()
1191 if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume)) in ieee80211_register_hw()
1192 return -EINVAL; in ieee80211_register_hw()
1195 if (local->emulate_chanctx) { in ieee80211_register_hw()
1196 for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) { in ieee80211_register_hw()
1199 comb = &local->hw.wiphy->iface_combinations[i]; in ieee80211_register_hw()
1201 if (comb->num_different_channels > 1) in ieee80211_register_hw()
1202 return -EINVAL; in ieee80211_register_hw()
1206 if (hw->wiphy->n_radio) { in ieee80211_register_hw()
1207 for (i = 0; i < hw->wiphy->n_radio; i++) { in ieee80211_register_hw()
1208 const struct wiphy_radio *radio = &hw->wiphy->radio[i]; in ieee80211_register_hw()
1210 if (!ieee80211_ifcomb_check(radio->iface_combinations, in ieee80211_register_hw()
1211 radio->n_iface_combinations)) in ieee80211_register_hw()
1212 return -EINVAL; in ieee80211_register_hw()
1215 if (!ieee80211_ifcomb_check(hw->wiphy->iface_combinations, in ieee80211_register_hw()
1216 hw->wiphy->n_iface_combinations)) in ieee80211_register_hw()
1217 return -EINVAL; in ieee80211_register_hw()
1221 if (WARN_ON(hw->netdev_features & ~MAC80211_SUPPORTED_FEATURES)) in ieee80211_register_hw()
1222 return -EINVAL; in ieee80211_register_hw()
1224 if (hw->max_report_rates == 0) in ieee80211_register_hw()
1225 hw->max_report_rates = hw->max_rates; in ieee80211_register_hw()
1227 local->rx_chains = 1; in ieee80211_register_hw()
1232 * that hw.conf.channel is assigned in ieee80211_register_hw()
1245 sband = local->hw.wiphy->bands[band]; in ieee80211_register_hw()
1255 for (i = 0; i < sband->n_channels; i++) in ieee80211_register_hw()
1256 if (!(sband->channels[i].flags & in ieee80211_register_hw()
1261 if (i == sband->n_channels) in ieee80211_register_hw()
1264 &sband->channels[i], in ieee80211_register_hw()
1267 local->monitor_chanreq.oper = dflt_chandef; in ieee80211_register_hw()
1268 if (local->emulate_chanctx) { in ieee80211_register_hw()
1269 local->dflt_chandef = dflt_chandef; in ieee80211_register_hw()
1270 local->hw.conf.chandef = dflt_chandef; in ieee80211_register_hw()
1274 channels += sband->n_channels; in ieee80211_register_hw()
1281 if (WARN_ON(sband->ht_cap.ht_supported && in ieee80211_register_hw()
1282 (sband->ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA) && in ieee80211_register_hw()
1283 hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO)) in ieee80211_register_hw()
1284 return -EINVAL; in ieee80211_register_hw()
1286 if (max_bitrates < sband->n_bitrates) in ieee80211_register_hw()
1287 max_bitrates = sband->n_bitrates; in ieee80211_register_hw()
1288 supp_ht = supp_ht || sband->ht_cap.ht_supported; in ieee80211_register_hw()
1289 supp_vht = supp_vht || sband->vht_cap.vht_supported; in ieee80211_register_hw()
1290 supp_s1g = supp_s1g || sband->s1g_cap.s1g; in ieee80211_register_hw()
1295 supp_he = supp_he || iftd->he_cap.has_he; in ieee80211_register_hw()
1296 supp_eht = supp_eht || iftd->eht_cap.has_eht; in ieee80211_register_hw()
1306 if (iftd->he_cap.has_he && in ieee80211_register_hw()
1307 iftd->types_mask & (BIT(NL80211_IFTYPE_STATION) | in ieee80211_register_hw()
1309 sband->ht_cap.ht_supported && in ieee80211_register_hw()
1310 sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40 && in ieee80211_register_hw()
1311 !(iftd->he_cap.he_cap_elem.phy_cap_info[0] & he_40_mhz_cap)) in ieee80211_register_hw()
1312 return -EINVAL; in ieee80211_register_hw()
1314 /* no support for per-band vendor elems with MLO */ in ieee80211_register_hw()
1315 if (WARN_ON(iftd->vendor_elems.len && in ieee80211_register_hw()
1316 hw->wiphy->flags & WIPHY_FLAG_SUPPORTS_MLO)) in ieee80211_register_hw()
1317 return -EINVAL; in ieee80211_register_hw()
1321 if (WARN_ON(local->hw.queues < IEEE80211_NUM_ACS && in ieee80211_register_hw()
1323 return -EINVAL; in ieee80211_register_hw()
1327 return -EINVAL; in ieee80211_register_hw()
1329 if (!sband->ht_cap.ht_supported) in ieee80211_register_hw()
1332 /* TODO: consider VHT for RX chains, hopefully it's the same */ in ieee80211_register_hw()
1333 local->rx_chains = in ieee80211_register_hw()
1334 max(ieee80211_mcs_to_chains(&sband->ht_cap.mcs), in ieee80211_register_hw()
1335 local->rx_chains); in ieee80211_register_hw()
1338 sband->ht_cap.cap |= WLAN_HT_CAP_SM_PS_DISABLED << in ieee80211_register_hw()
1342 /* if low-level driver supports AP, we also support VLAN. in ieee80211_register_hw()
1346 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP) && in ieee80211_register_hw()
1347 !ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL)) { in ieee80211_register_hw()
1348 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN); in ieee80211_register_hw()
1349 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN); in ieee80211_register_hw()
1353 hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR); in ieee80211_register_hw()
1354 hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR); in ieee80211_register_hw()
1357 local->int_scan_req = kzalloc(struct_size(local->int_scan_req, in ieee80211_register_hw()
1360 if (!local->int_scan_req) in ieee80211_register_hw()
1361 return -ENOMEM; in ieee80211_register_hw()
1363 eth_broadcast_addr(local->int_scan_req->bssid); in ieee80211_register_hw()
1366 if (!local->hw.wiphy->bands[band]) in ieee80211_register_hw()
1368 local->int_scan_req->rates[band] = (u32) -1; in ieee80211_register_hw()
1373 local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT); in ieee80211_register_hw()
1378 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_MESH_POINT)) in ieee80211_register_hw()
1379 local->hw.wiphy->flags |= WIPHY_FLAG_MESH_AUTH; in ieee80211_register_hw()
1382 local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL; in ieee80211_register_hw()
1384 if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) { in ieee80211_register_hw()
1385 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM; in ieee80211_register_hw()
1386 } else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC)) { in ieee80211_register_hw()
1387 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC; in ieee80211_register_hw()
1388 if (hw->max_signal <= 0) { in ieee80211_register_hw()
1389 result = -EINVAL; in ieee80211_register_hw()
1397 if (!local->ops->set_key) { in ieee80211_register_hw()
1398 wiphy_ext_feature_set(local->hw.wiphy, in ieee80211_register_hw()
1400 wiphy_ext_feature_set(local->hw.wiphy, in ieee80211_register_hw()
1404 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_ADHOC)) in ieee80211_register_hw()
1405 wiphy_ext_feature_set(local->hw.wiphy, in ieee80211_register_hw()
1409 * Calculate scan IE length -- we need this to alloc in ieee80211_register_hw()
1412 * information -- SSID is the driver's responsibility. in ieee80211_register_hw()
1414 local->scan_ies_len = 4 + max_bitrates /* (ext) supp rates */ + in ieee80211_register_hw()
1417 local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap); in ieee80211_register_hw()
1420 local->scan_ies_len += in ieee80211_register_hw()
1424 local->scan_ies_len += 2 + sizeof(struct ieee80211_s1g_cap); in ieee80211_register_hw()
1427 * HE cap element is variable in size - set len to allow max size */ in ieee80211_register_hw()
1429 local->scan_ies_len += in ieee80211_register_hw()
1435 local->scan_ies_len += in ieee80211_register_hw()
1441 if (!local->ops->hw_scan) { in ieee80211_register_hw()
1443 local->hw.wiphy->max_scan_ssids = 4; in ieee80211_register_hw()
1444 local->hw.wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN; in ieee80211_register_hw()
1454 if (local->hw.wiphy->max_scan_ie_len) in ieee80211_register_hw()
1455 local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len; in ieee80211_register_hw()
1461 if (!local->ops->remain_on_channel) in ieee80211_register_hw()
1462 local->hw.wiphy->max_remain_on_channel_duration = 5000; in ieee80211_register_hw()
1465 if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) in ieee80211_register_hw()
1466 local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP; in ieee80211_register_hw()
1469 if (ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA)) in ieee80211_register_hw()
1470 local->ext_capa[0] |= WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING; in ieee80211_register_hw()
1473 if (ieee80211_hw_check(&local->hw, SUPPORTS_MULTI_BSSID)) { in ieee80211_register_hw()
1474 local->hw.wiphy->support_mbssid = true; in ieee80211_register_hw()
1475 if (ieee80211_hw_check(&local->hw, in ieee80211_register_hw()
1477 local->hw.wiphy->support_only_he_mbssid = true; in ieee80211_register_hw()
1479 local->ext_capa[2] |= in ieee80211_register_hw()
1483 local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CNTDWN_COUNTERS_NUM; in ieee80211_register_hw()
1489 if (hw->queues > IEEE80211_MAX_QUEUES) in ieee80211_register_hw()
1490 hw->queues = IEEE80211_MAX_QUEUES; in ieee80211_register_hw()
1492 local->workqueue = in ieee80211_register_hw()
1493 alloc_ordered_workqueue("%s", 0, wiphy_name(local->hw.wiphy)); in ieee80211_register_hw()
1494 if (!local->workqueue) { in ieee80211_register_hw()
1495 result = -ENOMEM; in ieee80211_register_hw()
1504 local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, in ieee80211_register_hw()
1511 if (local->hw.max_listen_interval == 0) in ieee80211_register_hw()
1512 local->hw.max_listen_interval = 5; in ieee80211_register_hw()
1514 local->hw.conf.listen_interval = local->hw.max_listen_interval; in ieee80211_register_hw()
1516 local->dynamic_ps_forced_timeout = -1; in ieee80211_register_hw()
1518 if (!local->hw.max_nan_de_entries) in ieee80211_register_hw()
1519 local->hw.max_nan_de_entries = IEEE80211_MAX_NAN_INSTANCE_ID; in ieee80211_register_hw()
1521 if (!local->hw.weight_multiplier) in ieee80211_register_hw()
1522 local->hw.weight_multiplier = 1; in ieee80211_register_hw()
1526 local->hw.conf.flags = IEEE80211_CONF_IDLE; in ieee80211_register_hw()
1536 hw->rate_control_algorithm); in ieee80211_register_hw()
1539 wiphy_debug(local->hw.wiphy, in ieee80211_register_hw()
1544 if (local->rate_ctrl) { in ieee80211_register_hw()
1545 clear_bit(IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW, hw->flags); in ieee80211_register_hw()
1546 if (local->rate_ctrl->ops->capa & RATE_CTRL_CAPA_VHT_EXT_NSS_BW) in ieee80211_register_hw()
1558 BUILD_BUG_ON(NUM_NL80211_BANDS > 8 * sizeof(local->sband_allocated)); in ieee80211_register_hw()
1565 sband = local->hw.wiphy->bands[band]; in ieee80211_register_hw()
1566 if (!sband || !sband->vht_cap.vht_supported) in ieee80211_register_hw()
1569 ie_cap = !!(sband->vht_cap.vht_mcs.tx_highest & in ieee80211_register_hw()
1577 result = -ENOMEM; in ieee80211_register_hw()
1581 wiphy_dbg(hw->wiphy, "copying sband (band %d) due to VHT EXT NSS BW flag\n", in ieee80211_register_hw()
1584 sband->vht_cap.vht_mcs.tx_highest ^= in ieee80211_register_hw()
1587 local->hw.wiphy->bands[band] = sband; in ieee80211_register_hw()
1588 local->sband_allocated |= BIT(band); in ieee80211_register_hw()
1591 result = wiphy_register(local->hw.wiphy); in ieee80211_register_hw()
1601 wiphy_lock(hw->wiphy); in ieee80211_register_hw()
1604 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) && in ieee80211_register_hw()
1611 wiphy_warn(local->hw.wiphy, in ieee80211_register_hw()
1615 wiphy_unlock(hw->wiphy); in ieee80211_register_hw()
1619 local->ifa_notifier.notifier_call = ieee80211_ifa_changed; in ieee80211_register_hw()
1620 result = register_inetaddr_notifier(&local->ifa_notifier); in ieee80211_register_hw()
1626 local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed; in ieee80211_register_hw()
1627 result = register_inet6addr_notifier(&local->ifa6_notifier); in ieee80211_register_hw()
1637 unregister_inetaddr_notifier(&local->ifa_notifier); in ieee80211_register_hw()
1643 wiphy_unregister(local->hw.wiphy); in ieee80211_register_hw()
1653 destroy_workqueue(local->workqueue); in ieee80211_register_hw()
1655 kfree(local->int_scan_req); in ieee80211_register_hw()
1664 tasklet_kill(&local->tx_pending_tasklet); in ieee80211_unregister_hw()
1665 tasklet_kill(&local->tasklet); in ieee80211_unregister_hw()
1668 unregister_inetaddr_notifier(&local->ifa_notifier); in ieee80211_unregister_hw()
1671 unregister_inet6addr_notifier(&local->ifa6_notifier); in ieee80211_unregister_hw()
1685 wiphy_lock(local->hw.wiphy); in ieee80211_unregister_hw()
1686 wiphy_delayed_work_cancel(local->hw.wiphy, &local->roc_work); in ieee80211_unregister_hw()
1687 wiphy_work_cancel(local->hw.wiphy, &local->reconfig_filter); in ieee80211_unregister_hw()
1688 wiphy_work_cancel(local->hw.wiphy, &local->sched_scan_stopped_work); in ieee80211_unregister_hw()
1689 wiphy_work_cancel(local->hw.wiphy, &local->radar_detected_work); in ieee80211_unregister_hw()
1690 wiphy_unlock(local->hw.wiphy); in ieee80211_unregister_hw()
1693 cancel_work_sync(&local->restart_work); in ieee80211_unregister_hw()
1698 if (skb_queue_len(&local->skb_queue) || in ieee80211_unregister_hw()
1699 skb_queue_len(&local->skb_queue_unreliable)) in ieee80211_unregister_hw()
1700 wiphy_warn(local->hw.wiphy, "skb_queue not empty\n"); in ieee80211_unregister_hw()
1701 skb_queue_purge(&local->skb_queue); in ieee80211_unregister_hw()
1702 skb_queue_purge(&local->skb_queue_unreliable); in ieee80211_unregister_hw()
1704 wiphy_unregister(local->hw.wiphy); in ieee80211_unregister_hw()
1705 destroy_workqueue(local->workqueue); in ieee80211_unregister_hw()
1707 kfree(local->int_scan_req); in ieee80211_unregister_hw()
1723 mutex_destroy(&local->iflist_mtx); in ieee80211_free_hw()
1725 idr_for_each(&local->ack_status_frames, in ieee80211_free_hw()
1727 idr_destroy(&local->ack_status_frames); in ieee80211_free_hw()
1734 if (!(local->sband_allocated & BIT(band))) in ieee80211_free_hw()
1736 kfree(local->hw.wiphy->bands[band]); in ieee80211_free_hw()
1739 wiphy_free(local->hw.wiphy); in ieee80211_free_hw()
1759 BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb)); in ieee80211_init()
1761 IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb)); in ieee80211_init()