2 * @file frescan_bwres_analysis.h
4 * @brief FRESCAN bandwith reservation layer: sched analysis
6 * This module contains the scheduling analysis data and functions for the
7 * admission tests and spare capacity distribution of the negotiation layer.
8 * It provides an easy API easy to understand and in the implementation part
9 * it makes call to the general sched analysis module of FRSH which is shared
10 * with the CPU contracts layer in FRSH.
12 * EXAMPLE of utilization:
16 * params.min_prio = 0;
17 * params.max_prio = 16;
18 * params.overhead = ...;
19 * frescan_sa_init(&scenario, ¶ms);
23 * fadt_freelist_alloc(&freelist_contracts, &id);
24 * frescan_sa_add_contract(&scenario, &contracts[id], id);
25 * frescan_sa_sched_test(&scenario, &success);
28 * frescan_sa_remove_contract(&scenario, id);
30 * frescan_sa_spare_capacity(&scenario);
31 * vres_id = to_vres(resource_type, resource_id, id);
32 * create vres runtime structures;
34 * for vres_id in active_vres_id {
35 * frescan_sa_get_final_values(&scenario,
38 * update vres runtime structures if necessary;
45 * frescan_sa_update_contract(&scenario, to_index(vres_id), &contract);
46 * frescan_sa_sched_test(&scenario, &success);
49 * frescan_sa_update_contract(&sa_data,
53 * frescan_sa_spare_capacity(&scenario);
54 * for vres_id in active_vres_id {
55 * frescan_sa_get_final_values(&scenario,
58 * update vres runtime structures if necessary;
64 * frescan_sa_remove_contract(&scenario, to_index(vres_id));
65 * frescan_sa_spare_capacity(&scenario);
71 * @author Daniel Sangorrin <daniel.sangorrin@unican.es>
75 #ifndef _FRESCAN_BWRES_ANALYSIS_H_
76 #define _FRESCAN_BWRES_ANALYSIS_H_
79 #include "frescan_data.h"
82 * frescan_sa_init() - init the scenario
84 * @scenario: the scenario (in out)
85 * @params: init params (in)
88 extern int frescan_sa_init(frescan_sa_scenario_t *scenario,
89 const frescan_sa_init_params_t *params);
92 * frescan_sa_add_contract() - add a contract to the scenario
94 * @scenario: the scenario (in out)
95 * @contract: the new contract (in)
96 * @ss: the preallocated ss identificator (in)
97 * @node: the node this contract belongs to (in)
100 extern int frescan_sa_add_contract(frescan_sa_scenario_t *scenario,
101 const frescan_contract_t *contract,
103 frescan_node_t node);
106 * frescan_sa_update_contract() - update a contract in the scenario
108 * @scenario: the scenario (in out)
109 * @ss: the ss identificator (in)
110 * @contract: the values to update the contract (in)
111 * @node: the node this contract belongs to (in)
114 extern int frescan_sa_update_contract(frescan_sa_scenario_t *scenario,
116 const frescan_contract_t *contract,
117 frescan_node_t node);
120 * frescan_sa_remove_contract() - remove a contract from the scenario
122 * @scenario: the scenario (in out)
123 * @ss: the ss to remove (in)
124 * @node: the node this contract belongs to (in)
127 extern int frescan_sa_remove_contract(frescan_sa_scenario_t *scenario,
129 frescan_node_t node);
132 * frescan_sa_sched_test() - perform a scheduling test on the scenario
134 * @scenario: the scenario (in out)
135 * @success: if the scenario is schedulable or not (out)
138 extern int frescan_sa_sched_test(frescan_sa_scenario_t *scenario,
142 * frescan_sa_spare_capacity() - distribute the remaining spare capacity
144 * @scenario: the scenario (in out)
147 extern int frescan_sa_spare_capacity(frescan_sa_scenario_t *scenario);
150 * frescan_sa_get_final_values() - get the final values
152 * @scenario: the scenario (in)
153 * @ss: the ss from which we want the final values (in)
154 * @node: the node this contract belongs to (in)
155 * @final_values: the final values (out)
158 extern int frescan_sa_get_final_values(const frescan_sa_scenario_t *scenario,
161 frescan_sa_final_values_t *final_values);
163 #endif // _FRESCAN_BWRES_ANALYSIS_H_