QoS Supervisor Component

Data Structures

struct  qsup_user_t
 QoS Sup related data for each user. More...
struct  qsup_level_t
 QoS Sup related data for each level. More...

Modules

 QoS Supervisor Kernel Module
 

Mediates bandwidth requests made to the QoS Resource Reservation Kernel Module, enforcing system-level security policy and QoS behaviour configured through the use of level, group and user rules.


 QoS Supervisor Library
 

Allows a privileged application to configure level, group and user rules governing security and guarantees policies enforced by the QoS Supervisor Kernel Module.


Files

file  qsup.c
 

Implementation of the QoS Supervisor module.


Defines

#define QSUP_COEFF_BITS   16
 Number of binary decimal digits in qsup_coeff_t.
#define QSUP_COEFF_ONE   (1ul << QSUP_COEFF_BITS)
 This corresponds to a qsup_coeff_t of 1.0.
#define coeff_apply(a, b)   ((unsigned long) ul_mul_shr((__u32) (a), (__u32) (b), QSUP_COEFF_BITS) )
 Scale (multiply) a bandwidth value by a coefficient.
#define coeff_compute(a, b)   ((unsigned long) ul_shl_div((__u32) (a), QSUP_COEFF_BITS, (__u32) (b)) )
 Compute a coefficient value as the equivalent operation on reals: a/b.
#define MAX_NUM_LEVELS   2

Typedefs

typedef long int qsup_coeff_t
 Bandwidth coefficients are stored as fixed-point integers.
typedef struct qsup_user_t qsup_user_t
 QoS Sup related data for each user.
typedef struct qsup_level_t qsup_level_t
 QoS Sup related data for each level.

Functions

static void qsup_lock_coeffs_read (unsigned long *p_flags)
 Global QSUP coefficients lock.
static void qsup_unlock_coeffs_read (unsigned long flags)
 Unlock QSup coefficients for reading.
static void qsup_lock_coeffs_write (unsigned long *p_flags)
 Lock QSup coefficients for writing.
static void qsup_unlock_coeffs_write (unsigned long flags)
 Unlock QSup coefficients for writing.
static qos_bw_t bw_min (qos_bw_t a, qos_bw_t b)
qos_rv qsup_add_level_rule (int level, qos_bw_t max_bw)
 Add a level rule to the QSUP.
qos_rv qsup_add_group_constraints (int gid, qsup_constraints_t *constr)
 Add a group rule to the QSUP.
qos_rv qsup_add_user_constraints (int uid, qsup_constraints_t *constr)
 Add a user rule to the QSUP.
qos_rv qsup_init ()
 Initialize the QSUP subsystem just after module load into the kernel.
qos_rv qsup_cleanup ()
 Cleanup the QSUP subsystem before unloading the module from kernel.
qsup_constraints_tqsup_find_constr (int uid, int gid)
 Find the constraints in force for the supplied uid/gid pair.
qsup_server_tqsup_find_server_by_id (int server_id)
 Return qsup_server_t structure for specified server_id, or zero if not found.
qos_rv get_user_info (qsup_user_t **pp, int uid)
 Retrieve a qsup_user_t structure for the specified uid.
qos_bw_t qsup_get_max_gua_bw (int uid, int gid)
 Returns the maximum guaranteed bandwidth for the specified user.
qos_rv qsup_get_avail_gua_bw (int uid, int gid, qos_bw_t *p_avail_bw)
 Returns in *p_avail_bw the available guaranteed bw for the specified user.
qos_rv qsup_get_avail_bw (int uid, int gid, qos_bw_t *p_avail_bw)
 Returns in *p_avail_bw the available bw for the specified user.
qos_rv qsup_init_server (qsup_server_t *srv, int uid, int gid, qres_params_t *param)
 Initialize a new qsup_server_t structure.
qos_rv qsup_create_server (qsup_server_t **pp, int uid, int gid, qres_params_t *param)
 Create a new qsup_server_t structure.
qos_rv qsup_cleanup_server (qsup_server_t *srv)
qos_rv qsup_destroy_server (qsup_server_t *srv)
 Destroy a qsup_server_t and free associated resources.
