Revision: 497
          http://vde.svn.sourceforge.net/vde/?rev=497&view=rev
Author:   danielel
Date:     2011-05-31 17:20:29 +0000 (Tue, 31 May 2011)

Log Message:
-----------
Moved delay calculation to when the packets enter outgoing queue.
Removed some fprintf.

Modified Paths:
--------------
    branches/danielinux-wirefilter2/src/wirefilter.c

Modified: branches/danielinux-wirefilter2/src/wirefilter.c
===================================================================
--- branches/danielinux-wirefilter2/src/wirefilter.c    2011-05-30 05:39:05 UTC 
(rev 496)
+++ branches/danielinux-wirefilter2/src/wirefilter.c    2011-05-31 17:20:29 UTC 
(rev 497)
@@ -288,10 +288,40 @@
        
 }
 
+static inline double max_wirevalue(int node,int tag, int dir)
+{
+       return (WFVAL(node,tag,dir).value + WFVAL(node,tag,dir).plus);
+}
+
+static inline double min_wirevalue(int node,int tag, int dir)
+{
+       return (WFVAL(node,tag,dir).value - WFVAL(node,tag,dir).plus);
+}
+
+static void initrand()
+{
+       struct timeval v;
+       gettimeofday(&v,NULL);
+       srand48(v.tv_sec ^ v.tv_usec ^ getpid());
+}
+
+void set_egres_delay(struct wf_packet *pkt)
+{
+       pkt->dequeue_time = 0U;
+       if (max_wirevalue(markov_current,DELAY,pkt->dir) > 0) {
+               double delval=compute_wirevalue(DELAY,pkt->dir);
+               if (delval > 0) {
+                       unsigned long long now = gettimeofdayms();
+                       pkt->dequeue_time = now + delval; 
+               }
+       }
+}
+
 static void pkt_enqueue_out(struct wf_packet *pkt)
 {
        struct wf_packet *q = wf_queue_out[pkt->dir];
        queue_size_out[pkt->dir] += pkt->size;
+       set_egres_delay(pkt);
        pkt->next = NULL;
        if (!q) {
                wf_queue_out[pkt->dir] = pkt;
@@ -520,24 +550,8 @@
 }
 
 
-static inline double max_wirevalue(int node,int tag, int dir)
-{
-       return (WFVAL(node,tag,dir).value + WFVAL(node,tag,dir).plus);
-}
 
-static inline double min_wirevalue(int node,int tag, int dir)
-{
-       return (WFVAL(node,tag,dir).value - WFVAL(node,tag,dir).plus);
-}
 
-static void initrand()
-{
-       struct timeval v;
-       gettimeofday(&v,NULL);
-       srand48(v.tv_sec ^ v.tv_usec ^ getpid());
-}
-
-
 void printlog(int priority, const char *format, ...)
 {
        va_list arg;
@@ -677,7 +691,7 @@
        }
        static int max_q = 0;
        if (!pkt->dir && queue_size_out[0] > max_q) { 
-               fprintf(stderr, "%llu, %lu\n", gettimeofdayms(), 
queue_size_out[0]);
+               //fprintf(stderr, "%llu, %lu\n", gettimeofdayms(), 
queue_size_out[0]);
                max_q = queue_size_out[0];
        }
        /* NOISE */
@@ -726,17 +740,6 @@
        return timetogo;
 }
 
-void set_ingres_delay(struct wf_packet *pkt)
-{
-       pkt->dequeue_time = 0U;
-       if (max_wirevalue(markov_current,DELAY,pkt->dir) > 0) {
-               double delval=compute_wirevalue(DELAY,pkt->dir);
-               if (delval > 0) {
-                       unsigned long long now = gettimeofdayms();
-                       pkt->dequeue_time = now + delval; 
-               }
-       }
-}
 
 #define IS_TCP(x) ( x->size > 34 && x->payload[16] == 0x45 && x->payload[17] 
== 0x00 && x->payload[25]==0x06 )
 
@@ -811,7 +814,6 @@
                        memcpy(pkt_in, pkt, sizeof(struct wf_packet));
                } else
                        pkt_in = pkt;
-               set_ingres_delay(pkt_in);
 
                /* Mangle ACK with available window */
                if ((adv_flow > 0) && IS_TCP(pkt_in)) {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
vde-users mailing list
vde-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vde-users

Reply via email to