• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * rtg control interface
4  *
5  * Copyright (c) 2022-2023 Huawei Technologies Co., Ltd.
6  */
7 
8 #ifndef __RTG_CTL_H
9 #define __RTG_CTL_H
10 
11 #include <linux/compat.h>
12 #include <linux/uaccess.h>
13 #include <linux/sched/rtg_ctrl.h>
14 
15 #include "frame_rtg.h"
16 
17 /* set rtg */
18 #define INVALID_VALUE 0xffff
19 #define DEFAULT_RT_PRIO 97
20 
21 #define MAX_DATA_LEN 256
22 #define DECIMAL 10
23 #define DEFAULT_MAX_UTIL 1024
24 #define MAX_SUBPROCESS_NUM 8
25 
26 #define RTG_ID_INVALID (-1)
27 #define DEFAULT_MAX_RT_FRAME 3
28 #define MAX_RT_THREAD (MAX_TID_NUM + 2)
29 #define INIT_VALUE		(-1)
30 #define UPDATE_RTG_FRAME (1 << 0)
31 #define ADD_RTG_FRAME (1 << 1)
32 #define CLEAR_RTG_FRAME (1 << 2)
33 
34 #define DEFAULT_FREQ_CYCLE 4
35 #define MIN_FREQ_CYCLE 1
36 #define MAX_FREQ_CYCLE 16
37 #define DEFAULT_INVALID_INTERVAL 50
38 
39 /* proc_state */
40 enum proc_state {
41 	STATE_MIN = 0,
42 	FRAME_DRAWING,
43 	FRAME_RME_MAX = 19,
44 	/* rme end */
45 	FRAME_END_STATE = FRAME_RME_MAX + 1,
46 
47 	FRAME_CLICK = 100,
48 	STATE_MAX,
49 };
50 
51 enum rtg_config {
52 	RTG_FREQ_CYCLE,
53 	RTG_FRAME_MAX_UTIL,
54 	RTG_INVALID_INTERVAL,
55 	RTG_CONFIG_NUM,
56 };
57 
58 enum rtg_err_no {
59 	SUCC = 0,
60 	RTG_DISABLED = 1,
61 	INVALID_ARG,
62 	INVALID_MAGIC,
63 	INVALID_CMD,
64 	FRAME_ERR_PID = 100,
65 	NO_FREE_MULTI_FRAME,
66 	NOT_MULTI_FRAME,
67 	INVALID_RTG_ID,
68 	NO_RT_FRAME,
69 };
70 
71 struct rtg_grp_data {
72 	int rtg_cmd;
73 	int grp_id;
74 	int grp_type;
75 	int rt_cnt;
76 	int tid_num;
77 	int tids[MAX_TID_NUM];
78 };
79 
80 struct rtg_proc_data {
81 	int rtgid;
82 	int type;
83 	int thread[MAX_TID_NUM];
84 	int rtcnt;
85 };
86 
87 #endif
88