summaryrefslogtreecommitdiff
path: root/dynamic_twt_manager.h
blob: fe8b2897522a1f725d5c7d8d2617680f02b15316 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Driver for Wifi performance tracker
 *
 * Copyright 2022 Google LLC.
 *
 * Author: Star Chang <starchang@google.com>
 */
#ifndef __TP_TRACKER_DYNAMIC_TWT_SETUP_H
#define __TP_TRACKER_DYNAMIC_TWT_SETUP_H

#include "debugfs.h"

struct wlan_ptracker_client;
struct wlan_ptracker_core;

struct dytwt_setup_param {
	u8 config_id;
	u8 nego_type;
	u8 trigger_type;
	u32 wake_duration;
	u32 wake_interval;
};

struct dytwt_cap {
	u16 device_cap;
	u16 peer_cap;
};

struct dytwt_pwr_state {
	u64 awake;
	u64 asleep;
};

struct dytwt_client_ops {
	int (*setup)(void *priv, struct dytwt_setup_param *param);
	int (*teardown)(void *priv, struct dytwt_setup_param *param);
	int (*get_cap)(void *priv, struct dytwt_cap *cap);
	int (*get_pwrstates)(void *priv, struct dytwt_pwr_state *state);
};

enum {
	TWT_ACTION_SETUP,
	TWT_ACTION_TEARDOWN,
	TWT_ACTION_MAX,
};

enum {
	TWT_TEST_SETUP,
	TWT_TEST_TEARDOWN,
	TWT_TEST_CAP,
	TWT_TEST_PWRSTATS,
	TWT_TEST_ONOFF,
	TWT_TEST_MAX,
};

struct dytwt_scene_action {
	u32 action;
	struct dytwt_setup_param param;
};

struct dytwt_entry {
	/* base should put as first membor */
	struct history_entry base;
	bool apply;
	u32 rate;
	u32 reason;
	struct dytwt_pwr_state pwr;
} __align(void *);


struct dytwt_manager {
	u32 prev;
	u32 feature_flag;
	u32 state;
	struct history_manager *hm;
	struct dentry *dir;
};

extern int dytwt_init(struct wlan_ptracker_core *core);
extern void dytwt_exit(struct wlan_ptracker_core *core);

#endif /* __TP_TRACKER_DYNAMIC_TWT_SETUP_H */