realtek: dsa: rtl93xx: Support per port throttling
authorIssam Hamdi <[email protected]>
Tue, 15 Jul 2025 17:23:21 +0000 (19:23 +0200)
committerRobert Marko <[email protected]>
Fri, 7 Nov 2025 11:34:09 +0000 (12:34 +0100)
commit2e74eb6d93a7db37bb8e0ec901ae08078afa9a65
treefa68aee424736df7803a5c73c7a1a8400a8f6d74
parent2df73702c52b2dec7debb8b618d556385cf10f70
realtek: dsa: rtl93xx: Support per port throttling

The RTL930x and RTL931x have an ingress and egress bandwidth controller for
each port. They can can be used to reduce the throughput for each port.

They can be programmed via the the DSA flower offloading capabilities. Only
a limited functionality (bytes based rate limiter for ingress/egress) is
supported.

With kmod-sched-act-police, kmod-sched-flower and tc installed, each port
can have its ingress/egress rate limit applied in hardware using:

    # tc qdisc del dev lan1 clsact
    tc qdisc add dev lan1 clsact
    tc filter add dev lan1 ingress flower skip_sw action police rate 100mbit burst 64k conform-exceed drop
    tc filter add dev lan1 egress flower skip_sw action police rate 150mbit burst 64k conform-exceed drop

Signed-off-by: Issam Hamdi <[email protected]>
Co-developed-by: Sven Eckelmann <[email protected]>
Signed-off-by: Sven Eckelmann <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20663
Signed-off-by: Robert Marko <[email protected]>
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl838x.h
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c