Ver Fonte

qcacld-3.0: Create bug report in case of nil scan results

qcacld-2.0 to qcacld-3.0 propagation

Host should trigger bug report if HDD has zero scan results
to report to cfg80211 layer.
Add changes to trigger bug report if HDD has zero scan
results.

Change-Id: Ibac7fc5abfc860fc8759fe2cd029d19e2d6662a9
CRs-Fixed: 992733
Kapil Gupta há 9 anos atrás
pai
commit
0ed58dc628

+ 9 - 0
core/hdd/inc/wlan_hdd_cfg.h

@@ -3103,6 +3103,14 @@ enum dot11p_mode {
 #define CFG_ROAM_DENSE_RSSI_THRE_OFFSET_MAX     (20)
 #define CFG_ROAM_DENSE_RSSI_THRE_OFFSET_DEFAULT (10)
 
+/*
+ * Create bug report in case of nil scan results
+ */
+#define CFG_CREATE_BUG_REPORT_FOR_SCAN       "gbug_report_for_scan_results"
+#define CFG_CREATE_BUG_REPORT_FOR_SCAN_DISABLE    (0)
+#define CFG_CREATE_BUG_REPORT_FOR_SCAN_ENABLE     (1)
+#define CFG_CREATE_BUG_REPORT_FOR_SCAN_DEFAULT    (0)
+
 /*
  * Enabling gignore_peer_ht_opmode will enable 11g
  * protection only when there is a 11g AP in vicinity.
@@ -4107,6 +4115,7 @@ struct hdd_config {
 	uint8_t adapt_dwell_lpf_weight;
 	uint8_t adapt_dwell_passive_mon_intval;
 	uint8_t adapt_dwell_wifi_act_threshold;
+	bool bug_report_for_no_scan_results;
 #ifdef WLAN_FEATURE_NAN_DATAPATH
 	bool enable_nan_datapath;
 	uint8_t nan_datapath_ndi_channel;

+ 1 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -1479,6 +1479,7 @@ struct hdd_context_s {
 	int radio_index;
 	qdf_work_t sap_pre_cac_work;
 	bool hbw_requested;
+	uint32_t last_nil_scan_bug_report_timestamp;
 #ifdef WLAN_FEATURE_NAN_DATAPATH
 	bool nan_datapath_enabled;
 #endif

+ 6 - 0
core/hdd/src/wlan_hdd_cfg.c

@@ -3838,6 +3838,12 @@ REG_TABLE_ENTRY g_registry_table[] = {
 		CFG_ENABLE_NAN_NDI_CHANNEL_MIN,
 		CFG_ENABLE_NAN_NDI_CHANNEL_MAX),
 #endif
+	REG_VARIABLE(CFG_CREATE_BUG_REPORT_FOR_SCAN, WLAN_PARAM_Integer,
+		struct hdd_config, bug_report_for_no_scan_results,
+		VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+		CFG_CREATE_BUG_REPORT_FOR_SCAN_DEFAULT,
+		CFG_CREATE_BUG_REPORT_FOR_SCAN_DISABLE,
+		CFG_CREATE_BUG_REPORT_FOR_SCAN_ENABLE),
 
 	REG_VARIABLE(CFG_ENABLE_DP_TRACE, WLAN_PARAM_Integer,
 		struct hdd_config, enable_dp_trace,

+ 1 - 1
core/hdd/src/wlan_hdd_cfg80211.c

@@ -10023,7 +10023,7 @@ int wlan_hdd_cfg80211_update_bss(struct wiphy *wiphy,
 	/* no scan results */
 	if (NULL == pResult) {
 		hdd_err("No scan result Status %d", status);
-		return status;
+		return -EAGAIN;
 	}
 
 	pScanResult = sme_scan_result_get_first(hHal, pResult);

+ 22 - 1
core/hdd/src/wlan_hdd_scan.c

@@ -1123,6 +1123,7 @@ static QDF_STATUS hdd_cfg80211_scan_done_callback(tHalHandle halHandle,
 	bool aborted = false;
 	hdd_context_t *hddctx = WLAN_HDD_GET_CTX(pAdapter);
 	int ret = 0;
+	unsigned int current_timestamp, time_elapsed;
 	uint8_t source;
 	uint32_t scan_time;
 	uint32_t size = 0;
@@ -1150,8 +1151,28 @@ static QDF_STATUS hdd_cfg80211_scan_done_callback(tHalHandle halHandle,
 
 	ret = wlan_hdd_cfg80211_update_bss((WLAN_HDD_GET_CTX(pAdapter))->wiphy,
 					   pAdapter, scan_time);
-	if (0 > ret)
+	if (0 > ret) {
 		hdd_notice("NO SCAN result");
+		if (hddctx->config->bug_report_for_no_scan_results) {
+			current_timestamp = jiffies_to_msecs(jiffies);
+			time_elapsed = current_timestamp -
+				hddctx->last_nil_scan_bug_report_timestamp;
+
+			/*
+			 * check if we have generated bug report in
+			 * MIN_TIME_REQUIRED_FOR_NEXT_BUG_REPORT time.
+			 */
+			if (time_elapsed >
+			    MIN_TIME_REQUIRED_FOR_NEXT_BUG_REPORT) {
+				cds_flush_logs(WLAN_LOG_TYPE_NON_FATAL,
+						WLAN_LOG_INDICATOR_HOST_DRIVER,
+						WLAN_LOG_REASON_NO_SCAN_RESULTS,
+						true, true);
+				hddctx->last_nil_scan_bug_report_timestamp =
+					current_timestamp;
+			}
+		}
+	}
 
 	/*
 	 * cfg80211_scan_done informing NL80211 about completion

+ 3 - 0
core/hdd/src/wlan_hdd_scan.h

@@ -33,6 +33,9 @@
 
 #define MAX_PENDING_LOG 5
 
+/* (30 Mins) */
+#define MIN_TIME_REQUIRED_FOR_NEXT_BUG_REPORT (30 * 60 * 1000)
+
 /*
  * enum scan_source - scan request source
  *

+ 2 - 0
core/mac/inc/ani_global.h

@@ -168,6 +168,7 @@ enum log_event_indicator {
  * @WLAN_LOG_REASON_VOS_MSG_UNDER_RUN: VOS Core runs out of message wrapper
  * @WLAN_LOG_REASON_HDD_TIME_OUT: Wait for event Timeout in HDD layer
    @WLAN_LOG_REASON_SME_OUT_OF_CMD_BUFL sme out of cmd buffer
+ * @WLAN_LOG_REASON_NO_SCAN_RESULTS: no scan results to report from HDD
  * This enum contains the different reason codes for bug report
  */
 enum log_event_host_reason_code {
@@ -181,6 +182,7 @@ enum log_event_host_reason_code {
 	WLAN_LOG_REASON_VOS_MSG_UNDER_RUN,
 	WLAN_LOG_REASON_HDD_TIME_OUT,
 	WLAN_LOG_REASON_SME_OUT_OF_CMD_BUF,
+	WLAN_LOG_REASON_NO_SCAN_RESULTS,
 };