Bläddra i källkod

qcacld-3.0: Reduce console logging from tasklet

Currently, WoW wakeup host event is handled in tasklet context and
it is taking more than 800ms to execute. This is due to excessive
logging to the console from the tasklet. As a result of this, IRQs
are getting blocked during this tasklet execution.

To avoid this, add a sysfs entry to enable/disable console logging
from host wakeup event based on requirement.

Change-Id: If91a8bd5f783f358dabf9dcf46bf4c50d05d7909
CRs-Fixed: 2881972
Bapiraju Alla 4 år sedan
förälder
incheckning
9a02b15002
4 ändrade filer med 154 tillägg och 50 borttagningar
  1. 60 0
      core/hdd/src/wlan_hdd_sysfs.c
  2. 8 0
      core/wma/inc/wma.h
  3. 11 1
      core/wma/inc/wma_api.h
  4. 75 49
      core/wma/src/wma_features.c

+ 60 - 0
core/hdd/src/wlan_hdd_sysfs.c

@@ -76,6 +76,7 @@
 #include <wlan_hdd_sysfs_dp_aggregation.h>
 #include <wlan_hdd_sysfs_dl_modes.h>
 #include <wlan_hdd_sysfs_swlm.h>
+#include "wma_api.h"
 
 #define MAX_PSOC_ID_SIZE 10
 
@@ -592,6 +593,63 @@ static void hdd_sysfs_destroy_powerstats_interface(void)
 }
 #endif
 
