diff options
author | oleg <oleg@FreeBSD.org> | 2007-11-17 21:54:57 +0000 |
---|---|---|
committer | oleg <oleg@FreeBSD.org> | 2007-11-17 21:54:57 +0000 |
commit | 4e6e975846d9ebf395f824bc88086133d51086b1 (patch) | |
tree | 3ed3c68303e3c82dc0eb403f5cc13b7ef9bd41c6 /sys/netinet/ip_dummynet.c | |
parent | 6ebbe5e1f801ebbb225bda3c1a4ad0e363590a28 (diff) | |
download | FreeBSD-src-4e6e975846d9ebf395f824bc88086133d51086b1.zip FreeBSD-src-4e6e975846d9ebf395f824bc88086133d51086b1.tar.gz |
- New sysctl variable: net.inet.ip.dummynet.io_fast
If it is set to zero value (default) dummynet module will try to emulate
real link as close as possible (bandwidth & latency): packet will not leave
pipe faster than it should be on real link with given bandwidth.
(This is original behaviour of dummynet which was altered in previous commit)
If it is set to non-zero value only bandwidth is enforced: packet's latency
can be lower comparing to real link with given bandwidth.
- Document recently introduced dummynet(4) sysctl variables.
Requested by: luigi, julian
MFC after: 3 month
Diffstat (limited to 'sys/netinet/ip_dummynet.c')
-rw-r--r-- | sys/netinet/ip_dummynet.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/netinet/ip_dummynet.c b/sys/netinet/ip_dummynet.c index d6f1880..cb079a5 100644 --- a/sys/netinet/ip_dummynet.c +++ b/sys/netinet/ip_dummynet.c @@ -110,6 +110,7 @@ static long tick_lost; /* Lost(coalesced) ticks number. */ /* Adjusted vs non-adjusted curr_time difference (ticks). */ static long tick_diff; +static int io_fast; static unsigned long io_pkt; static unsigned long io_pkt_fast; static unsigned long io_pkt_drop; @@ -185,6 +186,8 @@ SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_diff, SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_lost, CTLFLAG_RD, &tick_lost, 0, "Number of ticks coalesced by dummynet taskqueue."); +SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, io_fast, + CTLFLAG_RW, &io_fast, 0, "Enable fast dummynet io."); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt, CTLFLAG_RD, &io_pkt, 0, "Number of packets passed to dummynet."); @@ -967,7 +970,7 @@ create_queue(struct dn_flow_set *fs, int i) q->hash_slot = i; q->next = fs->rq[i]; q->S = q->F + 1; /* hack - mark timestamp as invalid. */ - q->numbytes = fs->pipe->bandwidth; + q->numbytes = io_fast ? fs->pipe->bandwidth : 0; fs->rq[i] = q; fs->rq_elements++; return (q); @@ -1325,7 +1328,7 @@ dummynet_io(struct mbuf **m0, int dir, struct ip_fw_args *fwa) goto done; if (q->q_time < curr_time) - q->numbytes = fs->pipe->bandwidth; + q->numbytes = io_fast ? fs->pipe->bandwidth : 0; q->q_time = curr_time; /* @@ -1736,7 +1739,7 @@ config_pipe(struct dn_pipe *p) /* Flush accumulated credit for all queues. */ for (i = 0; i <= pipe->fs.rq_size; i++) for (q = pipe->fs.rq[i]; q; q = q->next) - q->numbytes = p->bandwidth; + q->numbytes = io_fast ? p->bandwidth : 0; pipe->bandwidth = p->bandwidth; pipe->numbytes = 0; /* just in case... */ |