Lines Matching defs: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 || local->in_reconfig ||
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;
170 if (local->user_power_level != IEEE80211_UNSET_POWER_LEVEL)
171 power = min(local->user_power_level, power);
174 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
185 if (local->hw.conf.power_level != power) {
187 local->hw.conf.power_level = power;
193 int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
203 if (changed && local->open_count) {
204 ret = drv_config(local, changed);
226 static int _ieee80211_hw_conf_chan(struct ieee80211_local *local,
231 if (!local->open_count)
234 changed = ieee80211_calc_hw_conf_chan(local, ctx);
238 return drv_config(local, changed);
241 int ieee80211_hw_conf_chan(struct ieee80211_local *local)
245 ctx = list_first_entry_or_null(&local->chanctx_list,
249 return _ieee80211_hw_conf_chan(local, ctx ? &ctx->conf : NULL);
252 void ieee80211_hw_conf_init(struct ieee80211_local *local)
258 if (WARN_ON(!local->open_count))
261 if (local->emulate_chanctx) {
264 ctx = list_first_entry_or_null(&local->chanctx_list,
268 changed |= ieee80211_calc_hw_conf_chan(local,
272 WARN_ON(drv_config(local, changed));
278 struct ieee80211_local *local = hw_to_local(hw);
280 local->hw.conf.radar_enabled = ctx->radar_enabled;
282 return _ieee80211_hw_conf_chan(local, ctx);
289 struct ieee80211_local *local = hw_to_local(hw);
291 local->hw.conf.radar_enabled = false;
293 _ieee80211_hw_conf_chan(local, NULL);
301 struct ieee80211_local *local = hw_to_local(hw);
303 local->hw.conf.radar_enabled = ctx->radar_enabled;
305 _ieee80211_hw_conf_chan(local, ctx);
314 struct ieee80211_local *local = hw_to_local(hw);
319 local->hw.conf.radar_enabled = vifs[0].new_ctx->radar_enabled;
320 _ieee80211_hw_conf_chan(local, vifs[0].new_ctx);
338 struct ieee80211_local *local = sdata->local;
368 trace_drv_vif_cfg_changed(local, sdata, changed);
369 if (local->ops->vif_cfg_changed)
370 local->ops->vif_cfg_changed(&local->hw, &sdata->vif, ch);
376 trace_drv_link_info_changed(local, sdata, &sdata->vif.bss_conf,
378 if (local->ops->link_info_changed)
379 local->ops->link_info_changed(&local->hw, &sdata->vif,
383 if (local->ops->bss_info_changed)
384 local->ops->bss_info_changed(&local->hw, &sdata->vif,
386 trace_drv_return_void(local);
392 struct ieee80211_local *local = sdata->local;
399 drv_vif_cfg_changed(local, sdata, changed);
406 struct ieee80211_local *local = sdata->local;
416 drv_link_info_changed(local, sdata, link->conf, link->link_id, changed);
430 void ieee80211_handle_queued_frames(struct ieee80211_local *local)
434 while ((skb = skb_dequeue(&local->skb_queue)) ||
435 (skb = skb_dequeue(&local->skb_queue_unreliable))) {
441 ieee80211_rx(&local->hw, skb);
445 ieee80211_tx_status_skb(&local->hw, skb);
458 struct ieee80211_local *local = from_tasklet(local, t, tasklet);
460 ieee80211_handle_queued_frames(local);
465 struct ieee80211_local *local =
470 flush_workqueue(local->workqueue);
474 wiphy_lock(local->hw.wiphy);
475 wiphy_work_flush(local->hw.wiphy, NULL);
477 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
480 list_for_each_entry(sdata, &local->interfaces, list) {
497 wiphy_work_cancel(local->hw.wiphy,
504 wiphy_delayed_work_flush(local->hw.wiphy,
507 ieee80211_scan_cancel(local);
509 /* make sure any new ROC will consider local->in_reconfig */
510 wiphy_delayed_work_flush(local->hw.wiphy, &local->roc_work);
511 wiphy_work_flush(local->hw.wiphy, &local->hw_roc_done);
516 ret = ieee80211_reconfig(local);
517 wiphy_unlock(local->hw.wiphy);
520 cfg80211_shutdown_all_interfaces(local->hw.wiphy);
527 struct ieee80211_local *local = hw_to_local(hw);
529 trace_api_restart_hw(local);
543 local->in_reconfig = true;
546 queue_work(system_freezable_wq, &local->restart_work);
555 struct ieee80211_local *local =
570 if (wdev->wiphy != local->hw.wiphy || !wdev->registered)
602 mutex_lock_nested(&local->hw.wiphy->mtx, 1);
603 __acquire(&local->hw.wiphy->mtx);
620 wiphy_unlock(local->hw.wiphy);
633 struct ieee80211_local *local =
639 if (!wdev || wdev->wiphy != local->hw.wiphy)
651 drv_ipv6_addr_change(local, sdata, idev);
779 struct ieee80211_local *local;
833 priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
897 local = wiphy_priv(wiphy);
899 if (sta_info_init(local))
902 local->hw.wiphy = wiphy;
904 local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
906 local->ops = ops;
907 local->emulate_chanctx = emulate_chanctx;
910 ieee80211_hw_set(&local->hw, CHANCTX_STA_CSA);
916 * second, so 7 is ~8ms of queued data. Only affects local TCP
919 * for local reasons (longer buffers, longer completion time, or
922 local->hw.tx_sk_pacing_shift = 7;
925 local->hw.queues = 1;
926 local->hw.max_rates = 1;
927 local->hw.max_report_rates = 0;
928 local->hw.max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT;
929 local->hw.max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT;
930 local->hw.offchannel_tx_hw_queue = IEEE80211_INVAL_HW_QUEUE;
931 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
932 local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
933 local->hw.radiotap_mcs_details = IEEE80211_RADIOTAP_MCS_HAVE_MCS |
936 local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
938 local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
939 local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
940 local->hw.max_mtu = IEEE80211_MAX_DATA_LEN;
941 local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
945 local->ext_capa[7] = WLAN_EXT_CAPA8_OPMODE_NOTIF;
947 wiphy->extended_capabilities = local->ext_capa;
948 wiphy->extended_capabilities_mask = local->ext_capa;
950 ARRAY_SIZE(local->ext_capa);
952 INIT_LIST_HEAD(&local->interfaces);
953 INIT_LIST_HEAD(&local->mon_list);
955 __hw_addr_init(&local->mc_list);
957 mutex_init(&local->iflist_mtx);
958 spin_lock_init(&local->filter_lock);
959 spin_lock_init(&local->rx_path_lock);
960 spin_lock_init(&local->queue_stop_reason_lock);
963 INIT_LIST_HEAD(&local->active_txqs[i]);
964 spin_lock_init(&local->active_txq_lock[i]);
965 local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L;
966 local->aql_txq_limit_high[i] =
968 atomic_set(&local->aql_ac_pending_airtime[i], 0);
971 local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX;
972 local->aql_threshold = IEEE80211_AQL_THRESHOLD;
973 atomic_set(&local->aql_total_pending_airtime, 0);
975 spin_lock_init(&local->handle_wake_tx_queue_lock);
977 INIT_LIST_HEAD(&local->chanctx_list);
979 wiphy_delayed_work_init(&local->scan_work, ieee80211_scan_work);
981 INIT_WORK(&local->restart_work, ieee80211_restart_work);
983 wiphy_work_init(&local->radar_detected_work,
986 wiphy_work_init(&local->reconfig_filter, ieee80211_reconfig_filter);
988 wiphy_work_init(&local->dynamic_ps_enable_work,
990 wiphy_work_init(&local->dynamic_ps_disable_work,
992 timer_setup(&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, 0);
994 wiphy_work_init(&local->sched_scan_stopped_work,
997 spin_lock_init(&local->ack_status_lock);
998 idr_init(&local->ack_status_frames);
1001 skb_queue_head_init(&local->pending[i]);
1002 atomic_set(&local->agg_queue_stop[i], 0);
1004 tasklet_setup(&local->tx_pending_tasklet, ieee80211_tx_pending);
1005 tasklet_setup(&local->wake_txqs_tasklet, ieee80211_wake_txqs);
1006 tasklet_setup(&local->tasklet, ieee80211_tasklet_handler);
1008 skb_queue_head_init(&local->skb_queue);
1009 skb_queue_head_init(&local->skb_queue_unreliable);
1011 ieee80211_alloc_led_names(local);
1013 ieee80211_roc_setup(local);
1015 local->hw.radiotap_timestamp.units_pos = -1;
1016 local->hw.radiotap_timestamp.accuracy = -1;
1018 return &local->hw;
1025 static int ieee80211_init_cipher_suites(struct ieee80211_local *local)
1028 bool have_mfp = ieee80211_hw_check(&local->hw, MFP_CAPABLE);
1048 if (ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL) ||
1049 local->hw.wiphy->cipher_suites) {
1057 if (!local->hw.wiphy->n_cipher_suites)
1061 suites = kmemdup_array(local->hw.wiphy->cipher_suites,
1062 local->hw.wiphy->n_cipher_suites,
1067 for (r = 0; r < local->hw.wiphy->n_cipher_suites; r++) {
1068 u32 suite = local->hw.wiphy->cipher_suites[r];
1079 local->hw.wiphy->cipher_suites = cipher_suites;
1080 local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
1083 local->hw.wiphy->n_cipher_suites -= 4;
1086 local->hw.wiphy->cipher_suites += 2;
1087 local->hw.wiphy->n_cipher_suites -= 2;
1094 local->hw.wiphy->cipher_suites = suites;
1095 local->hw.wiphy->n_cipher_suites = w;
1096 local->wiphy_ciphers_allocated = true;
1124 struct ieee80211_local *local = hw_to_local(hw);
1132 (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE ||
1133 local->hw.offchannel_tx_hw_queue >= local->hw.queues))
1137 (!local->ops->tdls_channel_switch ||
1138 !local->ops->tdls_cancel_channel_switch ||
1139 !local->ops->tdls_recv_channel_switch))
1143 !local->ops->set_frag_threshold))
1146 if (WARN_ON(local->hw.wiphy->interface_modes &
1148 (!local->ops->start_nan || !local->ops->stop_nan)))
1158 if (WARN_ON(local->emulate_chanctx))
1161 if (WARN_ON(!local->ops->link_info_changed))
1195 if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume))
1199 if (local->emulate_chanctx) {
1200 for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
1203 comb = &local->hw.wiphy->iface_combinations[i];
1231 local->rx_chains = 1;
1248 sband = local->hw.wiphy->bands[band];
1268 local->monitor_chanreq.oper = dflt_chandef;
1269 if (local->emulate_chanctx) {
1270 local->dflt_chandef = dflt_chandef;
1271 local->hw.conf.chandef = dflt_chandef;
1321 if (WARN_ON(local->hw.queues < IEEE80211_NUM_ACS &&
1333 local->rx_chains =
1335 local->rx_chains);
1346 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP) &&
1347 !ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL)) {
1357 local->int_scan_req = kzalloc(sizeof(*local->int_scan_req) +
1359 if (!local->int_scan_req)
1362 eth_broadcast_addr(local->int_scan_req->bssid);
1365 if (!local->hw.wiphy->bands[band])
1367 local->int_scan_req->rates[band] = (u32) -1;
1372 local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT);
1377 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_MESH_POINT))
1378 local->hw.wiphy->flags |= WIPHY_FLAG_MESH_AUTH;
1381 local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL;
1383 if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) {
1384 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
1385 } else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC)) {
1386 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
1396 if (!local->ops->set_key) {
1397 wiphy_ext_feature_set(local->hw.wiphy,
1399 wiphy_ext_feature_set(local->hw.wiphy,
1403 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_ADHOC))
1404 wiphy_ext_feature_set(local->hw.wiphy,
1413 local->scan_ies_len = 4 + max_bitrates /* (ext) supp rates */ +
1416 local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap);
1419 local->scan_ies_len +=
1425 local->scan_ies_len +=
1431 local->scan_ies_len +=
1437 if (!local->ops->hw_scan) {
1439 local->hw.wiphy->max_scan_ssids = 4;
1440 local->hw.wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
1450 if (local->hw.wiphy->max_scan_ie_len)
1451 local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len;
1453 result = ieee80211_init_cipher_suites(local);
1457 if (!local->ops->remain_on_channel)
1458 local->hw.wiphy->max_remain_on_channel_duration = 5000;
1461 if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)
1462 local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
1465 if (ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA))
1466 local->ext_capa[0] |= WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING;
1469 if (ieee80211_hw_check(&local->hw, SUPPORTS_MULTI_BSSID)) {
1470 local->hw.wiphy->support_mbssid = true;
1471 if (ieee80211_hw_check(&local->hw,
1473 local->hw.wiphy->support_only_he_mbssid = true;
1475 local->ext_capa[2] |=
1479 local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CNTDWN_COUNTERS_NUM;
1488 local->workqueue =
1489 alloc_ordered_workqueue("%s", 0, wiphy_name(local->hw.wiphy));
1490 if (!local->workqueue) {
1500 local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
1507 if (local->hw.max_listen_interval == 0)
1508 local->hw.max_listen_interval = 5;
1510 local->hw.conf.listen_interval = local->hw.max_listen_interval;
1512 local->dynamic_ps_forced_timeout = -1;
1514 if (!local->hw.max_nan_de_entries)
1515 local->hw.max_nan_de_entries = IEEE80211_MAX_NAN_INSTANCE_ID;
1517 if (!local->hw.weight_multiplier)
1518 local->hw.weight_multiplier = 1;
1520 ieee80211_wep_init(local);
1522 local->hw.conf.flags = IEEE80211_CONF_IDLE;
1524 ieee80211_led_init(local);
1526 result = ieee80211_txq_setup_flows(local);
1531 result = ieee80211_init_rate_ctrl_alg(local,
1535 wiphy_debug(local->hw.wiphy,
1540 if (local->rate_ctrl) {
1542 if (local->rate_ctrl->ops->capa & RATE_CTRL_CAPA_VHT_EXT_NSS_BW)
1554 BUILD_BUG_ON(NUM_NL80211_BANDS > 8 * sizeof(local->sband_allocated));
1561 sband = local->hw.wiphy->bands[band];
1583 local->hw.wiphy->bands[band] = sband;
1584 local->sband_allocated |= BIT(band);
1587 result = wiphy_register(local->hw.wiphy);
1591 debugfs_hw_add(local);
1592 rate_control_add_debugfs(local);
1594 ieee80211_check_wbrf_support(local);
1600 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) &&
1604 result = ieee80211_if_add(local, "wlan%d", NET_NAME_ENUM, NULL,
1607 wiphy_warn(local->hw.wiphy,
1615 local->ifa_notifier.notifier_call = ieee80211_ifa_changed;
1616 result = register_inetaddr_notifier(&local->ifa_notifier);
1622 local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
1623 result = register_inet6addr_notifier(&local->ifa6_notifier);
1633 unregister_inetaddr_notifier(&local->ifa_notifier);
1639 wiphy_unregister(local->hw.wiphy);
1642 rate_control_deinitialize(local);
1643 ieee80211_remove_interfaces(local);
1646 ieee80211_txq_teardown_flows(local);
1648 ieee80211_led_exit(local);
1649 destroy_workqueue(local->workqueue);
1651 if (local->wiphy_ciphers_allocated) {
1652 kfree(local->hw.wiphy->cipher_suites);
1653 local->wiphy_ciphers_allocated = false;
1655 kfree(local->int_scan_req);
1662 struct ieee80211_local *local = hw_to_local(hw);
1664 tasklet_kill(&local->tx_pending_tasklet);
1665 tasklet_kill(&local->tasklet);
1668 unregister_inetaddr_notifier(&local->ifa_notifier);
1671 unregister_inet6addr_notifier(&local->ifa6_notifier);
1681 ieee80211_remove_interfaces(local);
1683 ieee80211_txq_teardown_flows(local);
1685 wiphy_lock(local->hw.wiphy);
1686 wiphy_delayed_work_cancel(local->hw.wiphy, &local->roc_work);
1687 wiphy_work_cancel(local->hw.wiphy, &local->reconfig_filter);
1688 wiphy_work_cancel(local->hw.wiphy, &local->sched_scan_stopped_work);
1689 wiphy_work_cancel(local->hw.wiphy, &local->radar_detected_work);
1690 wiphy_unlock(local->hw.wiphy);
1693 cancel_work_sync(&local->restart_work);
1695 ieee80211_clear_tx_pending(local);
1696 rate_control_deinitialize(local);
1698 if (skb_queue_len(&local->skb_queue) ||
1699 skb_queue_len(&local->skb_queue_unreliable))
1700 wiphy_warn(local->hw.wiphy, "skb_queue not empty\n");
1701 skb_queue_purge(&local->skb_queue);
1702 skb_queue_purge(&local->skb_queue_unreliable);
1704 wiphy_unregister(local->hw.wiphy);
1705 destroy_workqueue(local->workqueue);
1706 ieee80211_led_exit(local);
1707 kfree(local->int_scan_req);
1720 struct ieee80211_local *local = hw_to_local(hw);
1723 mutex_destroy(&local->iflist_mtx);
1725 if (local->wiphy_ciphers_allocated) {
1726 kfree(local->hw.wiphy->cipher_suites);
1727 local->wiphy_ciphers_allocated = false;
1730 idr_for_each(&local->ack_status_frames,
1732 idr_destroy(&local->ack_status_frames);
1734 sta_info_stop(local);
1736 ieee80211_free_led_names(local);
1739 if (!(local->sband_allocated & BIT(band)))
1741 kfree(local->hw.wiphy->bands[band]);
1744 wiphy_free(local->hw.wiphy);