From: Mohsin Bashir <hmoh…@meta.com> At Meta, we intend to use tc-flower ingress rate limiting to limit the ingress rate of containers. Each container has its own IPv6 address, and a tc-flower rule on that destination address with a police action limits the traffic the NIC delivers to it. This series adds tc_flower_police.py, a drv-net test that covers this use case on any device that offloads it. The existing police tests either need a switch topology, only cover the software action, or are tied to a single driver. Patch 1 extends Iperf3Runner to send UDP at a given rate and read the results on the receiver. Patches 2-8 cover the offload itself. and the last 3 patches check that policing keeps working across channel and ring changes and a link flap, and next to ntuple steering and RSS contexts. The series was tested on mlx5 (ConnectX-7) in switchdev mode, with the fix that allows police as the last action of a TC rule [1]. mlx5 does not offload peakrate and overhead and has no ntuple filters in switchdev mode, so those tests skip. police_no_leak skips because the device accepts all 1025 rules. [1] https://lore.kernel.org/all/2026…@gmail.com/ # TAP version 13 # 1..22 # ok 1 tc_flower_police.offload_flags # ok 2 tc_flower_police.police_no_leak # SKIP Device accepted all 1025 rules, cannot fill it # # Unpoliced UDP rate 200 Mbit/s # ok 3 tc_flower_police.link_baseline # ok 4 tc_flower_police.police_rate # ok 5 tc_flower_police.police_isolation # ok 6 tc_flower_police.police_dst_prefix # ok 7 tc_flower_police.police_params.exceed_pipe # ok 8 tc_flower_police.police_params.peakrate # SKIP Not offloaded: Error: mlx5_core: Offload not supported when peakrate/avrate/overhead is configured. # ok 9 tc_flower_police.police_params.overhead # SKIP Not offloaded: Error: mlx5_core: Offload not supported when peakrate/avrate/overhead is configured. # ok 10 tc_flower_police.police_params.pkts_rate # ok 11 tc_flower_police.police_independent # ok 12 tc_flower_police.police_shared_action # ok 13 tc_flower_police.police_priority.slow_first # ok 14 tc_flower_police.police_priority.fast_first # ok 15 tc_flower_police.police_delete # ok 16 tc_flower_police.police_channels # ok 17 tc_flower_police.police_ring_size # ok 18 tc_flower_police.police_with_ntuple.ntuple_first # SKIP Device does not support ntuple-filters # ok 19 tc_flower_police.police_with_ntuple.police_first # SKIP Device does not support ntuple-filters # ok 20 tc_flower_police.police_rss_ctx # SKIP Device does not support ntuple-filters # ok 21 tc_flower_police.police_link_flap # ok 22 tc_flower_police.police_add_while_down # # Totals: pass:16 fail:0 xfail:0 xpass:0 skip:6 error:0 ok 1 selftests: drivers/net/hw: tc_flower_police.py Mohsin Bashir (11): selftests: drv-net: Iperf3Runner: Support UDP and server side results selftests: drv-net: Add tc-flower police offload test selftests: drv-net: tc_flower_police: Test that rules do not leak selftests: drv-net: tc_flower_police: Test the policed rate and its scope selftests: drv-net: tc_flower_police: Test destination prefix rules selftests: drv-net: tc_flower_police: Test police parameters selftests: drv-net: tc_flower_police: Test multiple policers selftests: drv-net: tc_flower_police: Test rule removal selftests: drv-net: tc_flower_police: Test policing across reconfiguration selftests: drv-net: tc_flower_police: Test policing with ntuple steering selftests: drv-net: tc_flower_police: Test policing with RSS contexts .../testing/selftests/drivers/net/hw/Makefile | 1 + tools/testing/selftests/drivers/net/hw/config | 2 + .../drivers/net/hw/lib/py/__init__.py | 4 +- .../drivers/net/hw/tc_flower_police.py | 833 ++++++++++++++++++ .../selftests/drivers/net/lib/py/load.py | 49 +- 5 files changed, 874 insertions(+), 15 deletions(-) create mode 100755 tools/testing/selftests/drivers/net/hw/tc_flower_police.py
-- 2.53.1-Meta