From ffad2a5e3c7aa2fbb7f8699c1e3e5a6fe81f6947 Mon Sep 17 00:00:00 2001 From: Qosmio Date: Tue, 13 Sep 2022 09:17:35 -0400 Subject: [PATCH] QSDK 12.1 backport + fixes * qca-nss-drv: backport 12.1 * qca-nss-ecm: backport 12.1 * qca-nss-gmac: consolidate patches --- .../patches/0003-11.4-netlink-optimize.patch | 9 +- qca-nss-drv/Makefile | 5 + ...hack-support-for-mismatched-firmware.patch | 2 +- qca-nss-drv/patches/0013-backport-12.1.patch | 716 ++++++++++++++++++ qca-nss-ecm/Makefile | 6 +- qca-nss-ecm/patches/0001-add-versioning.patch | 11 + ...de-componentize-the-module-even-more.patch | 99 ++- ...ipv6_dev_find_and_hold-to-internal-A.patch | 43 +- ...rk-debugfs-api-to-new-implementation.patch | 169 ++--- ...treewide-fix-wrong-chain-events-flag.patch | 4 +- ...olve-the-cpu-high-load-regarding-ecm.patch | 8 +- ...terface-switch-to-kernel_recvmsg-api.patch | 8 +- ...ide-rework-notifier-changes-for-5.15.patch | 8 +- ...se-of-static-be_liberal-and-no_windo.patch | 32 +- ...dp_get_timeouts-and-use-standard-ups.patch | 8 +- ...rework-vlan-API-to-internal-function.patch | 24 +- ...work-br_dev_update_stats-to-internal.patch | 24 +- ...assifier_nl_genl-kernel-5.10-support.patch | 14 +- ...cm_db-revert-ipv6_route_table_update.patch | 170 ----- ...-ecm-fix-a-memcpy-overflow-in-ecm_db.patch | 106 +++ ...0015-example-fix-compile-pcc-example.patch | 49 +- ...tifier-introduce-init-and-exit-mutex.patch | 55 ++ ...t.patch => 0000-kernel-5.10-support.patch} | 134 +++- .../patches/0002-nss-gmac-test-ptr.patch | 11 - ...0003-nss-gmac-fix-of_get_mac_address.patch | 22 - .../patches/0004-fix-ioremap-call.patch | 40 - .../0005-nss-gmac-fix-of_get_phy_mode.patch | 44 -- .../0006-fix-nss-gmac-tx-timeout.patch | 22 - ...-work-around-interface-close-warning.patch | 15 - 29 files changed, 1309 insertions(+), 549 deletions(-) create mode 100644 qca-nss-drv/patches/0013-backport-12.1.patch create mode 100644 qca-nss-ecm/patches/0001-add-versioning.patch delete mode 100644 qca-nss-ecm/patches/0014-ecm_db-revert-ipv6_route_table_update.patch create mode 100644 qca-nss-ecm/patches/0014-qca-nss-ecm-fix-a-memcpy-overflow-in-ecm_db.patch create mode 100644 qca-nss-ecm/patches/902-ecm-conntrack-notifier-introduce-init-and-exit-mutex.patch rename qca-nss-gmac/patches/{0001-kernel-5.4-support.patch => 0000-kernel-5.10-support.patch} (65%) delete mode 100644 qca-nss-gmac/patches/0002-nss-gmac-test-ptr.patch delete mode 100644 qca-nss-gmac/patches/0003-nss-gmac-fix-of_get_mac_address.patch delete mode 100644 qca-nss-gmac/patches/0004-fix-ioremap-call.patch delete mode 100644 qca-nss-gmac/patches/0005-nss-gmac-fix-of_get_phy_mode.patch delete mode 100644 qca-nss-gmac/patches/0006-fix-nss-gmac-tx-timeout.patch delete mode 100644 qca-nss-gmac/patches/0007-work-around-interface-close-warning.patch diff --git a/qca-nss-clients/patches/0003-11.4-netlink-optimize.patch b/qca-nss-clients/patches/0003-11.4-netlink-optimize.patch index 766e8c0..6727adb 100644 --- a/qca-nss-clients/patches/0003-11.4-netlink-optimize.patch +++ b/qca-nss-clients/patches/0003-11.4-netlink-optimize.patch @@ -19,15 +19,14 @@ -ccflags-y += -DCONFIG_NSS_NLIPV4_REASM=1 -ccflags-y += -DCONFIG_NSS_NLIPV6_REASM=1 -ccflags-y += -DCONFIG_NSS_NLWIFILI=1 --ccflags-y += -DCONFIG_NSS_NLLSO_RX=1 ++ccflags-y += -DCONFIG_NSS_NLIPV4_REASM=0 ++ccflags-y += -DCONFIG_NSS_NLIPV6_REASM=0 ++ccflags-y += -DCONFIG_NSS_NLWIFILI=0 + ccflags-y += -DCONFIG_NSS_NLLSO_RX=1 -ccflags-y += -DCONFIG_NSS_NLMAP_T=1 -ccflags-y += -DCONFIG_NSS_NLPPPOE=1 -ccflags-y += -DCONFIG_NSS_NLL2TPV2=1 -ccflags-y += -DCONFIG_NSS_NLPPTP=1 -+ccflags-y += -DCONFIG_NSS_NLIPV4_REASM=0 -+ccflags-y += -DCONFIG_NSS_NLIPV6_REASM=0 -+ccflags-y += -DCONFIG_NSS_NLWIFILI=0 -+ccflags-y += -DCONFIG_NSS_NLLSO_RX=0 +ccflags-y += -DCONFIG_NSS_NLMAP_T=0 +ccflags-y += -DCONFIG_NSS_NLPPPOE=0 +ccflags-y += -DCONFIG_NSS_NLL2TPV2=0 diff --git a/qca-nss-drv/Makefile b/qca-nss-drv/Makefile index 80fdf95..04ebac4 100644 --- a/qca-nss-drv/Makefile +++ b/qca-nss-drv/Makefile @@ -125,6 +125,10 @@ endif ifeq ($(CONFIG_TARGET_BOARD), "ipq806x") TARGET_NSS_MINOR_VERSION=0 DRV_MAKE_OPTS+= \ + NSS_DRV_BRIDGE_ENABLE=n \ + NSS_DRV_IPSEC_ENABLE=n \ + NSS_DRV_DTLS_ENABLE=n \ + NSS_DRV_C2C_ENABLE=n \ NSS_DRV_CAPWAP_ENABLE=n \ NSS_DRV_QRFS_ENABLE=n \ NSS_DRV_VLAN_ENABLE=n \ @@ -149,6 +153,7 @@ ifeq ($(CONFIG_TARGET_BOARD), "ipq806x") NSS_DRV_VXLAN_ENABLE=n \ NSS_DRV_MATCH_ENABLE=n \ NSS_DRV_MIRROR_ENABLE=n \ + NSS_DRV_IPV4_REASM_ENABLE=n \ NSS_DRV_PORTID_ENABLE=y endif diff --git a/qca-nss-drv/patches/0011-treewide-hack-support-for-mismatched-firmware.patch b/qca-nss-drv/patches/0011-treewide-hack-support-for-mismatched-firmware.patch index d8c0db3..1144db9 100644 --- a/qca-nss-drv/patches/0011-treewide-hack-support-for-mismatched-firmware.patch +++ b/qca-nss-drv/patches/0011-treewide-hack-support-for-mismatched-firmware.patch @@ -81,7 +81,7 @@ +#define __NSS_FW_VERSION_H + +#define NSS_FW_VERSION_MAJOR 11 -+#define NSS_FW_VERSION_MINOR 4 ++#define NSS_FW_VERSION_MINOR 0 + +#define NSS_FW_VERSION(a,b) (((a) << 8) + (b)) + diff --git a/qca-nss-drv/patches/0013-backport-12.1.patch b/qca-nss-drv/patches/0013-backport-12.1.patch new file mode 100644 index 0000000..57b875f --- /dev/null +++ b/qca-nss-drv/patches/0013-backport-12.1.patch @@ -0,0 +1,716 @@ +--- a/Makefile ++++ b/Makefile +@@ -8,8 +8,6 @@ obj-m += qca-nss-drv.o + # List the files that belong to the driver in alphabetical order. + # + qca-nss-drv-objs := \ +- nss_bridge.o \ +- nss_bridge_log.o \ + nss_cmn.o \ + nss_core.o \ + nss_coredump.o \ +@@ -18,9 +16,6 @@ qca-nss-drv-objs := \ + nss_dynamic_interface.o \ + nss_dynamic_interface_log.o \ + nss_dynamic_interface_stats.o \ +- nss_edma.o \ +- nss_edma_stats.o \ +- nss_edma_strings.o \ + nss_eth_rx.o \ + nss_eth_rx_stats.o \ + nss_eth_rx_strings.o \ +@@ -32,16 +27,6 @@ qca-nss-drv-objs := \ + nss_ipv4_stats.o \ + nss_ipv4_strings.o \ + nss_ipv4_log.o \ +- nss_ipv4_reasm.o \ +- nss_ipv4_reasm_stats.o \ +- nss_ipv4_reasm_strings.o \ +- nss_ipv6.o \ +- nss_ipv6_stats.o \ +- nss_ipv6_strings.o \ +- nss_ipv6_log.o \ +- nss_ipv6_reasm.o \ +- nss_ipv6_reasm_stats.o \ +- nss_ipv6_reasm_strings.o \ + nss_log.o \ + nss_lso_rx.o \ + nss_lso_rx_stats.o \ +@@ -104,6 +89,21 @@ qca-nss-drv-objs += nss_wifi.o \ + nss_wifi_mac_db.o + endif + ++ifneq "$(NSS_DRV_BRIDGE_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_BRIDGE_ENABLE ++qca-nss-drv-objs += \ ++ nss_bridge.o \ ++ nss_bridge_log.o ++endif ++ ++ifneq "$(NSS_DRV_IPV4_REASM_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_IPV4_REASM_ENABLE ++qca-nss-drv-objs += \ ++ nss_ipv4_reasm.o \ ++ nss_ipv4_reasm_stats.o \ ++ nss_ipv4_reasm_strings.o ++endif ++ + ifneq "$(NSS_DRV_L2TP_ENABLE)" "n" + ccflags-y += -DNSS_DRV_L2TP_ENABLE + qca-nss-drv-objs += \ +@@ -128,20 +128,20 @@ qca-nss-drv-objs += \ + nss_pvxlan_stats.o + endif + +-ifneq "$(NSS_DRV_MATCH_ENABLE)" "n" +-ccflags-y += -DNSS_DRV_MATCH_ENABLE ++ifneq "$(NSS_DRV_IPV6_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_IPV6_ENABLE + qca-nss-drv-objs += \ +- nss_match.o \ +- nss_match_log.o \ +- nss_match_stats.o ++ nss_ipv6.o \ ++ nss_ipv6_stats.o \ ++ nss_ipv6_strings.o \ ++ nss_ipv6_log.o ++ifneq "$(NSS_DRV_IPV6_REASM_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_IPV6_REASM_ENABLE ++qca-nss-drv-objs += \ ++ nss_ipv6_reasm.o \ ++ nss_ipv6_reasm_stats.o \ ++ nss_ipv6_reasm_strings.o + endif +- +-ifneq "$(NSS_DRV_MIRROR_ENABLE)" "n" +-ccflags-y += -DNSS_DRV_MIRROR_ENABLE +-qca-nss-drv-objs += \ +- nss_mirror.o \ +- nss_mirror_log.o \ +- nss_mirror_stats.o + endif + + ifneq "$(NSS_DRV_TSTAMP_ENABLE)" "n" +@@ -292,17 +292,6 @@ qca-nss-drv-objs += \ + nss_clmap_stats.o + endif + +-ifneq "$(NSS_DRV_C2C_ENABLE)" "n" +-ccflags-y += -DNSS_DRV_C2C_ENABLE +-qca-nss-drv-objs += \ +- nss_c2c_tx.o \ +- nss_c2c_tx_log.o \ +- nss_c2c_tx_stats.o \ +- nss_c2c_tx_strings.o \ +- nss_c2c_rx.o \ +- nss_c2c_rx_stats.o \ +- nss_c2c_rx_strings.o +-endif + + ifneq "$(NSS_DRV_VXLAN_ENABLE)" "n" + ccflags-y += -DNSS_DRV_VXLAN_ENABLE +@@ -312,10 +301,37 @@ qca-nss-drv-objs += \ + nss_vxlan_stats.o + endif + +-ifeq ($(SoC),$(filter $(SoC),ipq806x ipq40xx)) ++ifneq "$(NSS_DRV_MATCH_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_MATCH_ENABLE ++qca-nss-drv-objs += \ ++ nss_match.o \ ++ nss_match_log.o \ ++ nss_match_stats.o ++endif ++ ++ifneq "$(NSS_DRV_MIRROR_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_MIRROR_ENABLE ++qca-nss-drv-objs += \ ++ nss_mirror.o \ ++ nss_mirror_log.o \ ++ nss_mirror_stats.o ++endif ++ ++ifeq ($(SoC),$(filter $(SoC),ipq806x)) + qca-nss-drv-objs += nss_data_plane/nss_data_plane_gmac.o \ + nss_hal/ipq806x/nss_hal_pvt.o + ++ifneq "$(NSS_DRV_C2C_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_C2C_ENABLE ++qca-nss-drv-objs += \ ++ nss_c2c_tx.o \ ++ nss_c2c_tx_log.o \ ++ nss_c2c_tx_stats.o \ ++ nss_c2c_tx_strings.o \ ++ nss_c2c_rx.o \ ++ nss_c2c_rx_stats.o \ ++ nss_c2c_rx_strings.o ++endif + ifneq "$(NSS_DRV_IPSEC_ENABLE)" "n" + ccflags-y += -DNSS_DRV_IPSEC_ENABLE + qca-nss-drv-objs += \ +@@ -342,6 +358,9 @@ endif + + ifeq ($(SoC),$(filter $(SoC),ipq60xx ipq60xx_64 ipq807x ipq807x_64)) + qca-nss-drv-objs += nss_data_plane/nss_data_plane.o \ ++ nss_edma.o \ ++ nss_edma_stats.o \ ++ nss_edma_strings.o \ + nss_ppe.o \ + nss_ppe_log.o \ + nss_ppe_stats.o \ +@@ -382,9 +401,9 @@ endif + ifneq "$(NSS_DRV_QVPN_ENABLE)" "n" + ccflags-y += -DNSS_DRV_QVPN_ENABLE + qca-nss-drv-objs += \ +- nss_qvpn.o \ +- nss_qvpn_stats.o \ +- nss_qvpn_log.o ++ nss_qvpn.o \ ++ nss_qvpn_log.o \ ++ nss_qvpn_stats.o + endif + ifneq "$(NSS_DRV_TLS_ENABLE)" "n" + ccflags-y += -DNSS_DRV_TLS_ENABLE +@@ -397,6 +416,17 @@ endif + ifeq ($(SoC),$(filter $(SoC),ipq807x ipq807x_64)) + qca-nss-drv-objs += nss_hal/ipq807x/nss_hal_pvt.o \ + nss_data_plane/hal/nss_ipq807x.o ++ifneq "$(NSS_DRV_C2C_ENABLE)" "n" ++ccflags-y += -DNSS_DRV_C2C_ENABLE ++qca-nss-drv-objs += \ ++ nss_c2c_tx.o \ ++ nss_c2c_tx_log.o \ ++ nss_c2c_tx_stats.o \ ++ nss_c2c_tx_strings.o \ ++ nss_c2c_rx.o \ ++ nss_c2c_rx_stats.o \ ++ nss_c2c_rx_strings.o ++endif + ccflags-y += -I$(obj)/nss_hal/ipq807x -DNSS_HAL_IPQ807x_SUPPORT -DNSS_MULTI_H2N_DATA_RING_SUPPORT + endif + +@@ -437,7 +467,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 += -I$(obj)/nss_data_plane/hal/include + ccflags-y += -DNSS_PM_DEBUG_LEVEL=0 -DNSS_SKB_REUSE_SUPPORT=1 +-ccflags-y += -Werror ++ccflags-y += -Wall -Werror + + KERNELVERSION := $(word 1, $(subst ., ,$(KERNELVERSION))).$(word 2, $(subst ., ,$(KERNELVERSION))) + +--- a/nss_core.c ++++ b/nss_core.c +@@ -895,7 +895,7 @@ static inline void nss_core_handle_buffe + /* + * linearize or free if requested. + */ +- if (unlikely(skb_is_nonlinear(nbuf))) { ++ if (unlikely(skb_is_nonlinear(nbuf))) { + if (nss_core_skb_needs_linearize(nbuf, ndev->features) && __skb_linearize(nbuf)) { + dev_kfree_skb_any(nbuf); + return; +@@ -953,11 +953,11 @@ static inline void nss_core_handle_ext_b + ext_cb = subsys_dp_reg->ext_cb; + if (likely(ext_cb) && likely(ndev)) { + +- if (unlikely(skb_is_nonlinear(nbuf))) { ++ if (unlikely(skb_is_nonlinear(nbuf))) { + if (nss_core_skb_needs_linearize(nbuf, ndev->features) && __skb_linearize(nbuf)) { + /* +- * We needed to linearize, but __skb_linearize() failed. So free the nbuf. +- */ ++ * We needed to linearize, but __skb_linearize() failed. So free the nbuf. ++ */ + dev_kfree_skb_any(nbuf); + return; + } +@@ -1067,6 +1067,21 @@ static inline void nss_core_rx_pbuf(stru + } + + /* ++ * nss_core_set_skb_classify() ++ * Set skb field to avoid ingress shaping. ++ */ ++static inline void nss_core_set_skb_classify(struct sk_buff *nbuf) ++{ ++#ifdef CONFIG_NET_CLS_ACT ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)) ++ nbuf->tc_verd = SET_TC_NCLS_NSS(nbuf->tc_verd); ++#else ++ skb_skip_tc_classify(nbuf); ++#endif ++#endif ++} ++ ++/* + * nss_core_handle_nrfrag_skb() + * Handled the processing of fragmented skb's + */ +@@ -1119,9 +1134,10 @@ static inline bool nss_core_handle_nr_fr + * ingress shaped flag set. + */ + if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) { +- nbuf->tc_verd_qca_nss = SET_TC_NCLS_NSS(nbuf->tc_verd_qca_nss); ++ nss_core_set_skb_classify(nbuf); + } + #endif ++ + goto pull; + } + +@@ -1159,7 +1175,7 @@ static inline bool nss_core_handle_nr_fr + * ingress shaped flag set. + */ + if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) { +- nbuf->tc_verd_qca_nss = SET_TC_NCLS_NSS(nbuf->tc_verd_qca_nss); ++ nss_core_set_skb_classify(nbuf); + } + #endif + +@@ -1274,7 +1290,7 @@ static inline bool nss_core_handle_linea + * ingress shaped flag set. + */ + if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) { +- nbuf->tc_verd_qca_nss = SET_TC_NCLS_NSS(nbuf->tc_verd_qca_nss); ++ nss_core_set_skb_classify(nbuf); + } + #endif + +@@ -1332,7 +1348,7 @@ static inline bool nss_core_handle_linea + * ingress shaped flag set. + */ + if (unlikely(desc->bit_flags & N2H_BIT_FLAG_INGRESS_SHAPED)) { +- nbuf->tc_verd_qca_nss = SET_TC_NCLS_NSS(nbuf->tc_verd_qca_nss); ++ nss_core_set_skb_classify(nbuf); + } + #endif + +@@ -1702,7 +1718,7 @@ static void nss_core_init_nss(struct nss + if (nss_ctx->id) { + ret = nss_n2h_update_queue_config_async(nss_ctx, pn_mq_en, pn_qlimits); + if (ret != NSS_TX_SUCCESS) { +- nss_warning("Failed to send pnode queue config to core 1\n"); ++ nss_warning("%px: Failed to send pnode queue config to core 1\n", nss_ctx); + } + return; + } +@@ -1717,9 +1733,14 @@ static void nss_core_init_nss(struct nss + * connections supported by the accelerator. + */ + nss_ipv4_conn_cfg = max_ipv4_conn; ++ ++#ifdef NSS_DRV_IPV6_ENABLE + nss_ipv6_conn_cfg = max_ipv6_conn; + nss_ipv4_update_conn_count(max_ipv4_conn); + nss_ipv6_update_conn_count(max_ipv6_conn); ++#else ++ nss_ipv4_update_conn_count(max_ipv4_conn); ++#endif + + #ifdef NSS_MEM_PROFILE_LOW + /* +--- a/nss_core.h ++++ b/nss_core.h +@@ -232,6 +232,8 @@ static inline void nss_core_dma_cache_ma + * INFO: The LOW and MAX value together describe the "performance" band that we should operate the frequency at. + * + */ ++#define NSS_FREQ_SCALE_NA 0xFAADFAAD /* Frequency scale not supported */ ++ + #define NSS_FREQ_110 110000000 /* Frequency in hz */ + #define NSS_FREQ_110_MIN 0x03000 /* Instructions Per ms Min */ + #define NSS_FREQ_110_MAX 0x07000 /* Instructions Per ms Max */ +--- a/nss_coredump.c ++++ b/nss_coredump.c +@@ -1,6 +1,8 @@ + /* + ************************************************************************** + * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. ++ * + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -47,7 +49,8 @@ static struct workqueue_struct *coredump + */ + static void nss_coredump_wait(struct work_struct *work) + { +- panic("did not get all coredump finished signals\n"); ++ if (!(nss_cmd_buf.coredump & 0xFFFFFFFE)) ++ panic("did not get all coredump finished signals\n"); + } + + /* +--- a/nss_dma.c ++++ b/nss_dma.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the +@@ -120,7 +120,7 @@ static void nss_dma_msg_handler(struct n + */ + if (ndm->cm.type == NSS_DMA_MSG_TYPE_SYNC_STATS) { + nss_dma_stats_sync(nss_ctx, &ndm->msg.stats); +- ++ nss_dma_stats_notify(nss_ctx); + } + + /* +--- a/nss_dma_stats.c ++++ b/nss_dma_stats.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the +@@ -17,10 +17,16 @@ + */ + + #include "nss_core.h" ++#include "nss_dma.h" + #include "nss_dma_stats.h" + #include "nss_dma_strings.h" + + /* ++ * Declare atomic notifier data structure for statistics. ++ */ ++ATOMIC_NOTIFIER_HEAD(nss_dma_stats_notifier); ++ ++/* + * Spinlock to protect DMA statistics update/read + */ + DEFINE_SPINLOCK(nss_dma_stats_lock); +@@ -117,3 +123,41 @@ void nss_dma_stats_sync(struct nss_ctx_i + + spin_unlock_bh(&nss_dma_stats_lock); + } ++ ++/* ++ * nss_dma_stats_notify() ++ * Sends notifications to all the registered modules. ++ * ++ * Leverage NSS-FW statistics timing to update Netlink. ++ */ ++void nss_dma_stats_notify(struct nss_ctx_instance *nss_ctx) ++{ ++ struct nss_dma_stats_notification dma_stats; ++ ++ spin_lock_bh(&nss_dma_stats_lock); ++ dma_stats.core_id = nss_ctx->id; ++ memcpy(dma_stats.stats_ctx, nss_dma_stats, sizeof(dma_stats.stats_ctx)); ++ spin_unlock_bh(&nss_dma_stats_lock); ++ ++ atomic_notifier_call_chain(&nss_dma_stats_notifier, NSS_STATS_EVENT_NOTIFY, &dma_stats); ++} ++ ++/* ++ * nss_dma_stats_unregister_notifier() ++ * Deregisters statistics notifier. ++ */ ++int nss_dma_stats_unregister_notifier(struct notifier_block *nb) ++{ ++ return atomic_notifier_chain_unregister(&nss_dma_stats_notifier, nb); ++} ++EXPORT_SYMBOL(nss_dma_stats_unregister_notifier); ++ ++/* ++ * nss_dma_stats_register_notifier() ++ * Registers statistics notifier. ++ */ ++int nss_dma_stats_register_notifier(struct notifier_block *nb) ++{ ++ return atomic_notifier_chain_register(&nss_dma_stats_notifier, nb); ++} ++EXPORT_SYMBOL(nss_dma_stats_register_notifier); +--- a/nss_hal/ipq806x/nss_hal_pvt.c ++++ b/nss_hal/ipq806x/nss_hal_pvt.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2013, 2015-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2013, 2015-2021, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -464,6 +464,7 @@ static struct nss_platform_data *__nss_h + goto out; + } + ++ nss_assert(npd->vphys); + npd->vmap = ioremap_cache(npd->vphys, resource_size(&res_vphys)); + if (!npd->vmap) { + nss_info_always("%px: nss%d: ioremap() fail for vphys\n", nss_ctx, nss_ctx->id); +--- a/nss_hal/nss_hal.c ++++ b/nss_hal/nss_hal.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -41,7 +41,6 @@ + /* + * Macros + */ +-#define MIN_IMG_SIZE (64*1024) + #define NSS_AP0_IMAGE "qca-nss0.bin" + #define NSS_AP1_IMAGE "qca-nss1.bin" + +@@ -74,10 +73,6 @@ int nss_hal_firmware_load(struct nss_ctx + return rc; + } + +- if (nss_fw->size < MIN_IMG_SIZE) { +- nss_info_always("%px: nss firmware is truncated, size:%d", nss_ctx, (int)nss_fw->size); +- return rc; +- } + + load_mem = ioremap(npd->load_addr, nss_fw->size); + if (!load_mem) { +@@ -293,7 +288,6 @@ int nss_hal_probe(struct platform_device + * Physical address of logical registers space + */ + nss_ctx->vphys = npd->vphys; +- nss_assert(nss_ctx->vphys); + nss_info("%d:ctx=%px, vphys=%x, vmap=%px, nphys=%x, nmap=%px", nss_ctx->id, + nss_ctx, nss_ctx->vphys, nss_ctx->vmap, nss_ctx->nphys, nss_ctx->nmap); + +@@ -364,8 +358,10 @@ int nss_hal_probe(struct platform_device + nss_top->ipv4_handler_id = nss_dev->id; + nss_ipv4_register_handler(); + ++#ifdef NSS_DRV_EDMA_ENABLE + nss_top->edma_handler_id = nss_dev->id; + nss_edma_register_handler(); ++#endif + nss_eth_rx_register_handler(nss_ctx); + #ifdef NSS_DRV_LAG_ENABLE + nss_lag_register_handler(); +@@ -389,20 +385,27 @@ int nss_hal_probe(struct platform_device + } + #endif + #endif ++ ++#ifdef NSS_DRV_IPV4_REASM_ENABLE + if (npd->ipv4_reasm_enabled == NSS_FEATURE_ENABLED) { + nss_top->ipv4_reasm_handler_id = nss_dev->id; + nss_ipv4_reasm_register_handler(); + } ++#endif + ++#ifdef NSS_DRV_IPV6_ENABLE + if (npd->ipv6_enabled == NSS_FEATURE_ENABLED) { + nss_top->ipv6_handler_id = nss_dev->id; + nss_ipv6_register_handler(); + } + ++#ifdef NSS_DRV_IPV6_REASM_ENABLE + if (npd->ipv6_reasm_enabled == NSS_FEATURE_ENABLED) { + nss_top->ipv6_reasm_handler_id = nss_dev->id; + nss_ipv6_reasm_register_handler(); + } ++#endif ++#endif + + #ifdef NSS_DRV_CRYPTO_ENABLE + /* +@@ -583,11 +586,13 @@ int nss_hal_probe(struct platform_device + } + #endif + ++#ifdef NSS_DRV_BRIDGE_ENABLE + if (npd->bridge_enabled == NSS_FEATURE_ENABLED) { + nss_top->bridge_handler_id = nss_dev->id; + nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_BRIDGE] = nss_dev->id; + nss_bridge_init(); + } ++#endif + + #ifdef NSS_DRV_VLAN_ENABLE + if (npd->vlan_enabled == NSS_FEATURE_ENABLED) { +--- a/nss_hlos_if.h ++++ b/nss_hlos_if.h +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2013-2019, 2021, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -33,7 +33,11 @@ + */ + #if defined (NSS_MEM_PROFILE_LOW) + #define NSS_DEFAULT_NUM_CONN 512 /* Default number of connections for IPv4 and IPv6 each, for low memory profile */ ++#if defined (NSS_DRV_IPV6_ENABLE) + #define NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6 1024 /* MAX Connection shared between IPv4 and IPv6 for low memory profile */ ++#else ++#define NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6 512 /* MAX Connection for IPv4 for low memory profile */ ++#endif + #define NSS_LOW_MEM_EMPTY_POOL_BUF_SZ 4096 /* Default empty buffer pool size for low profile */ + #elif defined (NSS_MEM_PROFILE_MEDIUM) + #define NSS_DEFAULT_NUM_CONN 2048 /* Default number of connections for IPv4 and IPv6 each, for medium memory profile */ +--- a/nss_init.c ++++ b/nss_init.c +@@ -1,6 +1,6 @@ + /* + ************************************************************************** +- * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved. + * Permission to use, copy, modify, and/or distribute this software for + * any purpose with or without fee is hereby granted, provided that the + * above copyright notice and this permission notice appear in all copies. +@@ -307,7 +307,9 @@ static int nss_get_freq_table_handler(st + + i = 0; + while (i < NSS_FREQ_MAX_SCALE) { +- printk("%d Hz ", nss_runtime_samples.freq_scale[i].frequency); ++ if (nss_runtime_samples.freq_scale[i].frequency != NSS_FREQ_SCALE_NA) { ++ printk("%d Hz ", nss_runtime_samples.freq_scale[i].frequency); ++ } + i++; + } + printk("\n"); +@@ -738,7 +740,9 @@ static int __init nss_init(void) + * Registering sysctl for ipv4/6 specific config. + */ + nss_ipv4_register_sysctl(); ++#ifdef NSS_DRV_IPV6_ENABLE + nss_ipv6_register_sysctl(); ++#endif + + /* + * Registering sysctl for n2h specific config. +@@ -911,16 +915,15 @@ static void __exit nss_cleanup(void) + #endif + + /* +- * Unregister ipv4/6 specific sysctl ++ * Unregister ipv4/6 specific sysctl and free allocated to connection tables + */ + nss_ipv4_unregister_sysctl(); +- nss_ipv6_unregister_sysctl(); +- +- /* +- * Free Memory allocated for connection tables +- */ + nss_ipv4_free_conn_tables(); ++ ++#ifdef NSS_DRV_IPV6_ENABLE ++ nss_ipv6_unregister_sysctl(); + nss_ipv6_free_conn_tables(); ++#endif + + nss_project_unregister_sysctl(); + nss_data_plane_destroy_delay_work(); +--- a/nss_meminfo.c ++++ b/nss_meminfo.c +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. ++ * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above +@@ -311,6 +311,15 @@ static bool nss_meminfo_init_block_lists + switch (mtype) { + case NSS_MEMINFO_MEMTYPE_IMEM: + /* ++ * For SOC's where TCM is not present ++ */ ++ if (!nss_ctx->vphys) { ++ nss_info_always("%px:IMEM requested but TCM not defined " ++ "for this SOC\n", nss_ctx); ++ goto cleanup; ++ } ++ ++ /* + * Return SoC real address for IMEM as DMA address. + */ + dma_addr = nss_meminfo_alloc_imem(nss_ctx, r->size, r->alignment); +@@ -453,6 +462,15 @@ static bool nss_meminfo_allocate_n2h_h2n + } + break; + case NSS_MEMINFO_MEMTYPE_IMEM: ++ /* ++ * For SOC's where TCM is not present ++ */ ++ if (!nss_ctx->vphys) { ++ nss_info_always("%px:IMEM requested but TCM not defined " ++ "for this SOC\n", nss_ctx); ++ return false; ++ } ++ + info->dma_addr = nss_meminfo_alloc_imem(nss_ctx, info->total_size, L1_CACHE_BYTES); + if (!info->dma_addr) + return false; +@@ -517,6 +535,13 @@ static bool nss_meminfo_configure_n2h_h2 + } + + /* ++ * Returning true allows to execute firmware bin ++ */ ++ if (!mem_ctx->if_map) { ++ return true; ++ } ++ ++ /* + * Bring a fresh copy of if_map from memory in order to read it correctly. + */ + if_map = mem_ctx->if_map; +@@ -705,7 +730,6 @@ bool nss_meminfo_init(struct nss_ctx_ins + struct nss_meminfo_map *map; + struct nss_top_instance *nss_top = &nss_top_main; + +- NSS_VERIFY_CTX_MAGIC(nss_ctx); + mem_ctx = &nss_ctx->meminfo_ctx; + + /* +--- a/nss_profiler.c ++++ b/nss_profiler.c +@@ -153,8 +153,10 @@ void nss_profiler_release_dma(struct nss + + ctrl = nss_ctx->meminfo_ctx.sdma_ctrl; + +- if (ctrl && ctrl->consumer[0].ring.kp) ++ if (ctrl && ctrl->consumer[0].ring.kp) { + kfree(ctrl->consumer[0].ring.kp); ++ ctrl->consumer[0].ring.kp = NULL; ++ } + } + EXPORT_SYMBOL(nss_profiler_release_dma); + +@@ -198,10 +200,12 @@ EXPORT_SYMBOL(nss_profile_dma_deregister + struct nss_profile_sdma_ctrl *nss_profile_dma_get_ctrl(struct nss_ctx_instance *nss_ctx) + { + struct nss_profile_sdma_ctrl *ctrl = nss_ctx->meminfo_ctx.sdma_ctrl; +- if (ctrl) { +- dmac_inv_range(ctrl, &ctrl->cidx); +- dsb(sy); ++ if (!ctrl) { ++ return ctrl; + } ++ ++ dmac_inv_range(ctrl, &ctrl->cidx); ++ dsb(sy); + return ctrl; + } + EXPORT_SYMBOL(nss_profile_dma_get_ctrl); +@@ -233,7 +237,7 @@ void nss_profiler_notify_unregister(nss_ + { + nss_assert(core_id < NSS_CORE_MAX); + +- nss_core_register_handler(&nss_top_main.nss[core_id], NSS_PROFILER_INTERFACE, NULL, NULL); ++ nss_core_unregister_handler(&nss_top_main.nss[core_id], NSS_PROFILER_INTERFACE); + nss_top_main.profiler_callback[core_id] = NULL; + nss_top_main.profiler_ctx[core_id] = NULL; + } diff --git a/qca-nss-ecm/Makefile b/qca-nss-ecm/Makefile index a593e74..dd99223 100644 --- a/qca-nss-ecm/Makefile +++ b/qca-nss-ecm/Makefile @@ -5,10 +5,10 @@ PKG_NAME:=qca-nss-ecm PKG_RELEASE:=1 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-nss-ecm.git -PKG_SOURCE_DATE:=2021-06-15 +PKG_SOURCE_DATE:=2022-08-16 PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=34267065855d32f33264dc3054efb0e8103d627b -PKG_MIRROR_HASH:=0917659d69c5f3e6067d6671b9393b4b2d6b6cd5a7bacf5e7d6cf842dc906eca +PKG_SOURCE_VERSION:=bc390e91d7ef9a2e62866a37acd593123cf0387f +PKG_MIRROR_HASH:=2847d899feb719c52b90a06f1d3ee9d80a142cec610d4df3384d0f3af186cbd9 PKG_JOBS=-j4 LOCAL_VARIANT=$(patsubst qca-nss-ecm-%,%,$(patsubst qca-nss-ecm-%,%,$(BUILD_VARIANT))) diff --git a/qca-nss-ecm/patches/0001-add-versioning.patch b/qca-nss-ecm/patches/0001-add-versioning.patch new file mode 100644 index 0000000..cfb9bf3 --- /dev/null +++ b/qca-nss-ecm/patches/0001-add-versioning.patch @@ -0,0 +1,11 @@ +--- a/ecm_init.c ++++ b/ecm_init.c +@@ -118,7 +118,7 @@ static int __init ecm_init(void) + { + int ret; + +- printk(KERN_INFO "ECM init\n"); ++ printk(KERN_INFO "ECM init ( QSDK 12.1.0.r1 2022-08-16 )\n"); + + selected_front_end = ecm_front_end_type_select(); + if (selected_front_end == ECM_FRONT_END_TYPE_MAX) { diff --git a/qca-nss-ecm/patches/0001-treewide-componentize-the-module-even-more.patch b/qca-nss-ecm/patches/0001-treewide-componentize-the-module-even-more.patch index 9ef37fc..274742f 100644 --- a/qca-nss-ecm/patches/0001-treewide-componentize-the-module-even-more.patch +++ b/qca-nss-ecm/patches/0001-treewide-componentize-the-module-even-more.patch @@ -14,7 +14,7 @@ Signed-off-by: Ansuel Smith --- a/Makefile +++ b/Makefile -@@ -82,10 +82,18 @@ ccflags-$(ECM_INTERFACE_BOND_ENABLE) += +@@ -125,10 +125,18 @@ ccflags-$(ECM_INTERFACE_BOND_ENABLE) += # Define ECM_INTERFACE_PPPOE_ENABLE=y in order # to enable support for PPPoE acceleration. # ############################################################################# @@ -34,8 +34,8 @@ Signed-off-by: Ansuel Smith # Define ECM_INTERFACE_L2TPV2_ENABLE=y in order # to enable support for l2tpv2 acceleration. # ############################################################################# -@@ -118,6 +126,12 @@ ccflags-$(ECM_INTERFACE_PPP_ENABLE) += - - ccflags-$(ECM_INTERFACE_MAP_T_ENABLE) += -DECM_INTERFACE_MAP_T_ENABLE +@@ -155,6 +163,12 @@ endif + ccflags-$(ECM_INTERFACE_PPP_ENABLE) += -DECM_INTERFACE_PPP_ENABLE # ############################################################################# +# Define ECM_INTERFACE_GRE_ENABLE=y in order @@ -47,7 +47,7 @@ Signed-off-by: Ansuel Smith # Define ECM_INTERFACE_GRE_TAP_ENABLE=y in order # to enable support for GRE TAP interface. # ############################################################################# -@@ -186,7 +200,9 @@ ccflags-$(ECM_INTERFACE_OVS_BRIDGE_ENABL +@@ -230,7 +244,9 @@ ccflags-$(ECM_INTERFACE_OVS_BRIDGE_ENABL # ############################################################################# # Define ECM_INTERFACE_VLAN_ENABLE=y in order to enable support for VLAN # ############################################################################# @@ -58,7 +58,7 @@ Signed-off-by: Ansuel Smith ccflags-$(ECM_INTERFACE_VLAN_ENABLE) += -DECM_INTERFACE_VLAN_ENABLE # ############################################################################# -@@ -228,7 +244,9 @@ ccflags-$(ECM_CLASSIFIER_OVS_ENABLE) += +@@ -271,7 +287,9 @@ ccflags-$(ECM_CLASSIFIER_OVS_ENABLE) += # ############################################################################# # Define ECM_CLASSIFIER_MARK_ENABLE=y in order to enable mark classifier. # ############################################################################# @@ -69,7 +69,7 @@ Signed-off-by: Ansuel Smith ecm-$(ECM_CLASSIFIER_MARK_ENABLE) += ecm_classifier_mark.o ccflags-$(ECM_CLASSIFIER_MARK_ENABLE) += -DECM_CLASSIFIER_MARK_ENABLE -@@ -247,12 +265,23 @@ ccflags-$(ECM_CLASSIFIER_NL_ENABLE) += - +@@ -290,21 +308,14 @@ ccflags-$(ECM_CLASSIFIER_NL_ENABLE) += - # ############################################################################# # Define ECM_CLASSIFIER_DSCP_ENABLE=y in order to enable DSCP classifier. # ############################################################################# @@ -82,35 +82,35 @@ Signed-off-by: Ansuel Smith ccflags-$(ECM_CLASSIFIER_DSCP_IGS) += -DECM_CLASSIFIER_DSCP_IGS # ############################################################################# -+# Define ECM_CLASSIFIER_PCC_ENABLE=y in order to enable -+# the Parental Controls subsystem classifier in ECM. Currently disabled until -+# customers require it / if they need to integrate their Parental Controls with it. -+# ############################################################################# -+ECM_CLASSIFIER_PCC_ENABLE=y -+ecm-$(ECM_CLASSIFIER_PCC_ENABLE) += ecm_classifier_pcc.o -+ccflags-$(ECM_CLASSIFIER_PCC_ENABLE) += -DECM_CLASSIFIER_PCC_ENABLE -+ -+# ############################################################################# - # Define ECM_CLASSIFIER_HYFI_ENABLE=y in order to enable - # the Hy-Fi classifier in ECM. Currently disabled until the integration - # with Hy-Fi is completed. -@@ -270,15 +299,6 @@ ccflags-$(ECM_CLASSIFIER_HYFI_ENABLE) += - endif - - # ############################################################################# --# Define ECM_CLASSIFIER_PCC_ENABLE=y in order to enable --# the Parental Controls subsystem classifier in ECM. Currently disabled until --# customers require it / if they need to integrate their Parental Controls with it. +-# Define ECM_CLASSIFIER_HYFI_ENABLE=y in order to enable +-# the Hy-Fi classifier in ECM. Currently disabled until the integration +-# with Hy-Fi is completed. -# ############################################################################# --ECM_CLASSIFIER_PCC_ENABLE=y --ecm-$(ECM_CLASSIFIER_PCC_ENABLE) += ecm_classifier_pcc.o --ccflags-$(ECM_CLASSIFIER_PCC_ENABLE) += -DECM_CLASSIFIER_PCC_ENABLE +-# +-ecm-$(ECM_CLASSIFIER_HYFI_ENABLE) += ecm_classifier_hyfi.o +-ccflags-$(ECM_CLASSIFIER_HYFI_ENABLE) += -DECM_CLASSIFIER_HYFI_ENABLE - -# ############################################################################# + # Define ECM_CLASSIFIER_PCC_ENABLE=y in order to enable + # the Parental Controls subsystem classifier in ECM. Currently disabled until + # customers require it / if they need to integrate their Parental Controls with it. +@@ -314,6 +325,15 @@ ecm-$(ECM_CLASSIFIER_PCC_ENABLE) += ecm_ + ccflags-$(ECM_CLASSIFIER_PCC_ENABLE) += -DECM_CLASSIFIER_PCC_ENABLE + + # ############################################################################# ++# Define ECM_CLASSIFIER_HYFI_ENABLE=y in order to enable ++# the Hy-Fi classifier in ECM. Currently disabled until the integration ++# with Hy-Fi is completed. ++# ############################################################################# ++# ++ecm-$(ECM_CLASSIFIER_HYFI_ENABLE) += ecm_classifier_hyfi.o ++ccflags-$(ECM_CLASSIFIER_HYFI_ENABLE) += -DECM_CLASSIFIER_HYFI_ENABLE ++ ++# ############################################################################# # Define ECM_CLASSIFIER_EMESH_ENABLE=y in order to enable E-Mesh classifier. # ############################################################################# ecm-$(ECM_CLASSIFIER_EMESH_ENABLE) += ecm_classifier_emesh.o -@@ -301,28 +321,36 @@ ccflags-$(ECM_NON_PORTED_SUPPORT_ENABLE) +@@ -350,27 +370,36 @@ ccflags-$(ECM_NON_PORTED_SUPPORT_ENABLE) # ############################################################################# # Define ECM_STATE_OUTPUT_ENABLE=y to support XML state output # ############################################################################# @@ -144,14 +144,13 @@ Signed-off-by: Ansuel Smith # Define ECM_TRACKER_DPI_SUPPORT_ENABLE=y in order to enable support for # deep packet inspection and tracking of data with the trackers. # ############################################################################# --ECM_TRACKER_DPI_SUPPORT_ENABLE=y +ifndef $(ECM_TRACKER_DPI_SUPPORT_ENABLE) + ECM_TRACKER_DPI_SUPPORT_ENABLE=y +endif ccflags-$(ECM_TRACKER_DPI_SUPPORT_ENABLE) += -DECM_TRACKER_DPI_SUPPORT_ENABLE # ############################################################################# -@@ -330,14 +358,18 @@ ccflags-$(ECM_TRACKER_DPI_SUPPORT_ENABLE +@@ -378,14 +407,18 @@ ccflags-$(ECM_TRACKER_DPI_SUPPORT_ENABLE # support for the database keeping lists of connections that are assigned # on a per TYPE of classifier basis. # ############################################################################# @@ -174,7 +173,7 @@ Signed-off-by: Ansuel Smith # ############################################################################# --- a/ecm_db/ecm_db_connection.c +++ b/ecm_db/ecm_db_connection.c -@@ -430,7 +430,9 @@ EXPORT_SYMBOL(ecm_db_connection_make_def +@@ -462,7 +462,9 @@ EXPORT_SYMBOL(ecm_db_connection_make_def */ void ecm_db_connection_data_totals_update(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets) { @@ -184,7 +183,7 @@ Signed-off-by: Ansuel Smith DEBUG_CHECK_MAGIC(ci, ECM_DB_CONNECTION_INSTANCE_MAGIC, "%px: magic failed\n", ci); -@@ -529,7 +531,9 @@ EXPORT_SYMBOL(ecm_db_connection_data_tot +@@ -561,7 +563,9 @@ EXPORT_SYMBOL(ecm_db_connection_data_tot */ void ecm_db_connection_data_totals_update_dropped(struct ecm_db_connection_instance *ci, bool is_from, uint64_t size, uint64_t packets) { @@ -194,7 +193,7 @@ Signed-off-by: Ansuel Smith DEBUG_CHECK_MAGIC(ci, ECM_DB_CONNECTION_INSTANCE_MAGIC, "%px: magic failed\n", ci); -@@ -1508,6 +1512,7 @@ void ecm_db_connection_defunct_all(void) +@@ -1540,6 +1544,7 @@ void ecm_db_connection_defunct_all(void) } EXPORT_SYMBOL(ecm_db_connection_defunct_all); @@ -202,7 +201,7 @@ Signed-off-by: Ansuel Smith /* * ecm_db_connection_defunct_by_classifier() * Make defunct based on masked fields -@@ -1667,6 +1672,7 @@ next_ci: +@@ -1706,6 +1711,7 @@ next_ci: ECM_IP_ADDR_TO_OCTAL(dest_addr_mask), dest_port_mask, proto_mask, cnt); } } @@ -210,7 +209,7 @@ Signed-off-by: Ansuel Smith /* * ecm_db_connection_defunct_by_port() -@@ -1956,6 +1962,7 @@ struct ecm_db_node_instance *ecm_db_conn +@@ -1995,6 +2001,7 @@ struct ecm_db_node_instance *ecm_db_conn } EXPORT_SYMBOL(ecm_db_connection_node_get_and_ref); @@ -218,7 +217,7 @@ Signed-off-by: Ansuel Smith /* * ecm_db_connection_mapping_get_and_ref_next() * Return reference to next connection in the mapping chain in the specified direction. -@@ -1997,6 +2004,7 @@ struct ecm_db_connection_instance *ecm_d +@@ -2036,6 +2043,7 @@ struct ecm_db_connection_instance *ecm_d return nci; } EXPORT_SYMBOL(ecm_db_connection_iface_get_and_ref_next); @@ -228,7 +227,7 @@ Signed-off-by: Ansuel Smith * ecm_db_connection_mapping_get_and_ref() --- a/ecm_db/ecm_db_node.c +++ b/ecm_db/ecm_db_node.c -@@ -224,9 +224,11 @@ EXPORT_SYMBOL(ecm_db_node_get_and_ref_ne +@@ -227,9 +227,11 @@ EXPORT_SYMBOL(ecm_db_node_get_and_ref_ne */ int ecm_db_node_deref(struct ecm_db_node_instance *ni) { @@ -240,7 +239,7 @@ Signed-off-by: Ansuel Smith DEBUG_CHECK_MAGIC(ni, ECM_DB_NODE_INSTANCE_MAGIC, "%px: magic failed\n", ni); spin_lock_bh(&ecm_db_lock); -@@ -486,9 +488,11 @@ EXPORT_SYMBOL(ecm_db_node_iface_get_and_ +@@ -489,9 +491,11 @@ EXPORT_SYMBOL(ecm_db_node_iface_get_and_ void ecm_db_node_add(struct ecm_db_node_instance *ni, struct ecm_db_iface_instance *ii, uint8_t *address, ecm_db_node_final_callback_t final, void *arg) { @@ -254,7 +253,7 @@ Signed-off-by: Ansuel Smith --- a/ecm_interface.c +++ b/ecm_interface.c -@@ -1343,6 +1343,7 @@ struct neighbour *ecm_interface_ipv6_nei +@@ -1353,6 +1353,7 @@ struct neighbour *ecm_interface_ipv6_nei */ bool ecm_interface_is_pptp(struct sk_buff *skb, const struct net_device *out) { @@ -262,7 +261,7 @@ Signed-off-by: Ansuel Smith struct net_device *in; /* -@@ -1367,6 +1368,7 @@ bool ecm_interface_is_pptp(struct sk_buf +@@ -1377,6 +1378,7 @@ bool ecm_interface_is_pptp(struct sk_buf } dev_put(in); @@ -270,7 +269,7 @@ Signed-off-by: Ansuel Smith return false; } -@@ -1379,6 +1381,7 @@ bool ecm_interface_is_pptp(struct sk_buf +@@ -1389,6 +1391,7 @@ bool ecm_interface_is_pptp(struct sk_buf */ bool ecm_interface_is_l2tp_packet_by_version(struct sk_buff *skb, const struct net_device *out, int ver) { @@ -278,7 +277,7 @@ Signed-off-by: Ansuel Smith uint32_t flag = 0; struct net_device *in; -@@ -1411,6 +1414,7 @@ bool ecm_interface_is_l2tp_packet_by_ver +@@ -1421,6 +1424,7 @@ bool ecm_interface_is_l2tp_packet_by_ver } dev_put(in); @@ -286,7 +285,7 @@ Signed-off-by: Ansuel Smith return false; } -@@ -1423,6 +1427,7 @@ bool ecm_interface_is_l2tp_packet_by_ver +@@ -1433,6 +1437,7 @@ bool ecm_interface_is_l2tp_packet_by_ver */ bool ecm_interface_is_l2tp_pptp(struct sk_buff *skb, const struct net_device *out) { @@ -294,7 +293,7 @@ Signed-off-by: Ansuel Smith struct net_device *in; /* -@@ -1445,6 +1450,7 @@ bool ecm_interface_is_l2tp_pptp(struct s +@@ -1455,6 +1460,7 @@ bool ecm_interface_is_l2tp_pptp(struct s } dev_put(in); @@ -302,7 +301,7 @@ Signed-off-by: Ansuel Smith return false; } -@@ -6630,6 +6636,7 @@ static void ecm_interface_regenerate_con +@@ -6770,6 +6776,7 @@ static void ecm_interface_regenerate_con return; } @@ -310,7 +309,7 @@ Signed-off-by: Ansuel Smith for (dir = 0; dir < ECM_DB_OBJ_DIR_MAX; dir++) { /* * Re-generate all connections associated with this interface -@@ -6645,6 +6652,7 @@ static void ecm_interface_regenerate_con +@@ -6785,6 +6792,7 @@ static void ecm_interface_regenerate_con ci[dir] = cin; } } @@ -320,7 +319,7 @@ Signed-off-by: Ansuel Smith /* --- a/frontends/ecm_front_end_common.c +++ b/frontends/ecm_front_end_common.c -@@ -106,6 +106,7 @@ bool ecm_front_end_gre_proto_is_accel_al +@@ -354,6 +354,7 @@ bool ecm_front_end_gre_proto_is_accel_al struct nf_conntrack_tuple *tuple, int ip_version) { @@ -328,7 +327,7 @@ Signed-off-by: Ansuel Smith struct net_device *dev; struct gre_base_hdr *greh; -@@ -117,10 +118,12 @@ bool ecm_front_end_gre_proto_is_accel_al +@@ -365,10 +366,12 @@ bool ecm_front_end_gre_proto_is_accel_al /* * Case 1: PPTP locally terminated */ @@ -341,7 +340,7 @@ Signed-off-by: Ansuel Smith /* * Case 2: PPTP pass through -@@ -223,6 +226,10 @@ bool ecm_front_end_gre_proto_is_accel_al +@@ -476,6 +479,10 @@ bool ecm_front_end_gre_proto_is_accel_al */ DEBUG_TRACE("%px: GRE IPv%d pass through - allow acceleration\n", skb, ip_version); return true; diff --git a/qca-nss-ecm/patches/0002-treewide-rework-ipv6_dev_find_and_hold-to-internal-A.patch b/qca-nss-ecm/patches/0002-treewide-rework-ipv6_dev_find_and_hold-to-internal-A.patch index 85936d8..4034bc8 100644 --- a/qca-nss-ecm/patches/0002-treewide-rework-ipv6_dev_find_and_hold-to-internal-A.patch +++ b/qca-nss-ecm/patches/0002-treewide-rework-ipv6_dev_find_and_hold-to-internal-A.patch @@ -16,7 +16,7 @@ Signed-off-by: Ansuel Smith --- a/ecm_interface.c +++ b/ecm_interface.c -@@ -332,7 +332,7 @@ static struct net_device *ecm_interface_ +@@ -336,7 +336,7 @@ static struct net_device *ecm_interface_ struct net_device *dev; ECM_IP_ADDR_TO_NIN6_ADDR(addr6, addr); @@ -25,7 +25,7 @@ Signed-off-by: Ansuel Smith return dev; } #endif -@@ -716,6 +716,34 @@ bool ecm_interface_mac_addr_get(ip_addr_ +@@ -719,6 +719,34 @@ bool ecm_interface_mac_addr_get(ip_addr_ EXPORT_SYMBOL(ecm_interface_mac_addr_get); #ifdef ECM_IPV6_ENABLE @@ -60,7 +60,7 @@ Signed-off-by: Ansuel Smith /* * ecm_interface_mac_addr_get_ipv6_no_route() * Finds the mac address of a node from its ip address reachable via -@@ -734,7 +762,7 @@ static bool ecm_interface_mac_addr_get_i +@@ -737,7 +765,7 @@ static bool ecm_interface_mac_addr_get_i * Get the MAC address that corresponds to IP address given. */ ECM_IP_ADDR_TO_NIN6_ADDR(daddr, addr); @@ -71,17 +71,17 @@ Signed-off-by: Ansuel Smith memcpy(mac_addr, dev->dev_addr, ETH_ALEN); --- a/ecm_interface.h +++ b/ecm_interface.h -@@ -56,6 +56,7 @@ bool ecm_interface_mac_addr_get(ip_addr_ - bool ecm_interface_find_route_by_addr(ip_addr_t addr, struct ecm_interface_route *ecm_rt); +@@ -59,6 +59,7 @@ bool ecm_interface_find_route_by_addr(ip void ecm_interface_route_release(struct ecm_interface_route *rt); #ifdef ECM_IPV6_ENABLE + struct neighbour *ecm_interface_ipv6_neigh_get(struct ecm_front_end_connection_instance *feci, ecm_db_obj_dir_t dir, ip_addr_t addr); +struct net_device *ecm_interface_ipv6_dev_find_and_hold(struct net *net, struct in6_addr *addr, int strict); - struct neighbour *ecm_interface_ipv6_neigh_get(ip_addr_t addr); void ecm_interface_send_neighbour_solicitation(struct net_device *dev, ip_addr_t addr); #endif + void ecm_interface_send_arp_request(struct net_device *dest_dev, ip_addr_t dest_addr, bool on_link, ip_addr_t gw_addr); --- a/frontends/ecm_front_end_common.c +++ b/frontends/ecm_front_end_common.c -@@ -53,6 +53,9 @@ +@@ -57,11 +57,14 @@ #include "ecm_db.h" #include "ecm_front_end_common.h" #include "ecm_interface.h" @@ -89,9 +89,15 @@ Signed-off-by: Ansuel Smith +#include "ecm_front_end_ipv6.h" +#endif - #ifdef ECM_INTERFACE_BOND_ENABLE - /* -@@ -202,7 +205,7 @@ bool ecm_front_end_gre_proto_is_accel_al + #ifdef ECM_FRONT_END_NSS_ENABLE + #include + #include "ecm_nss_ipv4.h" +-#include "ecm_nss_ipv6.h" ++// #include "ecm_nss_ipv6.h" + #include "ecm_nss_common.h" + #include "ecm_nss_ported_ipv4.h" + #include "ecm_nss_ported_ipv6.h" +@@ -451,7 +454,7 @@ bool ecm_front_end_gre_proto_is_accel_al return false; } @@ -100,3 +106,20 @@ Signed-off-by: Ansuel Smith if (dev) { /* * Destination IP address is local +@@ -508,14 +511,14 @@ void ecm_front_end_tcp_set_dscp_ext(stru + dscpcte->flow_priority = skb->priority; + dscpcte->flow_mark = skb->mark; + dscpcte->flow_dscp = iph->ds >> XT_DSCP_SHIFT; +- dscpcte->flow_set_flags = NF_CT_DSCPREMARK_EXT_PRIO | NF_CT_DSCPREMARK_EXT_DSCP | NF_CT_DSCPREMARK_EXT_MARK; ++ dscpcte->flow_set_flags = NF_CT_DSCPREMARK_EXT_PRIO | NF_CT_DSCPREMARK_EXT_DSCP; + DEBUG_TRACE("%px: sender: %d flow priority: %d flow dscp: %d flow_mark: %d flow_set_flags: 0x%x\n", + ct, sender, dscpcte->flow_priority, dscpcte->flow_dscp, dscpcte->flow_mark, dscpcte->flow_set_flags); + } else { + dscpcte->reply_priority = skb->priority; + dscpcte->reply_mark = skb->mark; + dscpcte->reply_dscp = iph->ds >> XT_DSCP_SHIFT; +- dscpcte->return_set_flags = NF_CT_DSCPREMARK_EXT_PRIO | NF_CT_DSCPREMARK_EXT_DSCP | NF_CT_DSCPREMARK_EXT_MARK; ++ dscpcte->return_set_flags = NF_CT_DSCPREMARK_EXT_PRIO | NF_CT_DSCPREMARK_EXT_DSCP; + DEBUG_TRACE("%px: sender: %d reply priority: %d reply dscp: %d reply_mark: %d return_set_flags: 0x%x\n", + ct, sender, dscpcte->reply_priority, dscpcte->reply_dscp, dscpcte->reply_mark, dscpcte->return_set_flags); + } diff --git a/qca-nss-ecm/patches/0003-treewide-rework-debugfs-api-to-new-implementation.patch b/qca-nss-ecm/patches/0003-treewide-rework-debugfs-api-to-new-implementation.patch index efaaa4c..00c30cb 100644 --- a/qca-nss-ecm/patches/0003-treewide-rework-debugfs-api-to-new-implementation.patch +++ b/qca-nss-ecm/patches/0003-treewide-rework-debugfs-api-to-new-implementation.patch @@ -6,7 +6,7 @@ Subject: [PATCH 03/12] treewide: rework debugfs api to new implementation Signed-off-by: Ansuel Smith --- a/ecm_classifier_default.c +++ b/ecm_classifier_default.c -@@ -776,26 +776,14 @@ int ecm_classifier_default_init(struct d +@@ -760,26 +760,14 @@ int ecm_classifier_default_init(struct d return -1; } @@ -41,7 +41,7 @@ Signed-off-by: Ansuel Smith } --- a/ecm_classifier_dscp.c +++ b/ecm_classifier_dscp.c -@@ -747,12 +747,8 @@ int ecm_classifier_dscp_init(struct dent +@@ -816,12 +816,8 @@ int ecm_classifier_dscp_init(struct dent return -1; } @@ -58,7 +58,7 @@ Signed-off-by: Ansuel Smith } --- a/ecm_classifier_hyfi.c +++ b/ecm_classifier_hyfi.c -@@ -1099,11 +1099,8 @@ int ecm_classifier_hyfi_rules_init(struc +@@ -1104,11 +1104,8 @@ int ecm_classifier_hyfi_rules_init(struc goto classifier_task_cleanup; } @@ -91,7 +91,7 @@ Signed-off-by: Ansuel Smith } --- a/ecm_classifier_ovs.c +++ b/ecm_classifier_ovs.c -@@ -2200,12 +2200,8 @@ int ecm_classifier_ovs_init(struct dentr +@@ -2265,12 +2265,8 @@ int ecm_classifier_ovs_init(struct dentr return -1; } @@ -108,7 +108,7 @@ Signed-off-by: Ansuel Smith } --- a/ecm_classifier_pcc.c +++ b/ecm_classifier_pcc.c -@@ -1308,12 +1308,8 @@ int ecm_classifier_pcc_init(struct dentr +@@ -1246,12 +1246,8 @@ int ecm_classifier_pcc_init(struct dentr return -1; } @@ -125,7 +125,7 @@ Signed-off-by: Ansuel Smith } --- a/ecm_conntrack_notifier.c +++ b/ecm_conntrack_notifier.c -@@ -414,12 +414,8 @@ int ecm_conntrack_notifier_init(struct d +@@ -429,12 +429,8 @@ int ecm_conntrack_notifier_init(struct d return -1; } @@ -142,7 +142,7 @@ Signed-off-by: Ansuel Smith /* --- a/ecm_db/ecm_db_connection.c +++ b/ecm_db/ecm_db_connection.c -@@ -3642,11 +3642,8 @@ static struct file_operations ecm_db_con +@@ -3790,11 +3790,8 @@ static struct file_operations ecm_db_con */ bool ecm_db_connection_init(struct dentry *dentry) { @@ -158,7 +158,7 @@ Signed-off-by: Ansuel Smith NULL, &ecm_db_connection_count_simple_fops)) { --- a/ecm_db/ecm_db_host.c +++ b/ecm_db/ecm_db_host.c -@@ -770,11 +770,8 @@ EXPORT_SYMBOL(ecm_db_host_alloc); +@@ -771,11 +771,8 @@ EXPORT_SYMBOL(ecm_db_host_alloc); bool ecm_db_host_init(struct dentry *dentry) { @@ -174,7 +174,7 @@ Signed-off-by: Ansuel Smith if (!ecm_db_host_table) { --- a/ecm_db/ecm_db_iface.c +++ b/ecm_db/ecm_db_iface.c -@@ -3670,11 +3670,8 @@ EXPORT_SYMBOL(ecm_db_iface_alloc); +@@ -3688,11 +3688,8 @@ EXPORT_SYMBOL(ecm_db_iface_alloc); */ bool ecm_db_iface_init(struct dentry *dentry) { @@ -190,7 +190,7 @@ Signed-off-by: Ansuel Smith } --- a/ecm_db/ecm_db_mapping.c +++ b/ecm_db/ecm_db_mapping.c -@@ -806,11 +806,8 @@ EXPORT_SYMBOL(ecm_db_mapping_alloc); +@@ -807,11 +807,8 @@ EXPORT_SYMBOL(ecm_db_mapping_alloc); */ bool ecm_db_mapping_init(struct dentry *dentry) { @@ -206,7 +206,7 @@ Signed-off-by: Ansuel Smith if (!ecm_db_mapping_table) { --- a/ecm_db/ecm_db_node.c +++ b/ecm_db/ecm_db_node.c -@@ -1187,11 +1187,8 @@ keep_sni_conn: +@@ -1202,11 +1202,8 @@ keep_sni_conn: */ bool ecm_db_node_init(struct dentry *dentry) { @@ -222,7 +222,7 @@ Signed-off-by: Ansuel Smith if (!ecm_db_node_table) { --- a/ecm_state.c +++ b/ecm_state.c -@@ -899,17 +899,11 @@ int ecm_state_init(struct dentry *dentry +@@ -894,17 +894,11 @@ int ecm_state_init(struct dentry *dentry return -1; } @@ -246,7 +246,7 @@ Signed-off-by: Ansuel Smith * Register a char device that we will use to provide a dump of our state --- a/frontends/ecm_front_end_ipv4.c +++ b/frontends/ecm_front_end_ipv4.c -@@ -376,11 +376,8 @@ void ecm_front_end_ipv4_stop(int num) +@@ -383,11 +383,8 @@ void ecm_front_end_ipv4_stop(int num) */ int ecm_front_end_ipv4_init(struct dentry *dentry) { @@ -258,11 +258,11 @@ Signed-off-by: Ansuel Smith + debugfs_create_u32("front_end_ipv4_stop", S_IRUGO | S_IWUSR, dentry, + (u32 *)&ecm_front_end_ipv4_stopped); - switch (ecm_front_end_type_get()) { - case ECM_FRONT_END_TYPE_NSS: + return ecm_ipv4_init(dentry); + } --- a/frontends/ecm_front_end_ipv6.c +++ b/frontends/ecm_front_end_ipv6.c -@@ -255,11 +255,8 @@ void ecm_front_end_ipv6_stop(int num) +@@ -262,11 +262,8 @@ void ecm_front_end_ipv6_stop(int num) */ int ecm_front_end_ipv6_init(struct dentry *dentry) { @@ -274,11 +274,11 @@ Signed-off-by: Ansuel Smith + debugfs_create_u32("front_end_ipv6_stop", S_IRUGO | S_IWUSR, dentry, + (u32 *)&ecm_front_end_ipv6_stopped); - switch (ecm_front_end_type_get()) { - case ECM_FRONT_END_TYPE_NSS: + return ecm_ipv6_init(dentry); + } --- a/frontends/nss/ecm_nss_ipv4.c +++ b/frontends/nss/ecm_nss_ipv4.c -@@ -2802,41 +2802,23 @@ int ecm_nss_ipv4_init(struct dentry *den +@@ -1009,41 +1009,23 @@ int ecm_nss_ipv4_init(struct dentry *den return result; } @@ -332,7 +332,7 @@ Signed-off-by: Ansuel Smith if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_nss_ipv4_dentry, NULL, &ecm_nss_ipv4_accel_limit_mode_fops)) { -@@ -2867,11 +2849,8 @@ int ecm_nss_ipv4_init(struct dentry *den +@@ -1074,11 +1056,8 @@ int ecm_nss_ipv4_init(struct dentry *den goto task_cleanup; } @@ -348,7 +348,7 @@ Signed-off-by: Ansuel Smith if (!ecm_nss_non_ported_ipv4_debugfs_init(ecm_nss_ipv4_dentry)) { --- a/frontends/nss/ecm_nss_ipv6.c +++ b/frontends/nss/ecm_nss_ipv6.c -@@ -2542,41 +2542,23 @@ int ecm_nss_ipv6_init(struct dentry *den +@@ -986,41 +986,23 @@ int ecm_nss_ipv6_init(struct dentry *den return result; } @@ -402,7 +402,7 @@ Signed-off-by: Ansuel Smith if (!debugfs_create_file("accel_limit_mode", S_IRUGO | S_IWUSR, ecm_nss_ipv6_dentry, NULL, &ecm_nss_ipv6_accel_limit_mode_fops)) { -@@ -2607,11 +2589,8 @@ int ecm_nss_ipv6_init(struct dentry *den +@@ -1051,11 +1033,8 @@ int ecm_nss_ipv6_init(struct dentry *den goto task_cleanup; } @@ -418,7 +418,7 @@ Signed-off-by: Ansuel Smith if (!ecm_nss_non_ported_ipv6_debugfs_init(ecm_nss_ipv6_dentry)) { --- a/frontends/nss/ecm_nss_multicast_ipv4.c +++ b/frontends/nss/ecm_nss_multicast_ipv4.c -@@ -4113,14 +4113,8 @@ find_next_tuple: +@@ -2623,14 +2623,8 @@ find_next_tuple: */ bool ecm_nss_multicast_ipv4_debugfs_init(struct dentry *dentry) { @@ -434,7 +434,7 @@ Signed-off-by: Ansuel Smith return true; } -@@ -4139,11 +4133,8 @@ void ecm_nss_multicast_ipv4_stop(int num +@@ -2649,11 +2643,8 @@ void ecm_nss_multicast_ipv4_stop(int num */ int ecm_nss_multicast_ipv4_init(struct dentry *dentry) { @@ -450,7 +450,7 @@ Signed-off-by: Ansuel Smith * Register multicast update callback to MCS snooper --- a/frontends/nss/ecm_nss_multicast_ipv6.c +++ b/frontends/nss/ecm_nss_multicast_ipv6.c -@@ -3913,14 +3913,8 @@ static void ecm_nss_multicast_ipv6_mfc_u +@@ -2558,14 +2558,8 @@ static void ecm_nss_multicast_ipv6_mfc_u */ bool ecm_nss_multicast_ipv6_debugfs_init(struct dentry *dentry) { @@ -466,7 +466,7 @@ Signed-off-by: Ansuel Smith return true; } -@@ -3939,11 +3933,8 @@ void ecm_nss_multicast_ipv6_stop(int num +@@ -2584,11 +2578,8 @@ void ecm_nss_multicast_ipv6_stop(int num */ int ecm_nss_multicast_ipv6_init(struct dentry *dentry) { @@ -482,7 +482,7 @@ Signed-off-by: Ansuel Smith * Register multicast update callback to MCS snooper --- a/frontends/nss/ecm_nss_non_ported_ipv4.c +++ b/frontends/nss/ecm_nss_non_ported_ipv4.c -@@ -2615,11 +2615,8 @@ done: +@@ -1828,11 +1828,8 @@ struct ecm_front_end_connection_instance */ bool ecm_nss_non_ported_ipv4_debugfs_init(struct dentry *dentry) { @@ -498,7 +498,7 @@ Signed-off-by: Ansuel Smith } --- a/frontends/nss/ecm_nss_non_ported_ipv6.c +++ b/frontends/nss/ecm_nss_non_ported_ipv6.c -@@ -2329,11 +2329,8 @@ done: +@@ -1654,11 +1654,8 @@ struct ecm_front_end_connection_instance */ bool ecm_nss_non_ported_ipv6_debugfs_init(struct dentry *dentry) { @@ -514,61 +514,41 @@ Signed-off-by: Ansuel Smith } --- a/frontends/nss/ecm_nss_ported_ipv4.c +++ b/frontends/nss/ecm_nss_ported_ipv4.c -@@ -2935,21 +2935,11 @@ done: - */ - bool ecm_nss_ported_ipv4_debugfs_init(struct dentry *dentry) - { -- struct dentry *udp_dentry; -- -- udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, -+ debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, - &ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_UDP]); -- if (!udp_dentry) { -- DEBUG_ERROR("Failed to create ecm nss ipv4 udp_accelerated_count file in debugfs\n"); -- return false; -- } +@@ -1898,12 +1898,8 @@ bool ecm_nss_ported_ipv4_debugfs_init(st + return false; + } - if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, -- &ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_TCP])) { +- &ecm_nss_ported_ipv4_accelerated_count[ECM_FRONT_END_PORTED_PROTO_TCP])) { - DEBUG_ERROR("Failed to create ecm nss ipv4 tcp_accelerated_count file in debugfs\n"); - debugfs_remove(udp_dentry); - return false; - } + debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, -+ &ecm_nss_ported_ipv4_accelerated_count[ECM_NSS_PORTED_IPV4_PROTO_TCP]); ++ &ecm_nss_ported_ipv4_accelerated_count[ECM_FRONT_END_PORTED_PROTO_TCP]); return true; } --- a/frontends/nss/ecm_nss_ported_ipv6.c +++ b/frontends/nss/ecm_nss_ported_ipv6.c -@@ -2723,21 +2723,11 @@ done: - */ - bool ecm_nss_ported_ipv6_debugfs_init(struct dentry *dentry) - { -- struct dentry *udp_dentry; -- -- udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, -+ debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, - &ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_UDP]); -- if (!udp_dentry) { -- DEBUG_ERROR("Failed to create ecm nss ipv6 udp_accelerated_count file in debugfs\n"); -- return false; -- } +@@ -1812,12 +1812,8 @@ bool ecm_nss_ported_ipv6_debugfs_init(st + return false; + } - if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, -- &ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_TCP])) { +- &ecm_nss_ported_ipv6_accelerated_count[ECM_FRONT_END_PORTED_PROTO_TCP])) { - DEBUG_ERROR("Failed to create ecm nss ipv6 tcp_accelerated_count file in debugfs\n"); - debugfs_remove(udp_dentry); - return false; - } + debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, -+ &ecm_nss_ported_ipv6_accelerated_count[ECM_NSS_PORTED_IPV6_PROTO_TCP]); ++ &ecm_nss_ported_ipv6_accelerated_count[ECM_FRONT_END_PORTED_PROTO_TCP]); return true; } --- a/frontends/sfe/ecm_sfe_ipv4.c +++ b/frontends/sfe/ecm_sfe_ipv4.c -@@ -1808,48 +1808,27 @@ int ecm_sfe_ipv4_init(struct dentry *den +@@ -920,48 +920,27 @@ int ecm_sfe_ipv4_init(struct dentry *den } #ifdef CONFIG_XFRM @@ -633,7 +613,7 @@ Signed-off-by: Ansuel Smith NULL, &ecm_sfe_ipv4_accel_limit_mode_fops)) { --- a/frontends/sfe/ecm_sfe_ipv6.c +++ b/frontends/sfe/ecm_sfe_ipv6.c -@@ -1532,48 +1532,27 @@ int ecm_sfe_ipv6_init(struct dentry *den +@@ -912,48 +912,27 @@ int ecm_sfe_ipv6_init(struct dentry *den } #ifdef CONFIG_XFRM @@ -698,7 +678,7 @@ Signed-off-by: Ansuel Smith NULL, &ecm_sfe_ipv6_accel_limit_mode_fops)) { --- a/frontends/sfe/ecm_sfe_non_ported_ipv4.c +++ b/frontends/sfe/ecm_sfe_non_ported_ipv4.c -@@ -2284,11 +2284,8 @@ done: +@@ -1860,11 +1860,8 @@ struct ecm_front_end_connection_instance */ bool ecm_sfe_non_ported_ipv4_debugfs_init(struct dentry *dentry) { @@ -714,7 +694,7 @@ Signed-off-by: Ansuel Smith } --- a/frontends/sfe/ecm_sfe_non_ported_ipv6.c +++ b/frontends/sfe/ecm_sfe_non_ported_ipv6.c -@@ -2083,11 +2083,8 @@ done: +@@ -1684,11 +1684,8 @@ struct ecm_front_end_connection_instance */ bool ecm_sfe_non_ported_ipv6_debugfs_init(struct dentry *dentry) { @@ -730,7 +710,7 @@ Signed-off-by: Ansuel Smith } --- a/frontends/sfe/ecm_sfe_ported_ipv4.c +++ b/frontends/sfe/ecm_sfe_ported_ipv4.c -@@ -2519,21 +2519,11 @@ done: +@@ -1996,21 +1996,11 @@ struct ecm_front_end_connection_instance */ bool ecm_sfe_ported_ipv4_debugfs_init(struct dentry *dentry) { @@ -738,26 +718,26 @@ Signed-off-by: Ansuel Smith - - udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, + debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, - &ecm_sfe_ported_ipv4_accelerated_count[ECM_SFE_PORTED_IPV4_PROTO_UDP]); + &ecm_sfe_ported_ipv4_accelerated_count[ECM_FRONT_END_PORTED_PROTO_UDP]); - if (!udp_dentry) { - DEBUG_ERROR("Failed to create ecm sfe ipv4 udp_accelerated_count file in debugfs\n"); - return false; - } - if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, -- &ecm_sfe_ported_ipv4_accelerated_count[ECM_SFE_PORTED_IPV4_PROTO_TCP])) { +- &ecm_sfe_ported_ipv4_accelerated_count[ECM_FRONT_END_PORTED_PROTO_TCP])) { - DEBUG_ERROR("Failed to create ecm sfe ipv4 tcp_accelerated_count file in debugfs\n"); - debugfs_remove(udp_dentry); - return false; - } + debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, -+ &ecm_sfe_ported_ipv4_accelerated_count[ECM_SFE_PORTED_IPV4_PROTO_TCP]); ++ &ecm_sfe_ported_ipv4_accelerated_count[ECM_FRONT_END_PORTED_PROTO_TCP]); return true; } --- a/frontends/sfe/ecm_sfe_ported_ipv6.c +++ b/frontends/sfe/ecm_sfe_ported_ipv6.c -@@ -2365,21 +2365,11 @@ done: +@@ -1942,21 +1942,11 @@ struct ecm_front_end_connection_instance */ bool ecm_sfe_ported_ipv6_debugfs_init(struct dentry *dentry) { @@ -765,37 +745,56 @@ Signed-off-by: Ansuel Smith - - udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, + debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, - &ecm_sfe_ported_ipv6_accelerated_count[ECM_SFE_PORTED_IPV6_PROTO_UDP]); + &ecm_sfe_ported_ipv6_accelerated_count[ECM_FRONT_END_PORTED_PROTO_UDP]); - if (!udp_dentry) { - DEBUG_ERROR("Failed to create ecm sfe ipv6 udp_accelerated_count file in debugfs\n"); - return false; - } - if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, -- &ecm_sfe_ported_ipv6_accelerated_count[ECM_SFE_PORTED_IPV6_PROTO_TCP])) { +- &ecm_sfe_ported_ipv6_accelerated_count[ECM_FRONT_END_PORTED_PROTO_TCP])) { - DEBUG_ERROR("Failed to create ecm sfe ipv6 tcp_accelerated_count file in debugfs\n"); - debugfs_remove(udp_dentry); - return false; - } + debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, -+ &ecm_sfe_ported_ipv6_accelerated_count[ECM_SFE_PORTED_IPV6_PROTO_TCP]); ++ &ecm_sfe_ported_ipv6_accelerated_count[ECM_FRONT_END_PORTED_PROTO_TCP]); return true; } ---- a/frontends/nss/ecm_nss_bond_notifier.c -+++ b/frontends/nss/ecm_nss_bond_notifier.c -@@ -240,12 +240,8 @@ int ecm_nss_bond_notifier_init(struct de - return -1; - } - -- if (!debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_nss_bond_notifier_dentry, -- (u32 *)&ecm_nss_bond_notifier_stopped)) { -- DEBUG_ERROR("Failed to create ecm bond notifier stopped file in debugfs\n"); -- debugfs_remove_recursive(ecm_nss_bond_notifier_dentry); -- return -1; +--- a/frontends/ppe/ecm_ppe_ported_ipv4.c ++++ b/frontends/ppe/ecm_ppe_ported_ipv4.c +@@ -1423,14 +1423,8 @@ struct ecm_front_end_connection_instance + */ + bool ecm_ppe_ported_ipv4_debugfs_init(struct dentry *dentry) + { +- struct dentry *udp_dentry; +- +- udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, ++ debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, + &ecm_ppe_ported_ipv4_accelerated_count[ECM_FRONT_END_PORTED_PROTO_UDP]); +- if (!udp_dentry) { +- DEBUG_ERROR("Failed to create ecm ppe ipv4 udp_accelerated_count file in debugfs\n"); +- return false; - } -+ debugfs_create_u32("stop", S_IRUGO | S_IWUSR, ecm_nss_bond_notifier_dentry, -+ (u32 *)&ecm_nss_bond_notifier_stopped); - /* - * Register Link Aggregation callbacks with the bonding driver + if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, + &ecm_ppe_ported_ipv4_accelerated_count[ECM_FRONT_END_PORTED_PROTO_TCP])) { +--- a/frontends/ppe/ecm_ppe_ported_ipv6.c ++++ b/frontends/ppe/ecm_ppe_ported_ipv6.c +@@ -1396,14 +1396,8 @@ struct ecm_front_end_connection_instance + */ + bool ecm_ppe_ported_ipv6_debugfs_init(struct dentry *dentry) + { +- struct dentry *udp_dentry; +- +- udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, ++ debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, + &ecm_ppe_ported_ipv6_accelerated_count[ECM_FRONT_END_PORTED_PROTO_UDP]); +- if (!udp_dentry) { +- DEBUG_ERROR("Failed to create ecm ppe ipv6 udp_accelerated_count file in debugfs\n"); +- return false; +- } + + if (!debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, + &ecm_ppe_ported_ipv6_accelerated_count[ECM_FRONT_END_PORTED_PROTO_TCP])) { diff --git a/qca-nss-ecm/patches/0004-treewide-fix-wrong-chain-events-flag.patch b/qca-nss-ecm/patches/0004-treewide-fix-wrong-chain-events-flag.patch index 62aeb86..92e26d9 100644 --- a/qca-nss-ecm/patches/0004-treewide-fix-wrong-chain-events-flag.patch +++ b/qca-nss-ecm/patches/0004-treewide-fix-wrong-chain-events-flag.patch @@ -10,7 +10,7 @@ Signed-off-by: Ansuel Smith --- a/ecm_conntrack_notifier.c +++ b/ecm_conntrack_notifier.c -@@ -421,7 +421,11 @@ int ecm_conntrack_notifier_init(struct d +@@ -436,7 +436,11 @@ int ecm_conntrack_notifier_init(struct d /* * Eventing subsystem is available so we register a notifier hook to get fast notifications of expired connections */ @@ -22,7 +22,7 @@ Signed-off-by: Ansuel Smith if (result < 0) { DEBUG_ERROR("Can't register nf notifier hook.\n"); debugfs_remove_recursive(ecm_conntrack_notifier_dentry); -@@ -439,7 +443,9 @@ EXPORT_SYMBOL(ecm_conntrack_notifier_ini +@@ -454,7 +458,9 @@ EXPORT_SYMBOL(ecm_conntrack_notifier_ini void ecm_conntrack_notifier_exit(void) { DEBUG_INFO("ECM Conntrack Notifier exit\n"); diff --git a/qca-nss-ecm/patches/0005-qca-nss-ecm-resolve-the-cpu-high-load-regarding-ecm.patch b/qca-nss-ecm/patches/0005-qca-nss-ecm-resolve-the-cpu-high-load-regarding-ecm.patch index b2f0dd9..b5f3876 100644 --- a/qca-nss-ecm/patches/0005-qca-nss-ecm-resolve-the-cpu-high-load-regarding-ecm.patch +++ b/qca-nss-ecm/patches/0005-qca-nss-ecm-resolve-the-cpu-high-load-regarding-ecm.patch @@ -15,7 +15,7 @@ Signed-off-by: Dirk Buchwalder buchwalder@posteo.de --- a/frontends/nss/ecm_nss_ipv4.c +++ b/frontends/nss/ecm_nss_ipv4.c -@@ -2471,7 +2471,7 @@ static void ecm_nss_ipv4_stats_sync_req_ +@@ -700,7 +700,7 @@ static void ecm_nss_ipv4_stats_sync_req_ } spin_unlock_bh(&ecm_nss_ipv4_lock); @@ -24,7 +24,7 @@ Signed-off-by: Dirk Buchwalder buchwalder@posteo.de /* * If index is 0, we are starting a new round, but if we still have time remain -@@ -2485,7 +2485,7 @@ static void ecm_nss_ipv4_stats_sync_req_ +@@ -714,7 +714,7 @@ static void ecm_nss_ipv4_stats_sync_req_ } if (time_after(ecm_nss_ipv4_next_req_time, current_jiffies)) { @@ -35,7 +35,7 @@ Signed-off-by: Dirk Buchwalder buchwalder@posteo.de ecm_nss_ipv4_next_req_time = ecm_nss_ipv4_roll_check_jiffies + ECM_NSS_IPV4_STATS_SYNC_PERIOD; --- a/frontends/nss/ecm_nss_ipv6.c +++ b/frontends/nss/ecm_nss_ipv6.c -@@ -2210,7 +2210,7 @@ static void ecm_nss_ipv6_stats_sync_req_ +@@ -676,7 +676,7 @@ static void ecm_nss_ipv6_stats_sync_req_ } spin_unlock_bh(&ecm_nss_ipv6_lock); @@ -44,7 +44,7 @@ Signed-off-by: Dirk Buchwalder buchwalder@posteo.de /* * If index is 0, we are starting a new round, but if we still have time remain -@@ -2224,7 +2224,7 @@ static void ecm_nss_ipv6_stats_sync_req_ +@@ -690,7 +690,7 @@ static void ecm_nss_ipv6_stats_sync_req_ } if (time_after(ecm_nss_ipv6_next_req_time, current_jiffies)) { diff --git a/qca-nss-ecm/patches/0006-ecm_interface-switch-to-kernel_recvmsg-api.patch b/qca-nss-ecm/patches/0006-ecm_interface-switch-to-kernel_recvmsg-api.patch index 475f6aa..a5c0e1e 100644 --- a/qca-nss-ecm/patches/0006-ecm_interface-switch-to-kernel_recvmsg-api.patch +++ b/qca-nss-ecm/patches/0006-ecm_interface-switch-to-kernel_recvmsg-api.patch @@ -13,7 +13,7 @@ Signed-off-by: Ansuel Smith --- a/ecm_interface.c +++ b/ecm_interface.c -@@ -7521,9 +7521,13 @@ static int ecm_interface_wifi_event_hand +@@ -7658,9 +7658,13 @@ static int ecm_interface_wifi_event_hand static int ecm_interface_wifi_event_rx(struct socket *sock, struct sockaddr_nl *addr, unsigned char *buf, int len) { struct msghdr msg; @@ -27,16 +27,16 @@ Signed-off-by: Ansuel Smith iov.iov_base = buf; iov.iov_len = len; -@@ -7533,6 +7537,8 @@ static int ecm_interface_wifi_event_rx(s +@@ -7670,6 +7674,8 @@ static int ecm_interface_wifi_event_rx(s msg.msg_namelen = sizeof(struct sockaddr_nl); msg.msg_control = NULL; msg.msg_controllen = 0; + +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)) - iov_iter_init(&msg.msg_iter, READ, &iov, 1, 1); oldfs = get_fs(); set_fs(KERNEL_DS); -@@ -7544,6 +7550,9 @@ static int ecm_interface_wifi_event_rx(s + iov_iter_init(&msg.msg_iter, READ, &iov, 1, len); +@@ -7681,6 +7687,9 @@ static int ecm_interface_wifi_event_rx(s set_fs(oldfs); return size; diff --git a/qca-nss-ecm/patches/0007-treewide-rework-notifier-changes-for-5.15.patch b/qca-nss-ecm/patches/0007-treewide-rework-notifier-changes-for-5.15.patch index 409817c..f418a63 100644 --- a/qca-nss-ecm/patches/0007-treewide-rework-notifier-changes-for-5.15.patch +++ b/qca-nss-ecm/patches/0007-treewide-rework-notifier-changes-for-5.15.patch @@ -12,7 +12,7 @@ Signed-off-by: Ansuel Smith --- a/ecm_conntrack_notifier.c +++ b/ecm_conntrack_notifier.c -@@ -320,7 +320,7 @@ EXPORT_SYMBOL(ecm_conntrack_ipv4_event); +@@ -335,7 +335,7 @@ EXPORT_SYMBOL(ecm_conntrack_ipv4_event); #ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS static int ecm_conntrack_event(struct notifier_block *this, unsigned long events, void *ptr) #else @@ -21,7 +21,7 @@ Signed-off-by: Ansuel Smith #endif { #ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS -@@ -386,7 +386,11 @@ static struct notifier_block ecm_conntra +@@ -401,7 +401,11 @@ static struct notifier_block ecm_conntra * Netfilter conntrack event system to monitor connection tracking changes */ static struct nf_ct_event_notifier ecm_conntrack_notifier = { @@ -33,7 +33,7 @@ Signed-off-by: Ansuel Smith }; #endif #endif -@@ -424,14 +428,20 @@ int ecm_conntrack_notifier_init(struct d +@@ -439,14 +443,20 @@ int ecm_conntrack_notifier_init(struct d #ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS result = nf_conntrack_register_chain_notifier(&init_net, &ecm_conntrack_notifier); #else @@ -54,7 +54,7 @@ Signed-off-by: Ansuel Smith return 0; } -@@ -446,7 +456,11 @@ void ecm_conntrack_notifier_exit(void) +@@ -461,7 +471,11 @@ void ecm_conntrack_notifier_exit(void) #ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS nf_conntrack_unregister_chain_notifier(&init_net, &ecm_conntrack_notifier); #else diff --git a/qca-nss-ecm/patches/0008-frontends-drop-use-of-static-be_liberal-and-no_windo.patch b/qca-nss-ecm/patches/0008-frontends-drop-use-of-static-be_liberal-and-no_windo.patch index b65f2a6..9201b81 100644 --- a/qca-nss-ecm/patches/0008-frontends-drop-use-of-static-be_liberal-and-no_windo.patch +++ b/qca-nss-ecm/patches/0008-frontends-drop-use-of-static-be_liberal-and-no_windo.patch @@ -17,7 +17,7 @@ Signed-off-by: Ansuel Smith --- a/frontends/nss/ecm_nss_ported_ipv4.c +++ b/frontends/nss/ecm_nss_ported_ipv4.c -@@ -126,11 +126,11 @@ static int ecm_nss_ported_ipv4_accelerat +@@ -102,11 +102,11 @@ static int ecm_nss_ported_ipv4_accelerat /* * Expose what should be a static flag in the TCP connection tracker. */ @@ -31,16 +31,16 @@ Signed-off-by: Ansuel Smith /* * ecm_nss_ported_ipv4_connection_callback() * Callback for handling create ack/nack calls. -@@ -370,6 +370,8 @@ static void ecm_nss_ported_ipv4_connecti +@@ -343,6 +343,8 @@ static void ecm_nss_ported_ipv4_connecti uint8_t dest_mac_xlate[ETH_ALEN]; ecm_db_direction_t ecm_dir; ecm_front_end_acceleration_mode_t result_mode; + struct net *net = nf_ct_net(ct); + struct nf_tcp_net *tn = nf_tcp_pernet(net); - DEBUG_CHECK_MAGIC(npci, ECM_NSS_PORTED_IPV4_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", npci); + DEBUG_CHECK_MAGIC(feci, ECM_FRONT_END_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", feci); -@@ -1232,9 +1234,13 @@ static void ecm_nss_ported_ipv4_connecti +@@ -1207,9 +1209,13 @@ static void ecm_nss_ported_ipv4_connecti nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end; nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend; #ifdef ECM_OPENWRT_SUPPORT @@ -58,7 +58,7 @@ Signed-off-by: Ansuel Smith || (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) { --- a/frontends/nss/ecm_nss_ported_ipv6.c +++ b/frontends/nss/ecm_nss_ported_ipv6.c -@@ -126,11 +126,11 @@ static int ecm_nss_ported_ipv6_accelerat +@@ -103,11 +103,11 @@ static int ecm_nss_ported_ipv6_accelerat /* * Expose what should be a static flag in the TCP connection tracker. */ @@ -72,16 +72,16 @@ Signed-off-by: Ansuel Smith /* * ecm_nss_ported_ipv6_connection_callback() * Callback for handling create ack/nack calls. -@@ -374,6 +374,8 @@ static void ecm_nss_ported_ipv6_connecti +@@ -348,6 +348,8 @@ static void ecm_nss_ported_ipv6_connecti ip_addr_t src_ip; ip_addr_t dest_ip; ecm_front_end_acceleration_mode_t result_mode; + struct net *net = nf_ct_net(ct); + struct nf_tcp_net *tn = nf_tcp_pernet(net); - DEBUG_CHECK_MAGIC(npci, ECM_NSS_PORTED_IPV6_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", npci); + DEBUG_CHECK_MAGIC(feci, ECM_FRONT_END_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", feci); -@@ -1158,9 +1160,13 @@ static void ecm_nss_ported_ipv6_connecti +@@ -1134,9 +1136,13 @@ static void ecm_nss_ported_ipv6_connecti nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end; nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend; #ifdef ECM_OPENWRT_SUPPORT @@ -99,16 +99,16 @@ Signed-off-by: Ansuel Smith || (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) { --- a/frontends/sfe/ecm_sfe_ported_ipv4.c +++ b/frontends/sfe/ecm_sfe_ported_ipv4.c -@@ -347,6 +347,8 @@ static void ecm_sfe_ported_ipv4_connecti +@@ -365,6 +365,8 @@ static void ecm_sfe_ported_ipv4_connecti uint8_t dest_mac_xlate[ETH_ALEN]; ecm_db_direction_t ecm_dir; ecm_front_end_acceleration_mode_t result_mode; + struct net *net = nf_ct_net(ct); + struct nf_tcp_net *tn = nf_tcp_pernet(net); + uint32_t l2_accel_bits = (ECM_SFE_COMMON_FLOW_L2_ACCEL_ALLOWED | ECM_SFE_COMMON_RETURN_L2_ACCEL_ALLOWED); + ecm_sfe_common_l2_accel_check_callback_t l2_accel_check; - DEBUG_CHECK_MAGIC(npci, ECM_SFE_PORTED_IPV4_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", npci); - -@@ -976,9 +978,13 @@ static void ecm_sfe_ported_ipv4_connecti +@@ -1291,9 +1293,13 @@ static void ecm_sfe_ported_ipv4_connecti nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end; nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend; #ifdef ECM_OPENWRT_SUPPORT @@ -126,16 +126,16 @@ Signed-off-by: Ansuel Smith || (ct->proto.tcp.seen[return_dir].flags & IP_CT_TCP_FLAG_BE_LIBERAL)) { --- a/frontends/sfe/ecm_sfe_ported_ipv6.c +++ b/frontends/sfe/ecm_sfe_ported_ipv6.c -@@ -352,6 +352,8 @@ static void ecm_sfe_ported_ipv6_connecti +@@ -369,6 +369,8 @@ static void ecm_sfe_ported_ipv6_connecti ip_addr_t src_ip; ip_addr_t dest_ip; ecm_front_end_acceleration_mode_t result_mode; + struct net *net = nf_ct_net(ct); + struct nf_tcp_net *tn = nf_tcp_pernet(net); + uint32_t l2_accel_bits = (ECM_SFE_COMMON_FLOW_L2_ACCEL_ALLOWED | ECM_SFE_COMMON_RETURN_L2_ACCEL_ALLOWED); + ecm_sfe_common_l2_accel_check_callback_t l2_accel_check; - DEBUG_CHECK_MAGIC(npci, ECM_SFE_PORTED_IPV6_CONNECTION_INSTANCE_MAGIC, "%px: magic failed", npci); - -@@ -935,9 +937,13 @@ static void ecm_sfe_ported_ipv6_connecti +@@ -1252,9 +1254,13 @@ static void ecm_sfe_ported_ipv6_connecti nircm->tcp_rule.return_end = ct->proto.tcp.seen[return_dir].td_end; nircm->tcp_rule.return_max_end = ct->proto.tcp.seen[return_dir].td_maxend; #ifdef ECM_OPENWRT_SUPPORT diff --git a/qca-nss-ecm/patches/0010-frontends-drop-udp_get_timeouts-and-use-standard-ups.patch b/qca-nss-ecm/patches/0010-frontends-drop-udp_get_timeouts-and-use-standard-ups.patch index 8baa6c4..f82ebf0 100644 --- a/qca-nss-ecm/patches/0010-frontends-drop-udp_get_timeouts-and-use-standard-ups.patch +++ b/qca-nss-ecm/patches/0010-frontends-drop-udp_get_timeouts-and-use-standard-ups.patch @@ -15,7 +15,7 @@ instead or relying on a downstream api not present upstream. --- a/frontends/nss/ecm_nss_ipv4.c +++ b/frontends/nss/ecm_nss_ipv4.c -@@ -2381,7 +2381,8 @@ sync_conntrack: +@@ -610,7 +610,8 @@ sync_conntrack: #else timeouts = nf_ct_timeout_lookup(ct); if (!timeouts) { @@ -27,7 +27,7 @@ instead or relying on a downstream api not present upstream. spin_lock_bh(&ct->lock); --- a/frontends/nss/ecm_nss_ipv6.c +++ b/frontends/nss/ecm_nss_ipv6.c -@@ -2121,7 +2121,8 @@ sync_conntrack: +@@ -587,7 +587,8 @@ sync_conntrack: #else timeouts = nf_ct_timeout_lookup(ct); if (!timeouts) { @@ -39,7 +39,7 @@ instead or relying on a downstream api not present upstream. spin_lock_bh(&ct->lock); --- a/frontends/sfe/ecm_sfe_ipv4.c +++ b/frontends/sfe/ecm_sfe_ipv4.c -@@ -1614,7 +1614,8 @@ sync_conntrack: +@@ -533,7 +533,8 @@ sync_conntrack: #else timeouts = nf_ct_timeout_lookup(ct); if (!timeouts) { @@ -51,7 +51,7 @@ instead or relying on a downstream api not present upstream. spin_lock_bh(&ct->lock); --- a/frontends/sfe/ecm_sfe_ipv6.c +++ b/frontends/sfe/ecm_sfe_ipv6.c -@@ -1338,7 +1338,8 @@ sync_conntrack: +@@ -522,7 +522,8 @@ sync_conntrack: #else timeouts = nf_ct_timeout_lookup(ct); if (!timeouts) { diff --git a/qca-nss-ecm/patches/0011-ecm_interface-rework-vlan-API-to-internal-function.patch b/qca-nss-ecm/patches/0011-ecm_interface-rework-vlan-API-to-internal-function.patch index 2d11455..98528c0 100644 --- a/qca-nss-ecm/patches/0011-ecm_interface-rework-vlan-API-to-internal-function.patch +++ b/qca-nss-ecm/patches/0011-ecm_interface-rework-vlan-API-to-internal-function.patch @@ -14,11 +14,11 @@ Signed-off-by: Ansuel Smith --- a/ecm_interface.c +++ b/ecm_interface.c -@@ -304,8 +304,36 @@ EXPORT_SYMBOL(ecm_interface_get_and_hold +@@ -308,8 +308,36 @@ EXPORT_SYMBOL(ecm_interface_get_and_hold */ static inline struct net_device *ecm_interface_vlan_real_dev(struct net_device *vlan_dev) { -+#ifdef ECM_USE_INTERNAL_FUNC ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 11, 0)) + struct vlan_dev_priv *vlan = vlan_dev_priv(vlan_dev); + return vlan->real_dev; +#else @@ -27,7 +27,7 @@ Signed-off-by: Ansuel Smith +} + +#ifdef ECM_INTERFACE_VLAN_ENABLE -+#ifdef ECM_USE_INTERNAL_FUNC ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 11, 0)) +static void ecm_interface_vlan_dev_update_accel_stats(struct net_device *dev, + struct rtnl_link_stats64 *nlstats) +{ @@ -51,15 +51,15 @@ Signed-off-by: Ansuel Smith /* * ecm_interface_dev_find_by_local_addr_ipv4() -@@ -6442,7 +6470,11 @@ static void ecm_interface_list_stats_upd - stats.rx_bytes = rx_bytes; - stats.tx_packets = tx_packets; - stats.tx_bytes = tx_bytes; -+#ifdef ECM_USE_INTERNAL_FUNC -+ ecm_interface_vlan_dev_update_accel_stats(dev, &stats); +@@ -6593,7 +6621,11 @@ skip_bridge_refresh: + stats.rx_bytes = rx_bytes; + stats.tx_packets = tx_packets; + stats.tx_bytes = tx_bytes; ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 11, 0)) ++ ecm_interface_vlan_dev_update_accel_stats(dev, &stats); +#else - __vlan_dev_update_accel_stats(dev, &stats); + __vlan_dev_update_accel_stats(dev, &stats); +#endif - break; + dev_put(dev); + continue; #endif - #ifdef ECM_INTERFACE_OVS_BRIDGE_ENABLE diff --git a/qca-nss-ecm/patches/0012-ecm_interface-rework-br_dev_update_stats-to-internal.patch b/qca-nss-ecm/patches/0012-ecm_interface-rework-br_dev_update_stats-to-internal.patch index 603da6b..dba1a0e 100644 --- a/qca-nss-ecm/patches/0012-ecm_interface-rework-br_dev_update_stats-to-internal.patch +++ b/qca-nss-ecm/patches/0012-ecm_interface-rework-br_dev_update_stats-to-internal.patch @@ -14,11 +14,11 @@ Signed-off-by: Ansuel Smith --- a/ecm_interface.c +++ b/ecm_interface.c -@@ -743,6 +743,27 @@ bool ecm_interface_mac_addr_get(ip_addr_ +@@ -746,6 +746,27 @@ bool ecm_interface_mac_addr_get(ip_addr_ } EXPORT_SYMBOL(ecm_interface_mac_addr_get); -+#ifdef ECM_USE_INTERNAL_FUNC ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 11, 0)) +static void ecm_interface_br_dev_update_stats(struct net_device *dev, + struct rtnl_link_stats64 *nlstats) +{ @@ -42,15 +42,15 @@ Signed-off-by: Ansuel Smith #ifdef ECM_IPV6_ENABLE /* ecm_interface_ipv6_dev_find_and_hold() * Find (and hold) net device that has the given address. -@@ -6491,7 +6512,11 @@ static void ecm_interface_list_stats_upd - stats.rx_bytes = rx_bytes; - stats.tx_packets = tx_packets; - stats.tx_bytes = tx_bytes; -+#ifdef ECM_USE_INTERNAL_FUNC -+ ecm_interface_br_dev_update_stats(dev, &stats); +@@ -6586,7 +6607,11 @@ skip_bridge_refresh: + stats.rx_bytes = rx_bytes; + stats.tx_packets = tx_packets; + stats.tx_bytes = tx_bytes; ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(5, 11, 0)) ++ ecm_interface_br_dev_update_stats(dev, &stats); +#else - br_dev_update_stats(dev, &stats); + br_dev_update_stats(dev, &stats); +#endif - break; - #ifdef ECM_INTERFACE_PPPOE_ENABLE - case ECM_DB_IFACE_TYPE_PPPOE: + dev_put(dev); + continue; + diff --git a/qca-nss-ecm/patches/0013-ecm_classifier_nl_genl-kernel-5.10-support.patch b/qca-nss-ecm/patches/0013-ecm_classifier_nl_genl-kernel-5.10-support.patch index b9f000b..eaba118 100644 --- a/qca-nss-ecm/patches/0013-ecm_classifier_nl_genl-kernel-5.10-support.patch +++ b/qca-nss-ecm/patches/0013-ecm_classifier_nl_genl-kernel-5.10-support.patch @@ -1,6 +1,14 @@ --- a/ecm_classifier_nl.c +++ b/ecm_classifier_nl.c -@@ -141,12 +141,55 @@ static struct genl_multicast_group ecm_c +@@ -70,6 +70,7 @@ + #include "ecm_tracker_tcp.h" + #include "ecm_classifier_nl.h" + #include "ecm_db.h" ++#include "ecm_front_end_common.h" + #include "ecm_front_end_ipv4.h" + #ifdef ECM_IPV6_ENABLE + #include "ecm_front_end_ipv6.h" +@@ -144,12 +145,55 @@ static struct genl_multicast_group ecm_c }, }; @@ -57,7 +65,7 @@ }; /* -@@ -210,12 +253,7 @@ ecm_classifier_nl_send_genl_msg(enum ECM +@@ -213,12 +257,7 @@ ecm_classifier_nl_send_genl_msg(enum ECM return ret; } @@ -71,7 +79,7 @@ /* genlmsg_multicast frees the skb in both success and error cases */ ret = genlmsg_multicast(&ecm_cl_nl_genl_family, -@@ -1363,49 +1401,14 @@ static struct file_operations ecm_classi +@@ -1366,49 +1405,14 @@ static struct file_operations ecm_classi .write = ecm_classifier_nl_set_command, }; diff --git a/qca-nss-ecm/patches/0014-ecm_db-revert-ipv6_route_table_update.patch b/qca-nss-ecm/patches/0014-ecm_db-revert-ipv6_route_table_update.patch deleted file mode 100644 index 58c26a4..0000000 --- a/qca-nss-ecm/patches/0014-ecm_db-revert-ipv6_route_table_update.patch +++ /dev/null @@ -1,170 +0,0 @@ ---- a/ecm_db/ecm_db.c -+++ b/ecm_db/ecm_db.c -@@ -242,166 +242,14 @@ static int ecm_db_ipv6_route_table_updat - unsigned long event, - void *ptr) - { -- struct fib6_config *cfg = (struct fib6_config *)ptr; -- struct ecm_db_connection_instance *ci; -- - DEBUG_TRACE("route table update event v6\n"); - -- if ((event != RTM_DELROUTE) && (event != RTM_NEWROUTE)) { -- DEBUG_WARN("%px: Unhandled route table event: %lu\n", cfg, event); -- return NOTIFY_DONE; -- } -- -- /* -- * If a default route is changed, fc_dst address is set to all zeros. -- * In this case, we should defunct all the IPv6 flows. -- */ -- if (ipv6_addr_any(&cfg->fc_dst)) { -- DEBUG_TRACE("%px fc_dst (%pI6), default route is changed, defunct all IPv6 connections\n", -- cfg, &cfg->fc_dst); -- ecm_db_connection_defunct_ip_version(6); -- return NOTIFY_DONE; -- } -- - /* - * Disable IPv6 frontend processing until defunct function call is completed. - */ - ecm_front_end_ipv6_stop(1); - -- /* -- * Iterate all connections -- */ -- ci = ecm_db_connections_get_and_ref_first(); -- while (ci) { -- struct ecm_db_connection_instance *cin; -- struct in6_addr prefix_addr; -- struct in6_addr ecm_in6; -- ip_addr_t ecm_addr; -- struct ecm_db_iface_instance *interfaces[ECM_DB_IFACE_HEIRARCHY_MAX]; -- int32_t if_first; -- struct net_device *ecm_dev; -- struct net_device *fc_dev; -- bool is_dest_ip_match = true; -- ecm_db_obj_dir_t obj_dir = ECM_DB_OBJ_DIR_TO; -- -- if (ci->ip_version != 6) { -- goto next; -- } -- -- /* -- * Get the ECM connection's destination IPv6 address. -- */ -- ecm_db_connection_address_get(ci, ECM_DB_OBJ_DIR_TO, ecm_addr); -- ECM_IP_ADDR_TO_NIN6_ADDR(ecm_in6, ecm_addr); -- -- /* -- * Compute ECM connection's prefix destination address by masking it with the -- * route config's destination address prefix length. -- */ -- ipv6_addr_prefix(&prefix_addr, &ecm_in6, cfg->fc_dst_len); -- -- DEBUG_TRACE("dest addr prefix: %pI6 prefix_len: %d ecm_in6: %pI6\n", &prefix_addr, cfg->fc_dst_len, &ecm_in6); -- -- /* -- * Compare the ECM connection's destination address prefix with the route config's -- * destination address. If they are not equal, try with the ECM's source address prefix. -- * Because ECM can create the connection in the reply direction, and in this case, ECM -- * connection's source prefix IP address will match with the route config's dst IP address. -- * -- * If none of them match with the route config's destination address, this means that -- * this connection is not related to this route change event. -- * We should check with the next connection. -- */ -- if (ipv6_addr_cmp(&prefix_addr, &cfg->fc_dst)) { -- DEBUG_TRACE("dest addr prefix: %pI6 not equal to cfg->fc_dst: %pI6, go to next connection\n", &prefix_addr, &cfg->fc_dst); -- -- /* -- * ECM's destination address didn't match. -- * Get the ECM connection's source IPv6 address. -- */ -- ecm_db_connection_address_get(ci, ECM_DB_OBJ_DIR_FROM, ecm_addr); -- ECM_IP_ADDR_TO_NIN6_ADDR(ecm_in6, ecm_addr); -- -- /* -- * Compute ECM connection's prefix source address by masking it with the -- * route config's destination address prefix length. -- */ -- ipv6_addr_prefix(&prefix_addr, &ecm_in6, cfg->fc_dst_len); -- -- DEBUG_TRACE("src addr prefix: %pI6 prefix_len: %d ecm_in6: %pI6\n", &prefix_addr, cfg->fc_dst_len, &ecm_in6); -- -- if (ipv6_addr_cmp(&prefix_addr, &cfg->fc_dst)) { -- DEBUG_TRACE("src addr prefix: %pI6 not equal to cfg->fc_dst: %pI6, go to next connection\n", &prefix_addr, &cfg->fc_dst); -- goto next; -- } -- -- is_dest_ip_match = false; -- obj_dir = ECM_DB_OBJ_DIR_FROM; -- } -- -- DEBUG_TRACE("%px: ECM connection's %s address prefix: %pI6 equals to cfg->fc_dst: %pI6\n", -- ci, is_dest_ip_match?"dest":"src", &prefix_addr, &cfg->fc_dst); -- -- /* -- * If the event is a route delete event, comparing only the IP address is enough -- * to defunct the connection. -- */ -- if (event == RTM_DELROUTE) { -- DEBUG_TRACE("%px: Route DELETE event, defunct the connection\n", ci); -- ecm_db_connection_make_defunct(ci); -- goto next; -- } -- -- DEBUG_TRACE("%px: Route ADD event\n", ci); -- -- /* -- * If there is a route for this connection's source or destination IP address, we should -- * compare the devices as well, because the IP address could remain the same, but -- * the output device could be changed. So, the flows should take the new out device -- * for their route. -- */ -- if_first = ecm_db_connection_interfaces_get_and_ref(ci, interfaces, obj_dir); -- if (if_first == ECM_DB_IFACE_HEIRARCHY_MAX) { -- DEBUG_WARN("%px: Failed to get %s interfaces list\n", -- ci, ecm_db_obj_dir_strings[obj_dir]); -- goto next; -- } -- -- /* -- * Inner most interface has the IP address, so we should get that interface. -- */ -- ecm_dev = dev_get_by_index(&init_net, -- ecm_db_iface_interface_identifier_get(interfaces[ECM_DB_IFACE_HEIRARCHY_MAX - 1])); -- if (!ecm_dev) { -- DEBUG_WARN("%px: unable to find ecm netdevice\n", ci); -- ecm_db_connection_interfaces_deref(interfaces, if_first); -- goto next; -- } -- ecm_db_connection_interfaces_deref(interfaces, if_first); -- -- fc_dev = dev_get_by_index(&init_net, cfg->fc_ifindex); -- if (!fc_dev) { -- DEBUG_WARN("%px: unable to find fib6_config netdevice\n", ci); -- dev_put(ecm_dev); -- goto next; -- } -- -- /* -- * Compare the ECM connection's netdevice with the route change config's netdevice. -- * If they are different, this means the new route effected the connection. So, defunct it. -- */ -- if (ecm_dev != fc_dev) { -- DEBUG_TRACE("%px: fib6_config dev: %s is different from ecm dev: %s, defunct the connection\n", -- ci, fc_dev->name, ecm_dev->name); -- ecm_db_connection_make_defunct(ci); -- } -- dev_put(fc_dev); -- dev_put(ecm_dev); --next: -- cin = ecm_db_connection_get_and_ref_next(ci); -- ecm_db_connection_deref(ci); -- ci = cin; -- } -+ ecm_db_connection_defunct_ip_version(6); - - /* - * Re-enable IPv6 frontend processing. diff --git a/qca-nss-ecm/patches/0014-qca-nss-ecm-fix-a-memcpy-overflow-in-ecm_db.patch b/qca-nss-ecm/patches/0014-qca-nss-ecm-fix-a-memcpy-overflow-in-ecm_db.patch new file mode 100644 index 0000000..a925fcf --- /dev/null +++ b/qca-nss-ecm/patches/0014-qca-nss-ecm-fix-a-memcpy-overflow-in-ecm_db.patch @@ -0,0 +1,106 @@ +From 1958e34c4c1b8b4fb62eba693fbd7693536947b9 Mon Sep 17 00:00:00 2001 +From: flebourse +Date: Thu, 23 Dec 2021 16:11:06 +0100 +Subject: [PATCH] qca-nss-ecm: fix a memcpy overflow in ecm_db + +Calls to ipv6_addr_prefix() trigger a memcpy overflow if the prefix len +argument is greater than 128, cap it at this value. + +stack bactrace: +detected buffer overflow in memcpy +Kernel BUG at fortify_panic+0x20/0x24 +Internal error: Oops - BUG: 0 [#1] SMP +CPU: 2 PID: 2592 Comm: netifd Not tainted 5.10.80 #0 +Hardware name: Xiaomi AX9000 (DT) +Call trace: + fortify_panic+0x20/0x24 + ecm_db_exit+0x42c/0x49c [ecm] + ecm_db_exit+0x464/0x49c [ecm] + atomic_notifier_call_chain+0x5c/0x90 + ip6_route_add+0x13c/0x1a4 + inet6_rtm_newroute+0x98/0xa0 + rtnetlink_rcv_msg+0x10c/0x34c + netlink_rcv_skb+0x5c/0x130 + rtnetlink_rcv+0x1c/0x2c + netlink_unicast+0x1ec/0x2e0 + netlink_sendmsg+0x1a4/0x394 + ____sys_sendmsg+0x270/0x2b4 + ___sys_sendmsg+0x7c/0xc0 + __sys_sendmsg+0x5c/0xb0 + __arm64_sys_sendmsg+0x28/0x34 + el0_svc_common.constprop.0+0x88/0x190 + do_el0_svc+0x74/0x94 + el0_svc+0x14/0x20 + el0_sync_handler+0xa8/0x130 + el0_sync+0x184/0x1c0 +Code: aa0003e1 912b4040 910003fd 97fff56c (d4210000) + +Signed-off-By: Francis Le Bourse +--- + ecm_db/ecm_db.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/ecm_db/ecm_db.c ++++ b/ecm_db/ecm_db.c +@@ -242,11 +242,13 @@ static int ecm_db_ipv6_route_table_updat + unsigned long event, + void *ptr) + { ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)) + struct fib6_config *cfg = (struct fib6_config *)ptr; + struct ecm_db_connection_instance *ci; +- ++#endif + DEBUG_TRACE("route table update event v6\n"); + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)) + if ((event != RTM_DELROUTE) && (event != RTM_NEWROUTE)) { + DEBUG_WARN("%px: Unhandled route table event: %lu\n", cfg, event); + return NOTIFY_DONE; +@@ -262,12 +264,13 @@ static int ecm_db_ipv6_route_table_updat + ecm_db_connection_defunct_ip_version(6); + return NOTIFY_DONE; + } +- ++#endif + /* + * Disable IPv6 frontend processing until defunct function call is completed. + */ + ecm_front_end_ipv6_stop(1); + ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)) + /* + * Iterate all connections + */ +@@ -298,7 +301,7 @@ static int ecm_db_ipv6_route_table_updat + * Compute ECM connection's prefix destination address by masking it with the + * route config's destination address prefix length. + */ +- ipv6_addr_prefix(&prefix_addr, &ecm_in6, cfg->fc_dst_len); ++ ipv6_addr_prefix(&prefix_addr, &ecm_in6, min(128, cfg->fc_dst_len)); + + DEBUG_TRACE("dest addr prefix: %pI6 prefix_len: %d ecm_in6: %pI6\n", &prefix_addr, cfg->fc_dst_len, &ecm_in6); + +@@ -326,7 +329,7 @@ static int ecm_db_ipv6_route_table_updat + * Compute ECM connection's prefix source address by masking it with the + * route config's destination address prefix length. + */ +- ipv6_addr_prefix(&prefix_addr, &ecm_in6, cfg->fc_dst_len); ++ ipv6_addr_prefix(&prefix_addr, &ecm_in6, min(128, cfg->fc_dst_len)); + + DEBUG_TRACE("src addr prefix: %pI6 prefix_len: %d ecm_in6: %pI6\n", &prefix_addr, cfg->fc_dst_len, &ecm_in6); + +@@ -402,11 +405,12 @@ next: + ecm_db_connection_deref(ci); + ci = cin; + } +- ++#else + /* + * Re-enable IPv6 frontend processing. + */ + ecm_front_end_ipv6_stop(0); ++#endif + return NOTIFY_DONE; + } + diff --git a/qca-nss-ecm/patches/0015-example-fix-compile-pcc-example.patch b/qca-nss-ecm/patches/0015-example-fix-compile-pcc-example.patch index 9f73e98..be06cee 100644 --- a/qca-nss-ecm/patches/0015-example-fix-compile-pcc-example.patch +++ b/qca-nss-ecm/patches/0015-example-fix-compile-pcc-example.patch @@ -1,21 +1,24 @@ --- a/frontends/nss/ecm_nss_common.h +++ b/frontends/nss/ecm_nss_common.h -@@ -363,6 +363,7 @@ static inline bool ecm_nss_common_is_xfr - return false; +@@ -310,6 +310,7 @@ static inline bool ecm_nss_common_igs_ac } + #endif +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,1)) #ifdef ECM_CLASSIFIER_PCC_ENABLE /* * ecm_nss_common_fill_mirror_info() -@@ -416,3 +417,4 @@ static inline bool ecm_nss_common_fill_m +@@ -363,6 +364,7 @@ static inline bool ecm_nss_common_fill_m return true; } #endif +#endif + + bool ecm_nss_ipv6_is_conn_limit_reached(void); + bool ecm_nss_ipv4_is_conn_limit_reached(void); --- a/frontends/nss/ecm_nss_ported_ipv4.c +++ b/frontends/nss/ecm_nss_ported_ipv4.c -@@ -1064,6 +1064,7 @@ static void ecm_nss_ported_ipv4_connecti +@@ -1045,6 +1045,7 @@ static void ecm_nss_ported_ipv4_connecti } #endif @@ -23,7 +26,7 @@ #ifdef ECM_CLASSIFIER_PCC_ENABLE /* * Set up the interfaces for mirroring. -@@ -1088,6 +1089,7 @@ static void ecm_nss_ported_ipv4_connecti +@@ -1069,6 +1070,7 @@ static void ecm_nss_ported_ipv4_connecti nircm->valid_flags |= NSS_IPV4_RULE_CREATE_MIRROR_VALID; } #endif @@ -31,9 +34,25 @@ if (ecm_nss_ipv4_vlan_passthrough_enable && !ecm_db_connection_is_routed_get(feci->ci) && (nircm->vlan_primary_rule.ingress_vlan_tag == ECM_FRONT_END_VLAN_ID_NOT_CONFIGURED) && +@@ -1901,14 +1903,8 @@ struct ecm_front_end_connection_instance + */ + bool ecm_nss_ported_ipv4_debugfs_init(struct dentry *dentry) + { +- struct dentry *udp_dentry; +- +- udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, ++ debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, + &ecm_nss_ported_ipv4_accelerated_count[ECM_FRONT_END_PORTED_PROTO_UDP]); +- if (!udp_dentry) { +- DEBUG_ERROR("Failed to create ecm nss ipv4 udp_accelerated_count file in debugfs\n"); +- return false; +- } + + debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, + &ecm_nss_ported_ipv4_accelerated_count[ECM_FRONT_END_PORTED_PROTO_TCP]); --- a/frontends/nss/ecm_nss_ported_ipv6.c +++ b/frontends/nss/ecm_nss_ported_ipv6.c -@@ -1033,6 +1033,7 @@ static void ecm_nss_ported_ipv6_connecti +@@ -1014,6 +1014,7 @@ static void ecm_nss_ported_ipv6_connecti } #endif @@ -41,7 +60,7 @@ #ifdef ECM_CLASSIFIER_PCC_ENABLE /* * Set up the interfaces for mirroring. -@@ -1057,6 +1058,7 @@ static void ecm_nss_ported_ipv6_connecti +@@ -1038,6 +1039,7 @@ static void ecm_nss_ported_ipv6_connecti nircm->valid_flags |= NSS_IPV6_RULE_CREATE_MIRROR_VALID; } #endif @@ -49,3 +68,19 @@ if (ecm_nss_ipv6_vlan_passthrough_enable && !ecm_db_connection_is_routed_get(feci->ci) && (nircm->vlan_primary_rule.ingress_vlan_tag == ECM_FRONT_END_VLAN_ID_NOT_CONFIGURED) && +@@ -1814,14 +1816,8 @@ struct ecm_front_end_connection_instance + */ + bool ecm_nss_ported_ipv6_debugfs_init(struct dentry *dentry) + { +- struct dentry *udp_dentry; +- +- udp_dentry = debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, ++ debugfs_create_u32("udp_accelerated_count", S_IRUGO, dentry, + &ecm_nss_ported_ipv6_accelerated_count[ECM_FRONT_END_PORTED_PROTO_UDP]); +- if (!udp_dentry) { +- DEBUG_ERROR("Failed to create ecm nss ipv6 udp_accelerated_count file in debugfs\n"); +- return false; +- } + + debugfs_create_u32("tcp_accelerated_count", S_IRUGO, dentry, + &ecm_nss_ported_ipv6_accelerated_count[ECM_FRONT_END_PORTED_PROTO_TCP]); diff --git a/qca-nss-ecm/patches/902-ecm-conntrack-notifier-introduce-init-and-exit-mutex.patch b/qca-nss-ecm/patches/902-ecm-conntrack-notifier-introduce-init-and-exit-mutex.patch new file mode 100644 index 0000000..705fb5c --- /dev/null +++ b/qca-nss-ecm/patches/902-ecm-conntrack-notifier-introduce-init-and-exit-mutex.patch @@ -0,0 +1,55 @@ +--- a/ecm_conntrack_notifier.c ++++ b/ecm_conntrack_notifier.c +@@ -89,6 +89,7 @@ + * Locking of the classifier - concurrency control + */ + static DEFINE_SPINLOCK(ecm_conntrack_notifier_lock __attribute__((unused))); /* Protect against SMP access between netfilter, events and private threaded function. */ ++static DEFINE_MUTEX(ecm_conntrack_notifier_mtx); /* Protect against race conditions during nf_conntrack notifier registration/unregistration events */ + + /* + * Debugfs dentry object. +@@ -427,7 +428,9 @@ int ecm_conntrack_notifier_init(struct d + int result __attribute__((unused)); + DEBUG_INFO("ECM Conntrack Notifier init\n"); + +- ecm_conntrack_notifier_dentry = debugfs_create_dir("ecm_conntrack_notifier", dentry); ++ mutex_lock(&ecm_conntrack_notifier_mtx); ++ ++ ecm_conntrack_notifier_dentry = debugfs_create_dir("ecm_conntrack_notifier", dentry); + if (!ecm_conntrack_notifier_dentry) { + DEBUG_ERROR("Failed to create ecm conntrack notifier directory in debugfs\n"); + return -1; +@@ -453,11 +456,14 @@ int ecm_conntrack_notifier_init(struct d + if (result < 0) { + DEBUG_ERROR("Can't register nf notifier hook.\n"); + debugfs_remove_recursive(ecm_conntrack_notifier_dentry); +- return result; ++ mutex_unlock(&ecm_conntrack_notifier_mtx); ++ return result; + } + #endif + #endif + ++ mutex_unlock(&ecm_conntrack_notifier_mtx); ++ + return 0; + } + EXPORT_SYMBOL(ecm_conntrack_notifier_init); +@@ -468,6 +474,9 @@ EXPORT_SYMBOL(ecm_conntrack_notifier_ini + void ecm_conntrack_notifier_exit(void) + { + DEBUG_INFO("ECM Conntrack Notifier exit\n"); ++ ++ mutex_lock(&ecm_conntrack_notifier_mtx); ++ + #ifdef CONFIG_NF_CONNTRACK_CHAIN_EVENTS + nf_conntrack_unregister_chain_notifier(&init_net, &ecm_conntrack_notifier); + #else +@@ -483,5 +492,7 @@ void ecm_conntrack_notifier_exit(void) + if (ecm_conntrack_notifier_dentry) { + debugfs_remove_recursive(ecm_conntrack_notifier_dentry); + } ++ ++ mutex_unlock(&ecm_conntrack_notifier_mtx); + } + EXPORT_SYMBOL(ecm_conntrack_notifier_exit); diff --git a/qca-nss-gmac/patches/0001-kernel-5.4-support.patch b/qca-nss-gmac/patches/0000-kernel-5.10-support.patch similarity index 65% rename from qca-nss-gmac/patches/0001-kernel-5.4-support.patch rename to qca-nss-gmac/patches/0000-kernel-5.10-support.patch index 585c798..a196611 100644 --- a/qca-nss-gmac/patches/0001-kernel-5.4-support.patch +++ b/qca-nss-gmac/patches/0000-kernel-5.10-support.patch @@ -52,7 +52,30 @@ return ret; } -@@ -951,7 +949,7 @@ static const struct net_device_ops nss_g +@@ -761,6 +759,7 @@ static uint32_t nss_gmac_tstamp_ioctl(st + { + struct hwtstamp_config cfg; + struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); ++ int ret = -EINVAL; + + /* + * Return if NSS FW is not up +@@ -769,9 +768,11 @@ static uint32_t nss_gmac_tstamp_ioctl(st + netdev_dbg(netdev, "%s: NSS Firmware is not up. Cannot enable Timestamping \n", __func__); + return -EINVAL; + } +- +- copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)); +- ++ ret = copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)); ++ if (ret) { ++ netdev_err(netdev, "%s: Unable to copy NSS Firmware into memory \n", __func__); ++ return -EINVAL; ++ } + /* + * Enable Timestamping if not already enabled + */ +@@ -951,7 +952,7 @@ static const struct net_device_ops nss_g * @param[in] pointer to advertised features * @return void */ @@ -61,7 +84,66 @@ { *supp |= NSS_GMAC_SUPPORTED_FEATURES; *adv |= NSS_GMAC_ADVERTISED_FEATURES; -@@ -1409,8 +1407,8 @@ static int32_t nss_gmac_probe(struct pla +@@ -994,9 +995,11 @@ static int32_t nss_gmac_of_get_pdata(str + struct net_device *netdev, + struct msm_nss_gmac_platform_data *gmaccfg) + { +- uint8_t *maddr = NULL; + struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); + struct resource memres_devtree = {0}; ++ phy_interface_t phyif = 0; ++ ++ + + if (of_property_read_u32(np, "qcom,id", &gmacdev->macid) + || of_property_read_u32(np, "qcom,phy-mdio-addr", +@@ -1022,15 +1025,14 @@ static int32_t nss_gmac_of_get_pdata(str + + of_property_read_u32(np, "qcom,aux-clk-freq", &gmacdev->aux_clk_freq); + +- gmaccfg->phy_mii_type = of_get_phy_mode(np); ++ gmaccfg->phy_mii_type = of_get_phy_mode(np, &phyif); + netdev->irq = irq_of_parse_and_map(np, 0); + if (netdev->irq == NO_IRQ) { + pr_err("%s: Can't map interrupt\n", np->name); + return -EFAULT; + } +- maddr = (uint8_t *)of_get_mac_address(np); +- if (maddr) +- memcpy(gmaccfg->mac_addr, maddr, ETH_ALEN); ++ ++ of_get_mac_address(np, gmaccfg->mac_addr); + + if (of_address_to_resource(np, 0, &memres_devtree) != 0) + return -EFAULT; +@@ -1100,7 +1102,7 @@ static int32_t nss_gmac_do_common_init(s + ctx.msm_clk_ctl_enabled = true; + #endif + +- ctx.nss_base = (uint8_t *)ioremap_nocache(res_nss_base.start, ++ ctx.nss_base = (uint8_t *)ioremap(res_nss_base.start, + resource_size(&res_nss_base)); + if (!ctx.nss_base) { + pr_info("Error mapping NSS GMAC registers\n"); +@@ -1109,7 +1111,7 @@ static int32_t nss_gmac_do_common_init(s + } + pr_debug("%s: NSS base ioremap OK.\n", __func__); + +- ctx.qsgmii_base = (uint32_t *)ioremap_nocache(res_qsgmii_base.start, ++ ctx.qsgmii_base = (uint32_t *)ioremap(res_qsgmii_base.start, + resource_size(&res_qsgmii_base)); + if (!ctx.qsgmii_base) { + pr_info("Error mapping QSGMII registers\n"); +@@ -1119,7 +1121,7 @@ static int32_t nss_gmac_do_common_init(s + pr_debug("%s: QSGMII base ioremap OK, vaddr = 0x%p\n", + __func__, ctx.qsgmii_base); + +- ctx.clk_ctl_base = (uint32_t *)ioremap_nocache(res_clk_ctl_base.start, ++ ctx.clk_ctl_base = (uint32_t *)ioremap(res_clk_ctl_base.start, + resource_size(&res_clk_ctl_base)); + if (!ctx.clk_ctl_base) { + pr_info("Error mapping Clk control registers\n"); +@@ -1409,8 +1411,8 @@ static int32_t nss_gmac_probe(struct pla goto nss_gmac_phy_attach_fail; } @@ -72,7 +154,7 @@ gmacdev->phydev->irq = PHY_POLL; netdev_dbg(netdev, "PHY %s attach OK\n", phy_id); -@@ -1440,6 +1438,8 @@ static int32_t nss_gmac_probe(struct pla +@@ -1440,6 +1442,8 @@ static int32_t nss_gmac_probe(struct pla netdev_dbg(netdev, "%s MII_PHYSID2 - 0x%04x\n", netdev->name, nss_gmac_mii_rd_reg(gmacdev, gmacdev->phy_base, MII_PHYSID2)); } else if (gmacdev->phy_base != NSS_GMAC_NO_MDIO_PHY) { @@ -267,3 +349,49 @@ .get_strings = &nss_gmac_get_strings, .get_sset_count = &nss_gmac_get_strset_count, .get_ethtool_stats = &nss_gmac_get_ethtool_stats, +--- a/ipq806x/nss_gmac_dev.c ++++ b/ipq806x/nss_gmac_dev.c +@@ -1585,7 +1585,7 @@ int32_t nss_gmac_attach(struct nss_gmac_ + } + + /* ioremap addresses */ +- gmacdev->mac_base = ioremap_nocache(reg_base, ++ gmacdev->mac_base = ioremap(reg_base, + NSS_GMAC_REG_BLOCK_LEN); + if (!gmacdev->mac_base) { + netdev_dbg(netdev, "ioremap fail.\n"); +--- a/ipq806x/include/nss_gmac_network_interface.h ++++ b/ipq806x/include/nss_gmac_network_interface.h +@@ -41,7 +41,7 @@ int32_t nss_gmac_xmit_frames(struct sk_b + int32_t nss_gmac_close(struct net_device *netdev); + int32_t nss_gmac_open(struct net_device *netdev); + int32_t nss_gmac_change_mtu(struct net_device *netdev, int32_t newmtu); +-void nss_gmac_tx_timeout(struct net_device *netdev); ++void nss_gmac_tx_timeout(struct net_device *netdev, unsigned int txqueue); + + /* NSS driver interface APIs */ + void nss_gmac_receive(struct net_device *netdev, struct sk_buff *skb, +--- a/ipq806x/nss_gmac_tx_rx_offload.c ++++ b/ipq806x/nss_gmac_tx_rx_offload.c +@@ -1027,8 +1027,10 @@ int nss_gmac_close(struct net_device *ne + nss_gmac_disable_interrupt_all(gmacdev); + gmacdev->data_plane_ops->link_state(gmacdev->data_plane_ctx, 0); + +- if (!IS_ERR(gmacdev->phydev)) +- phy_stop(gmacdev->phydev); ++ if (!IS_ERR(gmacdev->phydev)) { ++ if (test_bit(__NSS_GMAC_LINKPOLL, &gmacdev->flags)) ++ phy_stop(gmacdev->phydev); ++ } + + clear_bit(__NSS_GMAC_UP, &gmacdev->flags); + clear_bit(__NSS_GMAC_CLOSING, &gmacdev->flags); +@@ -1044,7 +1046,7 @@ int nss_gmac_close(struct net_device *ne + * @param[in] pointer to net_device structure + * @return void. + */ +-void nss_gmac_tx_timeout(struct net_device *netdev) ++void nss_gmac_tx_timeout(struct net_device *netdev, unsigned int txqueue) + { + struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); + BUG_ON(gmacdev == NULL); diff --git a/qca-nss-gmac/patches/0002-nss-gmac-test-ptr.patch b/qca-nss-gmac/patches/0002-nss-gmac-test-ptr.patch deleted file mode 100644 index d370289..0000000 --- a/qca-nss-gmac/patches/0002-nss-gmac-test-ptr.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/ipq806x/nss_gmac_ctrl.c -+++ b/ipq806x/nss_gmac_ctrl.c -@@ -1027,7 +1027,7 @@ static int32_t nss_gmac_of_get_pdata(str - return -EFAULT; - } - maddr = (uint8_t *)of_get_mac_address(np); -- if (maddr) -+ if (!IS_ERR_OR_NULL(maddr)) - memcpy(gmaccfg->mac_addr, maddr, ETH_ALEN); - - if (of_address_to_resource(np, 0, &memres_devtree) != 0) diff --git a/qca-nss-gmac/patches/0003-nss-gmac-fix-of_get_mac_address.patch b/qca-nss-gmac/patches/0003-nss-gmac-fix-of_get_mac_address.patch deleted file mode 100644 index 133b944..0000000 --- a/qca-nss-gmac/patches/0003-nss-gmac-fix-of_get_mac_address.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/ipq806x/nss_gmac_ctrl.c -+++ b/ipq806x/nss_gmac_ctrl.c -@@ -992,7 +992,6 @@ static int32_t nss_gmac_of_get_pdata(str - struct net_device *netdev, - struct msm_nss_gmac_platform_data *gmaccfg) - { -- uint8_t *maddr = NULL; - struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); - struct resource memres_devtree = {0}; - -@@ -1026,9 +1025,8 @@ static int32_t nss_gmac_of_get_pdata(str - pr_err("%s: Can't map interrupt\n", np->name); - return -EFAULT; - } -- maddr = (uint8_t *)of_get_mac_address(np); -- if (!IS_ERR_OR_NULL(maddr)) -- memcpy(gmaccfg->mac_addr, maddr, ETH_ALEN); -+ -+ of_get_mac_address(np, gmaccfg->mac_addr); - - if (of_address_to_resource(np, 0, &memres_devtree) != 0) - return -EFAULT; diff --git a/qca-nss-gmac/patches/0004-fix-ioremap-call.patch b/qca-nss-gmac/patches/0004-fix-ioremap-call.patch deleted file mode 100644 index 03c3f11..0000000 --- a/qca-nss-gmac/patches/0004-fix-ioremap-call.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- a/ipq806x/nss_gmac_dev.c -+++ b/ipq806x/nss_gmac_dev.c -@@ -1585,7 +1585,7 @@ int32_t nss_gmac_attach(struct nss_gmac_ - } - - /* ioremap addresses */ -- gmacdev->mac_base = ioremap_nocache(reg_base, -+ gmacdev->mac_base = ioremap(reg_base, - NSS_GMAC_REG_BLOCK_LEN); - if (!gmacdev->mac_base) { - netdev_dbg(netdev, "ioremap fail.\n"); ---- a/ipq806x/nss_gmac_ctrl.c -+++ b/ipq806x/nss_gmac_ctrl.c -@@ -1096,7 +1096,7 @@ static int32_t nss_gmac_do_common_init(s - ctx.msm_clk_ctl_enabled = true; - #endif - -- ctx.nss_base = (uint8_t *)ioremap_nocache(res_nss_base.start, -+ ctx.nss_base = (uint8_t *)ioremap(res_nss_base.start, - resource_size(&res_nss_base)); - if (!ctx.nss_base) { - pr_info("Error mapping NSS GMAC registers\n"); -@@ -1105,7 +1105,7 @@ static int32_t nss_gmac_do_common_init(s - } - pr_debug("%s: NSS base ioremap OK.\n", __func__); - -- ctx.qsgmii_base = (uint32_t *)ioremap_nocache(res_qsgmii_base.start, -+ ctx.qsgmii_base = (uint32_t *)ioremap(res_qsgmii_base.start, - resource_size(&res_qsgmii_base)); - if (!ctx.qsgmii_base) { - pr_info("Error mapping QSGMII registers\n"); -@@ -1115,7 +1115,7 @@ static int32_t nss_gmac_do_common_init(s - pr_debug("%s: QSGMII base ioremap OK, vaddr = 0x%p\n", - __func__, ctx.qsgmii_base); - -- ctx.clk_ctl_base = (uint32_t *)ioremap_nocache(res_clk_ctl_base.start, -+ ctx.clk_ctl_base = (uint32_t *)ioremap(res_clk_ctl_base.start, - resource_size(&res_clk_ctl_base)); - if (!ctx.clk_ctl_base) { - pr_info("Error mapping Clk control registers\n"); diff --git a/qca-nss-gmac/patches/0005-nss-gmac-fix-of_get_phy_mode.patch b/qca-nss-gmac/patches/0005-nss-gmac-fix-of_get_phy_mode.patch deleted file mode 100644 index bcd89cf..0000000 --- a/qca-nss-gmac/patches/0005-nss-gmac-fix-of_get_phy_mode.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- a/ipq806x/nss_gmac_ctrl.c -+++ b/ipq806x/nss_gmac_ctrl.c -@@ -759,6 +759,7 @@ static uint32_t nss_gmac_tstamp_ioctl(st - { - struct hwtstamp_config cfg; - struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); -+ int32_t ret = 0; - - /* - * Return if NSS FW is not up -@@ -767,9 +768,11 @@ static uint32_t nss_gmac_tstamp_ioctl(st - netdev_dbg(netdev, "%s: NSS Firmware is not up. Cannot enable Timestamping \n", __func__); - return -EINVAL; - } -- -- copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)); -- -+ ret = copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg)); -+ if (ret) { -+ netdev_err(netdev, "%s: Unable to copy NSS Firmware into memory \n", __func__); -+ return -EINVAL; -+ } - /* - * Enable Timestamping if not already enabled - */ -@@ -994,6 +997,9 @@ static int32_t nss_gmac_of_get_pdata(str - { - struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); - struct resource memres_devtree = {0}; -+ phy_interface_t phyif = 0; -+ -+ - - if (of_property_read_u32(np, "qcom,id", &gmacdev->macid) - || of_property_read_u32(np, "qcom,phy-mdio-addr", -@@ -1019,7 +1025,7 @@ static int32_t nss_gmac_of_get_pdata(str - - of_property_read_u32(np, "qcom,aux-clk-freq", &gmacdev->aux_clk_freq); - -- gmaccfg->phy_mii_type = of_get_phy_mode(np); -+ gmaccfg->phy_mii_type = of_get_phy_mode(np, &phyif); - netdev->irq = irq_of_parse_and_map(np, 0); - if (netdev->irq == NO_IRQ) { - pr_err("%s: Can't map interrupt\n", np->name); diff --git a/qca-nss-gmac/patches/0006-fix-nss-gmac-tx-timeout.patch b/qca-nss-gmac/patches/0006-fix-nss-gmac-tx-timeout.patch deleted file mode 100644 index 17654c2..0000000 --- a/qca-nss-gmac/patches/0006-fix-nss-gmac-tx-timeout.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/ipq806x/include/nss_gmac_network_interface.h -+++ b/ipq806x/include/nss_gmac_network_interface.h -@@ -41,7 +41,7 @@ int32_t nss_gmac_xmit_frames(struct sk_b - int32_t nss_gmac_close(struct net_device *netdev); - int32_t nss_gmac_open(struct net_device *netdev); - int32_t nss_gmac_change_mtu(struct net_device *netdev, int32_t newmtu); --void nss_gmac_tx_timeout(struct net_device *netdev); -+void nss_gmac_tx_timeout(struct net_device *netdev, unsigned int txqueue); - - /* NSS driver interface APIs */ - void nss_gmac_receive(struct net_device *netdev, struct sk_buff *skb, ---- a/ipq806x/nss_gmac_tx_rx_offload.c -+++ b/ipq806x/nss_gmac_tx_rx_offload.c -@@ -1044,7 +1044,7 @@ int nss_gmac_close(struct net_device *ne - * @param[in] pointer to net_device structure - * @return void. - */ --void nss_gmac_tx_timeout(struct net_device *netdev) -+void nss_gmac_tx_timeout(struct net_device *netdev, unsigned int txqueue) - { - struct nss_gmac_dev *gmacdev = (struct nss_gmac_dev *)netdev_priv(netdev); - BUG_ON(gmacdev == NULL); diff --git a/qca-nss-gmac/patches/0007-work-around-interface-close-warning.patch b/qca-nss-gmac/patches/0007-work-around-interface-close-warning.patch deleted file mode 100644 index 7cb6d6f..0000000 --- a/qca-nss-gmac/patches/0007-work-around-interface-close-warning.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- a/ipq806x/nss_gmac_tx_rx_offload.c -+++ b/ipq806x/nss_gmac_tx_rx_offload.c -@@ -1027,8 +1027,10 @@ int nss_gmac_close(struct net_device *ne - nss_gmac_disable_interrupt_all(gmacdev); - gmacdev->data_plane_ops->link_state(gmacdev->data_plane_ctx, 0); - -- if (!IS_ERR(gmacdev->phydev)) -- phy_stop(gmacdev->phydev); -+ if (!IS_ERR(gmacdev->phydev)) { -+ if (test_bit(__NSS_GMAC_LINKPOLL, &gmacdev->flags)) -+ phy_stop(gmacdev->phydev); -+ } - - clear_bit(__NSS_GMAC_UP, &gmacdev->flags); - clear_bit(__NSS_GMAC_CLOSING, &gmacdev->flags);