Merge branch 'tc-action-offload'
Simon Horman says: ==================== allow user to offload tc action to net device Baowen Zheng says: Allow use of flow_indr_dev_register/flow_indr_dev_setup_offload to offload tc actions independent of flows. The motivation for this work is to prepare for using TC police action instances to provide hardware offload of OVS metering feature - which calls for policers that may be used by multiple flows and whose lifecycle is independent of any flows that use them. This patch includes basic changes to offload drivers to return EOPNOTSUPP if this feature is used - it is not yet supported by any driver. Tc cli command to offload and quote an action: # tc qdisc del dev $DEV ingress && sleep 1 || true # tc actions delete action police index 200 || true # tc qdisc add dev $DEV ingress # tc qdisc show dev $DEV ingress # tc actions add action police rate 100mbit burst 10000k index 200 skip_sw # tc -s -d actions list action police total acts 1 action order 0: police 0xc8 rate 100Mbit burst 10000Kb mtu 2Kb action reclassify overhead 0b linklayer ethernet ref 1 bind 0 installed 142 sec used 0 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 skip_sw in_hw in_hw_count 1 used_hw_stats delayed # tc filter add dev $DEV protocol ip parent ffff: \ flower skip_sw ip_proto tcp action police index 200 # tc -s -d filter show dev $DEV protocol ip parent ffff: filter pref 49152 flower chain 0 filter pref 49152 flower chain 0 handle 0x1 eth_type ipv4 ip_proto tcp skip_sw in_hw in_hw_count 1 action order 1: police 0xc8 rate 100Mbit burst 10000Kb mtu 2Kb action reclassify overhead 0b linklayer ethernet ref 2 bind 1 installed 300 sec used 0 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 skip_sw in_hw in_hw_count 1 used_hw_stats delayed # tc filter add dev $DEV protocol ipv6 parent ffff: \ flower skip_sw ip_proto tcp action police index 200 # tc -s -d filter show dev $DEV protocol ipv6 parent ffff: filter pref 49151 flower chain 0 filter pref 49151 flower chain 0 handle 0x1 eth_type ipv6 ip_proto tcp skip_sw in_hw in_hw_count 1 action order 1: police 0xc8 rate 100Mbit burst 10000Kb mtu 2Kb action reclassify overhead 0b linklayer ethernet ref 3 bind 2 installed 761 sec used 0 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 skip_sw in_hw in_hw_count 1 used_hw_stats delayed # tc -s -d actions list action police total acts 1 action order 0: police 0xc8 rate 100Mbit burst 10000Kb mtu 2Kb action reclassify overhead 0b linklayer ethernet ref 3 bind 2 installed 917 sec used 0 sec Action statistics: Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) backlog 0b 0p requeues 0 skip_sw in_hw in_hw_count 1 used_hw_stats delayed Changes between v7 and v8: * Rename enum offload_act_command as enum flow_offload_act_command * Add a single patch to rename exts stats update function for readability. * Fix the kernel test robot issue reported by Oliver Sang. Changes between v6 and v7: * Add a single patch to rename offload functions with offload for readability. * Post 166b6a46 ("flow_offload: return EOPNOTSUPP for the unsupported mpls action type") as a bug fix to netdev. * Rename enum flow_act_command as enum flow_offload_act_command * Rename the new added action offload setup ops with offload instead of flow * Rename the new added action offload function with offload instead of flow. * Add more selftest cases for validate filter and actions. Changes between v5 and v6: * Fix issue reported by Dan Carpenter found using Smatch. Changes beteeen v4 and v5: * Made changes of code style according to the public review comments. * Add a fix for unsupported mpls action type in flow action setup stage. * Add ops to tc_action_ops for flow action setup to facilitate adding a standalone action module. * Add notification process when deleting action in reoffload process. Changes between v3 and v4: * Made changes according to the public review comments. * Validate flags inside tcf_action_init() instead of creating new tcf_exts_validate_actions() function. * Exactly match when validating flags of actions and filters. * Add index to flow_action_entry for driver to identify actions. Changes between v2 and v3: * Made changes according to the review comments. * Delete in_hw and not_in_hw flag and user can judge if the action is offloaded to any hardware by in_hw_count. * Split the main patch of the action offload to three single patch to facilitate code review. Changes between v1 and v2: * Add the skip_hw/skip_sw for user to specify if the action should be in hardware or software. * Fix issue of sleeping function called from invalid context. * Change the action offload/delete from batch to one by one. * Add some parameters to the netlink message for user space to look up the offload status of the actions. * Add reoffload process to update action hw_count when driver is inserted or removed. Changes between v1 and RFC: * Fix robot test failure. * Change actions offload process in action add function rather than action init. * Change actions offload delete process after tcf_del_notify to keep undeleted actions. * Add process to update actions stats from hardware. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Please register or sign in to comment