summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPoddar, Siddarth <siddpodd@codeaurora.org>2017-02-21 19:21:11 +0530
committerqcabuildsw <qcabuildsw@localhost>2017-03-07 01:50:27 -0800
commit2cd6151d4d2ba3d06f0e8a4502f132654cbb10eb (patch)
treec8fd143d0428c482237e319fdd8a435323c0dc6e
parentaa4d2d0e9453f1855fec2e5b087ef586b2019570 (diff)
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: 2013877 Change-Id: I57aead03f0e9df51b238909efe2c1e0c89ffd506
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.c1
-rw-r--r--core/hdd/src/wlan_hdd_main.c35
-rw-r--r--core/mac/inc/sir_api.h2
-rw-r--r--core/sme/src/common/sme_api.c1
-rw-r--r--core/utils/pktlog/include/pktlog_ac.h7
-rw-r--r--core/utils/pktlog/pktlog_ac.c46
-rw-r--r--core/wma/src/wma_main.c3
7 files changed, 92 insertions, 3 deletions
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index 8f139192ad3c..174501962409 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -4527,6 +4527,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);
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index 4281edbbb394..414f857f05ef 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -7455,6 +7455,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
/**
@@ -7475,6 +7476,35 @@ 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)) {
+ hdd_err("sme_wifi_start_logger failed(err=%d)", status);
+ EXIT();
+ return -EINVAL;
+ }
+
+ 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)) {
@@ -7511,7 +7541,7 @@ int hdd_process_pktlog_command(hdd_context_t *hdd_ctx, uint32_t set_value,
hdd_info("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;
}
@@ -7525,6 +7555,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);
}
/*
@@ -7564,6 +7596,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
diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h
index 91eef977dfc9..43769e809ccc 100644
--- a/core/mac/inc/sir_api.h
+++ b/core/mac/inc/sir_api.h
@@ -3355,6 +3355,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;
@@ -3363,6 +3364,7 @@ struct sir_wifi_start_log {
bool ini_triggered;
uint8_t user_triggered;
int size;
+ bool is_pktlog_buff_clear;
};
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index a73ad42f03ab..5d22cbfd4f23 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -15006,6 +15006,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) {
diff --git a/core/utils/pktlog/include/pktlog_ac.h b/core/utils/pktlog/include/pktlog_ac.h
index a7fcf493a98b..d4a074fd49f5 100644
--- a/core/utils/pktlog/include/pktlog_ac.h
+++ b/core/utils/pktlog/include/pktlog_ac.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -135,6 +135,7 @@ void pktlog_init(struct hif_opaque_softc *scn);
int pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state,
bool, uint8_t, uint32_t);
int pktlog_setsize(struct hif_opaque_softc *scn, int32_t log_state);
+int pktlog_clearbuff(struct hif_opaque_softc *scn, bool clear_buff);
int pktlog_disable(struct hif_opaque_softc *scn);
int pktlogmod_init(void *context);
void pktlogmod_exit(void *context);
@@ -171,6 +172,10 @@ static int pktlog_setsize(struct hif_opaque_softc *scn, int32_t log_state)
{
return 0;
}
+static int pktlog_clearbuff(struct hif_opaque_softc *scn, bool clear_buff)
+{
+ return 0;
+}
static int pktlog_disable(struct hif_opaque_softc *scn)
{
return 0;
diff --git a/core/utils/pktlog/pktlog_ac.c b/core/utils/pktlog/pktlog_ac.c
index a7af06e62c63..571f7e01584c 100644
--- a/core/utils/pktlog/pktlog_ac.c
+++ b/core/utils/pktlog/pktlog_ac.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -516,6 +516,50 @@ int pktlog_setsize(struct hif_opaque_softc *scn, int32_t size)
return 0;
}
+int pktlog_clearbuff(struct hif_opaque_softc *scn, bool clear_buff)
+{
+ ol_txrx_pdev_handle pdev_txrx_handle =
+ cds_get_context(QDF_MODULE_ID_TXRX);
+ struct ol_pktlog_dev_t *pl_dev;
+ struct ath_pktlog_info *pl_info;
+
+ if (pdev_txrx_handle == NULL ||
+ pdev_txrx_handle->pl_dev == NULL ||
+ pdev_txrx_handle->pl_dev->pl_info == NULL)
+ return -EFAULT;
+
+ pl_dev = pdev_txrx_handle->pl_dev;
+ pl_info = pl_dev->pl_info;
+
+ if (!clear_buff)
+ return -EINVAL;
+
+ if (pl_info->log_state) {
+ qdf_print("%s: Logging should be disabled before clearing "
+ "pktlog buffer.", __func__);
+ return -EINVAL;
+ }
+
+ if (pl_info->buf != NULL) {
+ if (pl_info->buf_size > 0) {
+ qdf_print("%s: pktlog buffer is cleared.", __func__);
+ memset(pl_info->buf, 0, pl_info->buf_size);
+ pl_dev->is_pktlog_cb_subscribed = false;
+ pl_dev->tgt_pktlog_alloced = false;
+ pl_info->buf->rd_offset = -1;
+ } else {
+ qdf_print("%s: pktlog buffer size is not proper. "
+ "Existing Buf size %d", __func__, pl_info->buf_size);
+ return -EFAULT;
+ }
+ } else {
+ qdf_print("%s: pktlog buff is NULL", __func__);
+ return -EFAULT;
+ }
+
+ return 0;
+}
+
/**
* pktlog_process_fw_msg() - process packetlog message
* @buff: buffer
diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c
index 1f6ef2ba08b3..a2454e60024a 100644
--- a/core/wma/src/wma_main.c
+++ b/core/wma/src/wma_main.c
@@ -5954,6 +5954,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) {