]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
ramips: mtk_eth_soc: handle frag_cache on Linux >= 6.13
authorMieczyslaw Nalewaj <namiltd@yahoo.com>
Tue, 6 Jan 2026 10:14:37 +0000 (11:14 +0100)
committerRobert Marko <robimarko@gmail.com>
Mon, 6 Apr 2026 09:26:27 +0000 (11:26 +0200)
Fix fe_clean_rx to handle the changed frag_cache layout on newer kernels.

For kernels >= 6.13 the fragment cache needs to be converted from its
encoded_page value instead of using the old va field. Add an ifdef
to use frag_cache.encoded_page & PAGE_MASK and virt_to_page for those
kernels, keep the old path for older kernels.

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/21418
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/ramips/files/drivers/net/ethernet/ralink/mtk_eth_soc.c

index a67dc145daab50167cc99a316e49e89c116a60b1..f53746eee830acdf7854e3eabe344dc59d227463 100644 (file)
@@ -34,6 +34,7 @@
 #include <net/netfilter/nf_flow_table.h>
 #include <linux/gpio.h>
 #include <linux/gpio/consumer.h>
+#include <linux/version.h>
 
 #include <asm/mach-ralink/ralink_regs.h>
 
@@ -243,10 +244,18 @@ static void fe_clean_rx(struct fe_priv *priv)
                ring->rx_dma = NULL;
        }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,13,0)
+       void *vaddr = (void *)(ring->frag_cache.encoded_page & PAGE_MASK);
+       if (!vaddr)
+               return;
+
+       page = virt_to_page(vaddr);
+#else
        if (!ring->frag_cache.va)
            return;
 
        page = virt_to_page(ring->frag_cache.va);
+#endif
        __page_frag_cache_drain(page, ring->frag_cache.pagecnt_bias);
        memset(&ring->frag_cache, 0, sizeof(ring->frag_cache));
 }