Lines Matching refs:local
37 void ieee80211_configure_filter(struct ieee80211_local *local)
43 if (atomic_read(&local->iff_allmultis))
46 if (local->monitors || test_bit(SCAN_SW_SCANNING, &local->scanning) ||
47 test_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning))
50 if (local->fif_probe_req || local->probe_req_reg)
53 if (local->fif_fcsfail)
56 if (local->fif_plcpfail)
59 if (local->fif_control)
62 if (local->fif_other_bss)
65 if (local->fif_pspoll)
68 if (local->rx_mcast_action_reg)
71 spin_lock_bh(&local->filter_lock);
72 changed_flags = local->filter_flags ^ new_flags;
74 mc = drv_prepare_multicast(local, &local->mc_list);
75 spin_unlock_bh(&local->filter_lock);
80 drv_configure_filter(local, changed_flags, &new_flags, mc);
84 local->filter_flags = new_flags & ~(1<<31);
89 struct ieee80211_local *local =
92 ieee80211_configure_filter(local);
95 static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local)
103 offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
105 if (local->scan_chandef.chan) {
106 chandef = local->scan_chandef;
107 } else if (local->tmp_channel) {
108 chandef.chan = local->tmp_channel;
113 chandef = local->_oper_chandef;
121 if (!cfg80211_chandef_identical(&chandef, &local->_oper_chandef))
122 local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
124 local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL;
126 offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
129 !cfg80211_chandef_identical(&local->hw.conf.chandef,
130 &local->_oper_chandef)) {
131 local->hw.conf.chandef = chandef;
135 if (!conf_is_ht(&local->hw.conf)) {
141 local->hw.conf.smps_mode = IEEE80211_SMPS_STATIC;
142 } else if (local->hw.conf.smps_mode != local->smps_mode) {
143 local->hw.conf.smps_mode = local->smps_mode;
150 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
161 if (local->hw.conf.power_level != power) {
163 local->hw.conf.power_level = power;
169 int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
175 if (!local->use_chanctx)
176 changed |= ieee80211_hw_conf_chan(local);
182 if (changed && local->open_count) {
183 ret = drv_config(local, changed);
214 struct ieee80211_local *local = sdata->local;
242 trace_drv_vif_cfg_changed(local, sdata, changed);
243 if (local->ops->vif_cfg_changed)
244 local->ops->vif_cfg_changed(&local->hw, &sdata->vif, ch);
251 trace_drv_link_info_changed(local, sdata, &sdata->vif.bss_conf,
253 if (local->ops->link_info_changed)
254 local->ops->link_info_changed(&local->hw, &sdata->vif,
258 if (local->ops->bss_info_changed)
259 local->ops->bss_info_changed(&local->hw, &sdata->vif,
261 trace_drv_return_void(local);
267 struct ieee80211_local *local = sdata->local;
274 drv_vif_cfg_changed(local, sdata, changed);
281 struct ieee80211_local *local = sdata->local;
291 drv_link_info_changed(local, sdata, link->conf, link->link_id, changed);
306 struct ieee80211_local *local = from_tasklet(local, t, tasklet);
309 while ((skb = skb_dequeue(&local->skb_queue)) ||
310 (skb = skb_dequeue(&local->skb_queue_unreliable))) {
316 ieee80211_rx(&local->hw, skb);
320 ieee80211_tx_status(&local->hw, skb);
333 struct ieee80211_local *local =
338 flush_workqueue(local->workqueue);
342 wiphy_lock(local->hw.wiphy);
344 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
347 list_for_each_entry(sdata, &local->interfaces, list) {
364 wiphy_work_cancel(local->hw.wiphy,
376 ieee80211_scan_cancel(local);
378 /* make sure any new ROC will consider local->in_reconfig */
379 wiphy_delayed_work_flush(local->hw.wiphy, &local->roc_work);
380 wiphy_work_flush(local->hw.wiphy, &local->hw_roc_done);
385 ret = ieee80211_reconfig(local);
386 wiphy_unlock(local->hw.wiphy);
389 cfg80211_shutdown_all_interfaces(local->hw.wiphy);
396 struct ieee80211_local *local = hw_to_local(hw);
398 trace_api_restart_hw(local);
412 local->in_reconfig = true;
415 queue_work(system_freezable_wq, &local->restart_work);
424 struct ieee80211_local *local =
439 if (wdev->wiphy != local->hw.wiphy)
484 struct ieee80211_local *local =
490 if (!wdev || wdev->wiphy != local->hw.wiphy)
502 drv_ipv6_addr_change(local, sdata, idev);
625 struct ieee80211_local *local;
665 priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
726 local = wiphy_priv(wiphy);
728 if (sta_info_init(local))
731 local->hw.wiphy = wiphy;
733 local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
735 local->ops = ops;
736 local->use_chanctx = use_chanctx;
742 * second, so 7 is ~8ms of queued data. Only affects local TCP
745 * for local reasons (longer buffers, longer completion time, or
748 local->hw.tx_sk_pacing_shift = 7;
751 local->hw.queues = 1;
752 local->hw.max_rates = 1;
753 local->hw.max_report_rates = 0;
754 local->hw.max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT;
755 local->hw.max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT;
756 local->hw.offchannel_tx_hw_queue = IEEE80211_INVAL_HW_QUEUE;
757 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
758 local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
759 local->hw.radiotap_mcs_details = IEEE80211_RADIOTAP_MCS_HAVE_MCS |
762 local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
764 local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
765 local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
766 local->hw.max_mtu = IEEE80211_MAX_DATA_LEN;
767 local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
771 local->ext_capa[7] = WLAN_EXT_CAPA8_OPMODE_NOTIF;
773 wiphy->extended_capabilities = local->ext_capa;
774 wiphy->extended_capabilities_mask = local->ext_capa;
776 ARRAY_SIZE(local->ext_capa);
778 INIT_LIST_HEAD(&local->interfaces);
779 INIT_LIST_HEAD(&local->mon_list);
781 __hw_addr_init(&local->mc_list);
783 mutex_init(&local->iflist_mtx);
784 mutex_init(&local->mtx);
786 mutex_init(&local->key_mtx);
787 spin_lock_init(&local->filter_lock);
788 spin_lock_init(&local->rx_path_lock);
789 spin_lock_init(&local->queue_stop_reason_lock);
792 INIT_LIST_HEAD(&local->active_txqs[i]);
793 spin_lock_init(&local->active_txq_lock[i]);
794 local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L;
795 local->aql_txq_limit_high[i] =
797 atomic_set(&local->aql_ac_pending_airtime[i], 0);
800 local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX;
801 local->aql_threshold = IEEE80211_AQL_THRESHOLD;
802 atomic_set(&local->aql_total_pending_airtime, 0);
804 spin_lock_init(&local->handle_wake_tx_queue_lock);
806 INIT_LIST_HEAD(&local->chanctx_list);
807 mutex_init(&local->chanctx_mtx);
809 wiphy_delayed_work_init(&local->scan_work, ieee80211_scan_work);
811 INIT_WORK(&local->restart_work, ieee80211_restart_work);
813 wiphy_work_init(&local->radar_detected_work,
816 INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter);
817 local->smps_mode = IEEE80211_SMPS_OFF;
819 INIT_WORK(&local->dynamic_ps_enable_work,
821 INIT_WORK(&local->dynamic_ps_disable_work,
823 timer_setup(&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, 0);
825 wiphy_work_init(&local->sched_scan_stopped_work,
828 spin_lock_init(&local->ack_status_lock);
829 idr_init(&local->ack_status_frames);
832 skb_queue_head_init(&local->pending[i]);
833 atomic_set(&local->agg_queue_stop[i], 0);
835 tasklet_setup(&local->tx_pending_tasklet, ieee80211_tx_pending);
836 tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs);
837 tasklet_setup(&local->tasklet, ieee80211_tasklet_handler);
839 skb_queue_head_init(&local->skb_queue);
840 skb_queue_head_init(&local->skb_queue_unreliable);
842 ieee80211_alloc_led_names(local);
844 ieee80211_roc_setup(local);
846 local->hw.radiotap_timestamp.units_pos = -1;
847 local->hw.radiotap_timestamp.accuracy = -1;
849 return &local->hw;
856 static int ieee80211_init_cipher_suites(struct ieee80211_local *local)
859 bool have_mfp = ieee80211_hw_check(&local->hw, MFP_CAPABLE);
879 if (ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL) ||
880 local->hw.wiphy->cipher_suites) {
888 if (!local->hw.wiphy->n_cipher_suites)
892 suites = kmemdup(local->hw.wiphy->cipher_suites,
893 sizeof(u32) * local->hw.wiphy->n_cipher_suites,
898 for (r = 0; r < local->hw.wiphy->n_cipher_suites; r++) {
899 u32 suite = local->hw.wiphy->cipher_suites[r];
910 local->hw.wiphy->cipher_suites = cipher_suites;
911 local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
914 local->hw.wiphy->n_cipher_suites -= 4;
917 local->hw.wiphy->cipher_suites += 2;
918 local->hw.wiphy->n_cipher_suites -= 2;
925 local->hw.wiphy->cipher_suites = suites;
926 local->hw.wiphy->n_cipher_suites = w;
927 local->wiphy_ciphers_allocated = true;
934 struct ieee80211_local *local = hw_to_local(hw);
942 (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE ||
943 local->hw.offchannel_tx_hw_queue >= local->hw.queues))
947 (!local->ops->tdls_channel_switch ||
948 !local->ops->tdls_cancel_channel_switch ||
949 !local->ops->tdls_recv_channel_switch))
953 !local->ops->set_frag_threshold))
956 if (WARN_ON(local->hw.wiphy->interface_modes &
958 (!local->ops->start_nan || !local->ops->stop_nan)))
968 if (WARN_ON(!local->use_chanctx))
971 if (WARN_ON(!local->ops->link_info_changed))
1008 if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume))
1012 if (!local->use_chanctx) {
1013 for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
1016 comb = &local->hw.wiphy->iface_combinations[i];
1023 for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
1026 comb = &local->hw.wiphy->iface_combinations[i];
1041 local->rx_chains = 1;
1057 sband = local->hw.wiphy->bands[band];
1077 if (!local->use_chanctx && !local->_oper_chandef.chan) {
1078 local->hw.conf.chandef = dflt_chandef;
1079 local->_oper_chandef = dflt_chandef;
1081 local->monitor_chandef = dflt_chandef;
1111 if (WARN_ON(local->hw.queues < IEEE80211_NUM_ACS &&
1123 local->rx_chains =
1125 local->rx_chains);
1136 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP) &&
1137 !ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL)) {
1159 local->int_scan_req = kzalloc(sizeof(*local->int_scan_req) +
1161 if (!local->int_scan_req)
1164 eth_broadcast_addr(local->int_scan_req->bssid);
1167 if (!local->hw.wiphy->bands[band])
1169 local->int_scan_req->rates[band] = (u32) -1;
1174 local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT);
1179 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_MESH_POINT))
1180 local->hw.wiphy->flags |= WIPHY_FLAG_MESH_AUTH;
1183 local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL;
1185 if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) {
1186 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
1187 } else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC)) {
1188 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
1198 if (!local->ops->set_key) {
1199 wiphy_ext_feature_set(local->hw.wiphy,
1201 wiphy_ext_feature_set(local->hw.wiphy,
1205 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_ADHOC))
1206 wiphy_ext_feature_set(local->hw.wiphy,
1215 local->scan_ies_len = 4 + max_bitrates /* (ext) supp rates */ +
1218 local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap);
1221 local->scan_ies_len +=
1227 local->scan_ies_len +=
1233 local->scan_ies_len +=
1239 if (!local->ops->hw_scan) {
1241 local->hw.wiphy->max_scan_ssids = 4;
1242 local->hw.wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
1252 if (local->hw.wiphy->max_scan_ie_len)
1253 local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len;
1255 result = ieee80211_init_cipher_suites(local);
1259 if (!local->ops->remain_on_channel)
1260 local->hw.wiphy->max_remain_on_channel_duration = 5000;
1263 if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)
1264 local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
1267 if (ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA))
1268 local->ext_capa[0] |= WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING;
1271 if (ieee80211_hw_check(&local->hw, SUPPORTS_MULTI_BSSID)) {
1272 local->hw.wiphy->support_mbssid = true;
1273 if (ieee80211_hw_check(&local->hw,
1275 local->hw.wiphy->support_only_he_mbssid = true;
1277 local->ext_capa[2] |=
1281 local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CNTDWN_COUNTERS_NUM;
1290 local->workqueue =
1291 alloc_ordered_workqueue("%s", 0, wiphy_name(local->hw.wiphy));
1292 if (!local->workqueue) {
1302 local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
1309 if (local->hw.max_listen_interval == 0)
1310 local->hw.max_listen_interval = 5;
1312 local->hw.conf.listen_interval = local->hw.max_listen_interval;
1314 local->dynamic_ps_forced_timeout = -1;
1316 if (!local->hw.max_nan_de_entries)
1317 local->hw.max_nan_de_entries = IEEE80211_MAX_NAN_INSTANCE_ID;
1319 if (!local->hw.weight_multiplier)
1320 local->hw.weight_multiplier = 1;
1322 ieee80211_wep_init(local);
1324 local->hw.conf.flags = IEEE80211_CONF_IDLE;
1326 ieee80211_led_init(local);
1328 result = ieee80211_txq_setup_flows(local);
1333 result = ieee80211_init_rate_ctrl_alg(local,
1337 wiphy_debug(local->hw.wiphy,
1342 if (local->rate_ctrl) {
1344 if (local->rate_ctrl->ops->capa & RATE_CTRL_CAPA_VHT_EXT_NSS_BW)
1356 BUILD_BUG_ON(NUM_NL80211_BANDS > 8 * sizeof(local->sband_allocated));
1363 sband = local->hw.wiphy->bands[band];
1385 local->hw.wiphy->bands[band] = sband;
1386 local->sband_allocated |= BIT(band);
1389 result = wiphy_register(local->hw.wiphy);
1393 debugfs_hw_add(local);
1394 rate_control_add_debugfs(local);
1400 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) &&
1404 result = ieee80211_if_add(local, "wlan%d", NET_NAME_ENUM, NULL,
1407 wiphy_warn(local->hw.wiphy,
1415 local->ifa_notifier.notifier_call = ieee80211_ifa_changed;
1416 result = register_inetaddr_notifier(&local->ifa_notifier);
1422 local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
1423 result = register_inet6addr_notifier(&local->ifa6_notifier);
1433 unregister_inetaddr_notifier(&local->ifa_notifier);
1439 wiphy_unregister(local->hw.wiphy);
1442 rate_control_deinitialize(local);
1443 ieee80211_remove_interfaces(local);
1447 ieee80211_led_exit(local);
1448 destroy_workqueue(local->workqueue);
1450 if (local->wiphy_ciphers_allocated) {
1451 kfree(local->hw.wiphy->cipher_suites);
1452 local->wiphy_ciphers_allocated = false;
1454 kfree(local->int_scan_req);
1461 struct ieee80211_local *local = hw_to_local(hw);
1463 tasklet_kill(&local->tx_pending_tasklet);
1464 tasklet_kill(&local->tasklet);
1467 unregister_inetaddr_notifier(&local->ifa_notifier);
1470 unregister_inet6addr_notifier(&local->ifa6_notifier);
1480 ieee80211_remove_interfaces(local);
1482 wiphy_lock(local->hw.wiphy);
1483 wiphy_delayed_work_cancel(local->hw.wiphy, &local->roc_work);
1484 wiphy_work_cancel(local->hw.wiphy, &local->sched_scan_stopped_work);
1485 wiphy_work_cancel(local->hw.wiphy, &local->radar_detected_work);
1486 wiphy_unlock(local->hw.wiphy);
1489 cancel_work_sync(&local->restart_work);
1490 cancel_work_sync(&local->reconfig_filter);
1492 ieee80211_clear_tx_pending(local);
1493 rate_control_deinitialize(local);
1495 if (skb_queue_len(&local->skb_queue) ||
1496 skb_queue_len(&local->skb_queue_unreliable))
1497 wiphy_warn(local->hw.wiphy, "skb_queue not empty\n");
1498 skb_queue_purge(&local->skb_queue);
1499 skb_queue_purge(&local->skb_queue_unreliable);
1501 wiphy_unregister(local->hw.wiphy);
1502 destroy_workqueue(local->workqueue);
1503 ieee80211_led_exit(local);
1504 kfree(local->int_scan_req);
1517 struct ieee80211_local *local = hw_to_local(hw);
1520 mutex_destroy(&local->iflist_mtx);
1521 mutex_destroy(&local->mtx);
1523 if (local->wiphy_ciphers_allocated) {
1524 kfree(local->hw.wiphy->cipher_suites);
1525 local->wiphy_ciphers_allocated = false;
1528 idr_for_each(&local->ack_status_frames,
1530 idr_destroy(&local->ack_status_frames);
1532 sta_info_stop(local);
1534 ieee80211_free_led_names(local);
1537 if (!(local->sband_allocated & BIT(band)))
1539 kfree(local->hw.wiphy->bands[band]);
1542 wiphy_free(local->hw.wiphy);