| 1 |
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ |
| 2 |
/* |
| 3 |
* Copyright (C) 2024 Intel Corporation |
| 4 |
*/ |
| 5 |
#ifndef __iwl_mld_low_latency_h__ |
| 6 |
#define __iwl_mld_low_latency_h__ |
| 7 |
|
| 8 |
/** |
| 9 |
* struct iwl_mld_low_latency_packets_counters - Packets counters |
| 10 |
* @lock: synchronize the counting in data path against the worker |
| 11 |
* @vo_vi: per-mac, counts the number of TX and RX voice and video packets |
| 12 |
*/ |
| 13 |
struct iwl_mld_low_latency_packets_counters { |
| 14 |
spinlock_t lock; |
| 15 |
u32 vo_vi[NUM_MAC_INDEX_DRIVER]; |
| 16 |
} ____cacheline_aligned_in_smp; |
| 17 |
|
| 18 |
/** |
| 19 |
* enum iwl_mld_low_latency_cause - low-latency set causes |
| 20 |
* |
| 21 |
* @LOW_LATENCY_TRAFFIC: indicates low-latency traffic was detected |
| 22 |
* @LOW_LATENCY_DEBUGFS: low-latency mode set from debugfs |
| 23 |
* @LOW_LATENCY_VIF_TYPE: low-latency mode set because of vif type (AP) |
| 24 |
*/ |
| 25 |
enum iwl_mld_low_latency_cause { |
| 26 |
LOW_LATENCY_TRAFFIC = BIT(0), |
| 27 |
LOW_LATENCY_DEBUGFS = BIT(1), |
| 28 |
LOW_LATENCY_VIF_TYPE = BIT(2), |
| 29 |
}; |
| 30 |
|
| 31 |
/** |
| 32 |
* struct iwl_mld_low_latency - Manage low-latency detection and activation. |
| 33 |
* @work: this work is used to detect low-latency by monitoring the number of |
| 34 |
* voice and video packets transmitted in a period of time. If the |
| 35 |
* threshold is reached, low-latency is activated. When active, |
| 36 |
* it is deactivated if the threshold is not reached within a |
| 37 |
* 10-second period. |
| 38 |
* @timestamp: timestamp of the last update. |
| 39 |
* @window_start: per-mac, timestamp of the start of the current window. when |
| 40 |
* the window is over, the counters are reset. |
| 41 |
* @pkts_counters: per-queue array voice/video packet counters |
| 42 |
* @result: per-mac latest low-latency result |
| 43 |
* @stopped: if true, ignore the requests to update the counters |
| 44 |
*/ |
| 45 |
struct iwl_mld_low_latency { |
| 46 |
struct wiphy_delayed_work work; |
| 47 |
unsigned long timestamp; |
| 48 |
unsigned long window_start[NUM_MAC_INDEX_DRIVER]; |
| 49 |
struct iwl_mld_low_latency_packets_counters *pkts_counters; |
| 50 |
bool result[NUM_MAC_INDEX_DRIVER]; |
| 51 |
bool stopped; |
| 52 |
}; |
| 53 |
|
| 54 |
int iwl_mld_low_latency_init(struct iwl_mld *mld); |
| 55 |
void iwl_mld_low_latency_free(struct iwl_mld *mld); |
| 56 |
void iwl_mld_low_latency_restart_cleanup(struct iwl_mld *mld); |
| 57 |
void iwl_mld_vif_update_low_latency(struct iwl_mld *mld, |
| 58 |
struct ieee80211_vif *vif, |
| 59 |
bool low_latency, |
| 60 |
enum iwl_mld_low_latency_cause cause); |
| 61 |
void iwl_mld_low_latency_update_counters(struct iwl_mld *mld, |
| 62 |
struct ieee80211_hdr *hdr, |
| 63 |
struct ieee80211_sta *sta, |
| 64 |
u8 queue); |
| 65 |
void iwl_mld_low_latency_stop(struct iwl_mld *mld); |
| 66 |
void iwl_mld_low_latency_restart(struct iwl_mld *mld); |
| 67 |
|
| 68 |
#endif /* __iwl_mld_low_latency_h__ */ |