Parcourir la source

qcacld-3.0: Update QDF loggging usage according to converged framwork

As a part of QDF framework convergence, we need to update the QDF framwork
usage in current implementation according to converged framework.

Add qdf_print_ctrl_register API call in hdd_context_create to register HDD
module with QDF framwork and qdf_print_ctrl_cleanup API call in
__hdd_module_exit to deregister HDD module with QDF framwork.

Change-Id: Ibc45d91dca311760d4a5d0d1847662ba917b27a8
CRs-Fixed: 1108445
Ashish Kumar Dhanotiya il y a 8 ans
Parent
commit
7a031ce178

+ 63 - 12
core/hdd/src/wlan_hdd_main.c

@@ -533,7 +533,8 @@ uint8_t wlan_hdd_find_opclass(tHalHandle hal, uint8_t channel,
 static void hdd_qdf_trace_enable(QDF_MODULE_ID moduleId, uint32_t bitmask)
 {
 	QDF_TRACE_LEVEL level;
-
+	int qdf_print_idx = -1;
+	int status = -1;
 	/*
 	 * if the bitmask is the default value, then a bitmask was not
 	 * specified in cfg.ini, so leave the logging level alone (it
@@ -543,14 +544,22 @@ static void hdd_qdf_trace_enable(QDF_MODULE_ID moduleId, uint32_t bitmask)
 		return;
 	}
 
+	qdf_print_idx = qdf_get_pidx();
+
 	/* a mask was specified.  start by disabling all logging */
-	qdf_trace_set_value(moduleId, QDF_TRACE_LEVEL_NONE, 0);
+	status = qdf_print_set_category_verbose(qdf_print_idx, moduleId,
+					QDF_TRACE_LEVEL_NONE, 0);
 
+	if (QDF_STATUS_SUCCESS != status)
+		return;
 	/* now cycle through the bitmask until all "set" bits are serviced */
 	level = QDF_TRACE_LEVEL_FATAL;
 	while (0 != bitmask) {
 		if (bitmask & 1) {
-			qdf_trace_set_value(moduleId, level, 1);
+			status = qdf_print_set_category_verbose(qdf_print_idx,
+							moduleId, level, 1);
+			if (QDF_STATUS_SUCCESS != status)
+				return;
 		}
 		level++;
 		bitmask >>= 1;
@@ -6626,6 +6635,52 @@ static hdd_context_t *hdd_context_create(struct device *dev)
 	int ret = 0;
 	hdd_context_t *hdd_ctx;
 	v_CONTEXT_t p_cds_context;
+	int qdf_print_idx = -1;
+
+	struct category_info cinfo[MAX_SUPPORTED_CATEGORY] = {
+		[QDF_MODULE_ID_TLSHIM] =  {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_WMI] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_HTT] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_HDD] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_SME] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_PE] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_WMA] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_SYS] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_QDF] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_SAP] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_HDD_SOFTAP] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_HDD_DATA] = {QDF_DATA_PATH_TRACE_LEVEL},
+		[QDF_MODULE_ID_HDD_SAP_DATA] = {QDF_DATA_PATH_TRACE_LEVEL},
+		[QDF_MODULE_ID_HIF] = {QDF_DATA_PATH_TRACE_LEVEL},
+		[QDF_MODULE_ID_HTC] = {QDF_DATA_PATH_TRACE_LEVEL},
+		[QDF_MODULE_ID_TXRX] = {QDF_DATA_PATH_TRACE_LEVEL},
+		[QDF_MODULE_ID_QDF_DEVICE] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_CFG] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_BMI] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_EPPING] = {QDF_TRACE_LEVEL_ALL},
+		[QDF_MODULE_ID_QVIT] = {QDF_TRACE_LEVEL_ALL}
+		};
+
+	status = qdf_print_setup();
+	if (status != QDF_STATUS_SUCCESS) {
+		pr_err("QDF print control object setup failed\n");
+		ret = -EINVAL;
+		goto err_out;
+	}
+	/* Register the module here with QDF */
+	qdf_print_idx = qdf_print_ctrl_register(cinfo, NULL, NULL,
+						"MCL_WLAN");
+
+	/* if qdf_print_idx is negative */
+	if (qdf_print_idx < 0) {
+		pr_err("QDF print control can not be registered %d\n",
+			qdf_print_idx);
+		ret = -EINVAL;
+		goto err_out;
+	}
+
+	/* Store the qdf_pidx information into qdf module */
+	qdf_set_pidx(qdf_print_idx);
 
 	ENTER();
 
@@ -6703,15 +6758,6 @@ static hdd_context_t *hdd_context_create(struct device *dev)
 	if (ret)
 		goto err_free_histogram;
 
