Lines Matching refs:local

36 void ieee80211_configure_filter(struct ieee80211_local *local)
42 if (atomic_read(&local->iff_allmultis))
45 if (local->monitors || test_bit(SCAN_SW_SCANNING, &local->scanning) ||
46 test_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning))
49 if (local->fif_probe_req || local->probe_req_reg)
52 if (local->fif_fcsfail)
55 if (local->fif_plcpfail)
58 if (local->fif_control)
61 if (local->fif_other_bss)
64 if (local->fif_pspoll)
67 if (local->rx_mcast_action_reg)
70 spin_lock_bh(&local->filter_lock);
71 changed_flags = local->filter_flags ^ new_flags;
73 mc = drv_prepare_multicast(local, &local->mc_list);
74 spin_unlock_bh(&local->filter_lock);
79 drv_configure_filter(local, changed_flags, &new_flags, mc);
83 local->filter_flags = new_flags & ~(1<<31);
88 struct ieee80211_local *local =
91 ieee80211_configure_filter(local);
94 static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local)
102 offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
104 if (local->scan_chandef.chan) {
105 chandef = local->scan_chandef;
106 } else if (local->tmp_channel) {
107 chandef.chan = local->tmp_channel;
112 chandef = local->_oper_chandef;
120 if (!cfg80211_chandef_identical(&chandef, &local->_oper_chandef))
121 local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
123 local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL;
125 offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
128 !cfg80211_chandef_identical(&local->hw.conf.chandef,
129 &local->_oper_chandef)) {
130 local->hw.conf.chandef = chandef;
134 if (!conf_is_ht(&local->hw.conf)) {
140 local->hw.conf.smps_mode = IEEE80211_SMPS_STATIC;
141 } else if (local->hw.conf.smps_mode != local->smps_mode) {
142 local->hw.conf.smps_mode = local->smps_mode;
149 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
160 if (local->hw.conf.power_level != power) {
162 local->hw.conf.power_level = power;
168 int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
174 if (!local->use_chanctx)
175 changed |= ieee80211_hw_conf_chan(local);
180 if (changed && local->open_count) {
181 ret = drv_config(local, changed);
205 struct ieee80211_local *local = sdata->local;
210 drv_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed);
225 struct ieee80211_local *local = (struct ieee80211_local *) data;
228 while ((skb = skb_dequeue(&local->skb_queue)) ||
229 (skb = skb_dequeue(&local->skb_queue_unreliable))) {
235 ieee80211_rx(&local->hw, skb);
239 ieee80211_tx_status(&local->hw, skb);
252 struct ieee80211_local *local =
257 flush_workqueue(local->workqueue);
258 flush_work(&local->sched_scan_stopped_work);
260 WARN(test_bit(SCAN_HW_SCANNING, &local->scanning),
263 flush_work(&local->radar_detected_work);
265 list_for_each_entry(sdata, &local->interfaces, list) {
286 ieee80211_scan_cancel(local);
288 /* make sure any new ROC will consider local->in_reconfig */
289 flush_delayed_work(&local->roc_work);
290 flush_work(&local->hw_roc_done);
295 ieee80211_reconfig(local);
301 struct ieee80211_local *local = hw_to_local(hw);
303 trace_api_restart_hw(local);
317 local->in_reconfig = true;
320 queue_work(system_freezable_wq, &local->restart_work);
329 struct ieee80211_local *local =
344 if (wdev->wiphy != local->hw.wiphy)
390 struct ieee80211_local *local =
396 if (!wdev || wdev->wiphy != local->hw.wiphy)
408 drv_ipv6_addr_change(local, sdata, idev);
531 struct ieee80211_local *local;
567 priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
628 local = wiphy_priv(wiphy);
630 if (sta_info_init(local))
633 local->hw.wiphy = wiphy;
635 local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
637 local->ops = ops;
638 local->use_chanctx = use_chanctx;
644 * second, so 7 is ~8ms of queued data. Only affects local TCP
647 * for local reasons (longer buffers, longer completion time, or
650 local->hw.tx_sk_pacing_shift = 7;
653 local->hw.queues = 1;
654 local->hw.max_rates = 1;
655 local->hw.max_report_rates = 0;
656 local->hw.max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT;
657 local->hw.max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HT;
658 local->hw.offchannel_tx_hw_queue = IEEE80211_INVAL_HW_QUEUE;
659 local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
660 local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
661 local->hw.radiotap_mcs_details = IEEE80211_RADIOTAP_MCS_HAVE_MCS |
664 local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
666 local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
667 local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
668 local->hw.max_mtu = IEEE80211_MAX_DATA_LEN;
669 local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
673 local->ext_capa[7] = WLAN_EXT_CAPA8_OPMODE_NOTIF;
675 wiphy->extended_capabilities = local->ext_capa;
676 wiphy->extended_capabilities_mask = local->ext_capa;
678 ARRAY_SIZE(local->ext_capa);
680 INIT_LIST_HEAD(&local->interfaces);
681 INIT_LIST_HEAD(&local->mon_list);
683 __hw_addr_init(&local->mc_list);
685 mutex_init(&local->iflist_mtx);
686 mutex_init(&local->mtx);
688 mutex_init(&local->key_mtx);
689 spin_lock_init(&local->filter_lock);
690 spin_lock_init(&local->rx_path_lock);
691 spin_lock_init(&local->queue_stop_reason_lock);
694 INIT_LIST_HEAD(&local->active_txqs[i]);
695 spin_lock_init(&local->active_txq_lock[i]);
696 local->aql_txq_limit_low[i] = IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L;
697 local->aql_txq_limit_high[i] =
701 local->airtime_flags = AIRTIME_USE_TX | AIRTIME_USE_RX;
702 local->aql_threshold = IEEE80211_AQL_THRESHOLD;
703 atomic_set(&local->aql_total_pending_airtime, 0);
705 INIT_LIST_HEAD(&local->chanctx_list);
706 mutex_init(&local->chanctx_mtx);
708 INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work);
710 INIT_WORK(&local->restart_work, ieee80211_restart_work);
712 INIT_WORK(&local->radar_detected_work,
715 INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter);
716 local->smps_mode = IEEE80211_SMPS_OFF;
718 INIT_WORK(&local->dynamic_ps_enable_work,
720 INIT_WORK(&local->dynamic_ps_disable_work,
722 timer_setup(&local->dynamic_ps_timer, ieee80211_dynamic_ps_timer, 0);
724 INIT_WORK(&local->sched_scan_stopped_work,
727 INIT_WORK(&local->tdls_chsw_work, ieee80211_tdls_chsw_work);
729 spin_lock_init(&local->ack_status_lock);
730 idr_init(&local->ack_status_frames);
733 skb_queue_head_init(&local->pending[i]);
734 atomic_set(&local->agg_queue_stop[i], 0);
736 tasklet_init(&local->tx_pending_tasklet, ieee80211_tx_pending,
737 (unsigned long)local);
740 tasklet_init(&local->wake_txqs_tasklet, ieee80211_wake_txqs,
741 (unsigned long)local);
743 tasklet_init(&local->tasklet,
745 (unsigned long) local);
747 skb_queue_head_init(&local->skb_queue);
748 skb_queue_head_init(&local->skb_queue_unreliable);
749 skb_queue_head_init(&local->skb_queue_tdls_chsw);
751 ieee80211_alloc_led_names(local);
753 ieee80211_roc_setup(local);
755 local->hw.radiotap_timestamp.units_pos = -1;
756 local->hw.radiotap_timestamp.accuracy = -1;
758 return &local->hw;
765 static int ieee80211_init_cipher_suites(struct ieee80211_local *local)
768 bool have_mfp = ieee80211_hw_check(&local->hw, MFP_CAPABLE);
788 if (ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL) ||
789 local->hw.wiphy->cipher_suites) {
797 if (!local->hw.wiphy->n_cipher_suites)
801 suites = kmemdup(local->hw.wiphy->cipher_suites,
802 sizeof(u32) * local->hw.wiphy->n_cipher_suites,
807 for (r = 0; r < local->hw.wiphy->n_cipher_suites; r++) {
808 u32 suite = local->hw.wiphy->cipher_suites[r];
815 } else if (!local->hw.cipher_schemes) {
820 local->hw.wiphy->cipher_suites = cipher_suites;
821 local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
824 local->hw.wiphy->n_cipher_suites -= 4;
827 local->hw.wiphy->cipher_suites += 2;
828 local->hw.wiphy->n_cipher_suites -= 2;
836 cs = local->hw.cipher_schemes;
844 n_suites = local->hw.n_cipher_schemes + 5;
878 for (r = 0; r < local->hw.n_cipher_schemes; r++) {
887 local->hw.wiphy->cipher_suites = suites;
888 local->hw.wiphy->n_cipher_suites = w;
889 local->wiphy_ciphers_allocated = true;
896 struct ieee80211_local *local = hw_to_local(hw);
904 (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE ||
905 local->hw.offchannel_tx_hw_queue >= local->hw.queues))
909 (!local->ops->tdls_channel_switch ||
910 !local->ops->tdls_cancel_channel_switch ||
911 !local->ops->tdls_recv_channel_switch))
915 !local->ops->set_frag_threshold))
918 if (WARN_ON(local->hw.wiphy->interface_modes &
920 (!local->ops->start_nan || !local->ops->stop_nan)))
924 if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume))
928 if (!local->use_chanctx) {
929 for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
932 comb = &local->hw.wiphy->iface_combinations[i];
943 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS))
947 for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
950 comb = &local->hw.wiphy->iface_combinations[i];
965 local->rx_chains = 1;
980 sband = local->hw.wiphy->bands[band];
1000 if (!local->use_chanctx && !local->_oper_chandef.chan) {
1001 local->hw.conf.chandef = dflt_chandef;
1002 local->_oper_chandef = dflt_chandef;
1004 local->monitor_chandef = dflt_chandef;
1018 if (WARN_ON(local->hw.queues < IEEE80211_NUM_ACS &&
1026 local->rx_chains =
1028 local->rx_chains);
1039 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP) &&
1040 !ieee80211_hw_check(&local->hw, SW_CRYPTO_CONTROL)) {
1062 local->int_scan_req = kzalloc(sizeof(*local->int_scan_req) +
1064 if (!local->int_scan_req)
1068 if (!local->hw.wiphy->bands[band])
1070 local->int_scan_req->rates[band] = (u32) -1;
1075 local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT);
1080 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_MESH_POINT))
1081 local->hw.wiphy->flags |= WIPHY_FLAG_MESH_AUTH;
1084 local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL;
1086 if (ieee80211_hw_check(&local->hw, SIGNAL_DBM)) {
1087 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
1088 } else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC)) {
1089 local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
1099 if (!local->ops->set_key) {
1100 wiphy_ext_feature_set(local->hw.wiphy,
1102 wiphy_ext_feature_set(local->hw.wiphy,
1106 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_ADHOC))
1107 wiphy_ext_feature_set(local->hw.wiphy,
1116 local->scan_ies_len = 4 + max_bitrates /* (ext) supp rates */ +
1119 local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap);
1122 local->scan_ies_len +=
1132 local->scan_ies_len +=
1137 if (!local->ops->hw_scan) {
1139 local->hw.wiphy->max_scan_ssids = 4;
1140 local->hw.wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
1150 if (local->hw.wiphy->max_scan_ie_len)
1151 local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len;
1153 if (WARN_ON(!ieee80211_cs_list_valid(local->hw.cipher_schemes,
1154 local->hw.n_cipher_schemes))) {
1159 result = ieee80211_init_cipher_suites(local);
1163 if (!local->ops->remain_on_channel)
1164 local->hw.wiphy->max_remain_on_channel_duration = 5000;
1167 if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)
1168 local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
1171 if (ieee80211_hw_check(&local->hw, CHANCTX_STA_CSA))
1172 local->ext_capa[0] |= WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING;
1175 if (ieee80211_hw_check(&local->hw, SUPPORTS_MULTI_BSSID)) {
1176 local->hw.wiphy->support_mbssid = true;
1177 if (ieee80211_hw_check(&local->hw,
1179 local->hw.wiphy->support_only_he_mbssid = true;
1181 local->ext_capa[2] |=
1185 local->hw.wiphy->max_num_csa_counters = IEEE80211_MAX_CNTDWN_COUNTERS_NUM;
1194 local->workqueue =
1195 alloc_ordered_workqueue("%s", 0, wiphy_name(local->hw.wiphy));
1196 if (!local->workqueue) {
1206 local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
1213 if (local->hw.max_listen_interval == 0)
1214 local->hw.max_listen_interval = 5;
1216 local->hw.conf.listen_interval = local->hw.max_listen_interval;
1218 local->dynamic_ps_forced_timeout = -1;
1220 if (!local->hw.max_nan_de_entries)
1221 local->hw.max_nan_de_entries = IEEE80211_MAX_NAN_INSTANCE_ID;
1223 if (!local->hw.weight_multiplier)
1224 local->hw.weight_multiplier = 1;
1226 ieee80211_wep_init(local);
1228 local->hw.conf.flags = IEEE80211_CONF_IDLE;
1230 ieee80211_led_init(local);
1232 result = ieee80211_txq_setup_flows(local);
1237 result = ieee80211_init_rate_ctrl_alg(local,
1241 wiphy_debug(local->hw.wiphy,
1246 if (local->rate_ctrl) {
1248 if (local->rate_ctrl->ops->capa & RATE_CTRL_CAPA_VHT_EXT_NSS_BW)
1260 BUILD_BUG_ON(NUM_NL80211_BANDS > 8 * sizeof(local->sband_allocated));
1267 sband = local->hw.wiphy->bands[band];
1289 local->hw.wiphy->bands[band] = sband;
1290 local->sband_allocated |= BIT(band);
1293 result = wiphy_register(local->hw.wiphy);
1297 debugfs_hw_add(local);
1298 rate_control_add_debugfs(local);
1303 if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION) &&
1307 result = ieee80211_if_add(local, "wlan%d", NET_NAME_ENUM, NULL,
1310 wiphy_warn(local->hw.wiphy,
1317 local->ifa_notifier.notifier_call = ieee80211_ifa_changed;
1318 result = register_inetaddr_notifier(&local->ifa_notifier);
1324 local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
1325 result = register_inet6addr_notifier(&local->ifa6_notifier);
1335 unregister_inetaddr_notifier(&local->ifa_notifier);
1341 wiphy_unregister(local->hw.wiphy);
1344 rate_control_deinitialize(local);
1345 ieee80211_remove_interfaces(local);
1349 ieee80211_led_exit(local);
1350 destroy_workqueue(local->workqueue);
1352 if (local->wiphy_ciphers_allocated) {
1353 kfree(local->hw.wiphy->cipher_suites);
1354 local->wiphy_ciphers_allocated = false;
1356 kfree(local->int_scan_req);
1363 struct ieee80211_local *local = hw_to_local(hw);
1365 tasklet_kill(&local->tx_pending_tasklet);
1366 tasklet_kill(&local->tasklet);
1369 unregister_inetaddr_notifier(&local->ifa_notifier);
1372 unregister_inet6addr_notifier(&local->ifa6_notifier);
1382 ieee80211_remove_interfaces(local);
1386 cancel_delayed_work_sync(&local->roc_work);
1387 cancel_work_sync(&local->restart_work);
1388 cancel_work_sync(&local->reconfig_filter);
1389 cancel_work_sync(&local->tdls_chsw_work);
1390 flush_work(&local->sched_scan_stopped_work);
1391 flush_work(&local->radar_detected_work);
1393 ieee80211_clear_tx_pending(local);
1394 rate_control_deinitialize(local);
1396 if (skb_queue_len(&local->skb_queue) ||
1397 skb_queue_len(&local->skb_queue_unreliable))
1398 wiphy_warn(local->hw.wiphy, "skb_queue not empty\n");
1399 skb_queue_purge(&local->skb_queue);
1400 skb_queue_purge(&local->skb_queue_unreliable);
1401 skb_queue_purge(&local->skb_queue_tdls_chsw);
1403 wiphy_unregister(local->hw.wiphy);
1404 destroy_workqueue(local->workqueue);
1405 ieee80211_led_exit(local);
1406 kfree(local->int_scan_req);
1419 struct ieee80211_local *local = hw_to_local(hw);
1422 mutex_destroy(&local->iflist_mtx);
1423 mutex_destroy(&local->mtx);
1425 if (local->wiphy_ciphers_allocated) {
1426 kfree(local->hw.wiphy->cipher_suites);
1427 local->wiphy_ciphers_allocated = false;
1430 idr_for_each(&local->ack_status_frames,
1432 idr_destroy(&local->ack_status_frames);
1434 sta_info_stop(local);
1436 ieee80211_free_led_names(local);
1439 if (!(local->sband_allocated & BIT(band)))
1441 kfree(local->hw.wiphy->bands[band]);
1444 wiphy_free(local->hw.wiphy);