summaryrefslogtreecommitdiff
path: root/include/linux/pkt_cls.h
Commit message (Collapse)AuthorAgeFilesLines
* netdev-linux: Allow meter to work in tc software datapath when tc-policy is ↵Baowen Zheng2022-11-011-4/+7
| | | | | | | | | | | | | | | | | | | | | specified Add tc action flags when adding police action to offload meter table. There is a restriction that the flag of skip_sw/skip_hw should be same for filter rule and the independent created tc actions the rule uses. In this case, if we configure the tc-policy as skip_hw, filter rule will be created with skip_hw flag and the police action according to meter table will have no action flag, then flower rule will fail to add to tc kernel system. To fix this issue, we will add tc action flag when adding police action to offload a meter table, so it will allow meter table to work in tc software datapath. Fixes: 5c039ddc64ff ("netdev-linux: Add functions to manipulate tc police action") Signed-off-by: Baowen Zheng <baowen.zheng@corigine.com> Acked-by: Ilya Maximets <i.maximets@ovn.org> Signed-off-by: Simon Horman <simon.horman@corigine.com>
* add port-based ingress policing based packet-per-second rate-limitingYong Xu2021-07-011-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | OVS has support for using policing to enforce a rate limit in kilobits per second. This is configured using OVSDB. f.e. $ ovs-vsctl set interface tap0 ingress_policing_rate=1000 $ ovs-vsctl set interface tap0 ingress_policing_burst=100 This patch adds a related feature, allowing policing to enforce a rate limit in kilo-packets per second. This is also configured using OVSDB. $ ovs-vsctl set interface tap0 ingress_policing_kpkts_rate=1000 $ ovs-vsctl set interface tap0 ingress_policing_kpkts_burst=100 The kilo-bit and kilo-packet rate limits may be used separately or in combination. Add separate action for BPS and PPS in netlink message. Revise code and change action result to pipe to allow traffic pipe into second action. This patch implements the feature for: * OVSDB (northbound API) * TC policer when used both with and without TC offload (kernel API) Signed-off-by: Yong Xu <yong.xu@corigine.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* compat: Add ct_state flags definitionsPaul Blakey2021-03-151-1/+4
| | | | | | | | | Add TCA_FLOWER_KEY_CT_FLAGS_REPLY, and TCA_FLOWER_KEY_CT_FLAGS_INVALID. Signed-off-by: Paul Blakey <paulb@nvidia.com> Acked-by: Roi Dayan <roid@nvidia.com> Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* compat: Add tc ct action and flower matches defines for older kernelsPaul Blakey2019-12-221-3/+43
| | | | | | | | | Update kernel UAPI to support conntrack matches, and the tc actions ct and goto chain. Signed-off-by: Paul Blakey <paulb@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* tc: Set 'no_percpu' flag for compatible actionsVlad Buslov2019-11-111-1/+6
| | | | | | | | | | | | | | | | | | | | Recent changes in Linux kernel TC action subsystem introduced new TCA_ACT_FLAGS_NO_PERCPU_STATS flag. The purpose of the flag is to request action implementation to skip allocating action stats with expensive percpu allocator and use regular built-in action stats instead. Such approach significantly improves rule insertion rate and reduce memory usage for hardware-offloaded rules that don't need benefits provided by percpu allocated stats (improved software TC fast-path performance). Set the flag for all compatible actions. Modify acinclude.m4 to use OVS-internal pkt_cls.h implementation when TCA_ACT_FLAGS is not defined by kernel headers and to manually define struct nla_bitfield32 in netlink.h (new file) when it is not defined by kernel headers. Signed-off-by: Vlad Buslov <vladbu@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* compat: Add compat fix for old kernelsRoi Dayan2019-11-111-0/+2
| | | | | | | | | | | | In kernels older than 4.8, struct tcf_t didn't have the firstuse. If openvswitch is compiled with the compat pkt_cls.h then there is a struct size mismatch between openvswitch and the kernel which cause parsing netlink actions to fail. After this commit parsing the netlink actions pass even if compiled with the compat pkt_cls.h. Signed-off-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* lib/tc: add ingress ratelimiting support for tc-offloadPieter Jansen van Vuuren2019-03-041-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Firstly this patch introduces the notion of reserved priority, as the filter implementing ingress policing would require the highest priority. Secondly it allows setting rate limiters while tc-offloads has been enabled. Lastly it installs a matchall filter that matches all traffic and then applies a police action, when configuring an ingress rate limiter. An example of what to expect: OvS CLI: ovs-vsctl set interface <netdev_name> ingress_policing_rate=5000 ovs-vsctl set interface <netdev_name> ingress_policing_burst=100 Resulting TC filter: filter protocol ip pref 1 matchall chain 0 filter protocol ip pref 1 matchall chain 0 handle 0x1 not_in_hw action order 1: police 0x1 rate 5Mbit burst 125Kb mtu 64Kb action drop/continue overhead 0b ref 1 bind 1 installed 3 sec used 3 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 MIGRATED TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 10.0.0.200 () port 0 AF_INET : demo Recv Send Send Socket Socket Message Elapsed Size Size Size Time Throughput bytes bytes bytes secs. 10^6bits/sec 131072 16384 16384 60.13 4.49 ovs-vsctl list interface <netdev_name> _uuid : 2ca774e8-8b95-430f-a2c2-f8f742613ab1 admin_state : up ... ingress_policing_burst: 100 ingress_policing_rate: 5000 ... type : "" Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* lib/tc: add geneve with option match offloadPieter Jansen van Vuuren2018-09-201-0/+25
| | | | | | | Add TC offload support for classifying geneve tunnels with options. Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* lib/tc: Support matching on ip tunnel tos and ttlOr Gerlitz2018-08-011-1/+6
| | | | | | | | | Support matching on tos and ttl of ip tunnels for the TC data-path. Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* Add support to offload QinQ double VLAN headers matchJianbo Liu2018-07-251-1/+5
| | | | | | | | | | Currently the inner VLAN header is ignored when using the TC data-path. As TC flower supports QinQ, now we can offload the rules to match on both outer and inner VLAN headers. Signed-off-by: Jianbo Liu <jianbol@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* netdev-tc-offloads: Add support for IP fragmentationRoi Dayan2018-03-211-2/+3
| | | | | | | | | Add support for frag no, first and later. Signed-off-by: Roi Dayan <roid@mellanox.com> Reviewed-by: Shahar Klein <shahark@mellanox.com> Reviewed-by: Paul Blakey <paulb@mellanox.com> Signed-off-by: Simon Horman <simon.horman@netronome.com>
* compat: Update tc compatibility headerPaul Blakey2017-08-111-4/+47
| | | | | | | | | Update to include up to flower ttl matching. Signed-off-by: Paul Blakey <paulb@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Acked-by: Simon Horman <simon.horman@netronome.com> Signed-off-by: Joe Stringer <joe@ovn.org>
* compat: Add tc compatibility headers for old kernelsPaul Blakey2017-05-301-0/+165
Added compatibility headers for actions vlan and tunnel key. Do not use compat code when compiling kernel datapath there is no need for it as TC compatibility is not provided there. In other words, the compat code is only used when compiling user-space code against old kernel headers. Signed-off-by: Paul Blakey <paulb@mellanox.com> Reviewed-by: Roi Dayan <roid@mellanox.com> Acked-by: Flavio Leitner <fbl@sysclose.org> Signed-off-by: Simon Horman <simon.horman@netronome.com>