Эх сурвалжийг харах

qcacld-3.0: Add INI to set module log level

All INI configuration about modules log level which removed in
previous change "Change-Id: I9c519cf2509e3dc22282f0c7ea6f52cbd2913ccd",
add one INI item for log level of all modules.

Change-Id: Icaedb6bd61a18a81cea9e75e076fe64b11e5bde0
CRs-Fixed: 2442788
Wu Gao 6 жил өмнө
parent
commit
8dd9f50552

+ 70 - 1
core/hdd/inc/hdd_config.h

@@ -1268,6 +1268,74 @@ struct dhcp_server {
 			CFG_VALUE_OR_DEFAULT, \
 			"Disable wow feature")
 
+/**
+ * enum host_log_level - Debug verbose level imposed by user
+ * @HOST_LOG_LEVEL_NONE: no trace will be logged.
+ * @HOST_LOG_LEVEL_FATAL: fatal error will be logged
+ * @HOST_LOG_LEVEL_ERROR: error(include level less than error) will be logged
+ * @HOST_LOG_LEVEL_WARN: warning(include level less than warning) will be logged
+ * @HOST_LOG_LEVEL_INFO: inform(include level less than inform) will be logged
+ * @HOST_LOG_LEVEL_DEBUG: debug(include level less than debug) will be logged
+ * @HOST_LOG_LEVEL_TRACE: trace(include level less than trace) will be logged
+ * @HOST_LOG_LEVEL_MAX: Max host log level
+ */
+enum host_log_level {
+	HOST_LOG_LEVEL_NONE = 0,
+	HOST_LOG_LEVEL_FATAL,
+	HOST_LOG_LEVEL_ERROR,
+	HOST_LOG_LEVEL_WARN,
+	HOST_LOG_LEVEL_INFO,
+	HOST_LOG_LEVEL_DEBUG,
+	HOST_LOG_LEVEL_TRACE,
+	HOST_LOG_LEVEL_MAX,
+};
+
+/*
+ * <ini>
+ * gHostModuleLoglevel - modulized host debug log level
+ * @Min: N/A
+ * @Max: N/A
+ * @Default: N/A
+ *
+ * This ini is used to set modulized host debug log level.
+ * WLAN host module log level input string format looks like below:
+ * gHostModuleLoglevel="<host Module ID>,<Log Level>,..."
+ * For example:
+ * gHostModuleLoglevel=51,1,52,2,53,3,54,4,55,5,56,6
+ * The above input string means:
+ * For WLAN host module ID 51 enable log level HOST_LOG_LEVEL_FATAL
+ * For WLAN host module ID 52 enable log level HOST_LOG_LEVEL_ERROR
+ * For WLAN host module ID 53 enable log level HOST_LOG_LEVEL_WARN
+ * For WLAN host module ID 54 enable log level HOST_LOG_LEVEL_INFO
+ * For WLAN host module ID 55 enable log level HOST_LOG_LEVEL_DEBUG
+ * For WLAN host module ID 55 enable log level HOST_LOG_LEVEL_TRACE
+ * For valid values of module ids check enum QDF_MODULE_ID and
+ * for valid values of log levels check below.
+ * HOST_LOG_LEVEL_NONE = 0, No trace will be logged
+ * HOST_LOG_LEVEL_FATAL = 1, fatal error log
+ * HOST_LOG_LEVEL_ERROR = 2, error(include level less than error) log
+ * HOST_LOG_LEVEL_WARN = 3, warning(include level less than warning) log
+ * HOST_LOG_LEVEL_INFO = 4, inform(include level less than inform) log
+ * HOST_LOG_LEVEL_DEBUG = 5, debug(include level less than debug) log
+ * HOST_LOG_LEVEL_TRACE = 6, trace(include level less than trace) log
+ *
+ * Related: None
+ *
+ * Supported Feature: Debugging
+ *
+ * Usage: Internal
+ *
+ * </ini>
+ */
+
+#define HOST_MODULE_LOG_LEVEL_STRING_MAX_LENGTH  (QDF_MODULE_ID_MAX * 6)
+#define CFG_ENABLE_HOST_MODULE_LOG_LEVEL CFG_INI_STRING( \
+	"gHostModuleLoglevel", \
+	0, \
+	HOST_MODULE_LOG_LEVEL_STRING_MAX_LENGTH, \
+	"", \
+	"Set modulized host debug log level")
+
 #define CFG_HDD_ALL \
 	CFG_ENABLE_PACKET_LOG_ALL \
 	CFG_ENABLE_RUNTIME_PM_ALL \
