ramips: mtk_eth_soc: handle frag_cache on Linux >= 6.13

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>
This commit is contained in:
Mieczyslaw Nalewaj 2026-01-06 11:14:37 +01:00 committed by Robert Marko
parent eac2a6c404
commit f5c0225a48

View 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));
}