From 6754876c3c6534c6f51054fe45baaecbcf66a7fa Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Thu, 16 Jan 2025 23:31:28 +0800 Subject: [PATCH] ipq-package: add linux 6.6 support for nss --- package/qca/qca-nss-clients/Makefile | 3 +- ...5-nss-clients-add-kernel-6.6-support.patch | 274 ++++++++ package/qca/qca-nss-drv/Makefile | 1 + ...6-nss-drv-add-support-for-kernel-6.6.patch | 619 ++++++++++++++++++ package/qca/qca-nss-ecm/Makefile | 2 +- .../0015-ecm-add-support-for-kernel-6.6.patch | 132 ++++ ...ecm-fix-a-memcpy-overflow-in-ecm_db.patch} | 0 7 files changed, 1029 insertions(+), 2 deletions(-) create mode 100644 package/qca/qca-nss-clients/patches/0025-nss-clients-add-kernel-6.6-support.patch create mode 100644 package/qca/qca-nss-drv/patches/0016-nss-drv-add-support-for-kernel-6.6.patch create mode 100644 package/qca/qca-nss-ecm/patches/0015-ecm-add-support-for-kernel-6.6.patch rename package/qca/qca-nss-ecm/patches/{900-qca-nss-ecm-fix-a-memcpy-overflow-in-ecm_db.patch => 0900-qca-nss-ecm-fix-a-memcpy-overflow-in-ecm_db.patch} (100%) diff --git a/package/qca/qca-nss-clients/Makefile b/package/qca/qca-nss-clients/Makefile index 555fd790f..8ff75d72a 100644 --- a/package/qca/qca-nss-clients/Makefile +++ b/package/qca/qca-nss-clients/Makefile @@ -460,7 +460,8 @@ EXTRA_CFLAGS+= \ -I$(STAGING_DIR)/usr/include/qca-nss-ecm \ -I$(STAGING_DIR)/usr/include/qca-ssdk \ -I$(STAGING_DIR)/usr/include/qca-ssdk/fal \ - -I$(STAGING_DIR)/usr/include/nat46 + -I$(STAGING_DIR)/usr/include/nat46 \ + -Wno-error=enum-conversion # Build individual packages if selected ifneq ($(CONFIG_PACKAGE_kmod-qca-nss-drv-tun6rd),) diff --git a/package/qca/qca-nss-clients/patches/0025-nss-clients-add-kernel-6.6-support.patch b/package/qca/qca-nss-clients/patches/0025-nss-clients-add-kernel-6.6-support.patch new file mode 100644 index 000000000..2d4bd0a73 --- /dev/null +++ b/package/qca/qca-nss-clients/patches/0025-nss-clients-add-kernel-6.6-support.patch @@ -0,0 +1,274 @@ +--- a/bridge/nss_bridge_mgr.c ++++ b/bridge/nss_bridge_mgr.c +@@ -1369,7 +1369,6 @@ static struct notifier_block nss_bridge_ + .notifier_call = nss_bridge_mgr_netdevice_event, + }; + +-#if defined(NSS_BRIDGE_MGR_PPE_SUPPORT) + /* + * nss_bridge_mgr_is_physical_dev() + * Check if the device is on physical device. +@@ -1598,25 +1597,6 @@ static struct ctl_table nss_bridge_mgr_t + { } + }; + +-static struct ctl_table nss_bridge_mgr_dir[] = { +- { +- .procname = "bridge_mgr", +- .mode = 0555, +- .child = nss_bridge_mgr_table, +- }, +- { } +-}; +- +-static struct ctl_table nss_bridge_mgr_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_bridge_mgr_dir, +- }, +- { } +-}; +-#endif +- + /* + * nss_bridge_mgr_init_module() + * bridge_mgr module init function +@@ -1636,7 +1616,7 @@ int __init nss_bridge_mgr_init_module(vo + #if defined(NSS_BRIDGE_MGR_PPE_SUPPORT) + br_mgr_ctx.wan_if_num = -1; + br_fdb_update_register_notify(&nss_bridge_mgr_fdb_update_notifier); +- br_mgr_ctx.nss_bridge_mgr_header = register_sysctl_table(nss_bridge_mgr_root_dir); ++ br_mgr_ctx.nss_bridge_mgr_header = register_sysctl("nss/bridge_mgr", nss_bridge_mgr_table); + + /* + * Enable ACL rule to enable L2 exception. This is needed if PPE Virtual ports is added to bridge. +--- a/gre/nss_connmgr_gre.c ++++ b/gre/nss_connmgr_gre.c +@@ -277,7 +277,7 @@ static struct rtnl_link_stats64 *nss_con + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)) + start = u64_stats_fetch_begin_bh(&tstats->syncp); + #else +- start = u64_stats_fetch_begin_irq(&tstats->syncp); ++ start = u64_stats_fetch_begin(&tstats->syncp); + #endif + rx_packets = u64_stats_read(&tstats->rx_packets); + tx_packets = u64_stats_read(&tstats->tx_packets); +@@ -286,7 +286,7 @@ static struct rtnl_link_stats64 *nss_con + #if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)) + } while (u64_stats_fetch_retry_bh(&tstats->syncp, start)); + #else +- } while (u64_stats_fetch_retry_irq(&tstats->syncp, start)); ++ } while (u64_stats_fetch_retry(&tstats->syncp, start)); + #endif + + tot->rx_packets += rx_packets; +--- a/vlan/nss_vlan_mgr.c ++++ b/vlan/nss_vlan_mgr.c +@@ -1582,30 +1582,6 @@ static struct ctl_table nss_vlan_table[] + }; + + /* +- * nss_vlan sysctl dir +- */ +-static struct ctl_table nss_vlan_dir[] = { +- { +- .procname = "vlan_client", +- .mode = 0555, +- .child = nss_vlan_table, +- }, +- { } +-}; +- +-/* +- * nss_vlan systel root dir +- */ +-static struct ctl_table nss_vlan_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_vlan_dir, +- }, +- { } +-}; +- +-/* + * nss_vlan_mgr_add_bond_slave() + * Add new slave port to bond_vlan + */ +@@ -1944,7 +1920,7 @@ int __init nss_vlan_mgr_init_module(void + vlan_mgr_ctx.stpid = ETH_P_8021Q; + + #ifdef NSS_VLAN_MGR_PPE_SUPPORT +- vlan_mgr_ctx.sys_hdr = register_sysctl_table(nss_vlan_root_dir); ++ vlan_mgr_ctx.sys_hdr = register_sysctl("nss/vlan_client", nss_vlan_table); + if (!vlan_mgr_ctx.sys_hdr) { + nss_vlan_mgr_warn("Unabled to register sysctl table for vlan manager\n"); + return -EFAULT; +--- a/match/nss_match_cmd.c ++++ b/match/nss_match_cmd.c +@@ -692,33 +692,6 @@ static struct ctl_table nss_match_table[ + { } + }; + +-static struct ctl_table nss_match_root_dir[] = { +- { +- .procname = "match", +- .mode = 0555, +- .child = nss_match_table, +- }, +- { } +-}; +- +-static struct ctl_table nss_match_nss_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_match_root_dir, +- }, +- { } +-}; +- +-static struct ctl_table nss_match_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_match_nss_root_dir, +- }, +- { } +-}; +- + static struct ctl_table_header *nss_match_ctl_header; + + /* +@@ -726,7 +699,7 @@ static struct ctl_table_header *nss_matc + * Register command line interface for match. + */ + bool nss_match_ctl_register(void) { +- nss_match_ctl_header = register_sysctl_table(nss_match_root); ++ nss_match_ctl_header = register_sysctl("dev/nss/match", nss_match_table); + if (!nss_match_ctl_header) { + nss_match_warn("Unable to register command line interface.\n"); + return false; +--- a/tunipip6/nss_connmgr_tunipip6_sysctl.c ++++ b/tunipip6/nss_connmgr_tunipip6_sysctl.c +@@ -449,33 +449,6 @@ static struct ctl_table nss_tunipip6_tab + { } + }; + +-static struct ctl_table nss_tunipip6_root_dir[] = { +- { +- .procname = "ipip6", +- .mode = 0555, +- .child = nss_tunipip6_table, +- }, +- { } +-}; +- +-static struct ctl_table nss_tunipip6_nss_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_tunipip6_root_dir, +- }, +- { } +-}; +- +-static struct ctl_table nss_tunipip6_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_tunipip6_nss_root_dir, +- }, +- { } +-}; +- + static struct ctl_table_header *nss_tunipip6_ctl_header; + + /* +@@ -483,7 +456,7 @@ static struct ctl_table_header *nss_tuni + * Register command line interface for tunipip6. + */ + bool nss_tunipip6_sysctl_register(void) { +- nss_tunipip6_ctl_header = register_sysctl_table(nss_tunipip6_root); ++ nss_tunipip6_ctl_header = register_sysctl("drv/nss/ipip6", nss_tunipip6_table); + if (!nss_tunipip6_ctl_header) { + return false; + } +--- a/mirror/nss_mirror_ctl.c ++++ b/mirror/nss_mirror_ctl.c +@@ -919,48 +919,12 @@ static struct ctl_table nss_mirror_table + }; + + /* +- * nss mirror dir +- */ +-static struct ctl_table nss_mirror_root_dir[] = { +- { +- .procname = "mirror", +- .mode = 0555, +- .child = nss_mirror_table, +- }, +- { } +-}; +- +-/* +- * nss mirror sysctl nss root dir +- */ +-static struct ctl_table nss_mirror_nss_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_mirror_root_dir, +- }, +- { } +-}; +- +-/* +- * nss mirror sysctl root dir +- */ +-static struct ctl_table nss_mirror_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_mirror_nss_root_dir, +- }, +- { } +-}; +- +-/* + * nss_mirror_ctl_register() + * Register command line interface for mirror. + */ + int nss_mirror_ctl_register(void) + { +- nss_mirror_ctl_header = register_sysctl_table(nss_mirror_root); ++ nss_mirror_ctl_header = register_sysctl("dev/nss/mirror", nss_mirror_table); + if (!nss_mirror_ctl_header) { + nss_mirror_warn("Creating sysctl directory table header for mirror failed\n"); + return -1; +--- a/l2tp/l2tpv2/nss_connmgr_l2tpv2.c ++++ b/l2tp/l2tpv2/nss_connmgr_l2tpv2.c +@@ -1030,7 +1030,7 @@ int __init nss_connmgr_l2tpv2_init_modul + } + #endif + #if defined(NSS_L2TP_IPSEC_BIND_BY_NETDEV) +- ctl_tbl_hdr = register_sysctl_table(nss_connmgr_l2tpv2_sysroot); ++ ctl_tbl_hdr = register_sysctl("dev/nss/l2tpv2", nss_connmgr_l2tpv2_table); + if (!ctl_tbl_hdr) { + nss_connmgr_l2tpv2_info("Unable to register sysctl table for L2TP conn mgr\n"); + return -EFAULT; +--- a/netlink/nss_nl.c ++++ b/netlink/nss_nl.c +@@ -475,7 +475,11 @@ struct nss_nlcmn *nss_nl_get_msg(struct + /* + * validate the common message header version & magic + */ ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)) + cm = info->userhdr; ++#else ++ cm = genl_info_userhdr(info); ++#endif + if (nss_nlcmn_chk_ver(cm, family->version) == false) { + nss_nl_error("%d, %s: version mismatch (%d)\n", pid, family->name, cm->version); + return NULL; diff --git a/package/qca/qca-nss-drv/Makefile b/package/qca/qca-nss-drv/Makefile index 9aabffaf8..c2089a3b4 100644 --- a/package/qca/qca-nss-drv/Makefile +++ b/package/qca/qca-nss-drv/Makefile @@ -120,6 +120,7 @@ EXTRA_CFLAGS+= -I$(STAGING_DIR)/usr/include/qca-nss-gmac \ -I$(STAGING_DIR)/usr/include/qca-nss-dp \ -I$(STAGING_DIR)/usr/include/qca-ssdk \ -Wno-unused-variable \ + -Wno-error=enum-conversion \ -Wno-error=unused-function ifeq ($(BOARD),qualcommax) diff --git a/package/qca/qca-nss-drv/patches/0016-nss-drv-add-support-for-kernel-6.6.patch b/package/qca/qca-nss-drv/patches/0016-nss-drv-add-support-for-kernel-6.6.patch new file mode 100644 index 000000000..53b0314ae --- /dev/null +++ b/package/qca/qca-nss-drv/patches/0016-nss-drv-add-support-for-kernel-6.6.patch @@ -0,0 +1,619 @@ +--- a/nss_core.c ++++ b/nss_core.c +@@ -65,7 +65,7 @@ + (((LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)))) || \ + (((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \ + (((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)))) || \ +-(((LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)))))) ++(((LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)))))) + #error "Check skb recycle code in this file to match Linux version" + #endif + +--- a/nss_dynamic_interface.c ++++ b/nss_dynamic_interface.c +@@ -226,7 +226,7 @@ int nss_dynamic_interface_alloc_node(enu + core_id = nss_top_main.dynamic_interface_table[type]; + nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[core_id]; + di_data.if_num = -1; +- di_data.response = false; ++ di_data.response = -1; + init_completion(&di_data.complete); + + nss_dynamic_interface_msg_init(&ndim, NSS_DYNAMIC_INTERFACE, NSS_DYNAMIC_INTERFACE_ALLOC_NODE, +@@ -285,7 +285,7 @@ nss_tx_status_t nss_dynamic_interface_de + + core_id = nss_top_main.dynamic_interface_table[type]; + nss_ctx = (struct nss_ctx_instance *)&nss_top_main.nss[core_id]; +- di_data.response = false; ++ di_data.response = -1; + init_completion(&di_data.complete); + + if (nss_is_dynamic_interface(if_num) == false) { +--- a/nss_init.c ++++ b/nss_init.c +@@ -592,48 +592,12 @@ static struct ctl_table nss_general_tabl + { } + }; + +-static struct ctl_table nss_init_dir[] = { +-#if (NSS_FREQ_SCALE_SUPPORT == 1) +- { +- .procname = "clock", +- .mode = 0555, +- .child = nss_freq_table, +- }, +-#endif +- { +- .procname = "general", +- .mode = 0555, +- .child = nss_general_table, +- }, +-#if (NSS_SKB_REUSE_SUPPORT == 1) +- { +- .procname = "skb_reuse", +- .mode = 0555, +- .child = nss_skb_reuse_table, +- }, +-#endif +- { } +-}; +- +-static struct ctl_table nss_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_init_dir, +- }, +- { } +-}; +- +-static struct ctl_table nss_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_root_dir, +- }, +- { } +-}; +- +-static struct ctl_table_header *nss_dev_header; ++static struct ctl_table_header *nss_clock_header; ++static struct ctl_table_header *nss_skb_header; ++static struct ctl_table_header *nss_general_header; ++static struct ctl_table *nss_clock_table; ++static struct ctl_table *nss_skb_reuse_tabl; ++static struct ctl_table *nss_general_tabl; + + /* + * nss_init() +@@ -785,7 +749,16 @@ nss_info("Init NSS driver"); + /* + * Register sysctl table. + */ +- nss_dev_header = register_sysctl_table(nss_root); ++ // to avoid multiple calls to `register_sysctl_table` ++ nss_general_header = register_sysctl("dev/nss/general", nss_general_table); ++ ++#if (NSS_SKB_REUSE_SUPPORT == 1) ++ nss_skb_header = register_sysctl("dev/nss/skb_reuse", nss_skb_reuse_table); ++#endif ++ ++#if (NSS_FREQ_SCALE_SUPPORT == 1) ++ nss_clock_header = register_sysctl("dev/nss/clock", nss_freq_table); ++#endif + + /* + * Registering sysctl for ipv4/6 specific config. +@@ -948,8 +921,18 @@ static void __exit nss_cleanup(void) + { + nss_info("Exit NSS driver"); + +- if (nss_dev_header) +- unregister_sysctl_table(nss_dev_header); ++ if (nss_general_header) ++ unregister_sysctl_table(nss_general_header); ++ ++#if (NSS_SKB_REUSE_SUPPORT == 1) ++ if (nss_skb_header) ++ unregister_sysctl_table(nss_skb_header); ++#endif ++ ++#if (NSS_FREQ_SCALE_SUPPORT == 1) ++ if (nss_clock_header) ++ unregister_sysctl_table(nss_clock_header); ++#endif + + /* + * Unregister n2h specific sysctl +--- a/nss_project.c ++++ b/nss_project.c +@@ -333,33 +333,6 @@ static struct ctl_table nss_project_tabl + { } + }; + +-static struct ctl_table nss_project_dir[] = { +- { +- .procname = "project", +- .mode = 0555, +- .child = nss_project_table, +- }, +- { } +-}; +- +-static struct ctl_table nss_project_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_project_dir, +- }, +- { } +-}; +- +-static struct ctl_table nss_project_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_project_root_dir, +- }, +- { } +-}; +- + static struct ctl_table_header *nss_project_header; + + /* +@@ -368,7 +341,7 @@ static struct ctl_table_header *nss_proj + */ + void nss_project_register_sysctl(void) + { +- nss_project_header = register_sysctl_table(nss_project_root); ++ nss_project_header = register_sysctl("dev/nss/project", nss_project_table); + } + + /* +--- a/nss_n2h.c ++++ b/nss_n2h.c +@@ -1904,36 +1904,6 @@ static struct ctl_table nss_n2h_table_mu + { } + }; + +-/* +- * This table will be overwritten during single-core registration +- */ +-static struct ctl_table nss_n2h_dir[] = { +- { +- .procname = "n2hcfg", +- .mode = 0555, +- .child = nss_n2h_table_multi_core, +- }, +- { } +-}; +- +-static struct ctl_table nss_n2h_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_n2h_dir, +- }, +- { } +-}; +- +-static struct ctl_table nss_n2h_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_n2h_root_dir, +- }, +- { } +-}; +- + static struct ctl_table_header *nss_n2h_header; + + /* +@@ -2282,8 +2252,7 @@ void nss_n2h_single_core_register_sysctl + /* + * Register sysctl table. + */ +- nss_n2h_dir[0].child = nss_n2h_table_single_core; +- nss_n2h_header = register_sysctl_table(nss_n2h_root); ++ nss_n2h_header = register_sysctl("dev/nss/n2hcfg", nss_n2h_table_single_core); + } + + /* +@@ -2381,7 +2350,7 @@ void nss_n2h_multi_core_register_sysctl( + /* + * Register sysctl table. + */ +- nss_n2h_header = register_sysctl_table(nss_n2h_root); ++ nss_n2h_header = register_sysctl("dev/nss/n2hcfg", nss_n2h_table_multi_core); + } + + /* +--- a/nss_ppe_vp.c ++++ b/nss_ppe_vp.c +@@ -783,24 +783,6 @@ static struct ctl_table nss_ppe_vp_table + { } + }; + +-static struct ctl_table nss_ppe_vp_dir[] = { +- { +- .procname = "ppe_vp", +- .mode = 0555, +- .child = nss_ppe_vp_table, +- }, +- { } +-}; +- +-static struct ctl_table nss_ppe_vp_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_ppe_vp_dir, +- }, +- { } +-}; +- + static struct ctl_table_header *nss_ppe_vp_procfs_header; + + /* +@@ -812,7 +794,7 @@ void nss_ppe_vp_procfs_register(void) + /* + * Register sysctl table. + */ +- nss_ppe_vp_procfs_header = register_sysctl_table(nss_ppe_vp_root_dir); ++ nss_ppe_vp_procfs_header = register_sysctl("dev/nss/ppe_vp", nss_ppe_vp_table); + } + + /* +--- a/nss_pppoe.c ++++ b/nss_pppoe.c +@@ -353,33 +353,6 @@ static struct ctl_table nss_pppoe_table[ + { } + }; + +-static struct ctl_table nss_pppoe_dir[] = { +- { +- .procname = "pppoe", +- .mode = 0555, +- .child = nss_pppoe_table, +- }, +- { } +-}; +- +-static struct ctl_table nss_pppoe_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_pppoe_dir, +- }, +- { } +-}; +- +-static struct ctl_table nss_pppoe_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_pppoe_root_dir, +- }, +- { } +-}; +- + static struct ctl_table_header *nss_pppoe_header; + + /* +@@ -391,7 +364,7 @@ void nss_pppoe_register_sysctl(void) + /* + * Register sysctl table. + */ +- nss_pppoe_header = register_sysctl_table(nss_pppoe_root); ++ nss_pppoe_header = register_sysctl("dev/nss/pppoe", nss_pppoe_table); + } + + /* +--- a/nss_rps.c ++++ b/nss_rps.c +@@ -577,33 +577,6 @@ static struct ctl_table nss_rps_table[] + { } + }; + +-static struct ctl_table nss_rps_dir[] = { +- { +- .procname = "rps", +- .mode = 0555, +- .child = nss_rps_table, +- }, +- { } +-}; +- +-static struct ctl_table nss_rps_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_rps_dir, +- }, +- { } +-}; +- +-static struct ctl_table nss_rps_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_rps_root_dir, +- }, +- { } +-}; +- + static struct ctl_table_header *nss_rps_header; + + /* +@@ -640,7 +613,7 @@ void nss_rps_register_sysctl(void) + /* + * Register sysctl table. + */ +- nss_rps_header = register_sysctl_table(nss_rps_root); ++ nss_rps_header = register_sysctl("dev/nss/rps", nss_rps_table); + } + + /* +--- a/nss_stats.c ++++ b/nss_stats.c +@@ -88,32 +88,6 @@ static struct ctl_table nss_stats_table[ + { } + }; + +-static struct ctl_table nss_stats_dir[] = { +- { +- .procname = "stats", +- .mode = 0555, +- .child = nss_stats_table, +- }, +- { } +-}; +- +-static struct ctl_table nss_stats_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_stats_dir, +- }, +- { } +-}; +- +-static struct ctl_table nss_stats_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_stats_root_dir, +- }, +- { } +-}; + static struct ctl_table_header *nss_stats_header; + + /* +@@ -125,7 +99,7 @@ void nss_stats_register_sysctl(void) + /* + * Register sysctl table. + */ +- nss_stats_header = register_sysctl_table(nss_stats_root); ++ nss_stats_header = register_sysctl("dev/nss/stats", nss_stats_table); + } + + /* +--- a/nss_c2c_tx.c ++++ b/nss_c2c_tx.c +@@ -334,33 +334,6 @@ static struct ctl_table nss_c2c_tx_table + { } + }; + +-static struct ctl_table nss_c2c_tx_dir[] = { +- { +- .procname = "c2c_tx", +- .mode = 0555, +- .child = nss_c2c_tx_table, +- }, +- { } +-}; +- +-static struct ctl_table nss_c2c_tx_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_c2c_tx_dir, +- }, +- { } +-}; +- +-static struct ctl_table nss_c2c_tx_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_c2c_tx_root_dir, +- }, +- { } +-}; +- + static struct ctl_table_header *nss_c2c_tx_header; + + /* +@@ -378,7 +351,7 @@ void nss_c2c_tx_register_sysctl(void) + /* + * Register sysctl table. + */ +- nss_c2c_tx_header = register_sysctl_table(nss_c2c_tx_root); ++ nss_c2c_tx_header = register_sysctl("dev/nss/c2c_tx", nss_c2c_tx_table); + } + + /* +--- a/nss_dma.c ++++ b/nss_dma.c +@@ -378,33 +378,6 @@ static struct ctl_table nss_dma_table[] + { } + }; + +-static struct ctl_table nss_dma_dir[] = { +- { +- .procname = "dma", +- .mode = 0555, +- .child = nss_dma_table, +- }, +- { } +-}; +- +-static struct ctl_table nss_dma_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_dma_dir, +- }, +- { } +-}; +- +-static struct ctl_table nss_dma_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_dma_root_dir, +- }, +- { } +-}; +- + static struct ctl_table_header *nss_dma_header; + + /* +@@ -422,7 +395,7 @@ void nss_dma_register_sysctl(void) + /* + * Register sysctl table. + */ +- nss_dma_header = register_sysctl_table(nss_dma_root); ++ nss_dma_header = register_sysctl("dev/nss/dma", nss_dma_table); + } + + /* +--- a/nss_ipv4.c ++++ b/nss_ipv4.c +@@ -712,33 +712,6 @@ static struct ctl_table nss_ipv4_table[] + { } + }; + +-static struct ctl_table nss_ipv4_dir[] = { +- { +- .procname = "ipv4cfg", +- .mode = 0555, +- .child = nss_ipv4_table, +- }, +- { } +-}; +- +-static struct ctl_table nss_ipv4_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_ipv4_dir, +- }, +- { } +-}; +- +-static struct ctl_table nss_ipv4_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_ipv4_root_dir, +- }, +- { } +-}; +- + static struct ctl_table_header *nss_ipv4_header; + + /* +@@ -753,7 +726,7 @@ void nss_ipv4_register_sysctl(void) + /* + * Register sysctl table. + */ +- nss_ipv4_header = register_sysctl_table(nss_ipv4_root); ++ nss_ipv4_header = register_sysctl("dev/nss/ipv4cfg", nss_ipv4_table); + } + + /* +--- a/nss_ipv6.c ++++ b/nss_ipv6.c +@@ -18,6 +18,7 @@ + * nss_ipv6.c + * NSS IPv6 APIs + */ ++#include "linux/ipv6.h" + #include + #include "nss_dscp_map.h" + #include "nss_ipv6_stats.h" +@@ -377,7 +378,7 @@ EXPORT_SYMBOL(nss_ipv6_get_mgr); + * nss_ipv6_register_handler() + * Register our handler to receive messages for this interface + */ +-void nss_ipv6_register_handler() ++void nss_ipv6_register_handler(void) + { + struct nss_ctx_instance *nss_ctx = nss_ipv6_get_mgr(); + +@@ -706,33 +707,6 @@ static struct ctl_table nss_ipv6_table[] + { } + }; + +-static struct ctl_table nss_ipv6_dir[] = { +- { +- .procname = "ipv6cfg", +- .mode = 0555, +- .child = nss_ipv6_table, +- }, +- { } +-}; +- +-static struct ctl_table nss_ipv6_root_dir[] = { +- { +- .procname = "nss", +- .mode = 0555, +- .child = nss_ipv6_dir, +- }, +- { } +-}; +- +-static struct ctl_table nss_ipv6_root[] = { +- { +- .procname = "dev", +- .mode = 0555, +- .child = nss_ipv6_root_dir, +- }, +- { } +-}; +- + static struct ctl_table_header *nss_ipv6_header; + + /* +@@ -747,7 +721,7 @@ void nss_ipv6_register_sysctl(void) + /* + * Register sysctl table. + */ +- nss_ipv6_header = register_sysctl_table(nss_ipv6_root); ++ nss_ipv6_header = register_sysctl("dev/nss/ipv6cfg", nss_ipv6_table); + } + + /* +--- a/nss_pm.c ++++ b/nss_pm.c +@@ -323,6 +323,7 @@ error: + nss_pm_interface_status_t nss_pm_set_perf_level(void *handle, nss_pm_perf_level_t lvl) + { + #if ((NSS_DT_SUPPORT == 1) && (NSS_FREQ_SCALE_SUPPORT == 1)) ++#if !defined(NSS_HAL_IPQ807x_SUPPORT) + nss_freq_scales_t index; + + switch (lvl) { +@@ -335,10 +336,9 @@ nss_pm_interface_status_t nss_pm_set_per + break; + + default: +- index = NSS_PM_PERF_LEVEL_IDLE; ++ index = (nss_freq_scales_t)NSS_PM_PERF_LEVEL_IDLE; + } + +-#if !defined(NSS_HAL_IPQ807x_SUPPORT) + nss_freq_sched_change(index, false); + #endif + diff --git a/package/qca/qca-nss-ecm/Makefile b/package/qca/qca-nss-ecm/Makefile index c5de42d92..b35ced350 100644 --- a/package/qca/qca-nss-ecm/Makefile +++ b/package/qca/qca-nss-ecm/Makefile @@ -152,7 +152,7 @@ define Build/Compile ARCH="$(LINUX_KARCH)" \ $(KERNEL_MAKE_FLAGS) \ M="$(PKG_BUILD_DIR)" \ - EXTRA_CFLAGS="$(EXTRA_CFLAGS) -Wno-error=unused-function " \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS) -Wno-error=unused-function -Wno-unused-variable " \ SoC=$(SOC) \ $(PKG_JOBS) \ modules diff --git a/package/qca/qca-nss-ecm/patches/0015-ecm-add-support-for-kernel-6.6.patch b/package/qca/qca-nss-ecm/patches/0015-ecm-add-support-for-kernel-6.6.patch new file mode 100644 index 000000000..5fa4381c0 --- /dev/null +++ b/package/qca/qca-nss-ecm/patches/0015-ecm-add-support-for-kernel-6.6.patch @@ -0,0 +1,132 @@ +--- a/frontends/nss/ecm_nss_common.h ++++ b/frontends/nss/ecm_nss_common.h +@@ -277,8 +277,10 @@ static inline bool ecm_nss_common_igs_ac + */ + #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)) + if (likely(!(to_dev->ingress_cl_list))) { +-#else ++#elif (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)) + if (likely(!(to_dev->miniq_ingress))) { ++#else ++ if (likely(!(to_dev->tcx_ingress))) { + #endif + dev_put(to_dev); + continue; +--- a/frontends/ecm_front_end_common.c ++++ b/frontends/ecm_front_end_common.c +@@ -36,6 +36,9 @@ + #include + #include + #include ++#if (LINUX_VERSION_CODE > KERNEL_VERSION(6, 6, 0)) ++#include ++#endif + #include + #include + #ifdef ECM_FRONT_END_PPE_ENABLE +@@ -1169,7 +1173,9 @@ + { + .procname = "ecm", + .mode = 0555, ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)) + .child = ecm_front_end_sysctl_tbl, ++#endif + }, + { } + }; +@@ -1178,7 +1184,9 @@ + { + .procname = "net", + .mode = 0555, ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)) + .child = ecm_front_end_common_root, ++#endif + }, + { } + }; +@@ -1192,7 +1200,7 @@ + /* + * Register sysctl table. + */ +- ecm_front_end_ctl_tbl_hdr = register_sysctl_table(ecm_front_end_common_root_dir); ++ ecm_front_end_ctl_tbl_hdr = register_sysctl("net/ecm", ecm_front_end_sysctl_tbl); + #ifdef ECM_FRONT_END_SFE_ENABLE + if (ecm_front_end_ctl_tbl_hdr) { + ecm_sfe_sysctl_tbl_init(); +@@ -1712,7 +1720,12 @@ + } + + BUG_ON(!rcu_read_lock_bh_held()); ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)) + miniq = rcu_dereference_bh(dev->miniq_ingress); ++#else ++ struct bpf_mprog_entry *entry = rcu_dereference_bh(dev->tcx_ingress); ++ miniq = entry ? tcx_entry(entry)->miniq : NULL; ++#endif + if (miniq) { + DEBUG_INFO("Ingress Qdisc is present for device[%s]\n", dev->name); + dev_put(dev); +@@ -1767,7 +1780,12 @@ + } + + #if defined(CONFIG_NET_CLS_ACT) && defined(CONFIG_NET_EGRESS) ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0)) + miniq = rcu_dereference_bh(dev->miniq_egress); ++#else ++ struct bpf_mprog_entry *entry = rcu_dereference_bh(dev->tcx_egress); ++ miniq = entry ? tcx_entry(entry)->miniq : NULL; ++#endif + if (miniq) { + DEBUG_INFO("Egress needed\n"); + dev_put(dev); +--- a/ecm_interface.c ++++ b/ecm_interface.c +@@ -341,7 +341,8 @@ + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)) + dev = (struct net_device *)ipv6_dev_find_and_hold(&init_net, &addr6, 1); + #else +- dev = (struct net_device *)ipv6_dev_find_and_hold(&init_net, &addr6, 1); ++ dev = (struct net_device *)ipv6_dev_find(&init_net, &addr6, NULL); ++ dev_hold(dev); + #endif + return dev; + } +@@ -804,7 +805,8 @@ + #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)) + local_dev = ipv6_dev_find_and_hold(&init_net, &daddr, 1); + #else +- local_dev = ipv6_dev_find_and_hold(&init_net, &daddr, 1); ++ local_dev = ipv6_dev_find(&init_net, &daddr, NULL); ++ dev_hold(local_dev); + #endif + if (local_dev) { + DEBUG_TRACE("%pi6 is a local address\n", &daddr); +@@ -8276,7 +8278,9 @@ + { + .procname = "ecm", + .mode = 0555, ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)) + .child = ecm_interface_table, ++#endif + }, + { } + }; +@@ -8285,7 +8289,9 @@ + { + .procname = "net", + .mode = 0555, ++#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0)) + .child = ecm_interface_root_dir, ++#endif + }, + { } + }; +@@ -8786,7 +8792,7 @@ + /* + * Register sysctl table. + */ +- ecm_interface_ctl_table_header = register_sysctl_table(ecm_interface_root); ++ ecm_interface_ctl_table_header = register_sysctl("net/ecm", ecm_interface_table); + + result = register_netdevice_notifier(&ecm_interface_netdev_notifier); + if (result != 0) { diff --git a/package/qca/qca-nss-ecm/patches/900-qca-nss-ecm-fix-a-memcpy-overflow-in-ecm_db.patch b/package/qca/qca-nss-ecm/patches/0900-qca-nss-ecm-fix-a-memcpy-overflow-in-ecm_db.patch similarity index 100% rename from package/qca/qca-nss-ecm/patches/900-qca-nss-ecm-fix-a-memcpy-overflow-in-ecm_db.patch rename to package/qca/qca-nss-ecm/patches/0900-qca-nss-ecm-fix-a-memcpy-overflow-in-ecm_db.patch