nss-packages-LiBwrt/qca-nss-drv/patches-11.4/0016-nss-drv-add-support-for-kernel-6.6.patch
2025-11-04 13:19:44 +08:00

825 lines
18 KiB
Diff

--- a/nss_core.c
+++ b/nss_core.c
@@ -57,7 +57,7 @@
(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0)))) || \
(((LINUX_VERSION_CODE >= KERNEL_VERSION(5, 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, 14, 0))))))
#error "Check skb recycle code in this file to match Linux version"
#endif
@@ -1063,13 +1063,18 @@ static inline void nss_core_rx_pbuf(stru
*/
static inline void nss_core_set_skb_classify(struct sk_buff *nbuf)
{
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
#ifdef CONFIG_NET_CLS_ACT
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
- nbuf->tc_verd = SET_TC_NCLS_NSS(nbuf->tc_verd);
+ nbuf->tc_verd = SET_TC_NCLS_NSS(nbuf->tc_verd);
#else
- skb_set_tc_classify_offload(nbuf);
+ skb_set_tc_classify_offload(nbuf);
#endif
#endif
+#else
+ nss_warning("%px:API not supported on 6.6\n", nbuf);
+ nss_assert(0);
+#endif
}
/*
@@ -2609,6 +2614,16 @@ static inline bool nss_core_skb_can_reus
return false;
#endif
+ /*
+ * TODO: This check is only validated on kernel 6.6
+ * This needs to be validated on prior linux
+ * kernel versions.
+ */
+#ifdef CONFIG_SKB_EXTENSIONS
+ if (nbuf->active_extensions)
+ return false;
+#endif
+
return true;
}
--- 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 = NSS_CMN_RESPONSE_ACK;
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 = NSS_CMN_RESPONSE_ACK;
init_completion(&di_data.complete);
if (nss_is_dynamic_interface(if_num) == false) {
--- a/nss_init.c
+++ b/nss_init.c
@@ -584,48 +584,9 @@ 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;
/*
* nss_init()
@@ -748,7 +709,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.
@@ -911,8 +881,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
@@ -279,33 +279,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;
/*
@@ -314,7 +287,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
@@ -1155,11 +1155,11 @@ static nss_tx_status_t nss_n2h_mitigatio
}
up(&nss_n2h_mitigationcp[core_num].sem);
- return NSS_SUCCESS;
+ return NSS_TX_SUCCESS;
failure:
up(&nss_n2h_mitigationcp[core_num].sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
static inline void nss_n2h_buf_pool_free(struct nss_n2h_buf_pool *buf_pool)
@@ -1240,10 +1240,10 @@ static nss_tx_status_t nss_n2h_buf_pool_
up(&nss_n2h_bufcp[core_num].sem);
} while(num_pages);
- return NSS_SUCCESS;
+ return NSS_TX_SUCCESS;
failure:
up(&nss_n2h_bufcp[core_num].sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
/*
@@ -1542,7 +1542,7 @@ static nss_tx_status_t nss_n2h_host_bp_c
if (nss_tx_status != NSS_TX_SUCCESS) {
nss_warning("%px: nss_tx error setting back pressure\n", nss_ctx);
up(&nss_n2h_host_bp_cfg_pvt.sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
/*
@@ -1552,7 +1552,7 @@ static nss_tx_status_t nss_n2h_host_bp_c
if (ret == 0) {
nss_warning("%px: Waiting for ack timed out\n", nss_ctx);
up(&nss_n2h_host_bp_cfg_pvt.sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
/*
@@ -1560,11 +1560,11 @@ static nss_tx_status_t nss_n2h_host_bp_c
*/
if (nss_n2h_host_bp_cfg_pvt.response == NSS_FAILURE) {
up(&nss_n2h_host_bp_cfg_pvt.sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
up(&nss_n2h_host_bp_cfg_pvt.sem);
- return NSS_SUCCESS;
+ return NSS_TX_SUCCESS;
}
/*
@@ -1859,38 +1859,9 @@ 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;
+
/*
* nss_n2h_cfg_empty_pool_size()
* Config empty buffer pool
@@ -2130,8 +2101,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);
}
/*
@@ -2229,7 +2199,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
@@ -251,7 +251,7 @@ static nss_tx_status_t nss_rps_cfg(struc
nss_warning("%px: nss_tx error setting rps\n", nss_ctx);
up(&nss_rps_cfg_pvt.sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
/*
@@ -261,7 +261,7 @@ static nss_tx_status_t nss_rps_cfg(struc
if (ret == 0) {
nss_warning("%px: Waiting for ack timed out\n", nss_ctx);
up(&nss_rps_cfg_pvt.sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
/*
@@ -271,11 +271,11 @@ static nss_tx_status_t nss_rps_cfg(struc
*/
if (NSS_FAILURE == nss_rps_cfg_pvt.response) {
up(&nss_rps_cfg_pvt.sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
up(&nss_rps_cfg_pvt.sem);
- return NSS_SUCCESS;
+ return NSS_TX_SUCCESS;
}
#ifdef NSS_DRV_IPV4_ENABLE
@@ -301,11 +301,11 @@ static nss_tx_status_t nss_rps_ipv4_hash
nss_warning("%px: nss_tx error setting rps\n", nss_ctx);
up(&nss_rps_cfg_pvt.sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
up(&nss_rps_cfg_pvt.sem);
- return NSS_SUCCESS;
+ return NSS_TX_SUCCESS;
}
#endif
@@ -332,11 +332,11 @@ static nss_tx_status_t nss_rps_ipv6_hash
nss_warning("%px: nss_tx error setting rps\n", nss_ctx);
up(&nss_rps_cfg_pvt.sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
up(&nss_rps_cfg_pvt.sem);
- return NSS_SUCCESS;
+ return NSS_TX_SUCCESS;
}
#endif
@@ -372,7 +372,7 @@ static nss_tx_status_t nss_rps_pri_map_c
nss_warning("%px: nss_tx error setting rps\n", nss_ctx);
up(&nss_rps_cfg_pvt.sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
/*
@@ -382,7 +382,7 @@ static nss_tx_status_t nss_rps_pri_map_c
if (ret == 0) {
nss_warning("%px: Waiting for ack timed out\n", nss_ctx);
up(&nss_rps_cfg_pvt.sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
/*
@@ -392,11 +392,11 @@ static nss_tx_status_t nss_rps_pri_map_c
*/
if (NSS_FAILURE == nss_rps_cfg_pvt.response) {
up(&nss_rps_cfg_pvt.sem);
- return NSS_FAILURE;
+ return NSS_TX_FAILURE;
}
up(&nss_rps_cfg_pvt.sem);
- return NSS_SUCCESS;
+ return NSS_TX_SUCCESS;
}
/*
@@ -574,33 +574,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;
/*
@@ -637,7 +610,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 <nss_core.h>
#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_MID_SCALE;
}
-#if !defined(NSS_HAL_IPQ807x_SUPPORT)
nss_freq_sched_change(index, false);
#endif
--- a/nss_coredump.c
+++ b/nss_coredump.c
@@ -25,10 +25,11 @@
#include "nss_hal.h"
#include "nss_log.h"
#include <linux/kernel.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0))
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 6, 0))
#include <linux/notifier.h> /* for panic_notifier_list */
#else
-#include <linux/panic_notifier.h>
+#include <linux/panic_notifier.h> /* for panic_notifier_list */
#endif
#include <linux/jiffies.h> /* for time */
#include "nss_tx_rx_common.h"