From 2a3b9f4659542e529f4e1a535c33dfde7e272707 Mon Sep 17 00:00:00 2001 From: Ansuel Smith 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 --- 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 @@ -53,7 +53,9 @@ (((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, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)))))) +(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 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 @@ -2580,7 +2582,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 @@ -23,7 +23,11 @@ #include "nss_hal.h" #include "nss_log.h" #include +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)) #include /* for panic_notifier_list */ +#else +#include +#endif #include /* for time */ #include "nss_tx_rx_common.h" --- a/nss_hal/nss_hal.c +++ b/nss_hal/nss_hal.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "nss_hal.h" #include "nss_arch.h" @@ -57,9 +58,9 @@ int nss_hal_firmware_load(struct nss_ctx int rc; if (nss_ctx->id == 0) { - rc = request_firmware(&nss_fw, NSS_AP0_IMAGE, &(nss_dev->dev)); + rc = firmware_request_nowarn(&nss_fw, NSS_AP0_IMAGE, &(nss_dev->dev)); } else if (nss_ctx->id == 1) { - rc = request_firmware(&nss_fw, NSS_AP1_IMAGE, &(nss_dev->dev)); + rc = firmware_request_nowarn(&nss_fw, NSS_AP1_IMAGE, &(nss_dev->dev)); } else { nss_warning("%px: Invalid nss dev: %d\n", nss_ctx, nss_ctx->id); return -EINVAL; --- a/nss_data_plane/nss_data_plane_gmac.c +++ b/nss_data_plane/nss_data_plane_gmac.c @@ -20,7 +20,7 @@ #include "nss_tx_rx_common.h" #include -#define NSS_DP_GMAC_SUPPORTED_FEATURES (NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_FRAGLIST | (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_UFO)) +#define NSS_DP_GMAC_SUPPORTED_FEATURES (NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_FRAGLIST | (NETIF_F_TSO | NETIF_F_TSO6)) #define NSS_DATA_PLANE_GMAC_MAX_INTERFACES 4 static DEFINE_SPINLOCK(nss_data_plane_gmac_stats_lock);