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) {
}
#endif
+struct frm_fwp_priv priv = {
+ .rate_mbps = 1,
+ .erp_ofdm = false,
+ .short_preamble = false,
+};
+
static const struct fres_res_manager frm = {
.res_type = FRSH_RT_NETWORK,
.res_id = FRSH_NETPF_FWP,
//.admission_test = dummy_admission_test,
.name = "WLAN",
.admission_test = fwp_admctrl_utilization,
- .priv = NULL
+ .priv = &priv,
};
static struct option long_opts[] = {
- { "loglevel", 1, 0, 'l' },
+ { "loglevel", required_argument, 0, 'l' },
+ { "bitrate", required_argument, 0, 'b' },
+ { "ofdm", no_argument, 0, 'o' },
+ { "short-preamble", no_argument, 0, 's' },
{ 0, 0, 0, 0}
};
{
printf("usage: fwpmngr [ options ]\n");
printf(" -l, --loglevel <number>|<domain>=<number>,...\n");
+ printf(" -b, --bitrate <mbits/s>\n");
+ printf(" -o, --ofdm\n");
+ printf(" -s, --short-preamble\n");
}
int main(int argc, char *argv[])
forb_init_attr_t attr = { .orb_id = "org.frescor.frm.fwp" };
int opt;
- while ((opt = getopt_long(argc, argv, "l:", &long_opts[0], NULL)) != EOF) {
+ while ((opt = getopt_long(argc, argv, "b:l:os", &long_opts[0], NULL)) != EOF) {
switch (opt) {
case 'l':
ul_log_domain_arg2levels(optarg);
break;
+ case 'b':
+ priv.rate_mbps = atol(optarg);
+ break;
+ case 's':
+ priv.short_preamble = true;
+ break;
+ case 'o':
+ priv.erp_ofdm = true;
+ break;
case 'h':
/*default:*/
usage();