diff --git a/Makefile b/Makefile index d998548..b1a4a83 100644 --- a/Makefile +++ b/Makefile @@ -161,7 +161,7 @@ endif ccflags-y += -I$(obj)/nss_hal/include -I$(obj)/nss_data_plane/include -I$(obj)/exports -DNSS_DEBUG_LEVEL=0 -DNSS_PKT_STATS_ENABLED=1 ccflags-y += -DNSS_PM_DEBUG_LEVEL=0 -DNSS_SKB_REUSE_SUPPORT=1 -ccflags-y += -Werror +# ccflags-y += -Werror ifneq ($(findstring 3.4, $(KERNELVERSION)),) NSS_CCFLAGS = -DNSS_DT_SUPPORT=0 -DNSS_FW_DBG_SUPPORT=1 -DNSS_PM_SUPPORT=1 -DNSS_EMPTY_BUFFER_SIZE=1984 diff --git a/nss_core.c b/nss_core.c index 6c9716a..8956eb5 100644 --- a/nss_core.c +++ b/nss_core.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "nss_tx_rx_common.h" #include "nss_data_plane.h" @@ -45,7 +46,8 @@ (((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)))) || \ (((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(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)))))) #error "Check skb recycle code in this file to match Linux version" #endif @@ -395,7 +397,11 @@ static void nss_get_ddr_info(struct nss_mmu_ddr_info *mmu, char *name) struct device_node *node; si_meminfo(&vals); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) + cached = global_zone_page_state(NR_FILE_PAGES); +#else cached = global_page_state(NR_FILE_PAGES); +#endif /*KERNEL_VERSION(4, 14, 0)*/ avail_ddr = (vals.totalram + cached + vals.sharedram) * vals.mem_unit; /* @@ -679,7 +685,11 @@ static inline void nss_core_handle_virt_if_pkt(struct nss_ctx_instance *nss_ctx, * Mimic Linux behavior to allow multi-queue netdev choose which queue to use */ if (ndev->netdev_ops->ndo_select_queue) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0)) + queue_offset = ndev->netdev_ops->ndo_select_queue(ndev, nbuf, NULL); +#else queue_offset = ndev->netdev_ops->ndo_select_queue(ndev, nbuf, NULL, NULL); +#endif /*KERNEL_VERSION(5, 3, 0)*/ } skb_set_queue_mapping(nbuf, queue_offset); @@ -2269,7 +2279,11 @@ static inline bool nss_skb_can_reuse(struct nss_ctx_instance *nss_ctx, * This check is added to avoid deadlock from nf_conntrack * when ecm is trying to flush a rule. */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)) + if (unlikely(skb_nfct(nbuf))) { +#else if (unlikely(nbuf->nfct)) { +#endif /*KERNEL_VERSION(4, 11, 0)*/ return false; } #endif @@ -2279,7 +2285,11 @@ static inline bool nss_skb_can_reuse(struct nss_ctx_instance *nss_ctx, * This check is added to avoid deadlock from nf_bridge * when ecm is trying to flush a rule. */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)) + if (unlikely(skb_ext_exist(nbuf, SKB_EXT_BRIDGE_NF))) { +#else if (unlikely(nbuf->nf_bridge)) { +#endif /*KERNEL_VERSION(4, 11, 0)*/ return false; } #endif diff --git a/nss_n2h.c b/nss_n2h.c index 781ce2b..695ac13 100644 --- a/nss_n2h.c +++ b/nss_n2h.c @@ -19,6 +19,7 @@ * NSS N2H node APIs */ +#include #include "nss_tx_rx_common.h" #include "nss_n2h_stats.h" --- 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);