00001 00011 #ifndef __RRES_SERVER_H__ 00012 #define __RRES_SERVER_H__ 00013 00014 #ifndef __RRES_READY_QUEUE_H__ 00015 # error "Include rres_ready_queue.h first" 00016 #endif 00017 00018 #include "rres_config.h" 00019 #include "qos_debug.h" 00020 #include "qos_types.h" 00021 #include "qos_list.h" 00022 #include "kal_timer.h" 00023 #include "kal_sched.h" 00024 00026 struct server_t { 00027 qres_sid_t id; 00028 kal_time_t period; 00029 qres_time_t period_us; 00030 kal_time_t max_budget; 00031 qres_time_t max_budget_us; 00032 kal_time_t c; 00033 kal_time_t deadline; 00034 qos_bw_t U_current; 00035 struct rres_stat { 00036 unsigned long int n_rcg; 00037 kal_time_t exec_time; 00038 } stat; 00039 struct list_head slist; 00041 unsigned int flags; 00044 rq_placeholder_t rq_ph; 00045 00047 qos_bw_t (*get_bandwidth)(struct server_t *srv); 00048 00050 qos_rv (*cleanup)(struct server_t *srv); 00051 00052 struct list_head ready_tasks; 00053 struct list_head blocked_tasks; 00054 kal_timer_t reactive; 00055 #ifdef CONST_TIME_DISPATCH 00056 struct list_head disp_tasks; 00057 #endif 00058 00059 int forbid_reorder; 00060 unsigned int weight; 00061 }; 00062 00063 typedef struct server_t server_t; 00064 00065 extern qos_bw_t U_tot; 00066 #ifdef SHRUB 00067 extern qos_bw_t U_active_tot; 00068 #endif 00069 00073 #define U_LUB2 (U_LUB+r2bw_c(1,100)) 00074 00075 static inline qos_rv rres_cleanup_server(server_t *srv) { 00076 if (RRES_PARANOID) 00077 qos_chk_do(srv != NULL, return QOS_E_INTERNAL_ERROR); 00078 return srv->cleanup(srv); 00079 } 00080 00084 static inline void rres_set_weight(server_t *srv, unsigned int weight) { 00085 srv->weight = weight; 00086 } 00087 00088 static inline unsigned int rres_get_weight(server_t *srv) { 00089 return srv->weight; 00090 } 00091 00093 struct task_list { 00094 struct task_struct *task; 00095 struct list_head node; 00096 qos_bool_t is_stopped; 00097 server_t *srv; 00098 }; 00099 00100 #endif 00101