diff --git a/qdf/inc/qdf_trace.h b/qdf/inc/qdf_trace.h index 638412a317..ad151cef63 100644 --- a/qdf/inc/qdf_trace.h +++ b/qdf/inc/qdf_trace.h @@ -529,6 +529,7 @@ static inline void qdf_trace_enable(uint32_t bitmask_of_module_id, uint8_t enable) { } + static inline void qdf_trace(uint8_t module, uint8_t code, uint16_t session, uint32_t data) { @@ -548,6 +549,56 @@ QDF_STATUS qdf_trace_spin_lock_init(void) #endif #endif +#ifdef ENABLE_MTRACE_LOG +/** + * qdf_mtrace_log() - Logs a message tracepoint to DIAG + * Infrastructure. + * @src_module: Enum of source module (basically module id) + * from where the message with message_id is posted. + * @dst_module: Enum of destination module (basically module id) + * to which the message with message_id is posted. + * @message_id: Id of the message to be posted + * @vdev_id: Vdev Id + * + * This function logs to the DIAG Infrastructure a tracepoint for a + * message being sent from a source module to a destination module + * with a specific ID for the benefit of a specific vdev. + * For non-vdev messages vdev_id will be NO_SESSION + * Return: None + */ +void qdf_mtrace_log(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module, + uint16_t message_id, uint8_t vdev_id); +#else +static inline +void qdf_mtrace_log(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module, + uint16_t message_id, uint8_t vdev_id) +{ +} +#endif + +/** + * qdf_mtrace() - puts the messages in to ring-buffer + * and logs a message tracepoint to DIAG Infrastructure. + * @src_module: Enum of source module (basically module id) + * from where the message with message_id is posted. + * @dst_module: Enum of destination module (basically module id) + * to which the message with message_id is posted. + * @message_id: Id of the message to be posted + * @vdev_id: Vdev Id + * @data: Actual message contents + * + * This function will be called from each module which wants to record the + * messages in circular queue. Before calling this function make sure you + * have registered your module with qdf through qdf_trace_register function. + * In addition of the recording the messages in circular queue this function + * will log the message tracepoint to the DIAG infrastructure. + * these logs will be later used by post processing script. + * + * Return: None + */ +void qdf_mtrace(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module, + uint16_t message_id, uint8_t vdev_id, uint32_t data); + #ifdef CONFIG_DP_TRACE void qdf_dp_set_proto_bitmap(uint32_t val); void qdf_dp_trace_set_verbosity(uint32_t val); diff --git a/qdf/linux/src/qdf_trace.c b/qdf/linux/src/qdf_trace.c index 8cc840195b..0f492f0d67 100644 --- a/qdf/linux/src/qdf_trace.c +++ b/qdf/linux/src/qdf_trace.c @@ -514,7 +514,7 @@ qdf_export_symbol(qdf_trace_deinit); /** * qdf_trace() - puts the messages in to ring-buffer * @module: Enum of module, basically module id. - * @param: Code to be recorded + * @code: Code to be recorded * @session: Session ID of the log * @data: Actual message contents * @@ -580,6 +580,32 @@ void qdf_trace(uint8_t module, uint8_t code, uint16_t session, uint32_t data) } qdf_export_symbol(qdf_trace); +#ifdef ENABLE_MTRACE_LOG +void qdf_mtrace_log(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module, + uint16_t message_id, uint8_t vdev_id) +{ + uint32_t trace_log, payload; + static uint16_t counter; + + trace_log = (src_module << 23) | (dst_module << 15) | message_id; + payload = (vdev_id << 16) | counter++; + + QDF_TRACE(src_module, QDF_TRACE_LEVEL_TRACE, "%x %x", + trace_log, payload); +} + +qdf_export_symbol(qdf_mtrace_log); +#endif + +void qdf_mtrace(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module, + uint16_t message_id, uint8_t vdev_id, uint32_t data) +{ + qdf_trace(src_module, message_id, vdev_id, data); + qdf_mtrace_log(src_module, dst_module, message_id, vdev_id); +} + +qdf_export_symbol(qdf_mtrace); + /** * qdf_trace_spin_lock_init() - initializes the lock variable before use *