qcacmn: Call log handler in case of HTT command/event
htt_command_record, htt_event_record, htt_wbm_event_record
function is used to log command,event, wbm event to
in-memory data-structure.
We call these function from htt path.
Change-Id: Ib3e18b895485c84f0010f8c3ba95c2da85b00bde
CRs-Fixed: 2428742
diff --git a/dp/wifi3.0/dp_htt.c b/dp/wifi3.0/dp_htt.c
index ac4c9a2..2831b4e 100644
--- a/dp/wifi3.0/dp_htt.c
+++ b/dp/wifi3.0/dp_htt.c
@@ -43,12 +43,6 @@
#define HTT_PID_BIT_MASK 0x3
#define DP_EXT_MSG_LENGTH 2048
-#define DP_HTT_SEND_HTC_PKT(soc, pkt) \
-do { \
- if (htc_send_pkt(soc->htc_soc, &pkt->htc_pkt) == \
- QDF_STATUS_SUCCESS) \
- htt_htc_misc_pkt_list_add(soc, pkt); \
-} while (0)
#define HTT_MGMT_CTRL_TLV_HDR_RESERVERD_LEN 16
@@ -391,6 +385,28 @@
htt_htc_misc_pkt_list_trim(soc, misclist_trim_level);
}
+/**
+ * DP_HTT_SEND_HTC_PKT() - Send htt packet from host
+ * @soc : HTT SOC handle
+ * @pkt: pkt to be send
+ * @cmd : command to be recorded in dp htt logger
+ * @buf : Pointer to buffer needs to be recored for above cmd
+ * Note: Changed from macro function to statis inline function
+ * due to error reported by checkpatch for multiple use
+ * of same variable.
+ *
+ * Return: None
+ */
+static inline void DP_HTT_SEND_HTC_PKT(struct htt_soc *soc,
+ struct dp_htt_htc_pkt *pkt, uint8_t cmd,
+ uint8_t *buf)
+{
+ htt_command_record(soc->htt_logger_handle, cmd, buf);
+ if (htc_send_pkt(soc->htc_soc, &pkt->htc_pkt) ==
+ QDF_STATUS_SUCCESS)
+ htt_htc_misc_pkt_list_add(soc, pkt);
+}
+
/*
* htt_htc_misc_pkt_pool_free() - free pkts in misc list
* @htt_soc: HTT SOC handle
@@ -554,7 +570,7 @@
1); /* tag - not relevant here */
SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
- DP_HTT_SEND_HTC_PKT(soc, pkt);
+ DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_VERSION_REQ, NULL);
return 0;
}
@@ -579,6 +595,7 @@
uint32_t ring_entry_size =
hal_srng_get_entrysize(soc->hal_soc, hal_ring_type);
int htt_ring_type, htt_ring_id;
+ uint8_t *htt_logger_bufp;
/* Sizes should be set in 4-byte words */
ring_entry_size = ring_entry_size >> 2;
@@ -682,6 +699,7 @@
/* word 0 */
*msg_word = 0;
+ htt_logger_bufp = (uint8_t *)msg_word;
HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_SRING_SETUP);
if ((htt_ring_type == HTT_SW_TO_HW_RING) ||
@@ -809,7 +827,8 @@
HTC_TX_PACKET_TAG_RUNTIME_PUT); /* tag for no FW response msg */
SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, htt_msg);
- DP_HTT_SEND_HTC_PKT(soc, pkt);
+ DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_SRING_SETUP,
+ htt_logger_bufp);
return QDF_STATUS_SUCCESS;
@@ -841,6 +860,7 @@
struct hal_srng_params srng_params;
uint32_t htt_ring_type, htt_ring_id;
uint32_t tlv_filter;
+ uint8_t *htt_logger_bufp;
htt_msg = qdf_nbuf_alloc(soc->osdev,
HTT_MSG_BUF_SIZE(HTT_RX_RING_SELECTION_CFG_SZ),
@@ -902,6 +922,7 @@
qdf_nbuf_push_head(htt_msg, HTC_HDR_ALIGNMENT_PADDING);
/* word 0 */
+ htt_logger_bufp = (uint8_t *)msg_word;
*msg_word = 0;
HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_RX_RING_SELECTION_CFG);
@@ -1511,7 +1532,8 @@
1); /* tag - not relevant here */
SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, htt_msg);
- DP_HTT_SEND_HTC_PKT(soc, pkt);
+ DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_RX_RING_SELECTION_CFG,
+ htt_logger_bufp);
return QDF_STATUS_SUCCESS;
fail1:
@@ -3197,6 +3219,8 @@
msg_word = (u_int32_t *) qdf_nbuf_data(htt_t2h_msg);
msg_type = HTT_T2H_MSG_TYPE_GET(*msg_word);
+ htt_event_record(soc->htt_logger_handle,
+ msg_type, (uint8_t *)msg_word);
switch (msg_type) {
case HTT_T2H_MSG_TYPE_PEER_MAP:
{
@@ -3508,6 +3532,8 @@
soc->htc_endpoint = response.Endpoint;
hif_save_htc_htt_config_endpoint(dpsoc->hif_handle, soc->htc_endpoint);
+
+ htt_interface_logging_init(&soc->htt_logger_handle);
dp_hif_update_pipe_callback(soc->dp_soc, (void *)soc,
dp_htt_hif_t2h_hp_callback, DP_HTT_T2H_HP_PIPE);
@@ -3546,6 +3572,7 @@
void htt_soc_htc_dealloc(struct htt_soc *htt_handle)
{
+ htt_interface_logging_deinit(htt_handle->htt_logger_handle);
htt_htc_misc_pkt_pool_free(htt_handle);
htt_htc_pkt_pool_free(htt_handle);
}
@@ -3611,6 +3638,7 @@
qdf_nbuf_t msg;
uint32_t *msg_word;
uint8_t pdev_mask = 0;
+ uint8_t *htt_logger_bufp;
msg = qdf_nbuf_alloc(
soc->osdev,
@@ -3652,6 +3680,7 @@
msg_word = (uint32_t *) qdf_nbuf_data(msg);
qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
+ htt_logger_bufp = (uint8_t *)msg_word;
*msg_word = 0;
HTT_H2T_MSG_TYPE_SET(*msg_word, HTT_H2T_MSG_TYPE_EXT_STATS_REQ);
HTT_H2T_EXT_STATS_REQ_PDEV_MASK_SET(*msg_word, pdev_mask);
@@ -3709,7 +3738,8 @@
1); /* tag - not relevant here */
SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
- DP_HTT_SEND_HTC_PKT(soc, pkt);
+ DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_EXT_STATS_REQ,
+ htt_logger_bufp);
return 0;
}
@@ -3794,7 +3824,8 @@
1); /* tag - not relevant here */
SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg);
- DP_HTT_SEND_HTC_PKT(soc, pkt);
+ DP_HTT_SEND_HTC_PKT(soc, pkt, HTT_H2T_MSG_TYPE_PPDU_STATS_CFG,
+ (uint8_t *)msg_word);
return 0;
}
#endif
diff --git a/dp/wifi3.0/dp_htt.h b/dp/wifi3.0/dp_htt.h
index c085d93..3eac37a 100644
--- a/dp/wifi3.0/dp_htt.h
+++ b/dp/wifi3.0/dp_htt.h
@@ -26,6 +26,42 @@
#include "cdp_txrx_cmn_struct.h"
#include "dp_types.h"
+#ifdef HTT_LOGGER
+#include "dp_htt_logger.h"
+#else
+struct htt_logger;
+static inline
+void htt_interface_logging_init(struct htt_logger **htt_logger_handle)
+{
+}
+
+static inline
+void htt_interface_logging_deinit(struct htt_logger *htt_logger_handle)
+{
+}
+
+static inline
+int htt_command_record(struct htt_logger *h, uint8_t msg_type,
+ uint8_t *msg_data)
+{
+ return 0;
+}
+
+static inline
+int htt_event_record(struct htt_logger *h, uint8_t msg_type,
+ uint8_t *msg_data)
+{
+ return 0;
+}
+
+static inline
+int htt_wbm_event_record(struct htt_logger *h, uint8_t tx_status,
+ uint8_t *msg_data)
+{
+ return 0;
+}
+
+#endif
#define HTT_TX_MUTEX_TYPE qdf_spinlock_t
@@ -81,6 +117,8 @@
void *ctrl_psoc;
void *dp_soc;
void *hal_soc;
+ /* htt_logger handle */
+ struct htt_logger *htt_logger_handle;
HTC_HANDLE htc_soc;
qdf_device_t osdev;
HTC_ENDPOINT_ID htc_endpoint;
diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c
index 2024e52..df6d857 100644
--- a/dp/wifi3.0/dp_tx.c
+++ b/dp/wifi3.0/dp_tx.c
@@ -17,6 +17,7 @@
*/
#include "htt.h"
+#include "dp_htt.h"
#include "hal_hw_headers.h"
#include "dp_tx.h"
#include "dp_tx_desc.h"
@@ -3187,6 +3188,7 @@
uint32_t *htt_desc = (uint32_t *)status;
struct dp_peer *peer;
struct cdp_tid_tx_stats *tid_stats = NULL;
+ struct htt_soc *htt_handle;
qdf_assert(tx_desc->pdev);
@@ -3196,8 +3198,9 @@
if (!vdev)
return;
-
tx_status = HTT_TX_WBM_COMPLETION_V2_TX_STATUS_GET(htt_desc[0]);
+ htt_handle = (struct htt_soc *)soc->htt_handle;
+ htt_wbm_event_record(htt_handle->htt_logger_handle, tx_status, status);
switch (tx_status) {
case HTT_TX_FW2WBM_TX_STATUS_OK:
diff --git a/qdf/linux/src/qdf_debugfs.c b/qdf/linux/src/qdf_debugfs.c
index f590a87..f16908b 100644
--- a/qdf/linux/src/qdf_debugfs.c
+++ b/qdf/linux/src/qdf_debugfs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2019 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
@@ -165,6 +165,8 @@
va_end(args);
}
+qdf_export_symbol(qdf_debugfs_printf);
+
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
void qdf_debugfs_hexdump(qdf_debugfs_file_t file, const uint8_t *buf,