aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pkt_sched.h
diff options
context:
space:
mode:
authorHagen Paul Pfeifer <hagen@jauu.net>2011-11-30 07:20:26 -0500
committerDavid S. Miller <davem@drr.davemloft.net>2011-11-30 23:18:35 -0500
commit7bc0f28c7a0cd19f40e5a6e4d0a117db9a4e4cd5 (patch)
tree4cdbf530b8ed94f73907327dd21f8303085cfc09 /include/linux/pkt_sched.h
parent99d2f47aa9d3ad40daa6ee0770e91b95b71082f0 (diff)
netem: rate extension
Currently netem is not in the ability to emulate channel bandwidth. Only static delay (and optional random jitter) can be configured. To emulate the channel rate the token bucket filter (sch_tbf) can be used. But TBF has some major emulation flaws. The buffer (token bucket depth/rate) cannot be 0. Also the idea behind TBF is that the credit (token in buckets) fills if no packet is transmitted. So that there is always a "positive" credit for new packets. In real life this behavior contradicts the law of nature where nothing can travel faster as speed of light. E.g.: on an emulated 1000 byte/s link a small IPv4/TCP SYN packet with ~50 byte require ~0.05 seconds - not 0 seconds. Netem is an excellent place to implement a rate limiting feature: static delay is already implemented, tfifo already has time information and the user can skip TBF configuration completely. This patch implement rate feature which can be configured via tc. e.g: tc qdisc add dev eth0 root netem rate 10kbit To emulate a link of 5000byte/s and add an additional static delay of 10ms: tc qdisc add dev eth0 root netem delay 10ms rate 5KBps Note: similar to TBF the rate extension is bounded to the kernel timing system. Depending on the architecture timer granularity, higher rates (e.g. 10mbit/s and higher) tend to transmission bursts. Also note: further queues living in network adaptors; see ethtool(8). Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net> Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@drr.davemloft.net>
Diffstat (limited to 'include/linux/pkt_sched.h')
-rw-r--r--include/linux/pkt_sched.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 7281d5acf2f9..fb556dc594d3 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -465,6 +465,7 @@ enum {
465 TCA_NETEM_REORDER, 465 TCA_NETEM_REORDER,
466 TCA_NETEM_CORRUPT, 466 TCA_NETEM_CORRUPT,
467 TCA_NETEM_LOSS, 467 TCA_NETEM_LOSS,
468 TCA_NETEM_RATE,
468 __TCA_NETEM_MAX, 469 __TCA_NETEM_MAX,
469}; 470};
470 471
@@ -495,6 +496,10 @@ struct tc_netem_corrupt {
495 __u32 correlation; 496 __u32 correlation;
496}; 497};
497 498
499struct tc_netem_rate {
500 __u32 rate; /* byte/s */
501};
502
498enum { 503enum {
499 NETEM_LOSS_UNSPEC, 504 NETEM_LOSS_UNSPEC,
500 NETEM_LOSS_GI, /* General Intuitive - 4 state model */ 505 NETEM_LOSS_GI, /* General Intuitive - 4 state model */