iproute2/tc
Po Liu 07d5ee70b5 iproute2-next:tc:action: add a gate control action
Introduce a ingress frame gate control flow action.
Tc gate action does the work like this:
Assume there is a gate allow specified ingress frames can pass at
specific time slot, and also drop at specific time slot. Tc filter
chooses the ingress frames, and tc gate action would specify what slot
does these frames can be passed to device and what time slot would be
dropped.
Tc gate action would provide an entry list to tell how much time gate
keep open and how much time gate keep state close. Gate action also
assign a start time to tell when the entry list start. Then driver would
repeat the gate entry list cyclically.
For the software simulation, gate action require the user assign a time
clock type.

Below is the setting example in user space. Tc filter a stream source ip
address is 192.168.0.20 and gate action own two time slots. One is last
200ms gate open let frame pass another is last 100ms gate close let
frames dropped.

 # tc qdisc add dev eth0 ingress
 # tc filter add dev eth0 parent ffff: protocol ip \

            flower src_ip 192.168.0.20 \
            action gate index 2 clockid CLOCK_TAI \
            sched-entry open 200000000ns -1 8000000b \
            sched-entry close 100000000ns

 # tc chain del dev eth0 ingress chain 0

"sched-entry" follow the name taprio style. Gate state is
"open"/"close". Follow the period nanosecond. Then next -1 is internal
priority value means which ingress queue should put to. "-1" means
wildcard. The last value optional specifies the maximum number of
MSDU octets that are permitted to pass the gate during the specified
time interval, the overlimit frames would be dropped.

Below example shows filtering a stream with destination mac address is
10:00:80:00:00:00 and ip type is ICMP, follow the action gate. The gate
action would run with one close time slot which means always keep close.
The time cycle is total 200000000ns. The base-time would calculate by:

     1357000000000 + (N + 1) * cycletime

When the total value is the future time, it will be the start time.
The cycletime here would be 200000000ns for this case.

 #tc filter add dev eth0 parent ffff:  protocol ip \
           flower skip_hw ip_proto icmp dst_mac 10:00:80:00:00:00 \
           action gate index 12 base-time 1357000000000ns \
           sched-entry CLOSE 200000000ns \
           clockid CLOCK_TAI