+static ssize_t
+hdd_sysfs_wakeup_logs_to_console_store(struct kobject *kobj,
+				       struct kobj_attribute *attr,
+				       char const *buf, size_t count)
+{
+	char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
+	int ret, value;
+	char *sptr, *token;
+
+	ret = hdd_sysfs_validate_and_copy_buf(buf_local, sizeof(buf_local),
+					      buf, count);
+	if (ret) {
+		hdd_err_rl("invalid input");
+		return ret;
+	}
+
+	sptr = buf_local;
+	token = strsep(&sptr, " ");
+	if (!token)
+		return -EINVAL;
+	if (kstrtou32(token, 0, &value))
+		return -EINVAL;
+
+	wma_set_wakeup_logs_to_console(value);
+
+	return count;
+}
+
+static struct kobj_attribute wakeup_logs_to_console_attribute =
+	__ATTR(wakeup_logs_to_console, 0220, NULL,
+	       hdd_sysfs_wakeup_logs_to_console_store);
+
+static void hdd_sysfs_create_wakeup_logs_to_console(void)
+{
+	int error;
+
+	if (!driver_kobject) {
+		hdd_err("could not get driver kobject!");
+		return;
+	}
+
+	error = sysfs_create_file(driver_kobject,
+				  &wakeup_logs_to_console_attribute.attr);
+	if (error)
+		hdd_err("could not create power_stats sysfs file");
+}
+
+static void hdd_sysfs_destroy_wakeup_logs_to_console(void)
+{
+	if (!driver_kobject) {
+		hdd_err("could not get driver kobject!");
+		return;
+	}
+	sysfs_remove_file(driver_kobject,
+			  &wakeup_logs_to_console_attribute.attr);
+}
+
 static void hdd_sysfs_create_driver_root_obj(void)
 {
 	driver_kobject = kobject_create_and_add(DRIVER_NAME, kernel_kobj);
@@ -782,12 +840,14 @@ void hdd_create_sysfs_files(struct hdd_context *hdd_ctx)
 		hdd_sysfs_pm_dbs_create(driver_kobject);
 		hdd_sysfs_dp_aggregation_create(driver_kobject);
 		hdd_sysfs_dp_swlm_create(driver_kobject);
+		hdd_sysfs_create_wakeup_logs_to_console();
 	}
 }
 
 void hdd_destroy_sysfs_files(void)
 {
 	if  (QDF_GLOBAL_MISSION_MODE == hdd_get_conparam()) {
+		hdd_sysfs_destroy_wakeup_logs_to_console();
 		hdd_sysfs_dp_swlm_destroy(driver_kobject);
 		hdd_sysfs_dp_aggregation_destroy(driver_kobject);
 		hdd_sysfs_pm_dbs_destroy(driver_kobject);

+ 8 - 0
core/wma/inc/wma.h

@@ -91,6 +91,14 @@
 #define wma_nofl_debug(params...) \
 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_WMA, params)
 
+#define wma_conditional_log(is_console_log_enabled, params...) \
+	do { \
+		if (is_console_log_enabled) \
+			wma_info(params); \
+		else \
+			wma_debug(params); \
+	} while(0); \
+
 #define WMA_WILDCARD_PDEV_ID 0x0
 
 #define WMA_HW_DEF_SCAN_MAX_DURATION      30000 /* 30 secs */

+ 11 - 1
core/wma/inc/wma_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2021 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
@@ -829,4 +829,14 @@ QDF_STATUS wma_vdev_self_peer_create(struct vdev_mlme_obj *vdev_mlme);
  */
 void wma_cleanup_vdev(struct wlan_objmgr_vdev *vdev);
 
+/**
+ * wma_set_wakeup_logs_to_console() - Enable/disable wakeup logs to console
+ * @value: boolean value
+ *
+ * API to enable/disable wow host wakeup event logs to console.
+ *
+ * Return: None
+ */
+void wma_set_wakeup_logs_to_console(bool value);
+
 #endif /* WMA_API_H */

+ 75 - 49
core/wma/src/wma_features.c

@@ -78,6 +78,13 @@
  */
 #define WMA_SET_VDEV_IE_SOURCE_HOST 0x0
 
+static bool is_wakeup_event_console_logs_enabled = false;
+
+void wma_set_wakeup_logs_to_console(bool value)
+{
+	is_wakeup_event_console_logs_enabled = value;
+}
+
 #if defined(FEATURE_WLAN_DIAG_SUPPORT)
 /**
  * qdf_wma_wow_wakeup_stats_event()- send wow wakeup stats
@@ -1545,40 +1552,44 @@ static void wma_inc_wow_stats(t_wma_handle *wma,
 
 static void wma_wow_stats_display(struct wake_lock_stats *stats)
 {
-	wma_nofl_alert("WLAN wake reason counters:");
-	wma_nofl_alert("uc:%d bc:%d v4_mc:%d v6_mc:%d ra:%d ns:%d na:%d "
-		      "icmp:%d icmpv6:%d",
-		      stats->ucast_wake_up_count,
-		      stats->bcast_wake_up_count,
-		      stats->ipv4_mcast_wake_up_count,
-		      stats->ipv6_mcast_wake_up_count,
-		      stats->ipv6_mcast_ra_stats,
-		      stats->ipv6_mcast_ns_stats,
-		      stats->ipv6_mcast_na_stats,
-		      stats->icmpv4_count,
-		      stats->icmpv6_count);
-
-	wma_nofl_alert("assoc:%d disassoc:%d assoc_resp:%d reassoc:%d "
-		      "reassoc_resp:%d auth:%d deauth:%d action:%d",
-		      stats->mgmt_assoc,
-		      stats->mgmt_disassoc,
-		      stats->mgmt_assoc_resp,
-		      stats->mgmt_reassoc,
-		      stats->mgmt_reassoc_resp,
-		      stats->mgmt_auth,
-		      stats->mgmt_deauth,
-		      stats->mgmt_action);
-
-	wma_nofl_alert("pno_match:%d pno_complete:%d gscan:%d "
-		      "low_rssi:%d rssi_breach:%d oem:%d ucdrop:%d scan_11d:%d",
-		      stats->pno_match_wake_up_count,
-		      stats->pno_complete_wake_up_count,
-		      stats->gscan_wake_up_count,
-		      stats->low_rssi_wake_up_count,
-		      stats->rssi_breach_wake_up_count,
-		      stats->oem_response_wake_up_count,
-		      stats->uc_drop_wake_up_count,
-		      stats->scan_11d);
+	wma_conditional_log(is_wakeup_event_console_logs_enabled,
+			    "WLAN wake reason counters:");
+	wma_conditional_log(is_wakeup_event_console_logs_enabled,
+			    "uc:%d bc:%d v4_mc:%d v6_mc:%d ra:%d ns:%d na:%d "
+			    "icmp:%d icmpv6:%d",
+			    stats->ucast_wake_up_count,
+			    stats->bcast_wake_up_count,
+			    stats->ipv4_mcast_wake_up_count,
+			    stats->ipv6_mcast_wake_up_count,
+			    stats->ipv6_mcast_ra_stats,
+			    stats->ipv6_mcast_ns_stats,
+			    stats->ipv6_mcast_na_stats,
+			    stats->icmpv4_count,
+			    stats->icmpv6_count);
+
+	wma_conditional_log(is_wakeup_event_console_logs_enabled,
+			    "assoc:%d disassoc:%d assoc_resp:%d reassoc:%d "
+			    "reassoc_resp:%d auth:%d deauth:%d action:%d",
+			    stats->mgmt_assoc,
+			    stats->mgmt_disassoc,
+			    stats->mgmt_assoc_resp,
+			    stats->mgmt_reassoc,
+			    stats->mgmt_reassoc_resp,
+			    stats->mgmt_auth,
+			    stats->mgmt_deauth,
+			    stats->mgmt_action);
+
+	wma_conditional_log(is_wakeup_event_console_logs_enabled,
+			    "pno_match:%d pno_complete:%d gscan:%d low_rssi:%d"
+			    " rssi_breach:%d oem:%d ucdrop:%d scan_11d:%d",
+			    stats->pno_match_wake_up_count,
+			    stats->pno_complete_wake_up_count,
+			    stats->gscan_wake_up_count,
+			    stats->low_rssi_wake_up_count,
+			    stats->rssi_breach_wake_up_count,
+			    stats->oem_response_wake_up_count,
+			    stats->uc_drop_wake_up_count,
+			    stats->scan_11d);
 }
 
 static void wma_print_wow_stats(t_wma_handle *wma,
@@ -2124,15 +2135,18 @@ static void wma_wow_parse_data_pkt(t_wma_handle *wma,
 
 	src_mac = data + QDF_NBUF_SRC_MAC_OFFSET;
 	dest_mac = data + QDF_NBUF_DEST_MAC_OFFSET;
-	wma_info("Src_mac: " QDF_MAC_ADDR_FMT ", Dst_mac: " QDF_MAC_ADDR_FMT,
-		 QDF_MAC_ADDR_REF(src_mac), QDF_MAC_ADDR_REF(dest_mac));
+	wma_conditional_log(is_wakeup_event_console_logs_enabled,
+			    "Src_mac: " QDF_MAC_ADDR_FMT ", Dst_mac: "
+			    QDF_MAC_ADDR_FMT, QDF_MAC_ADDR_REF(src_mac),
+			    QDF_MAC_ADDR_REF(dest_mac));
 
 	wma_wow_inc_wake_lock_stats_by_dst_addr(wma, vdev_id, dest_mac);
 
 	proto_subtype = wma_wow_get_pkt_proto_subtype(data, length);
 	proto_subtype_name = wma_pkt_proto_subtype_to_string(proto_subtype);
 	if (proto_subtype_name)
-		wma_info("WOW Wakeup: %s rcvd", proto_subtype_name);
+		wma_conditional_log(is_wakeup_event_console_logs_enabled,
+				    "WOW Wakeup: %s rcvd", proto_subtype_name);
 
 	switch (proto_subtype) {
 	case QDF_PROTO_EAPOL_M1:
@@ -2215,32 +2229,43 @@ static void wma_wow_dump_mgmt_buffer(uint8_t *wow_packet_buffer,
 		uint8_t to_from_ds, frag_num;
 		uint32_t seq_num;
 
-		wma_err("RA: " QDF_MAC_ADDR_FMT " TA: " QDF_MAC_ADDR_FMT,
-			QDF_MAC_ADDR_REF(wh->i_addr1),
-			QDF_MAC_ADDR_REF(wh->i_addr2));
+		wma_conditional_log(is_wakeup_event_console_logs_enabled,
+				    "RA: " QDF_MAC_ADDR_FMT " TA: "
+				    QDF_MAC_ADDR_FMT,
+				    QDF_MAC_ADDR_REF(wh->i_addr1),
+				    QDF_MAC_ADDR_REF(wh->i_addr2));
 
-		wma_err("TO_DS: %u, FROM_DS: %u",
-			wh->i_fc[1] & IEEE80211_FC1_DIR_TODS,
-			wh->i_fc[1] & IEEE80211_FC1_DIR_FROMDS);
+		wma_conditional_log(is_wakeup_event_console_logs_enabled,
+				    "TO_DS: %u, FROM_DS: %u",
+				    wh->i_fc[1] & IEEE80211_FC1_DIR_TODS,
+				    wh->i_fc[1] & IEEE80211_FC1_DIR_FROMDS);
 
 		to_from_ds = wh->i_fc[1] & IEEE80211_FC1_DIR_MASK;
 
 		switch (to_from_ds) {
 		case IEEE80211_FC1_DIR_NODS:
-			wma_err("BSSID: " QDF_MAC_ADDR_FMT,
+			wma_conditional_log(
+				is_wakeup_event_console_logs_enabled,
+				"BSSID: " QDF_MAC_ADDR_FMT,
 				QDF_MAC_ADDR_REF(wh->i_addr3));
 			break;
 		case IEEE80211_FC1_DIR_TODS:
-			wma_err("DA: " QDF_MAC_ADDR_FMT,
+			wma_conditional_log(
+				is_wakeup_event_console_logs_enabled,
+				"DA: " QDF_MAC_ADDR_FMT,
 				QDF_MAC_ADDR_REF(wh->i_addr3));
 			break;
 		case IEEE80211_FC1_DIR_FROMDS:
-			wma_err("SA: " QDF_MAC_ADDR_FMT,
+			wma_conditional_log(
+				is_wakeup_event_console_logs_enabled,
+				"SA: " QDF_MAC_ADDR_FMT,
 				QDF_MAC_ADDR_REF(wh->i_addr3));
 			break;
 		case IEEE80211_FC1_DIR_DSTODS:
 			if (buf_len >= sizeof(struct ieee80211_frame_addr4))
-				wma_err("DA: " QDF_MAC_ADDR_FMT " SA: "
+				wma_conditional_log(
+					is_wakeup_event_console_logs_enabled,
+					"DA: " QDF_MAC_ADDR_FMT " SA: "
 					QDF_MAC_ADDR_FMT,
 					QDF_MAC_ADDR_REF(wh->i_addr3),
 					QDF_MAC_ADDR_REF(wh->i_addr4));
@@ -2254,8 +2279,9 @@ static void wma_wow_dump_mgmt_buffer(uint8_t *wow_packet_buffer,
 				IEEE80211_SEQ_FRAG_MASK) >>
 				IEEE80211_SEQ_FRAG_SHIFT);
 
-		wma_err("SEQ_NUM: %u, FRAG_NUM: %u",
-			seq_num, frag_num);
+		wma_conditional_log(is_wakeup_event_console_logs_enabled,
+				    "SEQ_NUM: %u, FRAG_NUM: %u", seq_num,
+				    frag_num);
 	} else {
 		wma_err("Insufficient buffer length for mgmt. packet");
 	}