realtek: rtl931x: Disable callbacks for l3 hw routing
authorHarshal Gohel <[email protected]>
Mon, 7 Jul 2025 17:00:43 +0000 (17:00 +0000)
committerRobert Marko <[email protected]>
Tue, 21 Oct 2025 19:59:28 +0000 (21:59 +0200)
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 <[email protected]>
Co-developed-by: Sven Eckelmann <[email protected]>
Signed-off-by: Sven Eckelmann <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/20208
Signed-off-by: Robert Marko <[email protected]>
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c

index aae66b78cdea98aada9dbb19845688a224d81892..8b782b5c14cd932cc58964bafc65c28dbfeee3bb 100644 (file)
@@ -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++)
index 38f7d2b2dfe0b2b55bda18fff92ee6af95514141..444c843db9c85e731dca8b70d18348098d3d2b0d 100644 (file)
@@ -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,