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