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

qcacld-3.0: Add iwpriv pktlog command to clear pktlog buffer

Implement iwpriv pktlog command to clear pktlog buffer.
This command is effective only if pktlog disable is issued previously.
This command needs one argument.
Command to use this feature : iwpriv wlan0 pktlog 4

CRs-Fixed: 2031210
Change-Id: I19d695c30608ab8cde21ee251eee5c5d43d89751
Poddar, Siddarth 8 жил өмнө
parent
commit
ab99a27dc1

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

@@ -4918,6 +4918,7 @@ static int __wlan_hdd_cfg80211_wifi_logger_start(struct wiphy *wiphy,
 
 	/* size is buff size which can be set using iwpriv command*/
 	start_log.size = 0;
+	start_log.is_pktlog_buff_clear = false;
 
 	cds_set_ring_log_level(start_log.ring_id, start_log.verbose_level);
 

+ 35 - 1
core/hdd/src/wlan_hdd_main.c

@@ -7973,6 +7973,7 @@ static inline void hdd_release_rtnl_lock(void) { }
 
 /* MAX iwpriv command support */
 #define PKTLOG_SET_BUFF_SIZE	3
+#define PKTLOG_CLEAR_BUFF	4
 #define MAX_PKTLOG_SIZE		16
 
 /**
@@ -7993,6 +7994,7 @@ static int hdd_pktlog_set_buff_size(hdd_context_t *hdd_ctx, int set_value2)
 	start_log.ini_triggered = cds_is_packet_log_enabled();
 	start_log.user_triggered = 1;
 	start_log.size = set_value2;
+	start_log.is_pktlog_buff_clear = false;
 
 	status = sme_wifi_start_logger(hdd_ctx->hHal, start_log);
 	if (!QDF_IS_STATUS_SUCCESS(status)) {
@@ -8004,6 +8006,35 @@ static int hdd_pktlog_set_buff_size(hdd_context_t *hdd_ctx, int set_value2)
 	return 0;
 }
 
+/**
+ * hdd_pktlog_clear_buff() - clear pktlog buffer
+ * @hdd_ctx: hdd context
+ *
+ * Return: 0 for success or error.
+ */
+static int hdd_pktlog_clear_buff(hdd_context_t *hdd_ctx)
+{
+	struct sir_wifi_start_log start_log;
+	QDF_STATUS status;
+
+	start_log.ring_id = RING_ID_PER_PACKET_STATS;
+	start_log.verbose_level = WLAN_LOG_LEVEL_OFF;
+	start_log.ini_triggered = cds_is_packet_log_enabled();
+	start_log.user_triggered = 1;
+	start_log.size = 0;
+	start_log.is_pktlog_buff_clear = true;
+
+	status = sme_wifi_start_logger(hdd_ctx->hHal, start_log);
+	if (!QDF_IS_STATUS_SUCCESS(status)) {
+		hdd_err("sme_wifi_start_logger failed(err=%d)", status);
+		EXIT();
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+
 /**
  * hdd_process_pktlog_command() - process pktlog command
  * @hdd_ctx: hdd context
@@ -8029,7 +8060,7 @@ int hdd_process_pktlog_command(hdd_context_t *hdd_ctx, uint32_t set_value,
 
 	hdd_debug("set pktlog %d, set size %d", set_value, set_value2);
 
-	if (set_value > PKTLOG_SET_BUFF_SIZE) {
+	if (set_value > PKTLOG_CLEAR_BUFF) {
 		hdd_err("invalid pktlog value %d", set_value);
 		return -EINVAL;
 	}
@@ -8043,6 +8074,8 @@ int hdd_process_pktlog_command(hdd_context_t *hdd_ctx, uint32_t set_value,
 			return -EINVAL;
 		}
 		return hdd_pktlog_set_buff_size(hdd_ctx, set_value2);
+	} else if (set_value == PKTLOG_CLEAR_BUFF) {
+		return hdd_pktlog_clear_buff(hdd_ctx);
 	}
 
 	/*
@@ -8082,6 +8115,7 @@ int hdd_pktlog_enable_disable(hdd_context_t *hdd_ctx, bool enable,
 	start_log.ini_triggered = cds_is_packet_log_enabled();
 	start_log.user_triggered = user_triggered;
 	start_log.size = size;
+	start_log.is_pktlog_buff_clear = false;
 	/*
 	 * Use "is_iwpriv_command" flag to distinguish iwpriv command from other
 	 * commands. Host uses this flag to decide whether to send pktlog

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

@@ -3238,6 +3238,7 @@ typedef struct {
  * @ini_triggered: triggered using ini
  * @user_triggered: triggered by user
  * @size: pktlog buffer size
+ * @is_pktlog_buff_clear: clear the pktlog buffer
  */
 struct sir_wifi_start_log {
 	uint32_t ring_id;
@@ -3246,6 +3247,7 @@ struct sir_wifi_start_log {
 	bool ini_triggered;
 	uint8_t user_triggered;
 	int size;
+	bool is_pktlog_buff_clear;
 };
 
 

+ 1 - 0
core/sme/src/common/sme_api.c

@@ -14215,6 +14215,7 @@ QDF_STATUS sme_wifi_start_logger(tHalHandle hal,
 	req_msg->ini_triggered = start_log.ini_triggered;
 	req_msg->user_triggered = start_log.user_triggered;
 	req_msg->size = start_log.size;
+	req_msg->is_pktlog_buff_clear = start_log.is_pktlog_buff_clear;
 
 	status = sme_acquire_global_lock(&mac->sme);
 	if (status != QDF_STATUS_SUCCESS) {

+ 3 - 0
core/wma/src/wma_main.c

@@ -5963,6 +5963,9 @@ static void wma_set_wifi_start_packet_stats(void *wma_handle,
 	if (start_log->size != 0) {
 		pktlog_setsize(scn, start_log->size * MEGABYTE);
 		return;
+	} else if (start_log->is_pktlog_buff_clear == true) {
+		pktlog_clearbuff(scn, start_log->is_pktlog_buff_clear);
+		return;
 	}
 
 	if (start_log->verbose_level == WLAN_LOG_LEVEL_ACTIVE) {