qos_rv qsup_set_required_bw (qsup_server_t *srv, qos_bw_t server_req)
 Sets the required bandwidth for the specified server.
qos_bw_t qsup_get_required_bw (qsup_server_t *srv)
 Gets the required bandwidth for the specified server.
qos_bw_t qsup_get_guaranteed_bw (qsup_server_t *srv)
 Gets the minimum granted bandwidth for the specified server.
void qsup_dump (void)
 Dumps into the log system the QSUP server complete state.
qos_bw_t qsup_get_approved_bw (qsup_server_t *srv)
 Returns the bandwidth approved for the specified server.
qos_rv qsup_reserve_spare (qos_bw_t bw)
 Cannot reserve more than U_LUB as spare, and cannot change the reserved spare when servers are already active.

Variables

qsup_group_rule_tgroup_rules = 0
int num_group_rules = 0
qsup_user_rule_tuser_rules = 0
int num_user_rules = 0
qos_bw_t spare_bw = 0
static qsup_constraints_t default_constraint
qsup_server_tqsup_servers
 Head of global list of created qsup_servers.
int next_server_id
 Id assigned to the next created qsup_server_t.
static qsup_user_tqsup_users
 User related data.
static qsup_level_t qsup_levels [MAX_NUM_LEVELS]
 Level related data.
static qos_bw_t tot_gua_bw = 0
 Sum of guaranteed bandwidths of accepted servers.
static qos_bw_t tot_used_gua_bw = 0
 Sum of actually used guaranteed bw by all servers.

Define Documentation

#define coeff_apply ( a,
 )     ((unsigned long) ul_mul_shr((__u32) (a), (__u32) (b), QSUP_COEFF_BITS) )

Scale (multiply) a bandwidth value by a coefficient.

Definition at line 51 of file qsup.c.

Referenced by qsup_dump(), and qsup_get_approved_bw().

#define coeff_compute ( a,
 )     ((unsigned long) ul_shl_div((__u32) (a), QSUP_COEFF_BITS, (__u32) (b)) )

Compute a coefficient value as the equivalent operation on reals: a/b.

Definition at line 55 of file qsup.c.

Referenced by qsup_set_required_bw().

#define MAX_NUM_LEVELS   2

Definition at line 57 of file qsup.c.

Referenced by qsup_add_level_rule(), qsup_dump(), qsup_init(), and qsup_set_required_bw().

#define QSUP_COEFF_BITS   16

Number of binary decimal digits in qsup_coeff_t.

Definition at line 44 of file qsup.c.

#define QSUP_COEFF_ONE   (1ul << QSUP_COEFF_BITS)

This corresponds to a qsup_coeff_t of 1.0.

Definition at line 47 of file qsup.c.

Referenced by get_user_info(), qsup_init(), and qsup_set_required_bw().


Typedef Documentation

typedef long int qsup_coeff_t

Bandwidth coefficients are stored as fixed-point integers.

Definition at line 41 of file qsup.c.

typedef struct qsup_level_t qsup_level_t

QoS Sup related data for each level.

typedef struct qsup_user_t qsup_user_t

QoS Sup related data for each user.


Function Documentation

static qos_bw_t bw_min ( qos_bw_t  a,
qos_bw_t  b 
) [inline, static]

Definition at line 127 of file qsup.c.

Referenced by main(), qos_func_define(), qsup_add_level_rule(), qsup_set_required_bw(), and test().

qos_rv get_user_info ( qsup_user_t **  pp,
int  uid 
)

Retrieve a qsup_user_t structure for the specified uid.

If structure does not exist, create it and fill static parameters from the user and group rules.

Not found: create a new qsup_user_t

Add to head of qsup_users list

Fill in static data ?!?

Definition at line 259 of file qsup.c.

References qsup_user_t::next, QOS_E_NO_MEMORY, qos_malloc(), QOS_OK, QSUP_COEFF_ONE, qsup_user_t::uid, qsup_user_t::user_coeff, qsup_user_t::user_gua, qsup_user_t::user_req, and qsup_user_t::user_used_gua.

