[openwrt/openwrt] realtek: eth: remove fixed dsa coupling

LEDE Commits lede-commits at lists.infradead.org
Mon Feb 23 13:03:07 PST 2026


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

commit f45cfd1f4310db0240f9ba7b1c30fd227a45b859
Author: Markus Stockhausen <markus.stockhausen at gmx.de>
AuthorDate: Fri Feb 20 20:48:54 2026 +0100

    realtek: eth: remove fixed dsa coupling
    
    The ethernet driver has a hard link to the dsa driver. Especially
    the setup_tc() function must be available when the driver loads.
    Decouple it by using a dsa callback recipe.
    
    Suggested-by: Balázs Triszka <info at balika011.hu>
    Signed-off-by: Markus Stockhausen <markus.stockhausen at gmx.de>
    Link: https://github.com/openwrt/openwrt/pull/22121
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 .../files-6.12/drivers/net/ethernet/rtl838x_eth.c  | 26 +++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
index 4dfe1452eb..6b83163fb4 100644
--- a/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
+++ b/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
@@ -24,8 +24,6 @@
 #include <asm/mach-rtl-otto/mach-rtl-otto.h>
 #include "rtl838x_eth.h"
 
-int rtl83xx_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data);
-
 #define RTETH_OWN_CPU		1
 #define RTETH_RX_RING_SIZE	128
 #define RTETH_RX_RINGS		2
@@ -1366,6 +1364,23 @@ static struct phylink_pcs *rteth_mac_select_pcs(struct phylink_config *config,
 	return &ctrl->pcs;
 }
 
+static int rteth_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data)
+{
+    struct dsa_switch *ds;
+    struct dsa_port *dp;
+
+    if (!netdev_uses_dsa(dev))
+        return -EOPNOTSUPP;
+
+    dp = dev->dsa_ptr;
+    ds = dp->ds;
+
+    if (!ds->ops->port_setup_tc)
+        return -EOPNOTSUPP;
+
+    return ds->ops->port_setup_tc(ds, dp->index, type, type_data);
+}
+
 static const struct net_device_ops rteth_838x_netdev_ops = {
 	.ndo_open = rteth_open,
 	.ndo_stop = rteth_stop,
@@ -1376,7 +1391,7 @@ static const struct net_device_ops rteth_838x_netdev_ops = {
 	.ndo_tx_timeout = rteth_tx_timeout,
 	.ndo_set_features = rteth_83xx_set_features,
 	.ndo_fix_features = rteth_fix_features,
-	.ndo_setup_tc = rtl83xx_setup_tc,
+	.ndo_setup_tc = rteth_setup_tc,
 };
 
 static const struct rteth_config rteth_838x_cfg = {
@@ -1423,7 +1438,7 @@ static const struct net_device_ops rteth_839x_netdev_ops = {
 	.ndo_tx_timeout = rteth_tx_timeout,
 	.ndo_set_features = rteth_83xx_set_features,
 	.ndo_fix_features = rteth_fix_features,
-	.ndo_setup_tc = rtl83xx_setup_tc,
+	.ndo_setup_tc = rteth_setup_tc,
 };
 
 static const struct rteth_config rteth_839x_cfg = {
@@ -1470,7 +1485,7 @@ static const struct net_device_ops rteth_930x_netdev_ops = {
 	.ndo_tx_timeout = rteth_tx_timeout,
 	.ndo_set_features = rteth_93xx_set_features,
 	.ndo_fix_features = rteth_fix_features,
-	.ndo_setup_tc = rtl83xx_setup_tc,
+	.ndo_setup_tc = rteth_setup_tc,
 };
 
 static const struct rteth_config rteth_930x_cfg = {
@@ -1520,6 +1535,7 @@ static const struct net_device_ops rteth_931x_netdev_ops = {
 	.ndo_tx_timeout = rteth_tx_timeout,
 	.ndo_set_features = rteth_93xx_set_features,
 	.ndo_fix_features = rteth_fix_features,
+	.ndo_setup_tc = rteth_setup_tc,
 };
 
 static const struct rteth_config rteth_931x_cfg = {




More information about the lede-commits mailing list