summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajeev Kumar <rajekuma@codeaurora.org>2018-04-11 13:30:08 -0700
committernshrivas <nshrivas@codeaurora.org>2018-04-12 16:56:22 -0700
commit8b5e51013cc29b0fcbbfa92d62215d1c4848b644 (patch)
tree3cfe305fddfb5ddea137e4587f8fa159c346c31d
parent38f52f7d599f91359d823cdbdd88dc4703321de8 (diff)
qcacld-3.0: Add CFG INI item to control various unit test features
Suspend/Resume unit test IOCTLs and other unit test features are only enabled in defconfig debug builds and always disabled in production builds. Add CFG INI item to disable thes test IOCTLs even in defconfig build such that by default on all build combinations unit test IOCTLs are always disabled. Change-Id: I71a63d2b85800b630d7c18eb77a3cffddcd66fbb CRs-Fixed: 2221874
-rw-r--r--core/hdd/inc/wlan_hdd_cfg.h18
-rw-r--r--core/hdd/src/wlan_hdd_cfg.c11
-rw-r--r--core/hdd/src/wlan_hdd_wext.c11
3 files changed, 40 insertions, 0 deletions
diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h
index 69e5b1709847..3eda88e2c5a1 100644
--- a/core/hdd/inc/wlan_hdd_cfg.h
+++ b/core/hdd/inc/wlan_hdd_cfg.h
@@ -14383,6 +14383,23 @@ enum hw_filter_mode {
#define CFG_ENABLE_RTT_MAC_RANDOMIZATION_MAX (1)
#define CFG_ENABLE_RTT_MAC_RANDOMIZATION_DEFAULT (0)
+/*
+ * <ini>
+ * gEnableUnitTestFramework - Enable/Disable unit test framework
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * Usage: Internal (only for dev and test team)
+ *
+ * </ini>
+ */
+#define CFG_ENABLE_UNIT_TEST_FRAMEWORK_NAME "gEnableUnitTestFramework"
+#define CFG_ENABLE_UNIT_TEST_FRAMEWORK_MIN (0)
+#define CFG_ENABLE_UNIT_TEST_FRAMEWORK_MAX (1)
+#define CFG_ENABLE_UINT_TEST_FRAMEWORK_DEFAULT (0)
+
+
/*---------------------------------------------------------------------------
Type declarations
-------------------------------------------------------------------------*/
@@ -15295,6 +15312,7 @@ struct hdd_config {
#endif
bool enable_rtt_mac_randomization;
bool enable_ftopen;
+ bool is_unit_test_framework_enabled;
};
#define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var))
diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c
index 746a6ce9fd28..b9c42eca58b0 100644
--- a/core/hdd/src/wlan_hdd_cfg.c
+++ b/core/hdd/src/wlan_hdd_cfg.c
@@ -5576,6 +5576,14 @@ struct reg_table_entry g_registry_table[] = {
CFG_ENABLE_RTT_MAC_RANDOMIZATION_DEFAULT,
CFG_ENABLE_RTT_MAC_RANDOMIZATION_MIN,
CFG_ENABLE_RTT_MAC_RANDOMIZATION_MAX),
+
+ REG_VARIABLE(CFG_ENABLE_UNIT_TEST_FRAMEWORK_NAME,
+ WLAN_PARAM_Integer,
+ struct hdd_config, is_unit_test_framework_enabled,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_ENABLE_UINT_TEST_FRAMEWORK_DEFAULT,
+ CFG_ENABLE_UNIT_TEST_FRAMEWORK_MIN,
+ CFG_ENABLE_UNIT_TEST_FRAMEWORK_MAX),
};
/**
@@ -7471,6 +7479,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx)
CFG_CHANNEL_SELECT_LOGIC_CONC_NAME,
pHddCtx->config->channel_select_logic_conc);
hdd_cfg_print_sae(pHddCtx);
+ hdd_debug("Name = [%s] value = [0x%x]",
+ CFG_ENABLE_UNIT_TEST_FRAMEWORK_NAME,
+ pHddCtx->config->is_unit_test_framework_enabled);
}
/**
diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c
index 10fcde605a8b..6f1c1791f3cf 100644
--- a/core/hdd/src/wlan_hdd_wext.c
+++ b/core/hdd/src/wlan_hdd_wext.c
@@ -98,6 +98,7 @@
#define HDD_FINISH_ULA_TIME_OUT 800
#define HDD_SET_MCBC_FILTERS_TO_FW 1
#define HDD_DELETE_MCBC_FILTERS_FROM_FW 0
+#define HDD_UT_SUSPEND_RESUME_LOG_RL (1024)
/* To Validate Channel against the Frequency and Vice-Versa */
static const struct ccp_freq_chan_map freq_chan_map[] = {
@@ -12543,9 +12544,19 @@ static int __iw_set_two_ints_getnone(struct net_device *dev,
ret = wlan_hdd_set_mon_chan(pAdapter, value[1], value[2]);
break;
case WE_SET_WLAN_SUSPEND:
+ if (!hdd_ctx->config->is_unit_test_framework_enabled) {
+ hdd_warn_ratelimited(HDD_UT_SUSPEND_RESUME_LOG_RL,
+ "UT suspend is disabled");
+ return 0;
+ }
ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy, dev);
break;
case WE_SET_WLAN_RESUME:
+ if (!hdd_ctx->config->is_unit_test_framework_enabled) {
+ hdd_warn_ratelimited(HDD_UT_SUSPEND_RESUME_LOG_RL,
+ "UT resume is disabled");
+ return 0;
+ }
ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy, dev);
break;
case WE_LOG_BUFFER: {