-
-	/*
-	 * Update QDF trace levels based upon the code. The multicast
-	 * levels of the code need not be set when the logger thread
-	 * is not enabled.
-	 */
-	if (cds_is_multicast_logging())
-		wlan_logging_set_log_level();
-
 skip_multicast_logging:
 	hdd_set_trace_level_for_each(hdd_ctx);
 
@@ -9380,6 +9426,8 @@ static void hdd_wait_for_recovery_completion(void)
  */
 static void __hdd_module_exit(void)
 {
+	int qdf_print_idx = -1;
+
 	pr_info("%s: Unloading driver v%s\n", WLAN_MODULE_NAME,
 		QWLAN_VERSIONSTR);
 
@@ -9393,6 +9441,9 @@ static void __hdd_module_exit(void)
 	hdd_deinit();
 	pld_deinit();
 
+	qdf_print_idx = qdf_get_pidx();
+	qdf_print_ctrl_cleanup(qdf_print_idx);
+
 	return;
 }
 

+ 1 - 5
core/utils/logging/inc/wlan_logging_sock_svc.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -46,16 +46,12 @@ int wlan_log_to_user(QDF_TRACE_LEVEL log_level, char *to_be_sent, int length);
 
 #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
 void wlan_logging_set_per_pkt_stats(void);
-void wlan_logging_set_log_level(void);
 void wlan_logging_set_fw_flush_complete(void);
 void wlan_flush_host_logs_for_fatal(void);
 #else
 static inline void wlan_flush_host_logs_for_fatal(void)
 {
 }
-static inline void wlan_logging_set_log_level(void)
-{
-}
 static inline void wlan_logging_set_per_pkt_stats(void)
 {
 }

+ 0 - 63
core/utils/logging/src/wlan_logging_sock_svc.c

@@ -224,56 +224,6 @@ static int wlan_send_sock_msg_to_app(tAniHdr *wmsg, int radio,
 	return err;
 }
 
-/**
- * is_data_path_module() - To check for a Datapath module
- * @mod_id: Module id
- *
- * Checks if the input module id belongs to data path.
- *
- * Return: True if the module belongs to data path, false otherwise
- */
-static bool is_data_path_module(QDF_MODULE_ID mod_id)
-{
-	switch (mod_id) {
-	case QDF_MODULE_ID_HDD_DATA:
-	case QDF_MODULE_ID_HDD_SAP_DATA:
-	case QDF_MODULE_ID_HTC:
-	case QDF_MODULE_ID_TXRX:
-	case QDF_MODULE_ID_HIF:
-		return true;
-	default:
-		return false;
-	}
-}
-
-static void set_default_logtoapp_log_level(void)
-{
-	int i;
-
-	/* module id 0 is reserved */
-	for (i = 1; i < QDF_MODULE_ID_MAX; i++) {
-		if (is_data_path_module(i))
-			qdf_trace_set_module_trace_level(i,
-					QDF_DATA_PATH_TRACE_LEVEL);
-		else
-			qdf_trace_set_value(i, QDF_TRACE_LEVEL_ALL, true);
-	}
-}
-
-static void clear_default_logtoapp_log_level(void)
-{
-	int module;
-
-	for (module = 0; module < QDF_MODULE_ID_MAX; module++) {
-		qdf_trace_set_value(module, QDF_TRACE_LEVEL_NONE, false);
-		qdf_trace_set_value(module, QDF_TRACE_LEVEL_FATAL, true);
-		qdf_trace_set_value(module, QDF_TRACE_LEVEL_ERROR, true);
-	}
-
-	qdf_trace_set_value(QDF_MODULE_ID_RSV4, QDF_TRACE_LEVEL_NONE,
-			    false);
-}
-
 /* Need to call this with spin_lock acquired */
 static int wlan_queue_logmsg_for_app(void)
 {
@@ -1028,7 +978,6 @@ int wlan_logging_sock_deactivate_svc(void)
 		return 0;
 
 	nl_srv_unregister(ANI_NL_MSG_LOG, wlan_logging_proc_sock_rx_msg);
-	clear_default_logtoapp_log_level();
 	gapp_pid = INVALID_PID;
 
 	INIT_COMPLETION(gwlan_logging.shutdown_comp);
@@ -1102,18 +1051,6 @@ void wlan_logging_set_per_pkt_stats(void)
 	wake_up_interruptible(&gwlan_logging.wait_queue);
 }
 
-/**
- * wlan_logging_set_log_level() - Set the logging level
- *
- * This function is used to set the logging level of host debug messages
- *
- * Return: None
- */
-void wlan_logging_set_log_level(void)
-{
-	set_default_logtoapp_log_level();
-}
-
 /*
  * wlan_logging_set_fw_flush_complete() - FW log flush completion
  *