police: add support for packet-per-second rate limiting
Subsystems (2)
PATCH 1/1 police: add support for packet-per-second rate limiting
From: Baowen Zheng <[email protected]>
Allow a policer action to enforce a rate-limit based on packets-per-second, configurable using a packet-per-second rate and burst parameters.
e.g.
# $TC actions add action police pkts_rate 1000 pkts_burst 200 index 1 # $TC actions ls action police
total acts 1
action order 0: police 0x1 rate 0bit burst 0b mtu 4096Mb pkts_rate 1000 pkts_burst 200 ref 1 bind 0
Signed-off-by Baowen Zheng <[email protected]>
Signed-off-by Simon Horman <[email protected]>
Signed-off-by Louis Peens <[email protected]>
--- man/man8/tc-police.8 | 35 ++++++++++++++++++++++++------- tc/m_police.c | 50 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 75 insertions(+), 10 deletions(-)
man/man8/tc-police.8 +28 -7
@@ -5,9 +5,11 @@ police - policing action .SH SYNOPSIS .in +8 .ti -8 -.BR tc " ... " "action police" +.BR tc " ... " "action police [" .BI rate " RATE " burst -.IR BYTES [\fB/ BYTES "] [" +.IR BYTES [\fB/ BYTES "] ] [" +.BI pkts_rate " RATE " pkts_burst +.IR PACKETS "] [" .B mtu .IR BYTES [\fB/ BYTES "] ] [" .BI peakrate " RATE"
@@ -34,19 +36,29 @@ police - policing action .SH DESCRIPTION The .B police -action allows to limit bandwidth of traffic matched by the filter it is -attached to. Basically there are two different algorithms available to measure -the packet rate: The first one uses an internal dual token bucket and is -configured using the +action allows limiting of the byte or packet rate of traffic matched by the +filter it is attached to. +.P +There are two different algorithms available to measure the byte rate: The +first one uses an internal dual token bucket and is configured using the .BR rate ", " burst ", " mtu ", " peakrate ", " overhead " and " linklayer parameters. The second one uses an in-kernel sampling mechanism. It can be fine-tuned using the .B estimator filter parameter. +.P +There is one algorithm available to measure packet rate and it is similar to +the first algorithm described for byte rate. It is configured using the +.BR pkt_rate " and " pkt_burst +parameters. +.P +At least one of the +.BR rate " and " pkt_rate " +parameters must be configured. .SH OPTIONS .TP .BI rate " RATE" -The maximum traffic rate of packets passing this action. Those exceeding it will +The maximum byte rate of packets passing this action. Those exceeding it will be treated as defined by the .B conform-exceed option.
@@ -55,6 +67,15 @@ option. Set the maximum allowed burst in bytes, optionally followed by a slash ('/') sign and cell size which must be a power of 2. .TP +.BI pkt_rate " RATE" +The maximum packet rate or packets passing this action. Those exceeding it will +be treated as defined by the +.B conform-exceed +option. +.TP +.BI pkt_burst " PACKETS" +Set the maximum allowed burst in packets. +.TP .BI mtu " BYTES\fR[\fB/\fIBYTES\fR]" This is the maximum packet size handled by the policer (larger ones will be handled like they exceeded the configured rate). Setting this value correctly
tc/m_police.c +47 -3
98 lines not on this page · raw message
Signature · 1 line
2.20.1
David Ahern
AppliedQuoted 13 lines · Simon Horman
From: Baowen Zheng <[email protected]>
Allow a policer action to enforce a rate-limit based on packets-per-second, configurable using a packet-per-second rate and burst parameters.
e.g.
# $TC actions add action policepkts_rate1000pkts_burst200 index 1 # $TC actions ls action police
total acts 1action order 0: police 0x1 rate 0bit burst 0b mtu 4096Mb pkts_rate 1000 pkts_burst 200 ref 1 bind 0
Quoted 8 lines
Signed-off-by Baowen Zheng <[email protected]>Signed-off-by Simon Horman <[email protected]>Signed-off-by Louis Peens <[email protected]>--- man/man8/tc-police.8 | 35 ++++++++++++++++++++++++------- tc/m_police.c | 50 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 75 insertions(+), 10 deletions(-)
applied to iproute2-next.