Referenced by qsup_get_avail_bw(), qsup_get_avail_gua_bw(), and qsup_init_server().

qos_rv qsup_add_group_constraints ( int  gid,
qsup_constraints_t constr 
)

Add a group rule to the QSUP.

Definition at line 139 of file qsup.c.

References qsup_group_rule_t::constr, qsup_group_rule_t::gid, qsup_group_rule_t::next, num_group_rules, qos_create, QOS_E_NO_MEMORY, and QOS_OK.

Referenced by main(), and qsup_gw_ks().

qos_rv qsup_add_level_rule ( int  level,
qos_bw_t  max_bw 
)

Add a level rule to the QSUP.

Add a level max bw constraint to the identified level.

Definition at line 129 of file qsup.c.

Referenced by main(), and qsup_gw_ks().

qos_rv qsup_add_user_constraints ( int  uid,
qsup_constraints_t constr 
)

Add a user rule to the QSUP.

Definition at line 153 of file qsup.c.

References qsup_user_rule_t::constr, qsup_user_rule_t::next, num_user_rules, QOS_E_NO_MEMORY, qos_malloc(), QOS_OK, and qsup_user_rule_t::uid.

Referenced by main().

qos_rv qsup_cleanup ( void   ) 

Cleanup the QSUP subsystem before unloading the module from kernel.

Definition at line 186 of file qsup.c.

Referenced by main(), qres_cleanup_module(), qsup_cleanup_ks(), and qsup_cleanup_module().

qos_rv qsup_cleanup_server ( qsup_server_t srv  ) 
qos_rv qsup_create_server ( qsup_server_t **  p_srv,
int  uid,
int  gid,
qres_params_t param 
)

Create a new qsup_server_t structure.

Returns:
The server_id of the new server, if greater than or equal to zero, or a QOS_E_ error code, if negative

Definition at line 389 of file qsup.c.

References qos_create, QOS_E_NO_MEMORY, qos_free(), qos_log_err, QOS_OK, qos_strerror(), and qsup_init_server().

Referenced by main().

qos_rv qsup_destroy_server ( qsup_server_t srv  ) 

Destroy a qsup_server_t and free associated resources.

Definition at line 440 of file qsup.c.

References qos_free(), and qsup_cleanup_server().

Referenced by main().

void qsup_dump ( void   ) 
qsup_constraints_t* qsup_find_constr ( int  uid,
int  gid 
)
qsup_server_t* qsup_find_server_by_id ( int  server_id  ) 

Return qsup_server_t structure for specified server_id, or zero if not found.

Definition at line 248 of file qsup.c.

References qsup_server_t::next, qsup_server_t::server_id, and srv.

qos_bw_t qsup_get_approved_bw ( qsup_server_t srv  ) 

Returns the bandwidth approved for the specified server.

Definition at line 577 of file qsup.c.

References coeff_apply, qsup_server_t::p_level_coeff, qsup_server_t::p_user_coeff, prof_func, prof_return, prof_vars, qsup_server_t::req_bw, and qsup_server_t::used_gua_bw.

Referenced by _qres_get_bandwidth(), main(), qos_func_define(), and qsup_dump().

qos_rv qsup_get_avail_bw ( int  uid,
int  gid,
qos_bw_t p_avail_bw 
)

Returns in *p_avail_bw the available bw for the specified user.

Definition at line 303 of file qsup.c.

References get_user_info(), qsup_constraints_t::max_bw, qos_chk_go_msg, QOS_OK, qsup_find_constr(), and qsup_user_t::user_req.

qos_rv qsup_get_avail_gua_bw ( int  uid,
int  gid,
qos_bw_t p_avail_bw 
)

Returns in *p_avail_bw the available guaranteed bw for the specified user.

Definition at line 288 of file qsup.c.

References get_user_info(), qsup_constraints_t::max_min_bw, qos_chk_go_msg, QOS_OK, qsup_find_constr(), and qsup_user_t::user_gua.

Referenced by qsup_gw_ks().

