Message ID | 20200324034745.30979-8-Po.Liu@nxp.com |
---|---|
State | Changes Requested |
Delegated to: | David Ahern |
Headers | show |
Series | [v2,net-next,1/4] net: qos: introduce a gate control flow action | expand |
Changes from V1: 0000: Update description make it more clear 0001: Removed 'add update dropped stats' patch, will provide pull request as standalone patches. 0001: Update commit description make it more clear ack by Jiri Pirko. 0001: No changes 0003: Fix some code style ack by Jiri Pirko. 0004: Fix enetc_psfp_enable/disable parameter type ack by test robot iprout2 command patches: Not attach with these serial patches, will provide separate pull request after kernel accept these patches. Changes from RFC: 0000: Reduce to 5 patches and remove the 4 max frame size offload and flow metering in the policing offload action, Only keep gate action offloading implementation. 0001: No changes. 0002: - fix kfree lead ack by Jakub Kicinski and Cong Wang - License fix from Jakub Kicinski and Stephen Hemminger - Update example in commit acked by Vinicius Costa Gomes - Fix the rcu protect in tcf_gate_act() acked by Vinicius 0003: No changes 0004: No changes 0005: Acked by Vinicius Costa Gomes - Use refcount kernel lib - Update stream gate check code position - Update reduce ref names more clear iprout2 command patches: 0000: Update license expression and add gate id 0001: Add tc action gate man page -------------------------------------------------------------------- These patches add stream gate action policing in IEEE802.1Qci (Per-Stream Filtering and Policing) software support and hardware offload support in tc flower, and implement the stream identify, stream filtering and stream gate filtering action in the NXP ENETC ethernet driver. Per-Stream Filtering and Policing (PSFP) specifies flow policing and filtering for ingress flows, and has three main parts: 1. The stream filter instance table consists of an ordered list of stream filters that determine the filtering and policing actions that are to be applied to frames received on a specific stream. The main elements are stream gate id, flow metering id and maximum SDU size. 2. The stream gate function setup a gate list to control ingress traffic class open/close state. When the gate is running at open state, the flow could pass but dropped when gate state is running to close. User setup a bastime to tell gate when start running the entry list, then the hardware would periodiclly. There is no compare qdisc action support. 3. Flow metering is two rates two buckets and three-color marker to policing the frames. Flow metering instance are as specified in the algorithm in MEF10.3. The most likely qdisc action is policing action. The first patch introduces an ingress frame flow control gate action, for the point 2. The tc gate action maintains the open/close state gate list, allowing flows to pass when the gate is open. Each gate action may policing one or more qdisc filters. When the start time arrived, The driver would repeat the gate list periodiclly. User can assign a passed time, the driver would calculate a new future time by the cycletime of the gate list. The 0002 patch introduces the gate flow hardware offloading. The 0003 patch adds support control the on/off for the tc flower offloading by ethtool. The 0004 patch implement the stream identify and stream filtering and stream gate filtering action in the NXP ENETC ethernet driver. Tc filter command provide filtering keys with MAC address and VLAN id. These keys would be set to stream identify instance entry. Stream gate instance entry would refer the gate action parameters. Stream filter instance entry would refer the stream gate index and assign a stream handle value matches to the stream identify instance. Po Liu (4): net: qos: introduce a gate control flow action net: schedule: add action gate offloading net: enetc: add hw tc hw offload features for PSPF capability net: enetc: add tc flower psfp offload driver drivers/net/ethernet/freescale/enetc/enetc.c | 34 +- drivers/net/ethernet/freescale/enetc/enetc.h | 86 ++ .../net/ethernet/freescale/enetc/enetc_hw.h | 159 +++ .../net/ethernet/freescale/enetc/enetc_pf.c | 6 + .../net/ethernet/freescale/enetc/enetc_qos.c | 1070 +++++++++++++++++ include/net/flow_offload.h | 10 + include/net/tc_act/tc_gate.h | 169 +++ include/uapi/linux/pkt_cls.h | 1 + include/uapi/linux/tc_act/tc_gate.h | 47 + net/sched/Kconfig | 13 + net/sched/Makefile | 1 + net/sched/act_gate.c | 647 ++++++++++ net/sched/cls_api.c | 33 + 13 files changed, 2275 insertions(+), 1 deletion(-) create mode 100644 include/net/tc_act/tc_gate.h create mode 100644 include/uapi/linux/tc_act/tc_gate.h create mode 100644 net/sched/act_gate.c
diff --git a/man/man8/tc-gate.8 b/man/man8/tc-gate.8 new file mode 100644 index 0000000..2b2d101 --- /dev/null +++ b/man/man8/tc-gate.8 @@ -0,0 +1,106 @@ +.TH GATE 8 "12 Mar 2020" "iproute2" "Linux" +.SH NAME +gate \- Stream Gate Action +.SH SYNOPSIS +.B tc " ... " action gate +.ti +8 +.B [ base-time +BASETIME ] +.B [ clockid +CLOCKID ] +.ti +8 +.B sched-entry +<gate state> <interval 1> <internal priority> <max octets> +.ti +8 +.B sched-entry +<gate state> <interval 2> <internal priority> <max octets> +.ti +8 +.B sched-entry +<gate state> <interval 3> <internal priority> <max octets> +.ti +8 +.B ...... +.ti +8 +.B sched-entry +<gate state> <interval N> <internal priority> <max octets> + +.SH DESCRIPTION +GATE action would provide a gate list to control when traffic keep +open/close state. when the gate open state, the flow could pass but +not when gate state is close. The driver would repeat the gate list +periodically. User also could assign a time point to start the gate +list by the basetime parameter. if the basetime has passed current +time, start time would calculate by the cycletime of the gate list. + +.SH PARAMETERS + +.TP +base-time +.br +Specifies the instant in nanoseconds, defining the time when the schedule +starts. If 'base-time' is a time in the past, the schedule will start at + +base-time + (N * cycle-time) + +where N is the smallest integer so the resulting time is greater than +"now", and "cycle-time" is the sum of all the intervals of the entries +in the schedule. Without base-time specified, will default to be 0. + +.TP +clockid +.br +Specifies the clock to be used by qdisc's internal timer for measuring +time and scheduling events. Not valid if using for offloading filter. +For example, tc filter command with +.B skip_sw parameter. + +.TP +sched-entry +.br +There may multiple +.B sched-entry +parameters in a single schedule. Each one has the format: + +sched-entry <gate state> <interval> <internal priority> <max octets> + +.br +<gate state> means gate states. 'OPEN' keep gate open, 'CLOSE' keep gate close. +.br +<interval> means how much nano seconds for this time slot. +.br +<internal priority> means internal priority value. Present of the +internal receiving queue for this stream. "-1" means wildcard. +.br +<max octets> means how many octets size for this time slot. Dropped +if overlimited. "-1" means wildcard. + +.SH EXAMPLES + +The following example shows tc filter frames source ip match to the +192.168.0.20 will be passed at offset time 0 last 200000000ns and will +be dropped at the offset time 200000000ns and last 100000000ns. Then +run the gate periodically. The schedule will start at instant 200000000000 +using the reference CLOCK_TAI. The schedule is composed of three entries +each of 300us duration. + +.EX +# tc filter add dev eth0 parent ffff: protocol ip \\ + flower skip_hw src_ip 192.168.0.20 \\ + action gate index 2 clockid CLOCK_TAI \\ + base-time 200000000000 \\ + sched-entry OPEN 200000000 -1 -1 \\ + sched-entry CLOSE 100000000 -1 -1 + +.EE + +Following is an example to filter a stream source mac match to the +10:00:80:00:00:00 will be dropped at any time. + +.EX +#tc filter add dev eth0 parent ffff: protocol ip chain 14 \\ + flower skip_sw dst_mac 10:00:80:00:00:00 \\ + action gate index 12 sched-entry close 200000000 -1 -1 + +.EE + +.SH AUTHORS +Po Liu <Po.Liu@nxp.com>
Signed-off-by: Po Liu <Po.Liu@nxp.com> --- man/man8/tc-gate.8 | 106 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 man/man8/tc-gate.8