00001 #ifndef __QMGR_BASE_H__
00002 #define __QMGR_BASE_H__
00003
00026 #include <linux/aquosa/qos_types.h>
00027 #include <linux/aquosa/qmgr_types.h>
00028 #include <linux/aquosa/qmgr_time.h>
00029 #include <linux/aquosa/qmgr_config.h>
00030 #include <linux/aquosa/qos_queue.h>
00031
00032
00033
00034
00035
00045 typedef struct qmgr_pred_struct {
00047 qos_rv (*finalize)(struct qmgr_pred_struct *pred);
00049 qos_rv (*add_sample)(struct qmgr_pred_struct *pred, qres_time_t last_sample);
00051 qos_rv (*skip_sample)(struct qmgr_pred_struct *pred);
00052 qres_time_t (*get_exp_value)(struct qmgr_pred_struct *pred);
00053 void (*get_exp_range)(struct qmgr_pred_struct *pred, qres_time_t *min, qres_time_t *max);
00054 qres_time_t (*get_std_dev)(struct qmgr_pred_struct *pred);
00055 qres_time_t (*get_pos_dev)(struct qmgr_pred_struct *pred);
00056 qres_time_t (*get_neg_dev)(struct qmgr_pred_struct *pred);
00057 enum qmgr_pred_type type;
00058 } qmgr_pred_t;
00059
00061 qos_rv qmgr_pred_final(qmgr_pred_t *pred);
00062
00073 qos_rv qmgr_set_pred_user(qmgr_pred_t *pred);
00074
00075
00076
00077
00078
00082 typedef struct qmgr_ctrl_struct {
00084 qos_rv (*finalize)(struct qmgr_ctrl_struct *ctrl);
00086 qos_bw_t (*fb_func)(struct qmgr_ctrl_struct *ctrl, qres_time_t sched_err);
00087 enum qmgr_ctrl_type type;
00088 qres_time_t old_sched_err;
00089 qres_time_t old_eps;
00090 qres_time_t period;
00091 qos_bw_t max_bandwidth;
00092 qos_bw_t min_bandwidth;
00093 qres_time_t server_period;
00094 qmgr_pred_t *pred;
00095 qmgr_time_t time;
00096 qres_time_t job_exec_time;
00097 struct timespec deadline;
00098
00099 } qmgr_ctrl_t;
00100
00102 qos_rv qmgr_ctrl_final(qmgr_ctrl_t *ctrl);
00103
00109 qos_rv qmgr_set_ctrl_user(qmgr_ctrl_t *ctrl);
00110
00131 qos_bw_t qmgr_ctrl_end_cycle(qmgr_ctrl_t *ctrl, int skip, qres_time_t *p_sched_error, qres_time_t *p_exec_time);
00132
00133
00134
00135
00136
00140 typedef struct qmgr_struct {
00141 qmgr_ctrl_t *ctrl;
00142 qmgr_pred_t *pred;
00143 } qmgr_t;
00144
00145
00146
00147
00148
00152 typedef enum {
00153 QMGR_LOC_UNKNOWN,
00154 QMGR_LOC_KS,
00155 QMGR_LOC_US,
00156 QMGR_LOC_XS
00157 } qmgr_location_t;
00158
00162 typedef struct qmgr_pred_params_struct {
00163 enum qmgr_pred_type type;
00164 } qmgr_pred_params_t;
00165
00168 qos_rv qmgr_pred_init(qmgr_pred_t *pred, qmgr_pred_params_t *params);
00169
00173 typedef struct qmgr_ctrl_params_struct {
00174 enum qmgr_ctrl_type type;
00175 qos_bw_t max_bandwidth;
00176 qos_bw_t min_bandwidth;
00177 qres_time_t period;
00178 qres_time_t server_period;
00179 } qmgr_ctrl_params_t;
00180
00183 qos_rv qmgr_ctrl_init(qmgr_ctrl_t *ctrl, qmgr_ctrl_params_t *params);
00184
00189 struct qmgr_params_struct;
00190
00191 qos_rv qmgr_create_params(qmgr_t **pp, struct qmgr_params_struct *params);
00192 qos_rv qmgr_ctrl_create(qmgr_ctrl_t **pp, qmgr_ctrl_params_t *params);
00193 qos_rv qmgr_pred_create(qmgr_pred_t **pp, qmgr_pred_params_t *params);
00194
00198 qos_rv qmgr_destroy(qmgr_t *qmgr);
00199 qos_rv qmgr_ctrl_destroy(qmgr_ctrl_t *fb);
00200 qos_rv qmgr_pred_destroy(qmgr_pred_t *pred);
00201
00203 void qmgr_ctrl_set_predictor(qmgr_ctrl_t *ctrl, qmgr_pred_t *pred);
00204
00207 typedef struct qmgr_lib_descriptor_t {
00209 qmgr_location_t location;
00212 qos_rv (*set_defaults)(void);
00213 } qmgr_lib_descriptor_t;
00214
00215 typedef qos_rv (*qmgr_pred_init_f)(qmgr_pred_t *self, qmgr_pred_params_t *params);
00216
00217 typedef struct qmgr_pred_descriptor_t {
00219 int obj_size;
00221 qmgr_pred_init_f obj_init;
00222 } qmgr_pred_descriptor_t;
00223
00224 typedef qos_rv (*qmgr_ctrl_init_f)(qmgr_ctrl_t *self, qmgr_ctrl_params_t *params);
00225
00226 typedef struct qmgr_ctrl_descriptor_t {
00228 int obj_size;
00230 qmgr_ctrl_init_f obj_init;
00231 } qmgr_ctrl_descriptor_t;
00232
00235 extern qmgr_pred_descriptor_t *pred_descriptors[QMGR_NUM_PREDS];
00236
00241 extern qmgr_ctrl_descriptor_t *ctrl_descriptors[QMGR_NUM_CTRLS];
00242
00244 qos_rv qmgr_ctrl_begin_cycle(qmgr_ctrl_t *ctrl);
00245
00247 qos_bw_t qmgr_ctrl_begin_cycle_deadline(qmgr_ctrl_t *ctrl, struct timespec *now, struct timespec *abs_dl);
00248
00252 void qmgr_ctrl_set_deadline(qmgr_ctrl_t *ctrl, const struct timespec *abs_dl);
00253
00255 void qmgr_ctrl_get_deadline(qmgr_ctrl_t *ctrl, struct timespec *abs_dl);
00256
00257 #endif