qos_bw_t qsup_get_guaranteed_bw ( qsup_server_t srv  ) 

Gets the minimum granted bandwidth for the specified server.

Definition at line 550 of file qsup.c.

References qsup_server_t::gua_bw.

qos_bw_t qsup_get_max_gua_bw ( int  uid,
int  gid 
)

Returns the maximum guaranteed bandwidth for the specified user.

Definition at line 282 of file qsup.c.

References qsup_constraints_t::max_min_bw, and qsup_find_constr().

qos_bw_t qsup_get_required_bw ( qsup_server_t srv  ) 

Gets the required bandwidth for the specified server.

Definition at line 546 of file qsup.c.

References qsup_server_t::req_bw.

qos_rv qsup_init ( void   ) 

Initialize the QSUP subsystem just after module load into the kernel.

Definition at line 167 of file qsup.c.

Referenced by check_open(), main(), and qsup_init_ks().

qos_rv qsup_init_server ( qsup_server_t srv,
int  uid,
int  gid,
qres_params_t param 
)
static void qsup_lock_coeffs_read ( unsigned long *  p_flags  )  [inline, static]

Global QSUP coefficients lock.

Todo:
use one for each CPU ?

Lock QSup coefficients for reading

Todo:
evaluate if using read_lock_irqsave() is worth for anything

Definition at line 107 of file qsup.c.

static void qsup_lock_coeffs_write ( unsigned long *  p_flags  )  [inline, static]

Lock QSup coefficients for writing.

Definition at line 118 of file qsup.c.

qos_rv qsup_reserve_spare ( qos_bw_t  bw  ) 

Cannot reserve more than U_LUB as spare, and cannot change the reserved spare when servers are already active.

Set the bandwidth that is considered as spare by the system for adaptive reservation purposes.

Set the spare bandwidth for admission control purposes.

Definition at line 594 of file qsup.c.

Referenced by main(), and qsup_gw_ks().

qos_rv qsup_set_required_bw ( qsup_server_t srv,
qos_bw_t  server_req 
)
static void qsup_unlock_coeffs_read ( unsigned long  flags  )  [inline, static]

Unlock QSup coefficients for reading.

Definition at line 113 of file qsup.c.

static void qsup_unlock_coeffs_write ( unsigned long  flags  )  [inline, static]

Unlock QSup coefficients for writing.

Definition at line 123 of file qsup.c.


Variable Documentation

Initial value:
 {
  .level = 0,
  .weight = 1,
  .max_bw = U_LUB,
  .max_min_bw = U_LUB,
  .flags_mask = 0x00000000
}

Definition at line 59 of file qsup.c.

Definition at line 32 of file qsup.c.

Id assigned to the next created qsup_server_t.

Definition at line 71 of file qsup.c.

Referenced by qsup_init(), and qsup_init_server().

int num_group_rules = 0

Definition at line 33 of file qsup.c.

Referenced by qsup_add_group_constraints(), and qsup_init().

int num_user_rules = 0

Definition at line 36 of file qsup.c.

Referenced by qsup_add_user_constraints(), and qsup_init().

qsup_level_t qsup_levels[MAX_NUM_LEVELS] [static]

Level related data.

Definition at line 95 of file qsup.c.

Head of global list of created qsup_servers.

Definition at line 68 of file qsup.c.

User related data.

Definition at line 93 of file qsup.c.

Definition at line 38 of file qsup.c.

Referenced by main(), qsup_init_server(), and qsup_reserve_spare().

qos_bw_t tot_gua_bw = 0 [static]

Sum of guaranteed bandwidths of accepted servers.

Definition at line 98 of file qsup.c.

Referenced by qsup_cleanup_server(), qsup_init(), and qsup_init_server().

qos_bw_t tot_used_gua_bw = 0 [static]

Sum of actually used guaranteed bw by all servers.

Definition at line 100 of file qsup.c.

Referenced by qsup_init(), and qsup_set_required_bw().

Definition at line 35 of file qsup.c.

Generated on Mon Aug 2 22:39:17 2010 for qosres by  doxygen 1.6.3