Lines Matching refs: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,
257 void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb)
283 if (test_and_clear_bit(SCAN_BEACON_WAIT, &local->scanning)) {
289 set_bit(SCAN_BEACON_DONE, &local->scanning);
290 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, 0);
293 channel = ieee80211_get_channel_khz(local->hw.wiphy,
305 sdata1 = rcu_dereference(local->scan_sdata);
306 sdata2 = rcu_dereference(local->sched_scan_sdata);
311 scan_req = rcu_dereference(local->scan_req);
312 sched_scan_req = rcu_dereference(local->sched_scan_req);
337 if (local->open_count == local->monitors)
340 bss = ieee80211_bss_info_update(local, rx_status,
344 ieee80211_rx_bss_put(local, bss);
357 struct ieee80211_local *local = sdata->local;
364 req = rcu_dereference_protected(local->scan_req,
365 lockdep_is_held(&local->hw.wiphy->mtx));
367 if (test_bit(SCAN_HW_CANCELLED, &local->scanning))
370 if (ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS)) {
372 local->hw_scan_req->req.channels[i] = req->channels[i];
379 if (local->hw_scan_band == NUM_NL80211_BANDS)
386 local->hw_scan_band)
388 local->hw_scan_req->req.channels[n_chans] =
394 local->hw_scan_band++;
398 local->hw_scan_req->req.n_channels = n_chans;
405 (u8 *)local->hw_scan_req->req.ie,
406 local->hw_scan_ies_bufsize,
407 &local->hw_scan_req->ies,
413 local->hw_scan_req->req.ie_len = ielen;
414 local->hw_scan_req->req.no_cck = req->no_cck;
415 ether_addr_copy(local->hw_scan_req->req.mac_addr, req->mac_addr);
416 ether_addr_copy(local->hw_scan_req->req.mac_addr_mask,
418 ether_addr_copy(local->hw_scan_req->req.bssid, req->bssid);
425 struct ieee80211_local *local = hw_to_local(hw);
426 bool hw_scan = test_bit(SCAN_HW_SCANNING, &local->scanning);
427 bool was_scanning = local->scanning;
432 lockdep_assert_wiphy(local->hw.wiphy);
437 * local->scan_req next), but not to complete it
440 if (WARN_ON(!local->scanning && !aborted))
443 if (WARN_ON(!local->scan_req))
446 scan_sdata = rcu_dereference_protected(local->scan_sdata,
447 lockdep_is_held(&local->hw.wiphy->mtx));
450 !ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS) &&
454 rc = drv_hw_scan(local,
455 rcu_dereference_protected(local->scan_sdata,
456 lockdep_is_held(&local->hw.wiphy->mtx)),
457 local->hw_scan_req);
465 memset(&local->scan_info, 0, sizeof(local->scan_info));
469 kfree(local->hw_scan_req);
470 local->hw_scan_req = NULL;
472 scan_req = rcu_dereference_protected(local->scan_req,
473 lockdep_is_held(&local->hw.wiphy->mtx));
475 RCU_INIT_POINTER(local->scan_req, NULL);
476 RCU_INIT_POINTER(local->scan_sdata, NULL);
478 local->scanning = 0;
479 local->scan_chandef.chan = NULL;
483 if (scan_req != local->int_scan_req) {
484 local->scan_info.aborted = aborted;
485 cfg80211_scan_done(scan_req, &local->scan_info);
489 ieee80211_hw_conf_chan(local);
492 ieee80211_configure_filter(local);
493 drv_sw_scan_complete(local, scan_sdata);
494 ieee80211_offchannel_return(local);
497 ieee80211_recalc_idle(local);
499 ieee80211_mlme_notify_scan_completed(local);
500 ieee80211_ibss_notify_scan_completed(local);
506 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
508 wiphy_work_queue(sdata->local->hw.wiphy, &sdata->work);
512 ieee80211_start_next_roc(local);
518 struct ieee80211_local *local = hw_to_local(hw);
520 trace_api_scan_completed(local, info->aborted);
522 set_bit(SCAN_COMPLETED, &local->scanning);
524 set_bit(SCAN_ABORTED, &local->scanning);
526 memcpy(&local->scan_info, info, sizeof(*info));
528 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, 0);
532 static int ieee80211_start_sw_scan(struct ieee80211_local *local,
536 if (!local->emulate_chanctx)
548 * Note that while local->sw_scanning is true everything else but
552 drv_sw_scan_start(local, sdata, local->scan_addr);
554 local->leave_oper_channel_time = jiffies;
555 local->next_scan_state = SCAN_DECISION;
556 local->scan_channel_idx = 0;
558 ieee80211_offchannel_stop_vifs(local);
561 ieee80211_flush_queues(local, NULL, false);
563 ieee80211_configure_filter(local);
566 ieee80211_hw_conf_chan(local);
568 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, 0);
575 struct ieee80211_local *local = sdata->local;
578 lockdep_assert_wiphy(local->hw.wiphy);
580 if (!ieee80211_is_radar_required(local))
583 if (!regulatory_pre_cac_allowed(local->hw.wiphy))
586 list_for_each_entry(sdata_iter, &local->interfaces, list) {
594 static bool ieee80211_can_scan(struct ieee80211_local *local,
600 if (!list_empty(&local->roc_list))
610 void ieee80211_run_deferred_scan(struct ieee80211_local *local)
612 lockdep_assert_wiphy(local->hw.wiphy);
614 if (!local->scan_req || local->scanning)
617 if (!ieee80211_can_scan(local,
619 local->scan_sdata,
620 lockdep_is_held(&local->hw.wiphy->mtx))))
623 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work,
656 static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
662 enum nl80211_band band = local->hw.conf.chandef.chan->band;
665 scan_req = rcu_dereference_protected(local->scan_req,
666 lockdep_is_held(&local->hw.wiphy->mtx));
676 sdata = rcu_dereference_protected(local->scan_sdata,
677 lockdep_is_held(&local->hw.wiphy->mtx));
681 sdata, local->scan_addr, scan_req->bssid,
685 tx_flags, local->hw.conf.chandef.chan);
695 local->next_scan_state = SCAN_DECISION;
701 struct ieee80211_local *local = sdata->local;
702 bool hw_scan = local->ops->hw_scan;
705 lockdep_assert_wiphy(local->hw.wiphy);
707 if (local->scan_req)
728 if (!ieee80211_can_scan(local, sdata)) {
730 rcu_assign_pointer(local->scan_req, req);
731 rcu_assign_pointer(local->scan_sdata, sdata);
739 local->hw_scan_ies_bufsize = local->scan_ies_len + req->ie_len;
741 if (ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS)) {
752 local->hw_scan_ies_bufsize *= n_bands;
755 local->hw_scan_req = kmalloc(
756 sizeof(*local->hw_scan_req) +
758 local->hw_scan_ies_bufsize, GFP_KERNEL);
759 if (!local->hw_scan_req)
762 local->hw_scan_req->req.ssids = req->ssids;
763 local->hw_scan_req->req.n_ssids = req->n_ssids;
764 ies = (u8 *)local->hw_scan_req +
765 sizeof(*local->hw_scan_req) +
767 local->hw_scan_req->req.ie = ies;
768 local->hw_scan_req->req.flags = req->flags;
769 eth_broadcast_addr(local->hw_scan_req->req.bssid);
770 local->hw_scan_req->req.duration = req->duration;
771 local->hw_scan_req->req.duration_mandatory =
773 local->hw_scan_req->req.tsf_report_link_id =
776 local->hw_scan_band = 0;
777 local->hw_scan_req->req.n_6ghz_params = req->n_6ghz_params;
778 local->hw_scan_req->req.scan_6ghz_params =
780 local->hw_scan_req->req.scan_6ghz = req->scan_6ghz;
783 * After allocating local->hw_scan_req, we must
791 rcu_assign_pointer(local->scan_req, req);
792 rcu_assign_pointer(local->scan_sdata, sdata);
795 get_random_mask_addr(local->scan_addr,
799 memcpy(local->scan_addr, sdata->vif.addr, ETH_ALEN);
802 __set_bit(SCAN_HW_SCANNING, &local->scanning);
804 (req->channels[0] == local->hw.conf.chandef.chan)) {
811 __set_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning);
813 ieee80211_recalc_idle(local);
817 drv_sw_scan_start(local, sdata, local->scan_addr);
819 ieee80211_configure_filter(local); /* accept probe-responses */
822 ieee80211_hw_conf_chan(local);
829 set_bit(SCAN_BEACON_WAIT, &local->scanning);
831 ieee80211_scan_state_send_probe(local, &next_delay);
836 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work,
841 __set_bit(SCAN_SW_SCANNING, &local->scanning);
844 ieee80211_recalc_idle(local);
848 rc = drv_hw_scan(local, sdata, local->hw_scan_req);
850 rc = ieee80211_start_sw_scan(local, sdata);
854 kfree(local->hw_scan_req);
855 local->hw_scan_req = NULL;
856 local->scanning = 0;
858 ieee80211_recalc_idle(local);
860 local->scan_req = NULL;
861 RCU_INIT_POINTER(local->scan_sdata, NULL);
891 static void ieee80211_scan_state_decision(struct ieee80211_local *local,
902 lockdep_assert_wiphy(local->hw.wiphy);
909 list_for_each_entry(sdata, &local->interfaces, list) {
925 scan_req = rcu_dereference_protected(local->scan_req,
926 lockdep_is_held(&local->hw.wiphy->mtx));
928 next_chan = scan_req->channels[local->scan_channel_idx];
940 local->leave_oper_channel_time + HZ / 8);
953 local->next_scan_state = next_scan_state;
958 static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,
965 scan_req = rcu_dereference_protected(local->scan_req,
966 lockdep_is_held(&local->hw.wiphy->mtx));
969 chan = scan_req->channels[local->scan_channel_idx];
971 local->scan_chandef.chan = chan;
972 local->scan_chandef.center_freq1 = chan->center_freq;
973 local->scan_chandef.freq1_offset = chan->freq_offset;
974 local->scan_chandef.center_freq2 = 0;
980 local->scan_chandef.width = ieee80211_s1g_channel_width(chan);
987 if (chan == local->hw.conf.chandef.chan)
988 local->scan_chandef = local->hw.conf.chandef;
990 local->scan_chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
993 if (ieee80211_hw_conf_chan(local))
997 local->scan_channel_idx++;
1001 local->next_scan_state = SCAN_DECISION;
1021 local->next_scan_state = SCAN_DECISION;
1023 set_bit(SCAN_BEACON_WAIT, &local->scanning);
1029 local->next_scan_state = SCAN_SEND_PROBE;
1032 static void ieee80211_scan_state_suspend(struct ieee80211_local *local,
1036 local->scan_chandef.chan = NULL;
1037 ieee80211_hw_conf_chan(local);
1040 ieee80211_offchannel_return(local);
1044 local->next_scan_state = SCAN_RESUME;
1047 static void ieee80211_scan_state_resume(struct ieee80211_local *local,
1050 ieee80211_offchannel_stop_vifs(local);
1052 if (local->ops->flush) {
1053 ieee80211_flush_queues(local, NULL, false);
1059 local->leave_oper_channel_time = jiffies;
1062 local->next_scan_state = SCAN_SET_CHANNEL;
1067 struct ieee80211_local *local =
1074 lockdep_assert_wiphy(local->hw.wiphy);
1076 if (!ieee80211_can_run_worker(local)) {
1081 sdata = rcu_dereference_protected(local->scan_sdata,
1082 lockdep_is_held(&local->hw.wiphy->mtx));
1083 scan_req = rcu_dereference_protected(local->scan_req,
1084 lockdep_is_held(&local->hw.wiphy->mtx));
1087 if (test_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning)) {
1088 aborted = test_and_clear_bit(SCAN_ABORTED, &local->scanning);
1092 if (test_and_clear_bit(SCAN_COMPLETED, &local->scanning)) {
1093 aborted = test_and_clear_bit(SCAN_ABORTED, &local->scanning);
1100 if (!local->scanning) {
1103 RCU_INIT_POINTER(local->scan_req, NULL);
1104 RCU_INIT_POINTER(local->scan_sdata, NULL);
1110 rcu_assign_pointer(local->scan_req, scan_req);
1115 clear_bit(SCAN_BEACON_WAIT, &local->scanning);
1127 if (test_and_clear_bit(SCAN_BEACON_DONE, &local->scanning) &&
1128 local->next_scan_state == SCAN_DECISION)
1129 local->next_scan_state = SCAN_SEND_PROBE;
1131 switch (local->next_scan_state) {
1134 if (local->scan_channel_idx >= scan_req->n_channels) {
1138 ieee80211_scan_state_decision(local, &next_delay);
1141 ieee80211_scan_state_set_channel(local, &next_delay);
1144 ieee80211_scan_state_send_probe(local, &next_delay);
1147 ieee80211_scan_state_suspend(local, &next_delay);
1150 ieee80211_scan_state_resume(local, &next_delay);
1158 wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work,
1163 __ieee80211_scan_completed(&local->hw, aborted);
1169 lockdep_assert_wiphy(sdata->local->hw.wiphy);
1179 struct ieee80211_local *local = sdata->local;
1183 lockdep_assert_wiphy(local->hw.wiphy);
1186 if (local->scan_req)
1194 if (!local->hw.wiphy->bands[band] ||
1198 max_n = local->hw.wiphy->bands[band]->n_channels;
1201 &local->hw.wiphy->bands[band]->channels[i];
1207 local->int_scan_req->channels[n_ch] = tmp_ch;
1215 local->int_scan_req->n_channels = n_ch;
1222 local->int_scan_req->channels[n_ch] = channels[i];
1229 local->int_scan_req->n_channels = n_ch;
1232 local->int_scan_req->ssids = &local->scan_ssid;
1233 local->int_scan_req->n_ssids = 1;
1234 memcpy(local->int_scan_req->ssids[0].ssid, ssid, IEEE80211_MAX_SSID_LEN);
1235 local->int_scan_req->ssids[0].ssid_len = ssid_len;
1237 ret = __ieee80211_start_scan(sdata, sdata->local->int_scan_req);
1242 void ieee80211_scan_cancel(struct ieee80211_local *local)
1245 lockdep_assert_wiphy(local->hw.wiphy);
1254 * local->hw_scan_req to operate on 5G band, what race with
1255 * driver which can use local->hw_scan_req
1265 if (!local->scan_req)
1273 if (test_bit(SCAN_HW_SCANNING, &local->scanning) &&
1274 test_bit(SCAN_COMPLETED, &local->scanning)) {
1275 set_bit(SCAN_HW_CANCELLED, &local->scanning);
1279 if (test_bit(SCAN_HW_SCANNING, &local->scanning)) {
1284 set_bit(SCAN_HW_CANCELLED, &local->scanning);
1285 if (local->ops->cancel_hw_scan)
1286 drv_cancel_hw_scan(local,
1287 rcu_dereference_protected(local->scan_sdata,
1288 lockdep_is_held(&local->hw.wiphy->mtx)));
1292 wiphy_delayed_work_cancel(local->hw.wiphy, &local->scan_work);
1294 memset(&local->scan_info, 0, sizeof(local->scan_info));
1295 __ieee80211_scan_completed(&local->hw, true);
1301 struct ieee80211_local *local = sdata->local;
1310 lockdep_assert_wiphy(local->hw.wiphy);
1312 iebufsz = local->scan_ies_len + req->ie_len;
1314 if (!local->ops->sched_scan_start)
1318 if (local->hw.wiphy->bands[i]) {
1343 ret = drv_sched_scan_start(local, sdata, req, &sched_scan_ies);
1345 rcu_assign_pointer(local->sched_scan_sdata, sdata);
1346 rcu_assign_pointer(local->sched_scan_req, req);
1354 RCU_INIT_POINTER(local->sched_scan_sdata, NULL);
1355 RCU_INIT_POINTER(local->sched_scan_req, NULL);
1364 struct ieee80211_local *local = sdata->local;
1366 lockdep_assert_wiphy(local->hw.wiphy);
1368 if (rcu_access_pointer(local->sched_scan_sdata))
1374 int ieee80211_request_sched_scan_stop(struct ieee80211_local *local)
1379 lockdep_assert_wiphy(local->hw.wiphy);
1381 if (!local->ops->sched_scan_stop)
1385 RCU_INIT_POINTER(local->sched_scan_req, NULL);
1387 sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata,
1388 lockdep_is_held(&local->hw.wiphy->mtx));
1390 ret = drv_sched_scan_stop(local, sched_scan_sdata);
1392 RCU_INIT_POINTER(local->sched_scan_sdata, NULL);
1400 struct ieee80211_local *local = hw_to_local(hw);
1402 trace_api_sched_scan_results(local);
1408 void ieee80211_sched_scan_end(struct ieee80211_local *local)
1410 lockdep_assert_wiphy(local->hw.wiphy);
1412 if (!rcu_access_pointer(local->sched_scan_sdata))
1415 RCU_INIT_POINTER(local->sched_scan_sdata, NULL);
1418 RCU_INIT_POINTER(local->sched_scan_req, NULL);
1420 cfg80211_sched_scan_stopped_locked(local->hw.wiphy, 0);
1426 struct ieee80211_local *local =
1430 ieee80211_sched_scan_end(local);
1435 struct ieee80211_local *local = hw_to_local(hw);
1437 trace_api_sched_scan_stopped(local);
1444 if (local->in_reconfig)
1447 wiphy_work_queue(hw->wiphy, &local->sched_scan_stopped_work);