From: Michal Sojka Date: Thu, 12 Nov 2009 13:16:14 +0000 (+0100) Subject: Allow bypassing FWP by setting FWP_BYPASS environment variable X-Git-Url: http://rtime.felk.cvut.cz/gitweb/frescor/fwp.git/commitdiff_plain/66fb5f0e3dbd20a576a9d2fe9b95c162eb99e196 Allow bypassing FWP by setting FWP_BYPASS environment variable This is done in order to be able to compare behavior of the same application (namely fwp-timing) with and without FWP. --- diff --git a/fwp/lib/fwp/fwp_vres.c b/fwp/lib/fwp/fwp_vres.c index 9bc1b79..1078bd1 100644 --- a/fwp/lib/fwp/fwp_vres.c +++ b/fwp/lib/fwp/fwp_vres.c @@ -92,7 +92,9 @@ struct fwp_vres{ * of vres parameters. */ int ac_sockd; /** Queue for messages to send */ - struct fwp_msgq msg_queue; + struct fwp_msgq msg_queue; + /** If true, it is always allowed to send messages through this vres. */ + bool bypass; }; /**< mapping priority to ac*/ @@ -254,6 +256,9 @@ int fwp_vres_create(fwp_vres_params_t *params, fwp_vres_t **vresp) apply_params(vres); fwp_msgq_init(&vres->msg_queue); + if (getenv("FWP_BYPASS")) + vres->bypass = true; + pthread_attr_init(&vres->tx_thread_attr); if ((rv = pthread_create(&vres->tx_thread, &vres->tx_thread_attr, fwp_vres_tx_thread, (void*) vres)) != 0){ @@ -314,6 +319,8 @@ static void do_consume_budget(struct fwp_vres *vres, size_t size) int __consume_budget(struct fwp_vres *vres, size_t size, bool can_block) { int ret = 0; + if (vres->bypass) + return 0; if (vres->params.budget < size) { errno = ENOSR; return -1; diff --git a/fwp/mngr/fwp_admctrl.c b/fwp/mngr/fwp_admctrl.c index ad5b5b7..e5f98eb 100644 --- a/fwp/mngr/fwp_admctrl.c +++ b/fwp/mngr/fwp_admctrl.c @@ -234,7 +234,7 @@ int fwp_admctrl_utilization(struct fres_sa_scenario *scenario, void *priv, 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 */ diff --git a/fwp/mngr/fwp_admctrl.h b/fwp/mngr/fwp_admctrl.h index 336d65f..ae4207c 100644 --- a/fwp/mngr/fwp_admctrl.h +++ b/fwp/mngr/fwp_admctrl.h @@ -52,6 +52,7 @@ struct frm_fwp_priv { int rate_mbps; bool erp_ofdm; bool short_preamble; + bool bypass; }; int fwp_admctrl_utilization(struct fres_sa_scenario *scenario, void *priv, diff --git a/fwp/mngr/fwp_mngr.c b/fwp/mngr/fwp_mngr.c index 75baa51..aa2d850 100644 --- a/fwp/mngr/fwp_mngr.c +++ b/fwp/mngr/fwp_mngr.c @@ -124,6 +124,10 @@ int main(int argc, char *argv[]) forb_init_attr_t attr = { .orb_id = "org.frescor.frm.fwp" }; int opt; + if (getenv("FWP_BYPASS")) + priv.bypass = true; + + while ((opt = getopt_long(argc, argv, "b:l:os", &long_opts[0], NULL)) != EOF) { switch (opt) { case 'l':