summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPoddar, Siddarth <siddpodd@codeaurora.org>2017-08-24 12:04:26 +0530
committersnandini <snandini@codeaurora.org>2018-02-01 06:56:14 -0800
commit16f06316ca7d3d394d92906ef70452b399bfe93a (patch)
tree0e57b02532f43e2ca4d19ec31db4918979cc70d5
parentf2f2d93d0f064ab6b37a461f0f550f5dd16c0d42 (diff)
qcacld-3.0: Debugfs Implementation for dp trace collection
Implement debugfs interface to dump DP trace buffer to a debugfs file. Change-Id: I51ac3acbfc404b87cacc8a247f85cc4ee9971b61 CRs-Fixed: 2180977
-rw-r--r--core/dp/txrx/ol_txrx.c91
-rw-r--r--core/dp/txrx/ol_txrx_types.h8
2 files changed, 99 insertions, 0 deletions
diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c
index 889954325c23..8dcd7b680a46 100644
--- a/core/dp/txrx/ol_txrx.c
+++ b/core/dp/txrx/ol_txrx.c
@@ -32,6 +32,7 @@
#include <qdf_types.h> /* qdf_device_t, qdf_print */
#include <qdf_lock.h> /* qdf_spinlock */
#include <qdf_atomic.h> /* qdf_atomic_read */
+#include <qdf_debugfs.h>
#if defined(HIF_PCI) || defined(HIF_SNOC) || defined(HIF_AHB)
/* Required for WLAN_FEATURE_FASTPATH */
@@ -94,6 +95,11 @@
/* thresh for peer's cached buf queue beyond which the elements are dropped */
#define OL_TXRX_CACHED_BUFQ_THRESH 128
+#define DPT_DEBUGFS_PERMS (QDF_FILE_USR_READ | \
+ QDF_FILE_USR_WRITE | \
+ QDF_FILE_GRP_READ | \
+ QDF_FILE_OTH_READ)
+
/* These macros are expected to be used only for data path.
* Existing APIs cannot be used since they log every time
* they are used. Other modules, outside of data path should
@@ -1227,6 +1233,82 @@ static void ol_txrx_tso_stats_clear(ol_txrx_pdev_handle pdev)
#endif /* defined(FEATURE_TSO) && defined(FEATURE_TSO_DEBUG) */
/**
+ * ol_txrx_read_dpt_buff_debugfs() - read dp trace buffer
+ * @file: file to read
+ * @arg: pdev object
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS ol_txrx_read_dpt_buff_debugfs(qdf_debugfs_file_t file,
+ void *arg)
+{
+ struct ol_txrx_pdev_t *pdev = (struct ol_txrx_pdev_t *)arg;
+ uint32_t i = 0;
+ QDF_STATUS status = QDF_STATUS_SUCCESS;
+
+ if (pdev->state == QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INVALID)
+ return QDF_STATUS_E_INVAL;
+ else if (pdev->state == QDF_DPT_DEBUGFS_STATE_SHOW_COMPLETE) {
+ pdev->state = QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INIT;
+ return QDF_STATUS_SUCCESS;
+ }
+
+ i = qdf_dpt_get_curr_pos_debugfs(file, pdev->state);
+ status = qdf_dpt_dump_stats_debugfs(file, i);
+ if (status == QDF_STATUS_E_FAILURE)
+ pdev->state = QDF_DPT_DEBUGFS_STATE_SHOW_IN_PROGRESS;
+ else if (status == QDF_STATUS_SUCCESS)
+ pdev->state = QDF_DPT_DEBUGFS_STATE_SHOW_COMPLETE;
+
+ return status;
+}
+
+/**
+ * ol_txrx_write_dpt_buff_debugfs() - set dp trace parameters
+ * @priv: pdev object
+ * @buf: buff to get value for dpt parameters
+ * @len: buf length
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS ol_txrx_write_dpt_buff_debugfs(void *priv,
+ const char *buf,
+ qdf_size_t len)
+{
+ return QDF_STATUS_SUCCESS;
+}
+
+static int ol_txrx_debugfs_init(struct ol_txrx_pdev_t *pdev)
+{
+ pdev->dpt_debugfs_fops.show = ol_txrx_read_dpt_buff_debugfs;
+ pdev->dpt_debugfs_fops.write = ol_txrx_write_dpt_buff_debugfs;
+ pdev->dpt_debugfs_fops.priv = pdev;
+
+ pdev->dpt_stats_log_dir = qdf_debugfs_create_dir("dpt_stats", NULL);
+
+ if (!pdev->dpt_stats_log_dir) {
+ QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
+ "%s: error while creating debugfs dir for %s",
+ __func__, "dpt_stats");
+ pdev->state = QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INVALID;
+ return -EBUSY;
+ }
+
+ if (!qdf_debugfs_create_file("dump_set_dpt_logs", DPT_DEBUGFS_PERMS,
+ pdev->dpt_stats_log_dir,
+ &pdev->dpt_debugfs_fops)) {
+ QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
+ "%s: debug Entry creation failed!",
+ __func__);
+ pdev->state = QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INVALID;
+ return -EBUSY;
+ }
+
+ pdev->state = QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INIT;
+ return 0;
+}
+
+/**
* ol_txrx_pdev_attach() - allocate txrx pdev
* @ctrl_pdev: cfg pdev
* @htc_pdev: HTC pdev
@@ -1310,6 +1392,8 @@ ol_txrx_pdev_attach(ol_pdev_handle ctrl_pdev,
pdev->tid_to_ac[OL_TX_NUM_TIDS + OL_TX_VDEV_DEFAULT_MGMT] =
OL_TX_SCHED_WRR_ADV_CAT_MCAST_MGMT;
+ ol_txrx_debugfs_init(pdev);
+
return pdev;
fail3:
@@ -2042,6 +2126,11 @@ void ol_txrx_pdev_pre_detach(ol_txrx_pdev_handle pdev, int force)
#endif
}
+static void ol_txrx_debugfs_exit(ol_txrx_pdev_handle pdev)
+{
+ qdf_debugfs_remove_dir_recursive(pdev->dpt_stats_log_dir);
+}
+
/**
* ol_txrx_pdev_detach() - delete the data SW state
* @pdev - the data physical device object being removed
@@ -2102,6 +2191,8 @@ void ol_txrx_pdev_detach(ol_txrx_pdev_handle pdev)
ol_txrx_pdev_txq_log_destroy(pdev);
ol_txrx_pdev_grp_stat_destroy(pdev);
+
+ ol_txrx_debugfs_exit(pdev);
}
#if defined(CONFIG_PER_VDEV_TX_DESC_POOL)
diff --git a/core/dp/txrx/ol_txrx_types.h b/core/dp/txrx/ol_txrx_types.h
index 6d88d95f1b54..39a0fdd158fe 100644
--- a/core/dp/txrx/ol_txrx_types.h
+++ b/core/dp/txrx/ol_txrx_types.h
@@ -51,6 +51,7 @@
#include "ol_txrx_osif_api.h" /* ol_rx_callback_fp */
#include "cdp_txrx_flow_ctrl_v2.h"
#include "cdp_txrx_peer_ops.h"
+#include <qdf_trace.h>
/*
* The target may allocate multiple IDs for a peer.
@@ -552,6 +553,7 @@ struct ol_txrx_stats_req_internal {
int offset;
};
+
/*
* As depicted in the diagram below, the pdev contains an array of
* NUM_EXT_TID ol_tx_active_queues_in_tid_t elements.
@@ -1027,6 +1029,12 @@ struct ol_txrx_pdev_t {
void (*offld_flush_cb)(void *);
} rx_offld_info;
struct ol_txrx_peer_t *self_peer;
+
+ /* dp debug fs */
+ struct dentry *dpt_stats_log_dir;
+ enum qdf_dpt_debugfs_state state;
+ struct qdf_debugfs_fops dpt_debugfs_fops;
+
};
struct ol_txrx_ocb_chan_info {