From 308f5758846d6a01be96fba5cdbceb973755187e Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Thu, 2 Aug 2018 14:26:53 +0530 Subject: [PATCH] qcacmn: Add wmi wrapper function for mtrace logging For qdf_mtrace 15 bits are reserved for message id and currently WMI message IDs are getting used as 32 bit IDs. Write a wrapper function which accepts 32 bit message IDs and converts this 32 bit message id to 15 bit by extracting WMI_GRP_ID and WMI_MESSAGE_ID in that group. New 15 bit message ID for qdf_mtrace will be constucted as 8 bits (From LSB) specifies the WMI_GRP_ID and remaining 7 bits specifies the actual WMI command. With this notation there can be maximum 256 groups and each group can have max 128 commands which can be supported. Change-Id: Ia5adfc079b63c2311bdc8ae4c73488d89afd462f CRs-Fixed: 2298877 --- qdf/inc/qdf_trace.h | 14 ++++++++++++++ wmi/src/wmi_unified_tlv.c | 27 +++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/qdf/inc/qdf_trace.h b/qdf/inc/qdf_trace.h index 194763defd74..ec4321c81385 100644 --- a/qdf/inc/qdf_trace.h +++ b/qdf/inc/qdf_trace.h @@ -40,6 +40,20 @@ #define QDF_TRACE_BUFFER_SIZE (512) +/* + * Extracts the 8-bit group id from the wmi command id by performing the + * reverse operation of WMI_CMD_GRP_START_ID + */ +#define QDF_WMI_MTRACE_GRP_ID(message_id) (((message_id) >> 12) & 0xFF) +/* + * Number of bits reserved for WMI mtrace command id + */ + #define QDF_WMI_MTRACE_CMD_NUM_BITS 7 +/* + * Extracts the 7-bit group specific command id from the wmi command id + */ +#define QDF_WMI_MTRACE_CMD_ID(message_id) ((message_id) & 0x7F) + #ifdef CONFIG_MCL #define QDF_DEFAULT_TRACE_LEVEL \ ((1 << QDF_TRACE_LEVEL_FATAL) | (1 << QDF_TRACE_LEVEL_ERROR)) diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 2bedad45872c..ea340bfe0720 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -143,6 +143,33 @@ static inline void copy_vdev_create_pdev_id( } #endif +/** + * wmi_mtrace() - Wrappper function for qdf_mtrace api + * @message_id: 32-Bit Wmi message ID + * @vdev_id: Vdev ID + * @data: Actual message contents + * + * This function converts the 32-bit WMI message ID in 15-bit message ID + * format for qdf_mtrace as in qdf_mtrace message there are only 15 + * bits reserved for message ID. + * out of these 15-bits, 8-bits (From MSB) specifies the WMI_GRP_ID + * and remaining 7-bits specifies the actual WMI command. With this + * notation there can be maximum 256 groups and each group can have + * max 128 commands can be supported. + * + * Return: None + */ +static void wmi_mtrace(uint32_t message_id, uint16_t vdev_id, uint32_t data) +{ + uint16_t mtrace_message_id; + + mtrace_message_id = QDF_WMI_MTRACE_CMD_ID(message_id) | + (QDF_WMI_MTRACE_GRP_ID(message_id) << + QDF_WMI_MTRACE_CMD_NUM_BITS); + qdf_mtrace(QDF_MODULE_ID_WMI, QDF_MODULE_ID_TARGET, + mtrace_message_id, vdev_id, data); +} + /** * send_vdev_create_cmd_tlv() - send VDEV create command to fw * @wmi_handle: wmi handle