This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / include / linux / crbce.h
1 /* 
2  * crbce.h
3  *
4  * Copyright (C) Hubertus Franke, IBM Corp. 2003
5  * 
6  * This files contains the type definition of the record 
7  * created by the CRBCE CKRM classification engine
8  * 
9  *
10  * Latest version, more details at http://ckrm.sf.net
11  * 
12  * This program is free software; you can redistribute it and/or modify it
13  * under the terms of version 2.1 of the GNU Lesser General Public License
14  * as published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it would be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  * 
20  *
21  */
22  
23
24 /*
25  * Changes
26  *
27  * 2003-11-11   Created                                 by H.Franke
28  * 2003-12-01   Sanitized for Delivery                  by H.Franke
29  *        
30  */
31
32 #ifndef CRBCE_RECORDS_H
33 #define CRBCE_RECORDS_H
34
35 #ifdef __KERNEL__
36 #include <linux/autoconf.h>     
37 #else
38 #define  CONFIG_CKRM
39 #define  CONFIG_CRBCE
40 #define  CONFIG_DELAY_ACCT
41 #endif
42
43 #include <linux/types.h>           
44 #include <linux/ckrm.h>
45 #include <linux/ckrm_ce.h>
46
47 #define CRBCE_UKCC_NAME   "crbce_ukcc"
48 #define CRBCE_UKCC_PATH   "/mnt/relayfs"
49
50 #define CRBCE_UKCC_PATH_NAME   CRBCE_UKCC_PATH"/"CRBCE_UKCC_NAME
51
52 #define CRBCE_MAX_CLASS_NAME_LEN  256
53
54 /****************************************************************
55  * 
56  *  CRBCE EVENT SET is and extension to the standard CKRM_EVENTS
57  *
58  ****************************************************************/
59 enum {
60
61         /* we use the standard CKRM_EVENT_<..> 
62          * to identify reclassification cause actions
63          * and extend by additional ones we need
64          */
65
66         /* up event flow */
67
68         CRBCE_REC_EXIT = CKRM_NUM_EVENTS,
69         CRBCE_REC_DATA_DELIMITER,
70         CRBCE_REC_SAMPLE,
71         CRBCE_REC_TASKINFO,
72         CRBCE_REC_SYS_INFO,
73         CRBCE_REC_CLASS_INFO,
74         CRBCE_REC_KERNEL_CMD_DONE,
75         CRBCE_REC_UKCC_FULL,
76
77         /* down command issueance */
78         CRBCE_REC_KERNEL_CMD,
79
80         CRBCE_NUM_EVENTS
81 };
82
83 struct task_sample_info {
84         uint32_t cpu_running;
85         uint32_t cpu_waiting;
86         uint32_t io_delayed;
87         uint32_t memio_delayed;
88 };
89
90 /*********************************************
91  *          KERNEL -> USER  records          *
92  *********************************************/
93
94 /* we have records with either a time stamp or not */
95 struct crbce_hdr {
96         int type;
97         pid_t pid;
98 };
99
100 struct crbce_hdr_ts {
101         int type;
102         pid_t pid;
103         uint32_t jiffies;
104         uint64_t cls;
105 };
106
107 /* individual records */
108
109 struct crbce_rec_fork {
110         struct crbce_hdr_ts hdr;
111         pid_t ppid;
112 };
113
114 struct crbce_rec_data_delim {
115         struct crbce_hdr_ts hdr;
116         int is_stop;            /* 0 start, 1 stop */
117 };
118
119 struct crbce_rec_task_data {
120         struct crbce_hdr_ts hdr;
121         struct task_sample_info sample;
122         struct task_delay_info delay;
123 };
124
125 struct crbce_ukcc_full {
126         struct crbce_hdr_ts hdr;
127 };
128
129 struct crbce_class_info {
130         struct crbce_hdr_ts hdr;
131         int action;
132         int namelen;
133         char name[CRBCE_MAX_CLASS_NAME_LEN];
134 };
135
136 /*********************************************
137  *           USER -> KERNEL records          *
138  *********************************************/
139
140 enum crbce_kernel_cmd {
141         CRBCE_CMD_START,
142         CRBCE_CMD_STOP,
143         CRBCE_CMD_SET_TIMER,
144         CRBCE_CMD_SEND_DATA,
145 };
146
147 struct crbce_command {
148         int type;               /* we need this for the K->U reflection */
149         int cmd;
150         uint32_t len;   /* added in the kernel for reflection */
151 };
152
153 #define set_cmd_hdr(rec,tok) \
154 ((rec).hdr.type=CRBCE_REC_KERNEL_CMD,(rec).hdr.cmd=(tok))
155
156 struct crbce_cmd_done {
157         struct crbce_command hdr;
158         int rc;
159 };
160
161 struct crbce_cmd {
162         struct crbce_command hdr;
163 };
164
165 struct crbce_cmd_send_data {
166         struct crbce_command hdr;
167         int delta_mode;
168 };
169
170 struct crbce_cmd_settimer {
171         struct crbce_command hdr;
172         uint32_t interval;      /* in msec .. 0 means stop */
173 };
174
175 #endif