svn commit: r202851 - user/luigi/ipfw3-head/sys/netinet/ipfw

Luigi Rizzo luigi at FreeBSD.org
Sat Jan 23 00:30:18 UTC 2010


Author: luigi
Date: Sat Jan 23 00:30:17 2010
New Revision: 202851
URL: http://svn.freebsd.org/changeset/base/202851

Log:
  simplify the testing code

Modified:
  user/luigi/ipfw3-head/sys/netinet/ipfw/test_dn_sched.c

Modified: user/luigi/ipfw3-head/sys/netinet/ipfw/test_dn_sched.c
==============================================================================
--- user/luigi/ipfw3-head/sys/netinet/ipfw/test_dn_sched.c	Sat Jan 23 00:24:31 2010	(r202850)
+++ user/luigi/ipfw3-head/sys/netinet/ipfw/test_dn_sched.c	Sat Jan 23 00:30:17 2010	(r202851)
@@ -54,6 +54,8 @@ dn_delete_queue(void *_q, void *do_free)
 }
 
 /*
+ * This is a simplified function for testing purposes, which does
+ * not implement statistics or random loss.
  * Enqueue a packet in q, subject to space and queue management policy
  * (whose parameters are in q->fs).
  * Update stats for the queue and the scheduler.
@@ -62,39 +64,16 @@ dn_delete_queue(void *_q, void *do_free)
 int
 dn_enqueue(struct new_queue *q, struct mbuf* m, int drop)
 {
-        struct new_fs *f;
-        struct dn_flow *ni;    /* stats for scheduler instance */
-        uint64_t len;
-
-        f = &q->fs->fs;
-        ni = &q->ni;
-        len = m->m_pkthdr.len;
-        /* Update statistics, then check reasons to drop pkt. */
-        q->ni.tot_bytes += len;
-        q->ni.tot_pkts++;
-        ni->tot_bytes += len;
-        ni->tot_pkts++;
         if (drop)
                 goto drop;
-        if (f->plr && random() < f->plr)
-                goto drop;
-        if (f->flags & DN_QSIZE_BYTES) {
-                if (q->ni.len_bytes > f->qsize)
-                        goto drop;
-        } else if (q->ni.length >= f->qsize) {
+        if (q->ni.length >= 50)
                 goto drop;
-        }
         mq_append(&q->mq, m);
         q->ni.length++;
-        q->ni.len_bytes += len;
-        ni->length++;
-        ni->len_bytes += len;
         return 0;
 
 drop:
-        io_pkt_drop++;
         q->ni.drops++;
-        ni->drops++;
         FREE_PKT(m);
         return 1;
 }


More information about the svn-src-user mailing list