From: Harshal Gohel Date: Tue, 15 Jul 2025 18:20:00 +0000 (+0200) Subject: realtek: rtl930x: Disable L3 offloading X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F20208%2Fhead;p=thirdparty%2Fopenwrt.git realtek: rtl930x: Disable L3 offloading L3 Offloading caused DHCP packets to be dropped at hardware level And potentially buggy route implementation can cause a crash 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/Kconfig b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/Kconfig index 0af4abcfb9c..97e6c8f428a 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/Kconfig +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/Kconfig @@ -5,3 +5,7 @@ config NET_DSA_RTL83XX select NET_DSA_TAG_TRAILER help This driver adds support for Realtek RTL83xx series switching. + +config NET_DSA_RTL83XX_RTL930X_L3_OFFLOAD + bool "Realtek RTL930x layer 3 offload (experimental)" + depends on NET_DSA_RTL83XX diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c index ead7dc4008d..0f29e2f9cd7 100644 --- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c +++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl930x.c @@ -907,6 +907,9 @@ static void rtl930x_init_eee(struct rtl838x_switch_priv *priv, bool enable) priv->eee_enabled = enable; } + +#ifdef CONFIG_NET_DSA_RTL83XX_RTL930X_L3_OFFLOAD + #define HASH_PICK(val, lsb, len) ((val & (((1 << len) - 1) << lsb)) >> lsb) static u32 rtl930x_l3_hash4(u32 ip, int algorithm, bool move_dip) @@ -1460,6 +1463,8 @@ static void rtl930x_set_l3_nexthop(int idx, u16 dmac_id, u16 interface) rtl_table_release(r); } +#endif /* CONFIG_NET_DSA_RTL83XX_RTL930X_L3_OFFLOAD */ + static void rtl930x_pie_lookup_enable(struct rtl838x_switch_priv *priv, int index) { int block = index / PIE_BLOCK_SIZE; @@ -1987,6 +1992,8 @@ static void rtl930x_pie_init(struct rtl838x_switch_priv *priv) } +#ifdef CONFIG_NET_DSA_RTL83XX_RTL930X_L3_OFFLOAD + /* Sets up an egress interface for L3 actions * Actions for ip4/6_icmp_redirect, ip4/6_pbr_icmp_redirect are: * 0: FORWARD, 1: DROP, 2: TRAP2CPU, 3: COPY2CPU, 4: TRAP2MASTERCPU 5: COPY2MASTERCPU @@ -2193,6 +2200,8 @@ static int rtl930x_l3_setup(struct rtl838x_switch_priv *priv) return 0; } +#endif /* CONFIG_NET_DSA_RTL83XX_RTL930X_L3_OFFLOAD */ + static u32 rtl930x_packet_cntr_read(int counter) { u32 v; @@ -2508,6 +2517,7 @@ const struct rtl838x_reg rtl930x_reg = { .l2_learning_setup = rtl930x_l2_learning_setup, .packet_cntr_read = rtl930x_packet_cntr_read, .packet_cntr_clear = rtl930x_packet_cntr_clear, +#ifdef CONFIG_NET_DSA_RTL83XX_RTL930X_L3_OFFLOAD .route_read = rtl930x_route_read, .route_write = rtl930x_route_write, .host_route_write = rtl930x_host_route_write, @@ -2521,6 +2531,7 @@ const struct rtl838x_reg rtl930x_reg = { .get_l3_router_mac = rtl930x_get_l3_router_mac, .set_l3_router_mac = rtl930x_set_l3_router_mac, .set_l3_egress_intf = rtl930x_set_l3_egress_intf, +#endif .set_distribution_algorithm = rtl930x_set_distribution_algorithm, .led_init = rtl930x_led_init, .enable_learning = rtldsa_930x_enable_learning, diff --git a/target/linux/realtek/rtl838x/config-6.12 b/target/linux/realtek/rtl838x/config-6.12 index ef2f183fc36..11e0991ad9a 100644 --- a/target/linux/realtek/rtl838x/config-6.12 +++ b/target/linux/realtek/rtl838x/config-6.12 @@ -173,6 +173,7 @@ CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_RTL83XX=y +# CONFIG_NET_DSA_RTL83XX_RTL930X_L3_OFFLOAD is not set CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_EGRESS=y CONFIG_NET_INGRESS=y diff --git a/target/linux/realtek/rtl839x/config-6.12 b/target/linux/realtek/rtl839x/config-6.12 index 26e8c2bb577..684ba5e590a 100644 --- a/target/linux/realtek/rtl839x/config-6.12 +++ b/target/linux/realtek/rtl839x/config-6.12 @@ -176,6 +176,7 @@ CONFIG_NEED_SRCU_NMI_SAFE=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_RTL83XX=y +# CONFIG_NET_DSA_RTL83XX_RTL930X_L3_OFFLOAD is not set CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_EGRESS=y CONFIG_NET_FLOW_LIMIT=y diff --git a/target/linux/realtek/rtl930x/config-6.12 b/target/linux/realtek/rtl930x/config-6.12 index 4da9fe4bca1..df36dfb1194 100644 --- a/target/linux/realtek/rtl930x/config-6.12 +++ b/target/linux/realtek/rtl930x/config-6.12 @@ -158,6 +158,7 @@ CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_RTL83XX=y +# CONFIG_NET_DSA_RTL83XX_RTL930X_L3_OFFLOAD is not set CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_EGRESS=y CONFIG_NET_FLOW_LIMIT=y diff --git a/target/linux/realtek/rtl930x_nand/config-6.12 b/target/linux/realtek/rtl930x_nand/config-6.12 index b38391cf609..61a4457d37b 100644 --- a/target/linux/realtek/rtl930x_nand/config-6.12 +++ b/target/linux/realtek/rtl930x_nand/config-6.12 @@ -165,6 +165,7 @@ CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_RTL83XX=y +# CONFIG_NET_DSA_RTL83XX_RTL930X_L3_OFFLOAD is not set CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_EGRESS=y CONFIG_NET_FLOW_LIMIT=y diff --git a/target/linux/realtek/rtl931x/config-6.12 b/target/linux/realtek/rtl931x/config-6.12 index 6d402df03bd..efd794258b6 100644 --- a/target/linux/realtek/rtl931x/config-6.12 +++ b/target/linux/realtek/rtl931x/config-6.12 @@ -169,6 +169,7 @@ CONFIG_NEED_SRCU_NMI_SAFE=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_RTL83XX=y +# CONFIG_NET_DSA_RTL83XX_RTL930X_L3_OFFLOAD is not set CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_EGRESS=y CONFIG_NET_FLOW_LIMIT=y diff --git a/target/linux/realtek/rtl931x_nand/config-6.12 b/target/linux/realtek/rtl931x_nand/config-6.12 index f77267c816b..9864c2d9ed4 100644 --- a/target/linux/realtek/rtl931x_nand/config-6.12 +++ b/target/linux/realtek/rtl931x_nand/config-6.12 @@ -176,6 +176,7 @@ CONFIG_NEED_SRCU_NMI_SAFE=y CONFIG_NET_DEVLINK=y CONFIG_NET_DSA=y CONFIG_NET_DSA_RTL83XX=y +# CONFIG_NET_DSA_RTL83XX_RTL930X_L3_OFFLOAD is not set CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_EGRESS=y CONFIG_NET_FLOW_LIMIT=y