@@ -1305,5 +1373,6 @@ struct dhcp_server {
 	CFG(CFG_HDD_DOT11_MODE) \
 	CFG(CFG_ENABLE_DISABLE_CHANNEL) \
 	CFG(CFG_SAR_VERSION) \
-	CFG(CFG_WOW_DISABLE)
+	CFG(CFG_WOW_DISABLE) \
+	CFG(CFG_ENABLE_HOST_MODULE_LOG_LEVEL)
 #endif

+ 65 - 3
core/hdd/src/wlan_hdd_main.c

@@ -9042,6 +9042,51 @@ static void hdd_set_mtrace_for_each(struct hdd_context *hdd_ctx)
 
 #endif
 
+/**
+ * hdd_log_level_to_bitmask() - user space log level to host log bitmask
+ * @user_log_level: user space log level
+ *
+ * Convert log level from user space to host log level bitmask.
+ *
+ * Return: Bitmask of log levels to be enabled
+ */
+static uint32_t hdd_log_level_to_bitmask(enum host_log_level user_log_level)
+{
+	QDF_TRACE_LEVEL host_trace_level;
+	uint32_t bitmask;
+
+	switch (user_log_level) {
+	case HOST_LOG_LEVEL_NONE:
+		host_trace_level = QDF_TRACE_LEVEL_NONE;
+		break;
+	case HOST_LOG_LEVEL_FATAL:
+		host_trace_level = QDF_TRACE_LEVEL_FATAL;
+		break;
+	case HOST_LOG_LEVEL_ERROR:
+		host_trace_level = QDF_TRACE_LEVEL_ERROR;
+		break;
+	case HOST_LOG_LEVEL_WARN:
+		host_trace_level = QDF_TRACE_LEVEL_WARN;
+		break;
+	case HOST_LOG_LEVEL_INFO:
+		host_trace_level = QDF_TRACE_LEVEL_INFO_LOW;
+		break;
+	case HOST_LOG_LEVEL_DEBUG:
+		host_trace_level = QDF_TRACE_LEVEL_DEBUG;
+		break;
+	case HOST_LOG_LEVEL_TRACE:
+		host_trace_level = QDF_TRACE_LEVEL_TRACE;
+		break;
+	default:
+		host_trace_level = QDF_TRACE_LEVEL_TRACE;
+		break;
+	}
+
+	bitmask = (1 << (host_trace_level + 1)) - 1;
+
+	return bitmask;
+}
+
 /**
  * hdd_set_trace_level_for_each - Set trace level for each INI config
  * @hdd_ctx - HDD context
@@ -9052,10 +9097,27 @@ static void hdd_set_mtrace_for_each(struct hdd_context *hdd_ctx)
  */
 static void hdd_set_trace_level_for_each(struct hdd_context *hdd_ctx)
 {
+	uint8_t host_module_log[QDF_MODULE_ID_MAX * 2];
+	qdf_size_t host_module_log_num = 0;
+	QDF_MODULE_ID module_id;
+	uint32_t bitmask;
+	uint32_t i;
+
 	hdd_qdf_trace_enable(QDF_MODULE_ID_DP, 0x7f);
-	hdd_qdf_trace_enable(QDF_MODULE_ID_MLME, 0xffff);
-	hdd_qdf_trace_enable(QDF_MODULE_ID_FWOL, 0xffff);
-	hdd_qdf_trace_enable(QDF_MODULE_ID_CRYPTO, 0xffff);
+
+	qdf_uint8_array_parse(cfg_get(hdd_ctx->psoc,
+				      CFG_ENABLE_HOST_MODULE_LOG_LEVEL),
+			      host_module_log,
+			      QDF_MODULE_ID_MAX * 2,
+			      &host_module_log_num);
+
+	for (i = 0; i + 1 < host_module_log_num; i += 2) {
+		module_id = host_module_log[i];
+		bitmask = hdd_log_level_to_bitmask(host_module_log[i + 1]);
+		if (module_id < QDF_MODULE_ID_MAX &&
+		    module_id >= QDF_MODULE_ID_MIN)
+			hdd_qdf_trace_enable(module_id, bitmask);
+	}
 
 	hdd_set_mtrace_for_each(hdd_ctx);
 }