[openwrt/openwrt] realtek: dsa: derive dsa port count and irq mask from cpu port

LEDE Commits lede-commits at lists.infradead.org
Sat Feb 21 11:34:04 PST 2026


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/75c772899c7a655b658577f63f3777ded2568890

commit 75c772899c7a655b658577f63f3777ded2568890
Author: Markus Stockhausen <markus.stockhausen at gmx.de>
AuthorDate: Tue Feb 17 19:19:22 2026 +0100

    realtek: dsa: derive dsa port count and irq mask from cpu port
    
    Avoid a family_id check and derive the values from the cpu port.
    
    Signed-off-by: Markus Stockhausen <markus.stockhausen at gmx.de>
    Link: https://github.com/openwrt/openwrt/pull/22068
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 .../linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c  | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c
index 0a23329778..23a37f2bcd 100644
--- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c
+++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c
@@ -1411,8 +1411,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
 		priv->cpu_port = RTL838X_CPU_PORT;
 		priv->port_mask = 0x1f;
 		priv->port_width = 1;
-		priv->irq_mask = 0x0FFFFFFF;
-		priv->ds->num_ports = RTL838X_CPU_PORT + 1;
 		priv->fib_entries = 8192;
 		priv->ds->num_lag_ids = 8;
 		priv->l2_bucket_size = 4;
@@ -1423,8 +1421,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
 		priv->cpu_port = RTL839X_CPU_PORT;
 		priv->port_mask = 0x3f;
 		priv->port_width = 2;
-		priv->irq_mask = 0xFFFFFFFFFFFFFULL;
-		priv->ds->num_ports = RTL839X_CPU_PORT + 1;
 		priv->fib_entries = 16384;
 		priv->ds->num_lag_ids = 16;
 		priv->l2_bucket_size = 4;
@@ -1435,8 +1431,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
 		priv->cpu_port = RTL930X_CPU_PORT;
 		priv->port_mask = 0x1f;
 		priv->port_width = 1;
-		priv->irq_mask = 0x0FFFFFFF;
-		priv->ds->num_ports = RTL930X_CPU_PORT + 1;
 		priv->fib_entries = 16384;
 		priv->ds->num_lag_ids = 16;
 		sw_w32(0, RTL930X_ST_CTRL);
@@ -1448,8 +1442,6 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
 		priv->cpu_port = RTL931X_CPU_PORT;
 		priv->port_mask = 0x3f;
 		priv->port_width = 2;
-		priv->irq_mask = GENMASK_ULL(priv->cpu_port - 1, 0);
-		priv->ds->num_ports = RTL931X_CPU_PORT + 1;
 		priv->fib_entries = 16384;
 		priv->ds->num_lag_ids = 16;
 		sw_w32(0, RTL931x_ST_CTRL);
@@ -1457,6 +1449,8 @@ static int rtl83xx_sw_probe(struct platform_device *pdev)
 		priv->n_mst = 128;
 		break;
 	}
+	priv->ds->num_ports = priv->cpu_port + 1;
+	priv->irq_mask = GENMASK_ULL(priv->cpu_port - 1, 0);
 
 	err = rtl83xx_mdio_probe(priv);
 	if (err) {




More information about the lede-commits mailing list