summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortinlin <tinlin@codeaurora.org>2019-03-20 11:58:36 +0800
committertinlin <tinlin@codeaurora.org>2019-06-25 17:52:39 +0800
commit198d5b8aacd54006ce8e80ba1d44908c054ac69e (patch)
tree52c753746db88d50646a35fbf3b9615bd9c7deae
parenteb7b0783fc30d5ffd963b78f8516361d104139a4 (diff)
qcacld-2.0: Define FEATURE_LARGE_PREALLOC
System may rmmod wlan.ko and then insmod repeatedly. After system runs for a while, it may fail to load wlan driver due to memory fragmentation. If the size of wlan.ko is as small as it could, the ratio of driver load failure can be lower. Define FEATURE_LARGE_PREALLOC to put all the module realization in wlan_prealloc.ko while wlan.ko only contains module init/exit. If system only rmmods wlan.ko and it is easily insmod. Change-Id: I0927c372a3733c886bbbfe440db58967d8ad7e8b CRs-Fixed: 2417924
-rw-r--r--CORE/HDD/src/wlan_hdd_main.c38
-rw-r--r--CORE/HDD/src/wlan_hdd_main_module.c88
-rw-r--r--Kbuild14
3 files changed, 139 insertions, 1 deletions
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index eb11478034b2..7b4a22f5d529 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -187,6 +187,9 @@ static struct kparam_string fwpath = {
static char *country_code;
static int enable_11d = -1;
static int enable_dfs_chan_scan = -1;
+#ifdef FEATURE_LARGE_PREALLOC
+static char *version_string = QWLAN_VERSIONSTR;
+#endif
#ifndef MODULE
static int wlan_hdd_inited;
@@ -18297,7 +18300,9 @@ static int hdd_driver_init( void)
return ret_status;
}
-
+#ifdef FEATURE_LARGE_PREALLOC
+EXPORT_SYMBOL(hdd_driver_init);
+#endif
/**---------------------------------------------------------------------------
\brief hdd_module_init() - Init Function
@@ -18309,6 +18314,7 @@ static int hdd_driver_init( void)
\return - 0 for success, non zero for failure
--------------------------------------------------------------------------*/
+#ifndef FEATURE_LARGE_PREALLOC
#ifdef MODULE
static int __init hdd_module_init ( void)
{
@@ -18321,6 +18327,7 @@ static int __init hdd_module_init ( void)
return 0;
}
#endif /* #ifdef MODULE */
+#endif /* #ifndef FEATURE_LARGE_PREALLOC*/
static struct timer_list unload_timer;
static bool unload_timer_started;
@@ -18512,6 +18519,9 @@ done:
hdd_wlan_wakelock_destroy();
pr_info("%s: driver unloaded\n", WLAN_MODULE_NAME);
}
+#ifdef FEATURE_LARGE_PREALLOC
+EXPORT_SYMBOL(hdd_driver_exit);
+#endif
/**---------------------------------------------------------------------------
@@ -18524,6 +18534,7 @@ done:
\return - None
--------------------------------------------------------------------------*/
+#ifndef FEATURE_LARGE_PREALLOC
static void __exit hdd_module_exit(void)
{
hdd_driver_exit();
@@ -18617,6 +18628,7 @@ static int con_mode_handler(const char *kmessage,
#endif
#endif /* #ifdef MODULE */
+#endif
/**---------------------------------------------------------------------------
\brief hdd_get_conparam() -
@@ -20869,6 +20881,7 @@ void hdd_initialize_adapter_common(hdd_adapter_t *adapter)
}
//Register the module init/exit functions
+#ifndef FEATURE_LARGE_PREALLOC
module_init(hdd_module_init);
module_exit(hdd_module_exit);
@@ -20907,3 +20920,26 @@ module_param(enable_11d, int,
module_param(country_code, charp,
S_IRUSR | S_IRGRP | S_IROTH);
+#else /* FEATURE_LARGE_PREALLOC */
+
+/**
+ * register_wlan_module_parameters_callback() - set module params
+ * @con_mode_set: con_mode
+ * @country_code_set: pointer to country code
+ * @version_string_set: pointer to version string
+ *
+ * At the time of driver startup, set basic initial params
+ *
+ * No return
+ */
+void register_wlan_module_parameters_callback(int con_mode_set,
+ char* country_code_set,
+ char* version_string_set
+)
+{
+ con_mode = con_mode_set;
+ country_code = country_code_set;
+ version_string = version_string_set;
+}
+EXPORT_SYMBOL(register_wlan_module_parameters_callback);
+#endif /* #ifndef FEATURE_LARGE_PREALLOC */
diff --git a/CORE/HDD/src/wlan_hdd_main_module.c b/CORE/HDD/src/wlan_hdd_main_module.c
new file mode 100644
index 000000000000..941be50461fb
--- /dev/null
+++ b/CORE/HDD/src/wlan_hdd_main_module.c
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2019 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.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*Gerbera - WiFi*/
+/*
+ */
+
+
+/*========================================================================
+
+ \file wlan_hdd_main_module.c
+
+ \brief WLAN Host Device Driver module interface implementation
+
+ ========================================================================*/
+
+/*--------------------------------------------------------------------------
+ Include Files
+ ------------------------------------------------------------------------*/
+#include <linux/module.h>
+#include "qwlan_version.h"
+
+static char *country_code;
+static char *version_string = QWLAN_VERSIONSTR;
+static int con_mode;
+
+extern void register_wlan_module_parameters_callback(int con_mode_set,
+ char* country_code_set,
+ char* version_string_set
+);
+
+extern int hdd_driver_init(void);
+extern void hdd_driver_exit(void);
+
+static int __init hdd_module_init ( void)
+{
+ register_wlan_module_parameters_callback(
+ con_mode,
+ country_code,
+ version_string
+ );
+
+ return hdd_driver_init();
+}
+
+void __exit hdd_module_exit(void)
+{
+ hdd_driver_exit();
+
+ register_wlan_module_parameters_callback(
+ con_mode,
+ country_code,
+ version_string
+ );
+}
+
+//Register the module init/exit functions
+module_init(hdd_module_init);
+module_exit(hdd_module_exit);
+
+MODULE_DESCRIPTION("WLAN HOST DEVICE DRIVER");
+
+#if defined(QCA_WIFI_FTM)
+module_param(con_mode, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+#else
+module_param_call(con_mode, con_mode_handler, param_get_int, &con_mode,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+#endif
+
+module_param(country_code, charp,
+ S_IRUSR | S_IRGRP | S_IROTH);
+
+module_param(version_string, charp,
+ S_IRUSR | S_IRGRP | S_IROTH);
diff --git a/Kbuild b/Kbuild
index 85eff1c4873e..492fe8c49ac9 100644
--- a/Kbuild
+++ b/Kbuild
@@ -1800,9 +1800,18 @@ endif
ifeq ($(CONFIG_VOS_MEM_PRE_ALLOC),y)
ifneq ($(CONFIG_WCNSS_MEM_PRE_ALLOC), y)
CDEFINES += -DCONFIG_VOS_MEM_PRE_ALLOC
+
+ifeq ($(CONFIG_FEATURE_LARGE_PREALLOC),y)
+CDEFINES += -DFEATURE_LARGE_PREALLOC
+obj-m += $(MODNAME).o
+$(MODNAME)-y += $(HDD_SRC_DIR)/wlan_hdd_main_module.o
+OBJS +=$(VOSS_SRC_DIR)/vos_memory_prealloc.o
+else
obj-m += wlan_prealloc.o
wlan_prealloc-y += $(VOSS_SRC_DIR)/vos_memory_prealloc.o
endif
+
+endif
endif
ifeq ($(CONFIG_DPTRACE_ENABLE), y)
@@ -1872,5 +1881,10 @@ CDEFINES += -DWLAN_SMART_ANTENNA_FEATURE
endif
# Module information used by KBuild framework
+ifeq ($(CONFIG_FEATURE_LARGE_PREALLOC),y)
+obj-$(CONFIG_QCA_CLD_WLAN) += wlan_prealloc.o
+wlan_prealloc-y := $(OBJS)
+else
obj-$(CONFIG_QCA_CLD_WLAN) += $(MODNAME).o
$(MODNAME)-y := $(OBJS)
+endif