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);
90 struct ieee80211_local *local =
93 ieee80211_configure_filter(local);
96 static u32 ieee80211_calc_hw_conf_chan(struct ieee80211_local *local,
107 if (!local->emulate_chanctx)
110 offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
122 if (local->scan_chandef.chan) {
123 chandef = local->scan_chandef;
124 } else if (local->tmp_channel) {
125 chandef.chan = local->tmp_channel;
132 chandef = local->dflt_chandef;
144 local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
146 local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL;
148 offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
151 if (offchannel_flag || local->scanning ||
152 !cfg80211_chandef_identical(&local->hw.conf.chandef, &chandef)) {
153 local->hw.conf.chandef = chandef;
157 if (!conf_is_ht(&local->hw.conf)) {
163 local->hw.conf.smps_mode = IEEE80211_SMPS_STATIC;
164 } else if (local->hw.conf.smps_mode != smps_mode) {
165 local->hw.conf.smps_mode = smps_mode;
172 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
183 if (local->hw.conf.power_level != power) {
185 local->hw.conf.power_level = power;
191 int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
201 if (changed && local->open_count) {
202 ret = drv_config(local, changed);
224 static int _ieee80211_hw_conf_chan(struct ieee80211_local *local,
229 if (!local->open_count)
232 changed = ieee80211_calc_hw_conf_chan(local, ctx);
236 return drv_config(local, changed);
239 int ieee80211_hw_conf_chan(struct ieee80211_local *local)
243 ctx = list_first_entry_or_null(&local->chanctx_list,
247 return _ieee80211_hw_conf_chan(local, ctx ? &ctx->conf : NULL);
250 void ieee80211_hw_conf_init(struct ieee80211_local *local)
256 if (WARN_ON(!local->open_count))
259 if (local->emulate_chanctx) {
262 ctx = list_first_entry_or_null(&local->chanctx_list,
266 changed |= ieee80211_calc_hw_conf_chan(local,
270 WARN_ON(drv_config(local, changed));
276 struct ieee80211_local *local = hw_to_local(hw);
278 local->hw.conf.radar_enabled = ctx->radar_enabled;
280 return _ieee80211_hw_conf_chan(local, ctx);
287 struct ieee80211_local *local = hw_to_local(hw);
289 local->hw.conf.radar_enabled = false;
291 _ieee80211_hw_conf_chan(local, NULL);
299 struct ieee80211_local *local = hw_to_local(hw);
301 local->hw.conf.radar_enabled = ctx->radar_enabled;
303 _ieee80211_hw_conf_chan(local, ctx);
312 struct ieee80211_local *local = hw_to_local(hw);
317 local->hw.conf.radar_enabled = vifs[0].new_ctx->radar_enabled;
318 _ieee80211_hw_conf_chan(local, vifs[0].new_ctx);
336 struct ieee80211_local *local = sdata->local;
364 trace_drv_vif_cfg_changed(local, sdata, changed);
365 if (local->ops->vif_cfg_changed)
366 local->ops->vif_cfg_changed(&local->hw, &sdata->vif, ch);
373 trace_drv_link_info_changed(local, sdata, &sdata->vif.bss_conf,
375 if (local->ops->link_info_changed)
376 local->ops->link_info_changed(&local->hw, &sdata->vif,
380 if (local->ops->bss_info_changed)
381 local->ops->bss_info_changed(&local->hw, &sdata->vif,
383 trace_drv_return_void(local);
389 struct ieee80211_local *local = sdata->local;
396 drv_vif_cfg_changed(local, sdata, changed);
403 struct ieee80211_local *local = sdata->local;
413 drv_link_info_changed(local, sdata, link->conf, link->link_id, changed);
428 struct ieee80211_local *local = from_tasklet(local, t, tasklet);
431 while ((skb = skb_dequeue(&local->skb_queue)) ||
432 (skb = skb_dequeue(&local->skb_queue_unreliable))) {
438 ieee80211_rx(&local->hw, skb);
442 ieee80211_tx_status_skb(&local->hw, skb);
455 struct ieee80211_local *local =
460 flush_workqueue(local->workqueue);
464 wiphy_lock(local->hw.wiphy);
465 wiphy_work_flush(local->hw.wiphy, NULL);
467 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
470 list_for_each_entry(sdata, &local->interfaces, list) {
487 wiphy_work_cancel(local->hw.wiphy,
494 wiphy_delayed_work_flush(local->hw.wiphy,
497 ieee80211_scan_cancel(local);
499 /* make sure any new ROC will consider local->in_reconfig */
500 wiphy_delayed_work_flush(local->hw.wiphy, &local->roc_work);
501 wiphy_work_flush(local->hw.wiphy, &local->hw_roc_done);
506 ret = ieee80211_reconfig(local);
507 wiphy_unlock(local->hw.wiphy);
510 cfg80211_shutdown_all_interfaces(local->hw.wiphy);
517 struct ieee80211_local *local = hw_to_local(hw);
519 trace_api_restart_hw(local);
533 local->in_reconfig = true;
536 queue_work(system_freezable_wq, &local->restart_work);
545 struct ieee80211_local *local =
560 if (wdev->wiphy != local->hw.wiphy || !wdev->registered)
592 mutex_lock_nested(&local->hw.wiphy->mtx, 1);
593 __acquire(&local->hw.wiphy->mtx);
610 wiphy_unlock(local->hw.wiphy);
623 struct ieee80211_local *local =
629 if (!wdev || wdev->wiphy != local->hw.wiphy)
641 drv_ipv6_addr_change(local, sdata, idev);
764 struct ieee80211_local *local;
818 priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
882 local = wiphy_priv(wiphy);
884 if (sta_info_init(local))
887 local->hw.wiphy = wiphy;
889 local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
891 local->ops = ops;
892 local->emulate_chanctx = emulate_chanctx;
895 ieee80211_hw_set(&local->hw, CHANCTX_STA_CSA);
901 * second, so 7 is ~8ms of queued data. Only affects local TCP
904 * for local reasons (longer buffers, longer completion time, or
907 local->hw.tx_sk_pacing_shift = 7;
910 local->hw.queues = 1;
911 local->hw.max_rates = 1;
912 local->hw.max_report_rates = 0;
913 local->hw.max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT;
914 local->hw.max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT;
915 local->hw.offchannel_tx_hw_queue = IEEE80211_INVAL_HW_QUEUE;
916 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
917 local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
918 local->hw.radiotap_mcs_details = IEEE80211_RADIOTAP_MCS_HAVE_MCS |
921 local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
923 local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
924 local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
925 local->hw.max_mtu = IEEE80211_MAX_DATA_LEN;
926 local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
930 local->ext_capa[7] = WLAN_EXT_CAPA8_OPMODE_NOTIF;
932 wiphy->extended_capabilities = local->ext_capa;
933 wiphy->extended_capabilities_mask = local->ext_capa;
935 ARRAY_SIZE(local->ext_capa);
937 INIT_LIST_HEAD(&local->interfaces);
938 INIT_LIST_HEAD(&local->mon_list);
940 __hw_addr_init(&local->mc_list);
942 mutex_init(&local->iflist_mtx);
943 spin_lock_init(&local->filter_lock);
944 spin_lock_init(&local->rx_path_lock);
945 spin_lock_init(&local->queue_stop_reason_lock);
948 INIT_LIST_HEAD(&local->active_txqs[i]);
949 spin_lock_init(&local->active_txq_lock[i]);
950 local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L;
951 local->aql_txq_limit_high[i] =
953 atomic_set(&local->aql_ac_pending_airtime[i], 0);
956 local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX;
957 local->aql_threshold = IEEE80211_AQL_THRESHOLD;
958 atomic_set(&local->aql_total_pending_airtime, 0);
960 spin_lock_init(&local->handle_wake_tx_queue_lock);
962 INIT_LIST_HEAD(&local->chanctx_list);
964 wiphy_delayed_work_init(&local->scan_work, ieee80211_scan_work);
966 INIT_WORK(&local->restart_work, ieee80211_restart_work);
968 wiphy_work_init(&local->radar_detected_work,
971 wiphy_work_init(&local->reconfig_filter, ieee80211_reconfig_filter);
973 wiphy_work_init(&local->dynamic_ps_enable_work,
975 wiphy_work_init(&local->dynamic_ps_disable_work,
977 timer_setup(&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, 0);
979 wiphy_work_init(&local->sched_scan_stopped_work,
982 spin_lock_init(&local->ack_status_lock);
983 idr_init(&local->ack_status_frames);
986 skb_queue_head_init(&local->pending[i]);
987 atomic_set(&local->agg_queue_stop[i], 0);
989 tasklet_setup(&local->tx_pending_tasklet, ieee80211_tx_pending);
990 tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs);
991 tasklet_setup(&local->tasklet, ieee80211_tasklet_handler);
993 skb_queue_head_init(&local->skb_queue);
994 skb_queue_head_init(&local->skb_queue_unreliable);
996 ieee80211_alloc_led_names(local);
998 ieee80211_roc_setup(local);
1000 local->hw.radiotap_timestamp.units_pos = -1;
1001 local->hw.radiotap_timestamp.accuracy = -1;
1003 return &local->hw;
1010 static int ieee80211_init_cipher_suites(struct ieee80211_local *local)
1013 bool have_mfp = ieee80211_hw_check(&local->hw, MFP_CAPABLE);
1033 if (ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL) ||
1034 local->hw.wiphy->cipher_suites) {
1042 if (!local->hw.wiphy->n_cipher_suites)
1046 suites = kmemdup(local->hw.wiphy->cipher_suites,
1047 sizeof(u32) * local->hw.wiphy->n_cipher_suites,
1052 for (r = 0; r < local->hw.wiphy->n_cipher_suites; r++) {
1053 u32 suite = local->hw.wiphy->cipher_suites[r];
1064 local->hw.wiphy->cipher_suites = cipher_suites;
1065 local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
1068 local->hw.wiphy->n_cipher_suites -= 4;
1071 local->hw.wiphy->cipher_suites += 2;
1072 local->hw.wiphy->n_cipher_suites -= 2;
1079 local->hw.wiphy->cipher_suites = suites;
1080 local->hw.wiphy->n_cipher_suites = w;
1081 local->wiphy_ciphers_allocated = true;
1088 struct ieee80211_local *local = hw_to_local(hw);
1096 (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE ||
1097 local->hw.offchannel_tx_hw_queue >= local->hw.queues))
1101 (!local->ops->tdls_channel_switch ||
1102 !local->ops->tdls_cancel_channel_switch ||
1103 !local->ops->tdls_recv_channel_switch))
1107 !local->ops->set_frag_threshold))
1110 if (WARN_ON(local->hw.wiphy->interface_modes &
1112 (!local->ops->start_nan || !local->ops->stop_nan)))
1122 if (WARN_ON(local->emulate_chanctx))
1125 if (WARN_ON(!local->ops->link_info_changed))
1162 if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume))
1166 if (local->emulate_chanctx) {
1167 for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
1170 comb = &local->hw.wiphy->iface_combinations[i];
1177 for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
1180 comb = &local->hw.wiphy->iface_combinations[i];
1195 local->rx_chains = 1;
1212 sband = local->hw.wiphy->bands[band];
1232 local->monitor_chanreq.oper = dflt_chandef;
1233 if (local->emulate_chanctx) {
1234 local->dflt_chandef = dflt_chandef;
1235 local->hw.conf.chandef = dflt_chandef;
1280 if (WARN_ON(local->hw.queues < IEEE80211_NUM_ACS &&
1292 local->rx_chains =
1294 local->rx_chains);
1305 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP) &&
1306 !ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL)) {
1328 local->int_scan_req = kzalloc(sizeof(*local->int_scan_req) +
1330 if (!local->int_scan_req)
1333 eth_broadcast_addr(local->int_scan_req->bssid);
1336 if (!local->hw.wiphy->bands[band])
1338 local->int_scan_req->rates[band] = (u32) -1;
1343 local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT);
1348 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_MESH_POINT))
1349 local->hw.wiphy->flags |= WIPHY_FLAG_MESH_AUTH;
1352 local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL;
1354 if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) {
1355 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
1356 } else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC)) {
1357 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
1367 if (!local->ops->set_key) {
1368 wiphy_ext_feature_set(local->hw.wiphy,
1370 wiphy_ext_feature_set(local->hw.wiphy,
1374 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_ADHOC))
1375 wiphy_ext_feature_set(local->hw.wiphy,
1384 local->scan_ies_len = 4 + max_bitrates /* (ext) supp rates */ +
1387 local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap);
1390 local->scan_ies_len +=
1396 local->scan_ies_len +=
1402 local->scan_ies_len +=
1408 if (!local->ops->hw_scan) {
1410 local->hw.wiphy->max_scan_ssids = 4;
1411 local->hw.wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
1421 if (local->hw.wiphy->max_scan_ie_len)
1422 local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len;
1424 result = ieee80211_init_cipher_suites(local);
1428 if (!local->ops->remain_on_channel)
1429 local->hw.wiphy->max_remain_on_channel_duration = 5000;
1432 if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)
1433 local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
1436 if (ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA))
1437 local->ext_capa[0] |= WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING;
1440 if (ieee80211_hw_check(&local->hw, SUPPORTS_MULTI_BSSID)) {
1441 local->hw.wiphy->support_mbssid = true;
1442 if (ieee80211_hw_check(&local->hw,
1444 local->hw.wiphy->support_only_he_mbssid = true;
1446 local->ext_capa[2] |=
1450 local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CNTDWN_COUNTERS_NUM;
1459 local->workqueue =
1460 alloc_ordered_workqueue("%s", 0, wiphy_name(local->hw.wiphy));
1461 if (!local->workqueue) {
1471 local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
1478 if (local->hw.max_listen_interval == 0)
1479 local->hw.max_listen_interval = 5;
1481 local->hw.conf.listen_interval = local->hw.max_listen_interval;
1483 local->dynamic_ps_forced_timeout = -1;
1485 if (!local->hw.max_nan_de_entries)
1486 local->hw.max_nan_de_entries = IEEE80211_MAX_NAN_INSTANCE_ID;
1488 if (!local->hw.weight_multiplier)
1489 local->hw.weight_multiplier = 1;
1491 ieee80211_wep_init(local);
1493 local->hw.conf.flags = IEEE80211_CONF_IDLE;
1495 ieee80211_led_init(local);
1497 result = ieee80211_txq_setup_flows(local);
1502 result = ieee80211_init_rate_ctrl_alg(local,
1506 wiphy_debug(local->hw.wiphy,
1511 if (local->rate_ctrl) {
1513 if (local->rate_ctrl->ops->capa & RATE_CTRL_CAPA_VHT_EXT_NSS_BW)
1525 BUILD_BUG_ON(NUM_NL80211_BANDS > 8 * sizeof(local->sband_allocated));
1532 sband = local->hw.wiphy->bands[band];
1554 local->hw.wiphy->bands[band] = sband;
1555 local->sband_allocated |= BIT(band);
1558 result = wiphy_register(local->hw.wiphy);
1562 debugfs_hw_add(local);
1563 rate_control_add_debugfs(local);
1565 ieee80211_check_wbrf_support(local);
1571 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) &&
1575 result = ieee80211_if_add(local, "wlan%d", NET_NAME_ENUM, NULL,
1578 wiphy_warn(local->hw.wiphy,
1586 local->ifa_notifier.notifier_call = ieee80211_ifa_changed;
1587 result = register_inetaddr_notifier(&local->ifa_notifier);
1593 local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
1594 result = register_inet6addr_notifier(&local->ifa6_notifier);
1604 unregister_inetaddr_notifier(&local->ifa_notifier);
1610 wiphy_unregister(local->hw.wiphy);
1613 rate_control_deinitialize(local);
1614 ieee80211_remove_interfaces(local);
1617 ieee80211_txq_teardown_flows(local);
1619 ieee80211_led_exit(local);
1620 destroy_workqueue(local->workqueue);
1622 if (local->wiphy_ciphers_allocated) {
1623 kfree(local->hw.wiphy->cipher_suites);
1624 local->wiphy_ciphers_allocated = false;
1626 kfree(local->int_scan_req);
1633 struct ieee80211_local *local = hw_to_local(hw);
1635 tasklet_kill(&local->tx_pending_tasklet);
1636 tasklet_kill(&local->tasklet);
1639 unregister_inetaddr_notifier(&local->ifa_notifier);
1642 unregister_inet6addr_notifier(&local->ifa6_notifier);
1652 ieee80211_remove_interfaces(local);
1654 ieee80211_txq_teardown_flows(local);
1656 wiphy_lock(local->hw.wiphy);
1657 wiphy_delayed_work_cancel(local->hw.wiphy, &local->roc_work);
1658 wiphy_work_cancel(local->hw.wiphy, &local->reconfig_filter);
1659 wiphy_work_cancel(local->hw.wiphy, &local->sched_scan_stopped_work);
1660 wiphy_work_cancel(local->hw.wiphy, &local->radar_detected_work);
1661 wiphy_unlock(local->hw.wiphy);
1664 cancel_work_sync(&local->restart_work);
1666 ieee80211_clear_tx_pending(local);
1667 rate_control_deinitialize(local);
1669 if (skb_queue_len(&local->skb_queue) ||
1670 skb_queue_len(&local->skb_queue_unreliable))
1671 wiphy_warn(local->hw.wiphy, "skb_queue not empty\n");
1672 skb_queue_purge(&local->skb_queue);
1673 skb_queue_purge(&local->skb_queue_unreliable);
1675 wiphy_unregister(local->hw.wiphy);
1676 destroy_workqueue(local->workqueue);
1677 ieee80211_led_exit(local);
1678 kfree(local->int_scan_req);
1691 struct ieee80211_local *local = hw_to_local(hw);
1694 mutex_destroy(&local->iflist_mtx);
1696 if (local->wiphy_ciphers_allocated) {
1697 kfree(local->hw.wiphy->cipher_suites);
1698 local->wiphy_ciphers_allocated = false;
1701 idr_for_each(&local->ack_status_frames,
1703 idr_destroy(&local->ack_status_frames);
1705 sta_info_stop(local);
1707 ieee80211_free_led_names(local);
1710 if (!(local->sband_allocated & BIT(band)))
1712 kfree(local->hw.wiphy->bands[band]);
1715 wiphy_free(local->hw.wiphy);