Signed-off-by: Po Liu <Po.Liu@nxp.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
2020-05-13 02:19:46 +00:00
..
.gitignore make yacc usage POSIX compatible 2020-01-20 09:43:22 -08:00
Makefile iproute2-next:tc:action: add a gate control action 2020-05-13 02:19:46 +00:00
e_bpf.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
em_canid.c drop unneeded include of syslog.h 2017-11-12 16:22:36 -08:00
em_cmp.c drop unneeded include of syslog.h 2017-11-12 16:22:36 -08:00
em_ipset.c Include bsd/string.h only in include/utils.h 2018-11-05 08:38:32 -08:00
em_ipt.c tc: fix spelling errors 2019-08-12 18:18:51 -07:00
em_meta.c tc/meta: make meta_table static and const 2018-11-19 11:42:44 -08:00
em_nbyte.c drop unneeded include of syslog.h 2017-11-12 16:22:36 -08:00
em_u32.c drop unneeded include of syslog.h 2017-11-12 16:22:36 -08:00
emp_ematch.l make yacc usage POSIX compatible 2020-01-20 09:43:22 -08:00
emp_ematch.y make yacc usage POSIX compatible 2020-01-20 09:43:22 -08:00
f_basic.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
f_bpf.c tc: full JSON support for 'bpf' filter 2020-05-05 16:19:06 +00:00
f_cgroup.c tc actions: Improved batching and time filtered dumping 2017-08-04 13:16:51 -07:00
f_flow.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
f_flower.c tc: f_flower: add options support for erspan 2020-05-01 16:33:27 +00:00
f_fw.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
f_matchall.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
f_route.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
f_rsvp.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
f_tcindex.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
f_u32.c tc: f_u32: allow skip_hw and skip_sw flags to be last 2018-11-09 08:12:29 -08:00
m_action.c Replace open-coded instances of print_nl() 2020-05-04 17:13:53 -07:00
m_bpf.c tc: print all error messages to stderr 2019-07-11 15:35:07 -07:00
m_connmark.c Replace open-coded instances of print_nl() 2020-05-04 17:13:53 -07:00
m_csum.c tc: do not output newline in oneline mode 2019-12-11 17:21:10 +00:00
m_ct.c tc: do not output newline in oneline mode 2019-12-11 17:21:10 +00:00
m_ctinfo.c Replace open-coded instances of print_nl() 2020-05-04 17:13:53 -07:00
m_ematch.c tc/ematch: make local functions static 2018-11-19 11:42:44 -08:00
m_ematch.h tc/ematch: make local functions static 2018-11-19 11:42:44 -08:00
m_estimator.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
m_gact.c tc: do not output newline in oneline mode 2019-12-11 17:21:10 +00:00
m_gate.c iproute2-next:tc:action: add a gate control action 2020-05-13 02:19:46 +00:00
m_ife.c Replace open-coded instances of print_nl() 2020-05-04 17:13:53 -07:00
m_ipt.c tc: print all error messages to stderr 2019-07-11 15:35:07 -07:00
m_mirred.c tc: do not output newline in oneline mode 2019-12-11 17:21:10 +00:00
m_mpls.c Replace open-coded instances of print_nl() 2020-05-04 17:13:53 -07:00
m_nat.c Replace open-coded instances of print_nl() 2020-05-04 17:13:53 -07:00
m_pedit.c tc: pedit: Support JSON dumping 2020-04-30 02:43:23 +00:00
m_pedit.h tc/pedit: make functions static 2018-11-19 11:42:44 -08:00
m_police.c iproute2-next: police: support 64bit rate and peakrate in tc utility 2019-09-15 10:39:19 -07:00
m_sample.c Replace open-coded instances of print_nl() 2020-05-04 17:13:53 -07:00
m_simple.c tc: do not output newline in oneline mode 2019-12-11 17:21:10 +00:00
m_skbedit.c Replace open-coded instances of print_nl() 2020-05-04 17:13:53 -07:00
m_skbmod.c tc: print all error messages to stderr 2019-07-11 15:35:07 -07:00
m_tunnel_key.c Merge branch 'master' into next 2020-05-05 16:49:38 +00:00
m_vlan.c tc: do not output newline in oneline mode 2019-12-11 17:21:10 +00:00
m_xt.c tc: do not output newline in oneline mode 2019-12-11 17:21:10 +00:00
m_xt_old.c tc: print all error messages to stderr 2019-07-11 15:35:07 -07:00
p_eth.c tc/pedit: use structure initialization 2018-11-19 11:42:44 -08:00
p_icmp.c tc/pedit: use structure initialization 2018-11-19 11:42:44 -08:00
p_ip.c tc/pedit: use structure initialization 2018-11-19 11:42:44 -08:00
p_ip6.c tc: p_ip6: Support pedit of IPv6 dsfield 2020-04-09 14:39:58 +00:00
p_tcp.c tc/pedit: use structure initialization 2018-11-19 11:42:44 -08:00
p_udp.c tc/pedit: use structure initialization 2018-11-19 11:42:44 -08:00
q_atm.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
q_cake.c q_cake: properly print memlimit 2020-04-20 09:33:15 -07:00
q_cbq.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
q_cbs.c tc: cbs: add support for JSON output 2019-12-29 09:57:27 -08:00
q_choke.c tc: choke: add support for JSON output 2019-12-29 09:57:27 -08:00
q_clsact.c SPDX license identifiers 2017-11-24 12:21:35 -08:00
q_codel.c tc: codel: add support for JSON output 2019-12-29 09:57:27 -08:00
q_drr.c treewide: Use addattr_nest()/addattr_nest_end() to handle nested attributes 2018-02-02 15:01:09 -08:00
q_dsmark.c treewide: Use addattr_nest()/addattr_nest_end() to handle nested attributes 2018-02-02 15:01:09 -08:00
q_etf.c etf: Add skip_sock_check 2019-07-18 15:44:21 -07:00
q_ets.c tc: Add support for ETS Qdisc 2020-01-18 21:54:12 +00:00
q_fifo.c tc: jsonify output of q_fifo 2018-10-08 09:22:22 -07:00
q_fq.c tc: fq: add timer_slack parameter 2020-04-27 14:56:42 -07:00
q_fq_codel.c tc: fq_codel: add drop_batch parameter 2020-04-27 14:56:42 -07:00
q_fq_pie.c tc: add support for FQ-PIE packet scheduler 2020-02-04 03:24:39 -08:00
q_gred.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
q_hfsc.c treewide: Use addattr_nest()/addattr_nest_end() to handle nested attributes 2018-02-02 15:01:09 -08:00
q_hhf.c tc: hhf: add support for JSON output 2019-12-29 09:57:27 -08:00
q_htb.c fix print_0xhex on 32 bit 2018-12-10 14:20:32 -08:00
q_ingress.c ingress: Don't break JSON output 2018-04-25 11:08:39 -07:00
q_mqprio.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
q_multiq.c tc: B.W limits can now be specified in %. 2017-11-24 11:22:13 -08:00
q_netem.c tc: fix spelling errors 2019-08-12 18:18:51 -07:00
q_pie.c Revert "tc: pie: change maximum integer value of tc_pie_xstats->prob" 2020-03-10 18:29:26 +00:00
q_plug.c tc: add support for plug qdisc 2019-05-04 09:22:14 -07:00
q_prio.c tc: prio: fix space in JSON tag 2020-01-06 13:11:41 -08:00
q_qfq.c treewide: Use addattr_nest()/addattr_nest_end() to handle nested attributes 2018-02-02 15:01:09 -08:00
q_red.c tc: q_red: Support 'nodrop' flag 2020-03-25 16:45:37 +00:00
q_rr.c tc: B.W limits can now be specified in %. 2017-11-24 11:22:13 -08:00
q_sfb.c tc: sfb: add support for JSON output 2019-12-29 09:57:27 -08:00
q_sfq.c tc: sfq: add support for JSON output 2019-12-29 09:57:27 -08:00
q_skbprio.c tc: skbprio: add support for JSON output 2020-01-06 13:12:02 -08:00
q_taprio.c Replace open-coded instances of print_nl() 2020-05-04 17:13:53 -07:00
q_tbf.c tc: tbf: add support for JSON output 2019-12-29 09:57:27 -08:00
static-syms.c SPDX license identifiers 2017-11-24 12:21:35 -08:00
tc.c build: fix build failure with -fno-common 2020-01-20 09:40:59 -08:00
tc_cbq.c tc: fix spelling errors 2019-08-12 18:18:51 -07:00
tc_cbq.h SPDX license identifiers 2017-11-24 12:21:35 -08:00
tc_class.c tc: parse attributes with NLA_F_NESTED flag 2020-01-22 03:45:48 +00:00
tc_common.h Revert "tc: Add batchsize feature for filter and actions" 2019-08-02 09:34:51 -07:00
tc_core.c iproute2-next: police: support 64bit rate and peakrate in tc utility 2019-09-15 10:39:19 -07:00
tc_core.h iproute2-next: police: support 64bit rate and peakrate in tc utility 2019-09-15 10:39:19 -07:00
tc_estimator.c tc: support conversions to or from 64 bit nanosecond-based time 2018-08-30 11:04:38 -07:00
tc_exec.c treewide: refactor help messages 2019-05-20 14:35:07 -07:00
tc_filter.c tc: parse attributes with NLA_F_NESTED flag 2020-01-22 03:45:48 +00:00
tc_monitor.c Tree wide: Drop sockaddr_nl arg 2018-10-22 09:43:48 -07:00
tc_qdisc.c tc: parse attributes with NLA_F_NESTED flag 2020-01-22 03:45:48 +00:00
tc_red.c tc: q_red: Support 'nodrop' flag 2020-03-25 16:45:37 +00:00
tc_red.h tc: move RED flag printing to helper 2018-11-24 07:10:58 -08:00
tc_stab.c drop unneeded include of syslog.h 2017-11-12 16:22:36 -08:00
tc_util.c Replace open-coded instances of print_nl() 2020-05-04 17:13:53 -07:00
tc_util.h tc_util: add functions for big endian masked numbers 2019-11-25 21:37:01 +00:00