Lines Matching +full:scan +full:- +full:interval +full:- +full:ms

1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2024-2025 Intel Corporation
12 #include "scan.h"
44 (void *)&pkt->data; in iwl_mld_fill_stats_from_oper_notif()
46 &notif->per_sta[fw_sta_id]; in iwl_mld_fill_stats_from_oper_notif()
51 * In that case, set the latest non-zero value we stored in iwl_mld_fill_stats_from_oper_notif()
55 link_sta = rcu_dereference(mld->fw_id_to_link_sta[fw_sta_id]); in iwl_mld_fill_stats_from_oper_notif()
63 if (per_sta->average_energy) in iwl_mld_fill_stats_from_oper_notif()
64 mld_link_sta->signal_avg = in iwl_mld_fill_stats_from_oper_notif()
65 -(s8)le32_to_cpu(per_sta->average_energy); in iwl_mld_fill_stats_from_oper_notif()
67 sinfo->signal_avg = mld_link_sta->signal_avg; in iwl_mld_fill_stats_from_oper_notif()
68 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL_AVG); in iwl_mld_fill_stats_from_oper_notif()
84 u16 cmd = WIDE_ID(pkt->hdr.group_id, pkt->hdr.cmd); in iwl_mld_wait_stats_handler()
88 iwl_mld_fill_stats_from_oper_notif(stats_data->mld, pkt, in iwl_mld_wait_stats_handler()
89 stats_data->fw_sta_id, in iwl_mld_wait_stats_handler()
90 stats_data->sinfo); in iwl_mld_wait_stats_handler()
116 .fw_sta_id = mld_sta->deflink.fw_id, in iwl_mld_fw_stats_to_mac80211()
123 iwl_init_notification_wait(&mld->notif_wait, &stats_wait, in iwl_mld_fw_stats_to_mac80211()
130 iwl_remove_notification(&mld->notif_wait, &stats_wait); in iwl_mld_fw_stats_to_mac80211()
134 /* Wait 500ms for OPERATIONAL, PART1, and END notifications, in iwl_mld_fw_stats_to_mac80211()
138 ret = iwl_wait_notification(&mld->notif_wait, &stats_wait, HZ / 2); in iwl_mld_fw_stats_to_mac80211()
145 * interval. The response we got here shouldn't be processed by in iwl_mld_fw_stats_to_mac80211()
169 struct rate_info *rinfo = &sinfo->txrate; in iwl_mld_sta_stats_fill_txrate()
170 u32 rate_n_flags = mld_sta->deflink.last_rate_n_flags; in iwl_mld_sta_stats_fill_txrate()
174 sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); in iwl_mld_sta_stats_fill_txrate()
178 rinfo->bw = RATE_INFO_BW_20; in iwl_mld_sta_stats_fill_txrate()
181 rinfo->bw = RATE_INFO_BW_40; in iwl_mld_sta_stats_fill_txrate()
184 rinfo->bw = RATE_INFO_BW_80; in iwl_mld_sta_stats_fill_txrate()
187 rinfo->bw = RATE_INFO_BW_160; in iwl_mld_sta_stats_fill_txrate()
190 rinfo->bw = RATE_INFO_BW_320; in iwl_mld_sta_stats_fill_txrate()
204 rinfo->legacy = 10; in iwl_mld_sta_stats_fill_txrate()
207 rinfo->legacy = 20; in iwl_mld_sta_stats_fill_txrate()
210 rinfo->legacy = 55; in iwl_mld_sta_stats_fill_txrate()
213 rinfo->legacy = 110; in iwl_mld_sta_stats_fill_txrate()
216 rinfo->legacy = 60; in iwl_mld_sta_stats_fill_txrate()
219 rinfo->legacy = 90; in iwl_mld_sta_stats_fill_txrate()
222 rinfo->legacy = 120; in iwl_mld_sta_stats_fill_txrate()
225 rinfo->legacy = 180; in iwl_mld_sta_stats_fill_txrate()
228 rinfo->legacy = 240; in iwl_mld_sta_stats_fill_txrate()
231 rinfo->legacy = 360; in iwl_mld_sta_stats_fill_txrate()
234 rinfo->legacy = 480; in iwl_mld_sta_stats_fill_txrate()
237 rinfo->legacy = 540; in iwl_mld_sta_stats_fill_txrate()
242 rinfo->nss = u32_get_bits(rate_n_flags, RATE_MCS_NSS_MSK) + 1; in iwl_mld_sta_stats_fill_txrate()
245 rinfo->mcs = RATE_HT_MCS_INDEX(rate_n_flags); in iwl_mld_sta_stats_fill_txrate()
247 rinfo->mcs = u32_get_bits(rate_n_flags, RATE_MCS_CODE_MSK); in iwl_mld_sta_stats_fill_txrate()
250 rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; in iwl_mld_sta_stats_fill_txrate()
254 rinfo->flags |= RATE_INFO_FLAGS_EHT_MCS; in iwl_mld_sta_stats_fill_txrate()
259 rinfo->flags |= RATE_INFO_FLAGS_HE_MCS; in iwl_mld_sta_stats_fill_txrate()
262 rinfo->bw = RATE_INFO_BW_HE_RU; in iwl_mld_sta_stats_fill_txrate()
263 rinfo->he_ru_alloc = NL80211_RATE_INFO_HE_RU_ALLOC_106; in iwl_mld_sta_stats_fill_txrate()
270 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_0_8; in iwl_mld_sta_stats_fill_txrate()
272 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_1_6; in iwl_mld_sta_stats_fill_txrate()
274 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_3_2; in iwl_mld_sta_stats_fill_txrate()
276 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_0_8; in iwl_mld_sta_stats_fill_txrate()
280 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_0_8; in iwl_mld_sta_stats_fill_txrate()
282 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_1_6; in iwl_mld_sta_stats_fill_txrate()
284 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_3_2; in iwl_mld_sta_stats_fill_txrate()
288 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_1_6; in iwl_mld_sta_stats_fill_txrate()
290 rinfo->he_gi = NL80211_RATE_INFO_HE_GI_3_2; in iwl_mld_sta_stats_fill_txrate()
295 rinfo->he_dcm = 1; in iwl_mld_sta_stats_fill_txrate()
298 rinfo->flags |= RATE_INFO_FLAGS_MCS; in iwl_mld_sta_stats_fill_txrate()
301 rinfo->flags |= RATE_INFO_FLAGS_VHT_MCS; in iwl_mld_sta_stats_fill_txrate()
316 if (hweight16(vif->active_links) > 1) in iwl_mld_mac80211_sta_statistics()
319 if (iwl_mld_fw_stats_to_mac80211(mld_sta->mld, mld_sta, sinfo)) in iwl_mld_mac80211_sta_statistics()
336 u32 elapsed_usec = curr_ts_usec - last_ts_usec; in iwl_mld_stats_load_percentage()
348 u32 last_ts_usec = mld->scan.traffic_load.last_stats_ts_usec; in iwl_mld_stats_recalc_traffic_load()
359 mld->scan.traffic_load.status = IWL_MLD_TRAFFIC_HIGH; in iwl_mld_stats_recalc_traffic_load()
361 mld->scan.traffic_load.status = IWL_MLD_TRAFFIC_MEDIUM; in iwl_mld_stats_recalc_traffic_load()
363 mld->scan.traffic_load.status = IWL_MLD_TRAFFIC_LOW; in iwl_mld_stats_recalc_traffic_load()
366 mld->scan.traffic_load.last_stats_ts_usec = curr_ts_usec; in iwl_mld_stats_recalc_traffic_load()
372 struct iwl_mld *mld = iwl_mld_vif_from_mac80211(vif)->mld; in iwl_mld_update_link_sig()
376 IWL_DEBUG_RX(mld, "RSSI is 0 - skip signal based decision\n"); in iwl_mld_update_link_sig()
390 iwl_mld_get_emlsr_rssi_thresh(mld, &bss_conf->chanreq.oper, in iwl_mld_update_link_sig()
396 bss_conf->link_id)); in iwl_mld_update_link_sig()
407 fw_id < ARRAY_SIZE(mld->fw_id_to_bss_conf); in iwl_mld_process_per_link_stats()
413 bss_conf = wiphy_dereference(mld->wiphy, in iwl_mld_process_per_link_stats()
414 mld->fw_id_to_bss_conf[fw_id]); in iwl_mld_process_per_link_stats()
415 if (!bss_conf || bss_conf->vif->type != NL80211_IFTYPE_STATION) in iwl_mld_process_per_link_stats()
420 total_airtime_usec += le32_to_cpu(link_stats->air_time); in iwl_mld_process_per_link_stats()
422 sig = -le32_to_cpu(link_stats->beacon_filter_average_energy); in iwl_mld_process_per_link_stats()
423 iwl_mld_update_link_sig(bss_conf->vif, sig, bss_conf); in iwl_mld_process_per_link_stats()
436 for (int i = 0; i < mld->fw->ucode_capa.num_stations; i++) { in iwl_mld_process_per_sta_stats()
438 wiphy_dereference(mld->wiphy, in iwl_mld_process_per_sta_stats()
439 mld->fw_id_to_link_sta[i]); in iwl_mld_process_per_sta_stats()
442 -(s8)le32_to_cpu(per_sta[i].average_energy); in iwl_mld_process_per_sta_stats()
451 mld_link_sta->signal_avg = avg_energy; in iwl_mld_process_per_sta_stats()
463 if (WARN_ON(phy->fw_id >= IWL_STATS_MAX_PHY_OPERATIONAL)) in iwl_mld_fill_chanctx_stats()
466 phy->channel_load_by_us = in iwl_mld_fill_chanctx_stats()
467 le32_to_cpu(per_phy[phy->fw_id].channel_load_by_us); in iwl_mld_fill_chanctx_stats()
469 old_load = phy->avg_channel_load_not_by_us; in iwl_mld_fill_chanctx_stats()
470 new_load = le32_to_cpu(per_phy[phy->fw_id].channel_load_not_by_us); in iwl_mld_fill_chanctx_stats()
472 if (IWL_FW_CHECK(phy->mld, in iwl_mld_fill_chanctx_stats()
480 phy->avg_channel_load_not_by_us = (new_load >> 1) + in iwl_mld_fill_chanctx_stats()
491 ieee80211_iter_chan_contexts_mtx(mld->hw, in iwl_mld_process_per_phy_stats()
501 (void *)&pkt->data; in iwl_mld_handle_stats_oper_notif()
502 u32 curr_ts_usec = le32_to_cpu(stats->time_stamp); in iwl_mld_handle_stats_oper_notif()
504 BUILD_BUG_ON(ARRAY_SIZE(stats->per_sta) != IWL_STATION_COUNT_MAX); in iwl_mld_handle_stats_oper_notif()
505 BUILD_BUG_ON(ARRAY_SIZE(stats->per_link) < in iwl_mld_handle_stats_oper_notif()
506 ARRAY_SIZE(mld->fw_id_to_bss_conf)); in iwl_mld_handle_stats_oper_notif()
508 iwl_mld_process_per_link_stats(mld, stats->per_link, curr_ts_usec); in iwl_mld_handle_stats_oper_notif()
509 iwl_mld_process_per_sta_stats(mld, stats->per_sta); in iwl_mld_handle_stats_oper_notif()
510 iwl_mld_process_per_phy_stats(mld, stats->per_phy); in iwl_mld_handle_stats_oper_notif()