lede/package/qca/qca-nss-drv/patches/0002-nss-drv-add-support-for-kernel-5.15.patch
2024-06-14 17:15:13 +08:00

63 lines
2.2 KiB
Diff

From 2a3b9f4659542e529f4e1a535c33dfde7e272707 Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
Date: Tue, 5 Apr 2022 18:10:57 +0200
Subject: [PATCH 2/4] nss-drv: add support for kernel 5.15
- Fix coredump panic notifier include change.
- Fix skb ZEROCOPY flag.
- Add skb reuse support for 5.15 kernel version.
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
nss_core.c | 5 +++--
nss_coredump.c | 4 ++++
nss_hal/nss_hal.c | 1 +
3 files changed, 9 insertions(+), 2 deletions(-)
--- a/nss_core.c
+++ b/nss_core.c
@@ -61,7 +61,9 @@
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 11, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \
-(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0))))))
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)))) || \
+(((LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))))))
#error "Check skb recycle code in this file to match Linux version"
#endif
@@ -2658,7 +2660,7 @@ static inline bool nss_core_skb_can_reus
if (unlikely(irqs_disabled()))
return false;
- if (unlikely(skb_shinfo(nbuf)->tx_flags & SKBTX_DEV_ZEROCOPY))
+ if (unlikely(skb_shinfo(nbuf)->flags & SKBFL_ZEROCOPY_ENABLE))
return false;
if (unlikely(skb_is_nonlinear(nbuf)))
--- a/nss_coredump.c
+++ b/nss_coredump.c
@@ -25,7 +25,11 @@
#include "nss_hal.h"
#include "nss_log.h"
#include <linux/kernel.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
#include <linux/notifier.h> /* for panic_notifier_list */
+#else
+#include <linux/panic_notifier.h>
+#endif
#include <linux/jiffies.h> /* for time */
#include "nss_tx_rx_common.h"
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -27,6 +27,7 @@
#include <linux/firmware.h>
#include <linux/of.h>
#include <linux/irq.h>
+#include <linux/ethtool.h>
#include "nss_hal.h"
#include "nss_arch.h"