xref: /wlan-driver/qcacld-3.0/core/mac/src/pe/include/lim_trace.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2013-2016, 2019-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**=========================================================================
20 
21  *  \file  lim_trace.h
22 
23  *  \brief definition for trace related APIs
24 
25  *  \author Sunit Bhatia
26 
27    ========================================================================*/
28 
29 #ifndef __LIM_TRACE_H
30 #define __LIM_TRACE_H
31 
32 #include "lim_global.h"
33 #include "mac_trace.h"
34 #include "qdf_trace.h"
35 
36 enum pecodetype {
37 	TRACE_CODE_MLM_STATE,
38 	TRACE_CODE_SME_STATE,
39 	TRACE_CODE_TX_MGMT,
40 	TRACE_CODE_RX_MGMT,
41 	TRACE_CODE_RX_MGMT_TSF,
42 	TRACE_CODE_TX_COMPLETE,
43 	TRACE_CODE_TX_SME_MSG,
44 	TRACE_CODE_RX_SME_MSG,
45 	TRACE_CODE_TX_WMA_MSG,
46 	TRACE_CODE_RX_WMA_MSG,
47 	TRACE_CODE_TX_LIM_MSG,
48 	TRACE_CODE_RX_LIM_MSG,
49 	TRACE_CODE_RX_MGMT_DROP,
50 
51 	TRACE_CODE_TIMER_ACTIVATE,
52 	TRACE_CODE_TIMER_DEACTIVATE,
53 	TRACE_CODE_INFO_LOG
54 };
55 
56 #ifdef LIM_TRACE_RECORD
57 
58 #define LIM_TRACE_GET_SSN(data)    (((data) >> 16) & 0xff)
59 #define LIM_TRACE_GET_SUBTYPE(data)    ((data) & 0xff)
60 #define LIM_TRACE_GET_DEFRD_OR_DROPPED(data) ((data) & 0xc0000000)
61 
62 #define LIM_MSG_PROCESSED 0
63 #define LIM_MSG_DEFERRED   1
64 #define LIM_MSG_DROPPED     2
65 
66 #define LIM_TRACE_MAKE_RXMGMT(type, ssn) \
67 	(((ssn) << 16) | (type))
68 #define LIM_TRACE_MAKE_RXMSG(msg, action) \
69 	((msg) | ((action) << 30))
70 
71 void lim_trace_init(struct mac_context *mac);
72 uint8_t *lim_trace_get_mlm_state_string(uint32_t mlmState);
73 uint8_t *lim_trace_get_sme_state_string(uint32_t smeState);
74 void lim_trace_dump(void *mac, tp_qdf_trace_record pRecord,
75 		    uint16_t recIndex);
76 void mac_trace_msg_tx(struct mac_context *mac, uint8_t session, uint32_t data);
77 void mac_trace_msg_rx(struct mac_context *mac, uint8_t session, uint32_t data);
78 
79 #endif /* endof LIM_TRACE_RECORD MACRO */
80 
81 #endif
82