From: Harshal Gohel Date: Mon, 7 Jul 2025 17:00:43 +0000 (+0000) Subject: realtek: rtl931x: Disable callbacks for l3 hw routing X-Git-Url: http://git.openwrt.org/?a=commitdiff_plain;h=5faf91ab8de484559380b2107a32414072224040;p=openwrt%2Fstaging%2Fnbd.git realtek: rtl931x: Disable callbacks for l3 hw routing The RTL931x is not supporting L3 offloading at the moment. To avoid crashes when using this switch, simply disable L3 offloading completely. Signed-off-by: Harshal Gohel Co-developed-by: Sven Eckelmann Signed-off-by: Sven Eckelmann Link: https://github.com/openwrt/openwrt/pull/20208 Signed-off-by: Robert Marko --- 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 aae66b78cd..8b782b5c14 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 @@ -1326,6 +1326,10 @@ static int rtl83xx_netevent_event(struct notifier_block *this, switch (event) { case NETEVENT_NEIGH_UPDATE: + /* ignore events for HW with missing L3 offloading implementation */ + if (!priv->r->l3_setup) + return NOTIFY_DONE; + if (n->tbl != &arp_tbl) return NOTIFY_DONE; dev = n->dev; @@ -1425,6 +1429,10 @@ static int rtl83xx_fib_event(struct notifier_block *this, unsigned long event, v priv = container_of(this, struct rtl838x_switch_priv, fib_nb); + /* ignore FIB events for HW with missing L3 offloading implementation */ + if (!priv->r->l3_setup) + return NOTIFY_DONE; + fib_work = kzalloc(sizeof(*fib_work), GFP_ATOMIC); if (!fib_work) return NOTIFY_BAD; @@ -1699,7 +1707,8 @@ static int __init rtl83xx_sw_probe(struct platform_device *pdev) rtl83xx_setup_qos(priv); - priv->r->l3_setup(priv); + if (priv->r->l3_setup) + priv->r->l3_setup(priv); /* Clear all destination ports for mirror groups */ for (int i = 0; i < 4; i++) diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c index 38f7d2b2df..444c843db9 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c @@ -1385,11 +1385,6 @@ static void rtl931x_pie_init(struct rtl838x_switch_priv *priv) } -static int rtl931x_l3_setup(struct rtl838x_switch_priv *priv) -{ - return 0; -} - static void rtl931x_vlan_port_keep_tag_set(int port, bool keep_outer, bool keep_inner) { sw_w32(FIELD_PREP(RTL931X_VLAN_PORT_TAG_EGR_OTAG_STS_MASK, @@ -1648,7 +1643,6 @@ const struct rtl838x_reg rtl931x_reg = { .pie_rule_add = rtl931x_pie_rule_add, .pie_rule_rm = rtl931x_pie_rule_rm, .l2_learning_setup = rtl931x_l2_learning_setup, - .l3_setup = rtl931x_l3_setup, .led_init = rtldsa_931x_led_init, .enable_learning = rtldsa_931x_enable_learning, .enable_flood = rtldsa_931x_enable_flood,