Lines Matching +full:low +full:- +full:latency
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2024-2025 Intel Corporation
22 struct iwl_mld_low_latency *ll = &mld->low_latency; in iwl_mld_calc_low_latency()
24 u8 num_rx_q = mld->trans->info.num_rxqs; in iwl_mld_calc_low_latency()
33 if (!ll->window_start[mac_id]) in iwl_mld_calc_low_latency()
37 time_after(timestamp, ll->window_start[mac_id] + in iwl_mld_calc_low_latency()
41 ll->window_start[mac_id] = timestamp; in iwl_mld_calc_low_latency()
45 &mld->low_latency.pkts_counters[q]; in iwl_mld_calc_low_latency()
47 spin_lock_bh(&counters->lock); in iwl_mld_calc_low_latency()
49 total_vo_vi_pkts += counters->vo_vi[mac_id]; in iwl_mld_calc_low_latency()
52 counters->vo_vi[mac_id] = 0; in iwl_mld_calc_low_latency()
54 spin_unlock_bh(&counters->lock); in iwl_mld_calc_low_latency()
58 * disabling only if the low-latency period expired and in iwl_mld_calc_low_latency()
62 mld->low_latency.result[mac_id] = true; in iwl_mld_calc_low_latency()
64 mld->low_latency.result[mac_id] = false; in iwl_mld_calc_low_latency()
66 global_low_latency |= mld->low_latency.result[mac_id]; in iwl_mld_calc_low_latency()
77 bool prev = mld_vif->low_latency_causes & LOW_LATENCY_TRAFFIC; in iwl_mld_low_latency_iter()
80 if (WARN_ON(mld_vif->fw_id >= ARRAY_SIZE(mld->low_latency.result))) in iwl_mld_low_latency_iter()
83 low_latency = mld->low_latency.result[mld_vif->fw_id]; in iwl_mld_low_latency_iter()
97 if (mld->fw_status.in_hw_restart) in iwl_mld_low_latency_wk()
106 /* Update the timestamp now after the low-latency calculation */ in iwl_mld_low_latency_wk()
107 mld->low_latency.timestamp = timestamp; in iwl_mld_low_latency_wk()
109 /* If low-latency is active we need to force re-evaluation after in iwl_mld_low_latency_wk()
110 * 10 seconds, so that we can disable low-latency when in iwl_mld_low_latency_wk()
111 * the low-latency traffic ends. in iwl_mld_low_latency_wk()
117 * updates triggered by traffic - those happen whenever the in iwl_mld_low_latency_wk()
121 wiphy_delayed_work_queue(mld->wiphy, &mld->low_latency.work, in iwl_mld_low_latency_wk()
124 ieee80211_iterate_active_interfaces_mtx(mld->hw, in iwl_mld_low_latency_wk()
131 struct iwl_mld_low_latency *ll = &mld->low_latency; in iwl_mld_low_latency_init()
134 ll->pkts_counters = kcalloc(mld->trans->info.num_rxqs, in iwl_mld_low_latency_init()
135 sizeof(*ll->pkts_counters), GFP_KERNEL); in iwl_mld_low_latency_init()
136 if (!ll->pkts_counters) in iwl_mld_low_latency_init()
137 return -ENOMEM; in iwl_mld_low_latency_init()
139 for (int q = 0; q < mld->trans->info.num_rxqs; q++) in iwl_mld_low_latency_init()
140 spin_lock_init(&ll->pkts_counters[q].lock); in iwl_mld_low_latency_init()
142 wiphy_delayed_work_init(&ll->work, iwl_mld_low_latency_wk); in iwl_mld_low_latency_init()
144 ll->timestamp = ts; in iwl_mld_low_latency_init()
146 /* The low-latency window_start will be initialized per-MAC on in iwl_mld_low_latency_init()
155 struct iwl_mld_low_latency *ll = &mld->low_latency; in iwl_mld_low_latency_free()
157 kfree(ll->pkts_counters); in iwl_mld_low_latency_free()
158 ll->pkts_counters = NULL; in iwl_mld_low_latency_free()
163 struct iwl_mld_low_latency *ll = &mld->low_latency; in iwl_mld_low_latency_restart_cleanup()
165 ll->timestamp = jiffies; in iwl_mld_low_latency_restart_cleanup()
167 memset(ll->window_start, 0, sizeof(ll->window_start)); in iwl_mld_low_latency_restart_cleanup()
168 memset(ll->result, 0, sizeof(ll->result)); in iwl_mld_low_latency_restart_cleanup()
170 for (int q = 0; q < mld->trans->info.num_rxqs; q++) in iwl_mld_low_latency_restart_cleanup()
171 memset(ll->pkts_counters[q].vo_vi, 0, in iwl_mld_low_latency_restart_cleanup()
172 sizeof(ll->pkts_counters[q].vo_vi)); in iwl_mld_low_latency_restart_cleanup()
192 IWL_ERR(mld, "Failed to send low latency command\n"); in iwl_mld_send_low_latency_cmd()
201 mld_vif->low_latency_causes |= cause; in iwl_mld_vif_set_low_latency()
203 mld_vif->low_latency_causes &= ~cause; in iwl_mld_vif_set_low_latency()
221 if (iwl_mld_send_low_latency_cmd(mld, low_latency, mld_vif->fw_id)) { in iwl_mld_vif_update_low_latency()
222 /* revert to previous low-latency state */ in iwl_mld_vif_update_low_latency()
250 if (!hdr || !ieee80211_is_data_qos(hdr->frame_control)) in iwl_mld_is_vo_vi_pkt()
266 struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(mld_sta->vif); in iwl_mld_low_latency_update_counters()
269 u8 fw_id = mld_vif->fw_id; in iwl_mld_low_latency_update_counters()
272 if (WARN_ON_ONCE(!mld->low_latency.pkts_counters)) in iwl_mld_low_latency_update_counters()
275 if (WARN_ON_ONCE(fw_id >= ARRAY_SIZE(counters->vo_vi) || in iwl_mld_low_latency_update_counters()
276 queue >= mld->trans->info.num_rxqs)) in iwl_mld_low_latency_update_counters()
279 if (mld->low_latency.stopped) in iwl_mld_low_latency_update_counters()
285 counters = &mld->low_latency.pkts_counters[queue]; in iwl_mld_low_latency_update_counters()
287 spin_lock_bh(&counters->lock); in iwl_mld_low_latency_update_counters()
288 counters->vo_vi[fw_id]++; in iwl_mld_low_latency_update_counters()
289 spin_unlock_bh(&counters->lock); in iwl_mld_low_latency_update_counters()
292 if (!mld->low_latency.window_start[fw_id]) in iwl_mld_low_latency_update_counters()
293 mld->low_latency.window_start[fw_id] = ts; in iwl_mld_low_latency_update_counters()
295 if (time_is_before_jiffies(mld->low_latency.timestamp + MLD_LL_PERIOD)) in iwl_mld_low_latency_update_counters()
296 wiphy_delayed_work_queue(mld->wiphy, &mld->low_latency.work, in iwl_mld_low_latency_update_counters()
302 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_low_latency_stop()
304 mld->low_latency.stopped = true; in iwl_mld_low_latency_stop()
306 wiphy_delayed_work_cancel(mld->wiphy, &mld->low_latency.work); in iwl_mld_low_latency_stop()
311 struct iwl_mld_low_latency *ll = &mld->low_latency; in iwl_mld_low_latency_restart()
315 lockdep_assert_wiphy(mld->wiphy); in iwl_mld_low_latency_restart()
317 ll->timestamp = ts; in iwl_mld_low_latency_restart()
318 mld->low_latency.stopped = false; in iwl_mld_low_latency_restart()
321 ll->window_start[mac] = 0; in iwl_mld_low_latency_restart()
322 low_latency |= ll->result[mac]; in iwl_mld_low_latency_restart()
324 for (int q = 0; q < mld->trans->info.num_rxqs; q++) { in iwl_mld_low_latency_restart()
325 spin_lock_bh(&ll->pkts_counters[q].lock); in iwl_mld_low_latency_restart()
326 ll->pkts_counters[q].vo_vi[mac] = 0; in iwl_mld_low_latency_restart()
327 spin_unlock_bh(&ll->pkts_counters[q].lock); in iwl_mld_low_latency_restart()
331 /* if low latency is active, force re-evaluation to cover the case of in iwl_mld_low_latency_restart()
335 wiphy_delayed_work_queue(mld->wiphy, &ll->work, MLD_LL_PERIOD); in iwl_mld_low_latency_restart()