Lines Matching full:local
32 void ieee80211_rx_bss_put(struct ieee80211_local *local,
37 cfg80211_put_bss(local->hw.wiphy,
68 struct ieee80211_local *local = wiphy_priv(wiphy);
147 local->hw.wiphy->bands[rx_status->band];
164 ieee80211_bss_info_update(struct ieee80211_local *local,
185 else if (ieee80211_hw_check(&local->hw, SIGNAL_DBM))
187 else if (ieee80211_hw_check(&local->hw, SIGNAL_UNSPEC))
188 bss_meta.signal = (rx_status->signal * 100) / local->hw.max_signal;
193 scan_sdata = rcu_dereference(local->scan_sdata);
215 ieee80211_calculate_rx_timestamp(local,
226 cbss = cfg80211_inform_bss_frame_data(local->hw.wiphy, &bss_meta,
273 void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
298 if (test_and_clear_bit(SCAN_BEACON_WAIT, &local->scanning)) {
304 set_bit(SCAN_BEACON_DONE, &local->scanning);
305 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, 0);
308 channel = ieee80211_get_channel_khz(local->hw.wiphy,
320 sdata1 = rcu_dereference(local->scan_sdata);
321 sdata2 = rcu_dereference(local->sched_scan_sdata);
326 scan_req = rcu_dereference(local->scan_req);
327 sched_scan_req = rcu_dereference(local->sched_scan_req);
352 if (local->open_count == local->monitors)
355 bss = ieee80211_bss_info_update(local, rx_status,
359 ieee80211_rx_bss_put(local, bss);
372 struct ieee80211_local *local = sdata->local;
380 req = rcu_dereference_protected(local->scan_req,
381 lockdep_is_held(&local->hw.wiphy->mtx));
383 if (test_bit(SCAN_HW_CANCELLED, &local->scanning))
386 if (ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS)) {
387 local->hw_scan_req->req.n_channels = req->n_channels;
390 local->hw_scan_req->req.channels[i] = req->channels[i];
395 if (local->hw_scan_band == NUM_NL80211_BANDS)
398 n_chans = &local->hw_scan_req->req.n_channels;
403 local->hw_scan_band)
405 local->hw_scan_req->req.channels[(*n_chans)++] =
411 local->hw_scan_band++;
421 (u8 *)local->hw_scan_req->req.ie,
422 local->hw_scan_ies_bufsize,
423 &local->hw_scan_req->ies,
429 local->hw_scan_req->req.ie_len = ielen;
430 local->hw_scan_req->req.no_cck = req->no_cck;
431 ether_addr_copy(local->hw_scan_req->req.mac_addr, req->mac_addr);
432 ether_addr_copy(local->hw_scan_req->req.mac_addr_mask,
434 ether_addr_copy(local->hw_scan_req->req.bssid, req->bssid);
441 struct ieee80211_local *local = hw_to_local(hw);
442 bool hw_scan = test_bit(SCAN_HW_SCANNING, &local->scanning);
443 bool was_scanning = local->scanning;
448 lockdep_assert_wiphy(local->hw.wiphy);
453 * local->scan_req next), but not to complete it
456 if (WARN_ON(!local->scanning && !aborted))
459 if (WARN_ON(!local->scan_req))
462 scan_sdata = rcu_dereference_protected(local->scan_sdata,
463 lockdep_is_held(&local->hw.wiphy->mtx));
466 !ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS) &&
470 rc = drv_hw_scan(local,
471 rcu_dereference_protected(local->scan_sdata,
472 lockdep_is_held(&local->hw.wiphy->mtx)),
473 local->hw_scan_req);
481 memset(&local->scan_info, 0, sizeof(local->scan_info));
485 kfree(local->hw_scan_req);
486 local->hw_scan_req = NULL;
488 scan_req = rcu_dereference_protected(local->scan_req,
489 lockdep_is_held(&local->hw.wiphy->mtx));
491 RCU_INIT_POINTER(local->scan_req, NULL);
492 RCU_INIT_POINTER(local->scan_sdata, NULL);
494 local->scanning = 0;
495 local->scan_chandef.chan = NULL;
499 if (scan_req != local->int_scan_req) {
500 local->scan_info.aborted = aborted;
501 cfg80211_scan_done(scan_req, &local->scan_info);
505 ieee80211_hw_conf_chan(local);
508 ieee80211_configure_filter(local);
509 drv_sw_scan_complete(local, scan_sdata);
510 ieee80211_offchannel_return(local);
513 ieee80211_recalc_idle(local);
515 ieee80211_mlme_notify_scan_completed(local);
516 ieee80211_ibss_notify_scan_completed(local);
522 list_for_each_entry(sdata, &local->interfaces, list) {
524 wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work);
528 ieee80211_start_next_roc(local);
534 struct ieee80211_local *local = hw_to_local(hw);
536 trace_api_scan_completed(local, info->aborted);
538 set_bit(SCAN_COMPLETED, &local->scanning);
540 set_bit(SCAN_ABORTED, &local->scanning);
542 memcpy(&local->scan_info, info, sizeof(*info));
544 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, 0);
548 static int ieee80211_start_sw_scan(struct ieee80211_local *local,
552 if (!local->emulate_chanctx)
564 * Note that while local->sw_scanning is true everything else but
568 drv_sw_scan_start(local, sdata, local->scan_addr);
570 local->leave_oper_channel_time = jiffies;
571 local->next_scan_state = SCAN_DECISION;
572 local->scan_channel_idx = 0;
574 ieee80211_offchannel_stop_vifs(local);
577 ieee80211_flush_queues(local, NULL, false);
579 ieee80211_configure_filter(local);
582 ieee80211_hw_conf_chan(local);
584 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, 0);
592 struct ieee80211_local *local = sdata->local;
596 lockdep_assert_wiphy(local->hw.wiphy);
598 if (!ieee80211_is_radar_required(local, req))
601 if (!regulatory_pre_cac_allowed(local->hw.wiphy))
604 list_for_each_entry(sdata_iter, &local->interfaces, list) {
613 static bool ieee80211_can_scan(struct ieee80211_local *local,
620 if (!list_empty(&local->roc_list))
630 void ieee80211_run_deferred_scan(struct ieee80211_local *local)
634 lockdep_assert_wiphy(local->hw.wiphy);
636 if (!local->scan_req || local->scanning)
639 req = wiphy_dereference(local->hw.wiphy, local->scan_req);
640 if (!ieee80211_can_scan(local,
642 local->scan_sdata,
643 lockdep_is_held(&local->hw.wiphy->mtx)),
647 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work,
680 static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
686 enum nl80211_band band = local->hw.conf.chandef.chan->band;
689 scan_req = rcu_dereference_protected(local->scan_req,
690 lockdep_is_held(&local->hw.wiphy->mtx));
700 sdata = rcu_dereference_protected(local->scan_sdata,
701 lockdep_is_held(&local->hw.wiphy->mtx));
705 sdata, local->scan_addr, scan_req->bssid,
709 tx_flags, local->hw.conf.chandef.chan);
719 local->next_scan_state = SCAN_DECISION;
725 struct ieee80211_local *local = sdata->local;
726 bool hw_scan = local->ops->hw_scan;
729 lockdep_assert_wiphy(local->hw.wiphy);
731 if (local->scan_req)
744 if (!ieee80211_can_scan(local, sdata, req)) {
746 rcu_assign_pointer(local->scan_req, req);
747 rcu_assign_pointer(local->scan_sdata, sdata);
755 local->hw_scan_ies_bufsize = local->scan_ies_len + req->ie_len;
757 if (ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS)) {
768 local->hw_scan_ies_bufsize *= n_bands;
771 local->hw_scan_req = kmalloc(struct_size(local->hw_scan_req,
774 local->hw_scan_ies_bufsize,
776 if (!local->hw_scan_req)
779 local->hw_scan_req->req.ssids = req->ssids;
780 local->hw_scan_req->req.n_ssids = req->n_ssids;
784 local->hw_scan_req->req.n_channels = req->n_channels;
786 ies = (u8 *)local->hw_scan_req +
787 sizeof(*local->hw_scan_req) +
789 local->hw_scan_req->req.ie = ies;
790 local->hw_scan_req->req.flags = req->flags;
791 eth_broadcast_addr(local->hw_scan_req->req.bssid);
792 local->hw_scan_req->req.duration = req->duration;
793 local->hw_scan_req->req.duration_mandatory =
795 local->hw_scan_req->req.tsf_report_link_id =
798 local->hw_scan_band = 0;
799 local->hw_scan_req->req.n_6ghz_params = req->n_6ghz_params;
800 local->hw_scan_req->req.scan_6ghz_params =
802 local->hw_scan_req->req.scan_6ghz = req->scan_6ghz;
803 local->hw_scan_req->req.first_part = req->first_part;
806 * After allocating local->hw_scan_req, we must
814 rcu_assign_pointer(local->scan_req, req);
815 rcu_assign_pointer(local->scan_sdata, sdata);
818 get_random_mask_addr(local->scan_addr,
822 memcpy(local->scan_addr, sdata->vif.addr, ETH_ALEN);
825 __set_bit(SCAN_HW_SCANNING, &local->scanning);
827 (req->channels[0] == local->hw.conf.chandef.chan)) {
834 __set_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning);
836 ieee80211_recalc_idle(local);
840 drv_sw_scan_start(local, sdata, local->scan_addr);
842 ieee80211_configure_filter(local); /* accept probe-responses */
845 ieee80211_hw_conf_chan(local);
852 set_bit(SCAN_BEACON_WAIT, &local->scanning);
854 ieee80211_scan_state_send_probe(local, &next_delay);
859 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work,
864 __set_bit(SCAN_SW_SCANNING, &local->scanning);
867 ieee80211_recalc_idle(local);
871 rc = drv_hw_scan(local, sdata, local->hw_scan_req);
873 rc = ieee80211_start_sw_scan(local, sdata);
877 kfree(local->hw_scan_req);
878 local->hw_scan_req = NULL;
879 local->scanning = 0;
881 ieee80211_recalc_idle(local);
883 local->scan_req = NULL;
884 RCU_INIT_POINTER(local->scan_sdata, NULL);
914 static void ieee80211_scan_state_decision(struct ieee80211_local *local,
925 lockdep_assert_wiphy(local->hw.wiphy);
932 list_for_each_entry(sdata, &local->interfaces, list) {
948 scan_req = rcu_dereference_protected(local->scan_req,
949 lockdep_is_held(&local->hw.wiphy->mtx));
951 next_chan = scan_req->channels[local->scan_channel_idx];
963 local->leave_oper_channel_time + HZ / 8);
976 local->next_scan_state = next_scan_state;
981 static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,
988 scan_req = rcu_dereference_protected(local->scan_req,
989 lockdep_is_held(&local->hw.wiphy->mtx));
992 chan = scan_req->channels[local->scan_channel_idx];
994 local->scan_chandef.chan = chan;
995 local->scan_chandef.center_freq1 = chan->center_freq;
996 local->scan_chandef.freq1_offset = chan->freq_offset;
997 local->scan_chandef.center_freq2 = 0;
1001 local->scan_chandef.width = NL80211_CHAN_WIDTH_1;
1002 local->scan_chandef.s1g_primary_2mhz = false;
1010 if (chan == local->hw.conf.chandef.chan)
1011 local->scan_chandef = local->hw.conf.chandef;
1013 local->scan_chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
1016 if (ieee80211_hw_conf_chan(local))
1020 local->scan_channel_idx++;
1024 local->next_scan_state = SCAN_DECISION;
1042 local->next_scan_state = SCAN_DECISION;
1044 set_bit(SCAN_BEACON_WAIT, &local->scanning);
1050 local->next_scan_state = SCAN_SEND_PROBE;
1053 static void ieee80211_scan_state_suspend(struct ieee80211_local *local,
1057 local->scan_chandef.chan = NULL;
1058 ieee80211_hw_conf_chan(local);
1061 ieee80211_offchannel_return(local);
1065 local->next_scan_state = SCAN_RESUME;
1068 static void ieee80211_scan_state_resume(struct ieee80211_local *local,
1071 ieee80211_offchannel_stop_vifs(local);
1073 if (local->ops->flush) {
1074 ieee80211_flush_queues(local, NULL, false);
1080 local->leave_oper_channel_time = jiffies;
1083 local->next_scan_state = SCAN_SET_CHANNEL;
1088 struct ieee80211_local *local =
1095 lockdep_assert_wiphy(local->hw.wiphy);
1097 if (!ieee80211_can_run_worker(local)) {
1102 sdata = rcu_dereference_protected(local->scan_sdata,
1103 lockdep_is_held(&local->hw.wiphy->mtx));
1104 scan_req = rcu_dereference_protected(local->scan_req,
1105 lockdep_is_held(&local->hw.wiphy->mtx));
1108 if (test_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning)) {
1109 aborted = test_and_clear_bit(SCAN_ABORTED, &local->scanning);
1113 if (test_and_clear_bit(SCAN_COMPLETED, &local->scanning)) {
1114 aborted = test_and_clear_bit(SCAN_ABORTED, &local->scanning);
1121 if (!local->scanning) {
1124 RCU_INIT_POINTER(local->scan_req, NULL);
1125 RCU_INIT_POINTER(local->scan_sdata, NULL);
1131 rcu_assign_pointer(local->scan_req, scan_req);
1136 clear_bit(SCAN_BEACON_WAIT, &local->scanning);
1148 if (test_and_clear_bit(SCAN_BEACON_DONE, &local->scanning) &&
1149 local->next_scan_state == SCAN_DECISION)
1150 local->next_scan_state = SCAN_SEND_PROBE;
1152 switch (local->next_scan_state) {
1155 if (local->scan_channel_idx >= scan_req->n_channels) {
1159 ieee80211_scan_state_decision(local, &next_delay);
1162 ieee80211_scan_state_set_channel(local, &next_delay);
1165 ieee80211_scan_state_send_probe(local, &next_delay);
1168 ieee80211_scan_state_suspend(local, &next_delay);
1171 ieee80211_scan_state_resume(local, &next_delay);
1179 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work,
1184 __ieee80211_scan_completed(&local->hw, aborted);
1190 lockdep_assert_wiphy(sdata->local->hw.wiphy);
1200 struct ieee80211_local *local = sdata->local;
1204 lockdep_assert_wiphy(local->hw.wiphy);
1207 if (local->scan_req)
1215 if (!local->hw.wiphy->bands[band] ||
1220 max_n = local->hw.wiphy->bands[band]->n_channels;
1223 &local->hw.wiphy->bands[band]->channels[i];
1231 local->int_scan_req->channels[n_ch] = tmp_ch;
1239 local->int_scan_req->n_channels = n_ch;
1248 local->int_scan_req->channels[n_ch] = channels[i];
1255 local->int_scan_req->n_channels = n_ch;
1258 local->int_scan_req->ssids = &local->scan_ssid;
1259 local->int_scan_req->n_ssids = 1;
1260 memcpy(local->int_scan_req->ssids[0].ssid, ssid, IEEE80211_MAX_SSID_LEN);
1261 local->int_scan_req->ssids[0].ssid_len = ssid_len;
1263 return __ieee80211_start_scan(sdata, sdata->local->int_scan_req);
1266 void ieee80211_scan_cancel(struct ieee80211_local *local)
1269 lockdep_assert_wiphy(local->hw.wiphy);
1278 * local->hw_scan_req to operate on 5G band, what race with
1279 * driver which can use local->hw_scan_req
1289 if (!local->scan_req)
1297 if (test_bit(SCAN_HW_SCANNING, &local->scanning) &&
1298 test_bit(SCAN_COMPLETED, &local->scanning)) {
1299 set_bit(SCAN_HW_CANCELLED, &local->scanning);
1303 if (test_bit(SCAN_HW_SCANNING, &local->scanning)) {
1308 set_bit(SCAN_HW_CANCELLED, &local->scanning);
1309 if (local->ops->cancel_hw_scan)
1310 drv_cancel_hw_scan(local,
1311 rcu_dereference_protected(local->scan_sdata,
1312 lockdep_is_held(&local->hw.wiphy->mtx)));
1316 wiphy_delayed_work_cancel(local->hw.wiphy, &local->scan_work);
1318 memset(&local->scan_info, 0, sizeof(local->scan_info));
1319 __ieee80211_scan_completed(&local->hw, true);
1325 struct ieee80211_local *local = sdata->local;
1334 lockdep_assert_wiphy(local->hw.wiphy);
1336 iebufsz = local->scan_ies_len + req->ie_len;
1338 if (!local->ops->sched_scan_start)
1342 if (local->hw.wiphy->bands[i]) {
1367 ret = drv_sched_scan_start(local, sdata, req, &sched_scan_ies);
1369 rcu_assign_pointer(local->sched_scan_sdata, sdata);
1370 rcu_assign_pointer(local->sched_scan_req, req);
1378 RCU_INIT_POINTER(local->sched_scan_sdata, NULL);
1379 RCU_INIT_POINTER(local->sched_scan_req, NULL);
1388 struct ieee80211_local *local = sdata->local;
1390 lockdep_assert_wiphy(local->hw.wiphy);
1392 if (rcu_access_pointer(local->sched_scan_sdata))
1398 int ieee80211_request_sched_scan_stop(struct ieee80211_local *local)
1403 lockdep_assert_wiphy(local->hw.wiphy);
1405 if (!local->ops->sched_scan_stop)
1409 RCU_INIT_POINTER(local->sched_scan_req, NULL);
1411 sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata,
1412 lockdep_is_held(&local->hw.wiphy->mtx));
1414 ret = drv_sched_scan_stop(local, sched_scan_sdata);
1416 RCU_INIT_POINTER(local->sched_scan_sdata, NULL);
1424 struct ieee80211_local *local = hw_to_local(hw);
1426 trace_api_sched_scan_results(local);
1432 void ieee80211_sched_scan_end(struct ieee80211_local *local)
1434 lockdep_assert_wiphy(local->hw.wiphy);
1436 if (!rcu_access_pointer(local->sched_scan_sdata))
1439 RCU_INIT_POINTER(local->sched_scan_sdata, NULL);
1442 RCU_INIT_POINTER(local->sched_scan_req, NULL);
1444 cfg80211_sched_scan_stopped_locked(local->hw.wiphy, 0);
1450 struct ieee80211_local *local =
1454 ieee80211_sched_scan_end(local);
1459 struct ieee80211_local *local = hw_to_local(hw);
1461 trace_api_sched_scan_stopped(local);
1468 if (local->in_reconfig)
1471 wiphy_work_queue(hw->wiphy, &local->sched_scan_stopped_work);