lede/package/qca/nss/qca-nss-drv-64/patches/0008-Makefile-modularize-driver-even-more.patch

165 lines
4.2 KiB
Diff

From 895de8e4119afe3cbad2aa81566b1ebcb2b39dcd Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
Date: Tue, 17 May 2022 20:23:19 +0200
Subject: [PATCH] Makefile: modularize driver even more
Permit to disable even more module.
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
Makefile | 56 ++++++++++++++++++++++++++++++++---------------
nss_hal/nss_hal.c | 6 +++++
nss_init.c | 4 ++++
3 files changed, 48 insertions(+), 18 deletions(-)
diff --git a/Makefile b/Makefile
index f5c4b90..0194dbd 100644
--- a/Makefile
+++ b/Makefile
@@ -39,21 +39,44 @@ qca-nss-drv-objs := \
nss_pm.o \
nss_profiler.o \
nss_project.o \
- nss_pppoe.o \
- nss_pppoe_log.o \
- nss_pppoe_stats.o \
- nss_pppoe_strings.o \
nss_rps.o \
nss_stats.o \
nss_strings.o \
nss_tx_msg_sync.o \
nss_unaligned.o \
nss_unaligned_log.o \
- nss_unaligned_stats.o \
- nss_virt_if.o \
- nss_virt_if_stats.o \
+ nss_unaligned_stats.o
+
+# Base NSS data plane/HAL support
+qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o
+qca-nss-drv-objs += nss_hal/nss_hal.o
+
+ifneq "$(NSS_DRV_PPPOE_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_PPPOE_ENABLE
+qca-nss-drv-objs += \
+ nss_pppoe.o \
+ nss_pppoe_log.o \
+ nss_pppoe_stats.o \
+ nss_pppoe_strings.o
+endif
+
+ifneq "$(NSS_DRV_VIRT_IF_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_VIRT_IF_ENABLE
+qca-nss-drv-objs += \
+ nss_virt_if.o \
+ nss_virt_if_stats.o
+endif
+
+ifneq "$(NSS_DRV_VLAN_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_VLAN_ENABLE
+qca-nss-drv-objs += \
nss_vlan.o \
- nss_vlan_log.o \
+ nss_vlan_log.o
+endif
+
+ifneq "$(NSS_DRV_WIFI_ENABLE)" "n"
+ccflags-y += -DNSS_DRV_WIFI_ENABLE
+qca-nss-drv-objs += \
nss_wifi.o \
nss_wifi_log.o \
nss_wifi_stats.o \
@@ -63,10 +86,7 @@ qca-nss-drv-objs := \
nss_wifili_stats.o \
nss_wifili_strings.o \
nss_wifi_mac_db.o
-
-# Base NSS data plane/HAL support
-qca-nss-drv-objs += nss_data_plane/nss_data_plane_common.o
-qca-nss-drv-objs += nss_hal/nss_hal.o
+endif
ifneq "$(NSS_DRV_BRIDGE_ENABLE)" "n"
ccflags-y += -DNSS_DRV_BRIDGE_ENABLE
diff --git a/nss_hal/nss_hal.c b/nss_hal/nss_hal.c
index 7e9a044..c0051e4 100644
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
--- nss_hal.c.orig 2022-07-21 16:52:43.562803700 +0300
+++ nss_hal.c 2022-07-21 16:54:46.052803700 +0300
@@ -460,10 +460,12 @@ int nss_hal_probe(struct platform_device
}
#endif
+#ifdef NSS_DRV_PPPOE_ENABLE
if (npd->pppoe_enabled == NSS_FEATURE_ENABLED) {
nss_top->pppoe_handler_id = nss_dev->id;
nss_pppoe_register_handler();
}
+#endif
#ifdef NSS_DRV_PPE_ENABLE
if (npd->ppe_enabled == NSS_FEATURE_ENABLED) {
@@ -558,6 +560,7 @@ int nss_hal_probe(struct platform_device
}
#endif
+#ifdef NSS_DRV_WIFI_ENABLE
if (npd->wifioffload_enabled == NSS_FEATURE_ENABLED) {
nss_top->wifi_handler_id = nss_dev->id;
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_VAP] = nss_dev->id;
@@ -585,6 +588,7 @@ int nss_hal_probe(struct platform_device
*/
nss_wifili_thread_scheme_db_init(nss_dev->id);
}
+#endif
#ifdef NSS_DRV_OAM_ENABLE
if (npd->oam_enabled == NSS_FEATURE_ENABLED) {
@@ -601,11 +605,13 @@ int nss_hal_probe(struct platform_device
}
#endif
+#ifdef NSS_DRV_VLAN_ENABLE
if (npd->vlan_enabled == NSS_FEATURE_ENABLED) {
nss_top->vlan_handler_id = nss_dev->id;
nss_top->dynamic_interface_table[NSS_DYNAMIC_INTERFACE_TYPE_VLAN] = nss_dev->id;
nss_vlan_register_handler();
}
+#endif
#ifdef NSS_DRV_QVPN_ENABLE
#if defined(NSS_HAL_IPQ807x_SUPPORT) || defined(NSS_HAL_IPQ60XX_SUPPORT)
diff --git a/nss_init.c b/nss_init.c
index ebd2a12..40e9351 100644
--- a/nss_init.c
+++ b/nss_init.c
@@ -775,10 +775,12 @@ static int __init nss_init(void)
*/
nss_project_register_sysctl();
+#ifdef NSS_DRV_PPPOE_ENABLE
/*
* Registering sysctl for pppoe specific config.
*/
nss_pppoe_register_sysctl();
+#endif
/*
* Setup Runtime Sample values
@@ -913,10 +915,12 @@ static void __exit nss_cleanup(void)
nss_c2c_tx_unregister_sysctl();
#endif
+#ifdef NSS_DRV_PPPOE_ENABLE
/*
* Unregister pppoe specific sysctl
*/
nss_pppoe_unregister_sysctl();
+#endif
/*
* Unregister ipv4/6 specific sysctl and free allocated to connection tables
--
2.34.1