[openwrt/openwrt] realtek: dsa: rtl930x: Fix flow control with ingress shaping

LEDE Commits lede-commits at lists.infradead.org
Tue Dec 2 01:42:28 PST 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/141ac0b2bd1e7cbad1a75fe17a7b47a3778d16ca

commit 141ac0b2bd1e7cbad1a75fe17a7b47a3778d16ca
Author: Sven Eckelmann <se at simonwunderlich.de>
AuthorDate: Mon Dec 1 13:58:40 2025 +0100

    realtek: dsa: rtl930x: Fix flow control with ingress shaping
    
    Tests with ingress shaping and enabled flow control showed really high
    packet loss. It seems like the MAC pause frames are not created correctly
    when both burst high off is set to the same value as burst high on.
    
    By default, RTL930x has set the burst high values to:
    
    * on: 64K
    * off: 32K
    
    Using the same 1:2 ratio seems to solve the high packet loss rate during
    UDP tests.
    
    Fixes: 2e74eb6d93a7 ("realtek: dsa: rtl93xx: Support per port throttling")
    Signed-off-by: Sven Eckelmann <se at simonwunderlich.de>
    Link: https://github.com/openwrt/openwrt/pull/21011
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c
index fb25b9cf0b..bb41acaf64 100644
--- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c
+++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c
@@ -208,9 +208,13 @@ static int rtldsa_930x_port_rate_police_add(struct dsa_switch *ds, int port,
 	if (ingress) {
 		burst = min_t(u32, act->police.burst, RTL930X_BANDWIDTH_CTRL_INGRESS_BURST_MAX);
 
-		/* set burst high on/off the same to avoid TCP oscillation */
+		/* the linux kernel only provides a single burst value. But the
+		 * realtek HW needs two. And to get flow control correctly
+		 * working, the realtek default ratio of 1:2 seems to work
+		 * reasonable well
+		 */
 		sw_w32(burst, RTL930X_BANDWIDTH_CTRL_INGRESS_BURST_HIGH_ON(port));
-		sw_w32(burst, RTL930X_BANDWIDTH_CTRL_INGRESS_BURST_HIGH_OFF(port));
+		sw_w32(burst / 2, RTL930X_BANDWIDTH_CTRL_INGRESS_BURST_HIGH_OFF(port));
 
 		/* Enable ingress bandwidth flow control to improve TCP throughput and avoid
 		 * the drops behavior of the RTL930x ingress rate limiter which seem to not




More information about the lede-commits mailing list