Debian Codegraph @

upstream/debian-unstable/man8/tc-gate.8

raw
1 .TH GATE 8 "12 Mar 2020" "iproute2" "Linux"
2 .SH NAME
3 gate \- Stream Gate Action
4 .SH SYNOPSIS
5 .B tc " ... " action gate
6 .ti +8
7 .B [ base-time
8 BASETIME ]
9 .B [ clockid
10 CLOCKID ]
11 .ti +8
12 .B sched-entry
13 <gate state> <interval 1> [ <internal priority> <max octets> ]
14 .ti +8
15 .B sched-entry
16 <gate state> <interval 2> [ <internal priority> <max octets> ]
17 .ti +8
18 .B sched-entry
19 <gate state> <interval 3> [ <internal priority> <max octets> ]
20 .ti +8
21 .B ......
22 .ti +8
23 .B sched-entry
24 <gate state> <interval N> [ <internal priority> <max octets> ]
25
26 .SH DESCRIPTION
27 GATE action allows specified ingress frames can be passed at
28 specific time slot, or be dropped at specific time slot. Tc filter
29 filters the ingress frames, then tc gate action would specify which time
30 slot and how many bytes these frames can be passed to device and
31 which time slot frames would be dropped.
32 Gate action also assign a base-time to tell when the entry list start.
33 Then gate action would start to repeat the gate entry list cyclically
34 at the start base-time.
35 For the software simulation, gate action requires the user assign reference
36 time clock type.
37
38 .SH PARAMETERS
39
40 .TP
41 base-time
42 .br
43 Specifies the instant in nanoseconds, defining the time when the schedule
44 starts. If 'base-time' is a time in the past, the schedule will start at
45
46 base-time + (N * cycle-time)
47
48 where N is the smallest integer so the resulting time is greater than
49 "now", and "cycle-time" is the sum of all the intervals of the entries
50 in the schedule. Without base-time specified, will default to be 0.
51
52 .TP
53 clockid
54 .br
55 Specifies the clock to be used by qdisc's internal timer for measuring
56 time and scheduling events. Not valid if gate action is used for offloading
57 filter.
58 For example, tc filter command with
59 .B skip_sw
60 parameter.
61
62 .TP
63 sched-entry
64 .br
65 There may multiple
66 .B sched-entry
67 parameters in a single schedule. Each one has the format:
68
69 sched-entry <gate state> <interval> [ <internal priority> <max octets> ]
70
71 .br
72 <gate state> means gate states. 'open' keep gate open, 'close' keep gate close.
73 .br
74 <interval> means how much nano seconds for this time slot.
75 .br
76 <internal priority> means internal priority value. Present of the
77 internal receiving queue for this stream. "-1" means wildcard.
78 <internal priority> and <max octets> can be omit default to be "-1" which both
79 value to be "-1" for this <sched-entry>.
80 .br
81 <max octets> means how many octets size could pass in this time slot. Dropped
82 if overlimited. "-1" means wildcard. <max octets> can be omit default to be
83 "-1" which value to be "-1" for this <sched-entry>.
84 .br
85 Note that <internal priority> and <max octets> are nothing meaning for gate state
86 is "close" in a "sched-entry". All frames are dropped when "sched-entry" with
87 "close" state.
88
89 .SH EXAMPLES
90
91 The following example shows tc filter frames source ip match to the
92 192.168.0.20 will keep the gate open for 200ms and limit the traffic to 8MB
93 in this sched-entry. Then keep the traffic gate to be close for 100ms.
94 Frames arrived at gate close state would be dropped. Then the cycle would
95 run the gate entries periodically. The schedule will start at instant 200.0s
96 using the reference CLOCK_TAI. The schedule is composed of two entries
97 each of 300ms duration.
98
99 .EX
100 # tc qdisc add dev eth0 ingress
101 # tc filter add dev eth0 parent ffff: protocol ip \\
102 flower skip_hw src_ip 192.168.0.20 \\
103 action gate index 2 clockid CLOCK_TAI \\
104 base-time 200000000000ns \\
105 sched-entry open 200000000ns -1 8000000b \\
106 sched-entry close 100000000ns
107
108 .EE
109
110 Following commands is an example to filter a stream source mac match to the
111 10:00:80:00:00:00 icmp frames will be dropped at any time with cycle 200ms.
112 With a default basetime 0 and clockid is CLOCK_TAI as default.
113
114 .EX
115 # tc qdisc add dev eth0 ingress
116 # tc filter add dev eth0 parent ffff: protocol ip \\
117 flower ip_proto icmp dst_mac 10:00:80:00:00:00 \\
118 action gate index 12 sched-entry close 200000000ns
119
120 .EE
121
122 .SH AUTHORS
123 Po Liu <[email protected]>