#include <fwp.h>
#include "fwp_idl.h"
#include "fwp_admctrl.h"
+#include <ul_log.h>
+
+UL_LOG_CUST(ulogd_fwp_admctrl);
+ul_log_domain_t ulogd_frm_aqcpu = {UL_LOGL_MSG, "fwp_admctrl"};
/* TODO: Find out the real value and determine what influences it (MTU
* of the interface minus header sizes?). */
const int rate = 54*1000*1000;
const bool erp_ofdm = true;
const bool short_preamble = true;
- struct fres_sa_contract *c, *c_new = NULL;
+ struct fres_sa_contract *c;
long int period_usec;
- fres_block_basic *basic;
fres_block_fwp_sched *fwp_sched;
size_t bytes;
//duration_usec *= 2; /* For demo, we have always STA-to-STA */
basic = fres_contract_get_basic(c->contract);
- period_usec = fosa_rel_time_to_msec(basic->period)*1000;
+ period_usec = basic ? fosa_rel_time_to_msec(basic->period)*1000 : 0;
+
if (c->contract == c->new) {
- c_new = c;
if (period_usec == 0) {
+ ul_logmsg("Period is zero!\n");
goto not_schedulable;
}
+
+ frsh_rel_time_t deadline;
+ long int d;
+ if (fres_contract_get_deadline(&c->contract, &deadline)) {
+ d = fosa_rel_time_to_msec(deadline)*1000;
+ } else {
+ d = 100/*sec*/*1000*1000;
+ }
+ if (d < 30/*msec*/*1000) {
+ ul_logmsg("Deadline shorter than 30 ms!\n");
+ goto not_schedulable;
+ };
+
+ fwp_sched = malloc(sizeof(*fwp_sched));
+ fwp_sched->ac_id =
+ d < 100*1000 ? FWP_AC_VO :
+ d < 500*1000 ? FWP_AC_VI :
+ d < 1000*1000 ? FWP_AC_BE :
+ FWP_AC_BK;
+ fres_contract_add_block(c->contract, FRES_BLOCK_FWP_SCHED, fwp_sched);
}
+
utilization += (long long)(duration_usec * 10000) / period_usec;
}
- if (!c_new) {
- *schedulable = false;
- return -1;
- }
if (utilization >= 10000 * 96/100) {
goto not_schedulable;
}
scenario->utilization = utilization/100; /* For GUI */
- basic = fres_contract_get_basic(c_new->contract);
- /*int d = c->deadline_usec;*/
- long int d = fosa_rel_time_to_msec(basic->period)*1000;
- if (d <= 0) d = 100*1000*1000;
- if (d < 30000) {
- goto not_schedulable;
- };
-
*schedulable = true;
- fwp_sched = malloc(sizeof(*fwp_sched));
- fwp_sched->ac_id =
- d < 100*1000 ? FWP_AC_VO :
- d < 500*1000 ? FWP_AC_VI :
- d < 1000*1000 ? FWP_AC_BE :
- FWP_AC_BK;
- fres_contract_add_block(c_new->contract, FRES_BLOCK_FWP_SCHED, fwp_sched);
return 0;
not_schedulable: