]> rtime.felk.cvut.cz Git - frescor/fwp.git/commitdiff
Allow bypassing FWP by setting FWP_BYPASS environment variable
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 12 Nov 2009 13:16:14 +0000 (14:16 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 12 Nov 2009 13:16:14 +0000 (14:16 +0100)
This is done in order to be able to compare behavior of the same
application (namely fwp-timing) with and without FWP.

fwp/lib/fwp/fwp_vres.c
fwp/mngr/fwp_admctrl.c
fwp/mngr/fwp_admctrl.h
fwp/mngr/fwp_mngr.c

index 9bc1b79b19cccefbf78d3fcab7611fa13713f11d..1078bd184f592e16b92704e32aa558b24a7d4d3f 100644 (file)
@@ -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;
index ad5b5b73a0746f7ac0258dfd55fd23df5df4e38b..e5f98eb492d83d83fd5a397616ac490922c0efb1 100644 (file)
@@ -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 */
index 336d65f338f3bcd6cabfabc11a5948c2bd168fb4..ae4207c4a672c300553ebe9fa04a6113f94b00d4 100644 (file)
@@ -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,
index 75baa517771adfcdaa7405d9d1befecc63b6614d..aa2d8505338848c420c9368d3c716cf95322f9e1 100644 (file)
@@ -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':