From a8b3b99726b342c81f8af85743fb11541fa5c8c3 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Mon, 19 Dec 2022 22:57:39 +0100 Subject: [PATCH] Add kernel v5.12 support --- os_dep/linux/recv_linux.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/os_dep/linux/recv_linux.c b/os_dep/linux/recv_linux.c index 13cd766..d87c40b 100644 --- a/os_dep/linux/recv_linux.c +++ b/os_dep/linux/recv_linux.c @@ -399,13 +399,17 @@ static int napi_recv(_adapter *padapter, int budget) rx_ok = _FALSE; #ifdef CONFIG_RTW_GRO - /* + /* cloned SKB use dataref to avoid kernel release it. But dataref changed in napi_gro_receive. So, we should prevent cloned SKB go into napi_gro_receive. */ if (pregistrypriv->en_gro && !skb_cloned(pskb)) { +if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)) + if (rtw_napi_gro_receive(&padapter->napi, pskb) != GRO_MERGED_FREE) +#else if (rtw_napi_gro_receive(&padapter->napi, pskb) != GRO_DROP) +#endif rx_ok = _TRUE; goto next; }