|
Packit Service |
3880ab |
.TH GATE 8 "12 Mar 2020" "iproute2" "Linux"
|
|
Packit Service |
3880ab |
.SH NAME
|
|
Packit Service |
3880ab |
gate \- Stream Gate Action
|
|
Packit Service |
3880ab |
.SH SYNOPSIS
|
|
Packit Service |
3880ab |
.B tc " ... " action gate
|
|
Packit Service |
3880ab |
.ti +8
|
|
Packit Service |
3880ab |
.B [ base-time
|
|
Packit Service |
3880ab |
BASETIME ]
|
|
Packit Service |
3880ab |
.B [ clockid
|
|
Packit Service |
3880ab |
CLOCKID ]
|
|
Packit Service |
3880ab |
.ti +8
|
|
Packit Service |
3880ab |
.B sched-entry
|
|
Packit Service |
3880ab |
<gate state> <interval 1> [ <internal priority> <max octets> ]
|
|
Packit Service |
3880ab |
.ti +8
|
|
Packit Service |
3880ab |
.B sched-entry
|
|
Packit Service |
3880ab |
<gate state> <interval 2> [ <internal priority> <max octets> ]
|
|
Packit Service |
3880ab |
.ti +8
|
|
Packit Service |
3880ab |
.B sched-entry
|
|
Packit Service |
3880ab |
<gate state> <interval 3> [ <internal priority> <max octets> ]
|
|
Packit Service |
3880ab |
.ti +8
|
|
Packit Service |
3880ab |
.B ......
|
|
Packit Service |
3880ab |
.ti +8
|
|
Packit Service |
3880ab |
.B sched-entry
|
|
Packit Service |
3880ab |
<gate state> <interval N> [ <internal priority> <max octets> ]
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH DESCRIPTION
|
|
Packit Service |
3880ab |
GATE action allows specified ingress frames can be passed at
|
|
Packit Service |
3880ab |
specific time slot, or be dropped at specific time slot. Tc filter
|
|
Packit Service |
3880ab |
filters the ingress frames, then tc gate action would specify which time
|
|
Packit Service |
3880ab |
slot and how many bytes these frames can be passed to device and
|
|
Packit Service |
3880ab |
which time slot frames would be dropped.
|
|
Packit Service |
3880ab |
Gate action also assign a base-time to tell when the entry list start.
|
|
Packit Service |
3880ab |
Then gate action would start to repeat the gate entry list cyclically
|
|
Packit Service |
3880ab |
at the start base-time.
|
|
Packit Service |
3880ab |
For the software simulation, gate action requires the user assign reference
|
|
Packit Service |
3880ab |
time clock type.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH PARAMETERS
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
base-time
|
|
Packit Service |
3880ab |
.br
|
|
Packit Service |
3880ab |
Specifies the instant in nanoseconds, defining the time when the schedule
|
|
Packit Service |
3880ab |
starts. If 'base-time' is a time in the past, the schedule will start at
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
base-time + (N * cycle-time)
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
where N is the smallest integer so the resulting time is greater than
|
|
Packit Service |
3880ab |
"now", and "cycle-time" is the sum of all the intervals of the entries
|
|
Packit Service |
3880ab |
in the schedule. Without base-time specified, will default to be 0.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
clockid
|
|
Packit Service |
3880ab |
.br
|
|
Packit Service |
3880ab |
Specifies the clock to be used by qdisc's internal timer for measuring
|
|
Packit Service |
3880ab |
time and scheduling events. Not valid if gate action is used for offloading
|
|
Packit Service |
3880ab |
filter.
|
|
Packit Service |
3880ab |
For example, tc filter command with
|
|
Packit Service |
3880ab |
.B skip_sw
|
|
Packit Service |
3880ab |
parameter.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
sched-entry
|
|
Packit Service |
3880ab |
.br
|
|
Packit Service |
3880ab |
There may multiple
|
|
Packit Service |
3880ab |
.B sched-entry
|
|
Packit Service |
3880ab |
parameters in a single schedule. Each one has the format:
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
sched-entry <gate state> <interval> [ <internal priority> <max octets> ]
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.br
|
|
Packit Service |
3880ab |
<gate state> means gate states. 'open' keep gate open, 'close' keep gate close.
|
|
Packit Service |
3880ab |
.br
|
|
Packit Service |
3880ab |
<interval> means how much nano seconds for this time slot.
|
|
Packit Service |
3880ab |
.br
|
|
Packit Service |
3880ab |
<internal priority> means internal priority value. Present of the
|
|
Packit Service |
3880ab |
internal receiving queue for this stream. "-1" means wildcard.
|
|
Packit Service |
3880ab |
<internal priority> and <max octets> can be omit default to be "-1" which both
|
|
Packit Service |
3880ab |
value to be "-1" for this <sched-entry>.
|
|
Packit Service |
3880ab |
.br
|
|
Packit Service |
3880ab |
<max octets> means how many octets size could pass in this time slot. Dropped
|
|
Packit Service |
3880ab |
if overlimited. "-1" means wildcard. <max octets> can be omit default to be
|
|
Packit Service |
3880ab |
"-1" which value to be "-1" for this <sched-entry>.
|
|
Packit Service |
3880ab |
.br
|
|
Packit Service |
3880ab |
Note that <internal priority> and <max octets> are nothing meaning for gate state
|
|
Packit Service |
3880ab |
is "close" in a "sched-entry". All frames are dropped when "sched-entry" with
|
|
Packit Service |
3880ab |
"close" state.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH EXAMPLES
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
The following example shows tc filter frames source ip match to the
|
|
Packit Service |
3880ab |
192.168.0.20 will keep the gate open for 200ms and limit the traffic to 8MB
|
|
Packit Service |
3880ab |
in this sched-entry. Then keep the traffic gate to be close for 100ms.
|
|
Packit Service |
3880ab |
Frames arrived at gate close state would be dropped. Then the cycle would
|
|
Packit Service |
3880ab |
run the gate entries periodically. The schedule will start at instant 200.0s
|
|
Packit Service |
3880ab |
using the reference CLOCK_TAI. The schedule is composed of two entries
|
|
Packit Service |
3880ab |
each of 300ms duration.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.EX
|
|
Packit Service |
3880ab |
# tc qdisc add dev eth0 ingress
|
|
Packit Service |
3880ab |
# tc filter add dev eth0 parent ffff: protocol ip \\
|
|
Packit Service |
3880ab |
flower skip_hw src_ip 192.168.0.20 \\
|
|
Packit Service |
3880ab |
action gate index 2 clockid CLOCK_TAI \\
|
|
Packit Service |
3880ab |
base-time 200000000000ns \\
|
|
Packit Service |
3880ab |
sched-entry open 200000000ns -1 8000000b \\
|
|
Packit Service |
3880ab |
sched-entry close 100000000ns
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.EE
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
Following commands is an example to filter a stream source mac match to the
|
|
Packit Service |
3880ab |
10:00:80:00:00:00 icmp frames will be dropped at any time with cycle 200ms.
|
|
Packit Service |
3880ab |
With a default basetime 0 and clockid is CLOCK_TAI as default.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.EX
|
|
Packit Service |
3880ab |
# tc qdisc add dev eth0 ingress
|
|
Packit Service |
3880ab |
# tc filter add dev eth0 parent ffff: protocol ip \\
|
|
Packit Service |
3880ab |
flower ip_proto icmp dst_mac 10:00:80:00:00:00 \\
|
|
Packit Service |
3880ab |
action gate index 12 sched-entry close 200000000ns
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.EE
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH AUTHORS
|
|
Packit Service |
3880ab |
Po Liu <Po.Liu@nxp.com>
|