]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: dsa: fix ingress priority setter
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sun, 5 Apr 2026 08:11:50 +0000 (10:11 +0200)
committerRobert Marko <robimarko@gmail.com>
Tue, 7 Apr 2026 08:14:52 +0000 (10:14 +0200)
There are two issues with the current setter.

- It is only called for RTL839x
- It unconditionally overwrites the register and not only
  the needed bits.

Fix that by renaming it to the right prefix and using a
register write based on mask.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22794
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/qos.c

index 78b5f5e6aaadcd5830893d7c74be15ce417b6a98..8458003396998e9c383a92f52ba73408e1b89b78 100644 (file)
@@ -162,12 +162,11 @@ void rtl839x_set_egress_queue(int port, int queue)
 }
 
 /* Sets the priority assigned of an ingress port, the port can be the CPU-port */
-static void rtl83xx_set_ingress_priority(int port, int priority)
+static void rtldsa_839x_set_ingress_priority(int port, int priority)
 {
-       if (soc_info.family == RTL8380_FAMILY_ID)
-               sw_w32(priority << ((port % 10) * 3), RTL838X_PRI_SEL_PORT_PRI(port));
-       else
-               sw_w32(priority << ((port % 10) * 3), RTL839X_PRI_SEL_PORT_PRI(port));
+       int shift = ((port % 10) * 3);
+
+       sw_w32_mask(7 << shift, priority << shift, RTL839X_PRI_SEL_PORT_PRI(port));
 }
 
 static int rtl839x_get_scheduling_algorithm(struct rtl838x_switch_priv *priv, int port)
@@ -329,7 +328,7 @@ void rtldsa_839x_qos_init(struct rtl838x_switch_priv *priv)
        sw_w32(7, RTL839X_QM_PORT_QNUM(soc_info.cpu_port));
 
        for (int port = 0; port <= soc_info.cpu_port; port++) {
-               rtl83xx_set_ingress_priority(port, 0);
+               rtldsa_839x_set_ingress_priority(port, 0);
                rtl839x_set_scheduling_algorithm(priv, port, WEIGHTED_FAIR_QUEUE);
                rtl839x_set_scheduling_queue_weights(priv, port, rtldsa_default_queue_weights);
                /* Do re-marking based on outer tag */