#include "fwp_admctrl.h"
#include <ul_log.h>
#include <ul_logreg.h>
+#include "fwp_utils.h"
UL_LOG_CUST(ulogd_fwp_admctrl);
ul_log_domain_t ulogd_fwp_admctrl = {UL_LOGL_MSG, "fwp_admctrl"};
bool *schedulable)
{
int utilization = 0;
-
- const int rate = 54*1000*1000;
- const bool erp_ofdm = true;
- const bool short_preamble = true;
+ struct frm_fwp_priv *pr = priv;
+ const int rate = pr->rate_mbps*1000*1000;
struct fres_sa_contract *c;
long int period_usec;
fres_block_fwp_sched *fwp_sched;
LLC_HEADER_SIZE + MAC_FCS_SIZE;
duration_usec = frame_duration(data_overhead + bytes%MTU, rate,
- erp_ofdm, short_preamble);
- tmp_usec = frame_duration(data_overhead + MTU, rate, erp_ofdm,
- short_preamble);
+ pr->erp_ofdm, pr->short_preamble);
+ tmp_usec = frame_duration(data_overhead + MTU, rate,
+ pr->erp_ofdm, pr->short_preamble);
duration_usec += tmp_usec*(fragments-1);
/* Add average backoff - assume there is no collision */
tmp_usec = ASLOTTIME_USEC*fragments*pisvejc[ac];
duration_usec += (aifsn[ac] + cwmin[ac]/2)*tmp_usec;
/* We use ACK and ignore burst */
- tmp_usec = frame_duration(ACK_FRAME_SIZE, rate, erp_ofdm,
- short_preamble) + ASIFSTIME_USEC;
+ tmp_usec = frame_duration(ACK_FRAME_SIZE, rate,
+ pr->erp_ofdm, pr->short_preamble)
+ + ASIFSTIME_USEC;
duration_usec += fragments * tmp_usec;
//printf("duration: %ld ms\n", duration_usec/1000);
/* TODO: If STA-to-STA, multiply it by two. Note that
* AP may use different values for backoff. */
- //duration_usec *= 2; /* For demo, we have always STA-to-STA */
+ duration_usec *= 2; /* For demo, we have always STA-to-STA */
if (c->contract == c->new) {
if (period_usec == 0) {
utilization += (long long)(duration_usec * 10000) / period_usec;
}
- if (utilization >= 10000 * 96/100) {
+ if (utilization >= 10000 * 96/100 && !pr->bypass) {
goto not_schedulable;
}
scenario->utilization = utilization/100; /* For GUI */