xref: /wlan-driver/qca-wifi-host-cmn/utils/logging/inc/wlan_roam_debug.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2013-2019, 2021 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
4*5113495bSYour Name  *
5*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
6*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
7*5113495bSYour Name  * above copyright notice and this permission notice appear in all
8*5113495bSYour Name  * copies.
9*5113495bSYour Name  *
10*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
18*5113495bSYour Name  */
19*5113495bSYour Name /*
20*5113495bSYour Name  * DOC: Roaming debug log operations declarations
21*5113495bSYour Name  */
22*5113495bSYour Name #ifndef _WLAN_ROAM_DEBUG_H_
23*5113495bSYour Name #define _WLAN_ROAM_DEBUG_H_
24*5113495bSYour Name 
25*5113495bSYour Name #define roam_debug(args ...) \
26*5113495bSYour Name 		QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_ROAM_DEBUG, ## args)
27*5113495bSYour Name #define roam_info(args ...) \
28*5113495bSYour Name 		QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_ROAM_DEBUG, ## args)
29*5113495bSYour Name 
30*5113495bSYour Name #define wlan_rec_conn_info(vdev_id, op, mac_addr, arg1, arg2) \
31*5113495bSYour Name 	wlan_rec_debug_log(REC_CONN, vdev_id, op, 0, mac_addr, 0, arg1,\
32*5113495bSYour Name 			   arg2)
33*5113495bSYour Name 
34*5113495bSYour Name #ifndef WLAN_ROAM_DEBUG_MAX_REC
35*5113495bSYour Name #define WLAN_ROAM_DEBUG_MAX_REC 128
36*5113495bSYour Name #endif
37*5113495bSYour Name 
38*5113495bSYour Name typedef enum {
39*5113495bSYour Name 	REC_ROAM,
40*5113495bSYour Name 	REC_CONN,
41*5113495bSYour Name 	REC_MAX,
42*5113495bSYour Name } wlan_rec_type;
43*5113495bSYour Name 
44*5113495bSYour Name /**
45*5113495bSYour Name  * @DEBUG_PEER_CREATE_SEND: sent peer_create command to firmware
46*5113495bSYour Name  * @DEBUG_PEER_CREATE_RESP: received peer create response
47*5113495bSYour Name  * @DEBUG_PEER_DELETE_SEND: sent peer delete command to firmware
48*5113495bSYour Name  * @DEBUG_PEER_DELETE_RESP: received peer delete response
49*5113495bSYour Name  * @DEBUG_PEER_MAP_EVENT: received peer map event
50*5113495bSYour Name  * @DEBUG_PEER_UNMAP_EVENT: received peer unmap event
51*5113495bSYour Name  * @DEBUG_PEER_UNREF_DELETE: peer reference is decremented
52*5113495bSYour Name  * @DEBUG_DELETING_PEER_OBJ: peer object is deleted
53*5113495bSYour Name  * @DEBUG_ROAM_SYNCH_IND: received roam offload sync indication
54*5113495bSYour Name  * @DEBUG_ROAM_SYNCH_CNF: sent roam offload sync confirmation
55*5113495bSYour Name  * @DEBUG_ROAM_SYNCH_FAIL: received roam sync failure indication
56*5113495bSYour Name  * @DEBUG_ROAM_EVENT: received roam event
57*5113495bSYour Name  * @DEBUG_BUS_SUSPEND: host going into suspend mode
58*5113495bSYour Name  * @DEBUG_BUS_RESUME: host operation resumed
59*5113495bSYour Name  * @DEBUG_CONN_CONNECTING: trace connecting to bssid
60*5113495bSYour Name  * @DEBUG_CONN_ASSOCIATION: trace association completion
61*5113495bSYour Name  * @DEBUG_CONN_CONNECT_RESULT: trace connect result to os
62*5113495bSYour Name  * @DEBUG_CONN_ROAMING: trace station roaming propagtion
63*5113495bSYour Name  * @DEBUG_CONN_ROAMED: trace roamed to bssid
64*5113495bSYour Name  * @DEBUG_CONN_ROAMED_IND: trace roam indication
65*5113495bSYour Name  * @DEBUG_CONN_DISCONNECT: trace station disconnect
66*5113495bSYour Name  * @DEBUG_CONN_DISCONNECT_HANDLER: trace disconnect handler
67*5113495bSYour Name  * @DEBUG_CONN_DISCONNECT_IND: trace disconnect indication
68*5113495bSYour Name  * @DEBUG_CONN_RSO: trace RSO state changing
69*5113495bSYour Name  */
70*5113495bSYour Name enum peer_debug_op {
71*5113495bSYour Name 	DEBUG_PEER_CREATE_SEND = 0,
72*5113495bSYour Name 	DEBUG_PEER_CREATE_RESP,
73*5113495bSYour Name 	DEBUG_PEER_DELETE_SEND,
74*5113495bSYour Name 	DEBUG_PEER_DELETE_RESP,
75*5113495bSYour Name 	DEBUG_PEER_MAP_EVENT,
76*5113495bSYour Name 	DEBUG_PEER_UNMAP_EVENT,
77*5113495bSYour Name 	DEBUG_PEER_UNREF_DELETE,
78*5113495bSYour Name 	DEBUG_DELETING_PEER_OBJ,
79*5113495bSYour Name 	DEBUG_ROAM_SYNCH_IND,
80*5113495bSYour Name 	DEBUG_ROAM_SYNCH_CNF,
81*5113495bSYour Name 	DEBUG_ROAM_SYNCH_FAIL,
82*5113495bSYour Name 	DEBUG_ROAM_EVENT,
83*5113495bSYour Name 	DEBUG_WOW_ROAM_EVENT,
84*5113495bSYour Name 	DEBUG_BUS_SUSPEND,
85*5113495bSYour Name 	DEBUG_BUS_RESUME,
86*5113495bSYour Name 	DEBUG_WOW_REASON,
87*5113495bSYour Name 	DEBUG_CONN_CONNECTING,
88*5113495bSYour Name 	DEBUG_CONN_ASSOCIATION,
89*5113495bSYour Name 	DEBUG_CONN_CONNECT_RESULT,
90*5113495bSYour Name 	DEBUG_CONN_ROAMING,
91*5113495bSYour Name 	DEBUG_CONN_ROAMED,
92*5113495bSYour Name 	DEBUG_CONN_ROAMED_IND,
93*5113495bSYour Name 	DEBUG_CONN_DISCONNECT,
94*5113495bSYour Name 	DEBUG_CONN_DISCONNECT_HANDLER,
95*5113495bSYour Name 	DEBUG_CONN_DISCONNECT_IND,
96*5113495bSYour Name 	DEBUG_CONN_RSO,
97*5113495bSYour Name };
98*5113495bSYour Name 
99*5113495bSYour Name /**
100*5113495bSYour Name  * struct wlan_roam_debug_rec - roam debug information record definition
101*5113495bSYour Name  * @time: timestamp when record was added
102*5113495bSYour Name  * @operation: identifier for operation, command, event, etc.
103*5113495bSYour Name  * @vdev_id: vdev identifier
104*5113495bSYour Name  * @peer_id: peer_id. Range 0 - 255, 0xffff is invalid peer_id.
105*5113495bSYour Name  * @mac_addr: mac address of peer
106*5113495bSYour Name  * @peer_obj: pointer to peer object
107*5113495bSYour Name  * @arg1: Optional argument #1
108*5113495bSYour Name  * @arg2: Opttional argument #2
109*5113495bSYour Name  */
110*5113495bSYour Name struct wlan_roam_debug_rec {
111*5113495bSYour Name 	uint64_t time;
112*5113495bSYour Name 	enum peer_debug_op operation;
113*5113495bSYour Name 	uint8_t vdev_id;
114*5113495bSYour Name 	uint16_t peer_id;
115*5113495bSYour Name 	struct qdf_mac_addr mac_addr;
116*5113495bSYour Name 	void *peer_obj;
117*5113495bSYour Name 	uint32_t arg1;
118*5113495bSYour Name 	uint32_t arg2;
119*5113495bSYour Name };
120*5113495bSYour Name 
121*5113495bSYour Name /**
122*5113495bSYour Name  * struct wlan_roam_debug_info - Buffer to store the wma debug records
123*5113495bSYour Name  * @index: index of the most recent entry in the circular buffer
124*5113495bSYour Name  * @num_max_rec: maximum records stored in the records array
125*5113495bSYour Name  * @rec: array to store wma debug records, used in circular fashion
126*5113495bSYour Name  */
127*5113495bSYour Name struct wlan_roam_debug_info {
128*5113495bSYour Name 	qdf_atomic_t index;
129*5113495bSYour Name 	uint32_t num_max_rec;
130*5113495bSYour Name 	void (*rec_print)(struct wlan_roam_debug_rec *dbg_rec,
131*5113495bSYour Name 			  uint32_t idx, uint32_t delta,
132*5113495bSYour Name 			  bool to_kernel);
133*5113495bSYour Name 	struct wlan_roam_debug_rec rec[WLAN_ROAM_DEBUG_MAX_REC];
134*5113495bSYour Name };
135*5113495bSYour Name 
136*5113495bSYour Name #define DEBUG_INVALID_PEER_ID 0xffff
137*5113495bSYour Name #define DEBUG_INVALID_VDEV_ID 0xff
138*5113495bSYour Name 
139*5113495bSYour Name #ifdef FEATURE_ROAM_DEBUG
140*5113495bSYour Name /**
141*5113495bSYour Name  * wlan_roam_debug_log() - Add a debug log entry to wlan roam debug records
142*5113495bSYour Name  * @vdev_id: vdev identifier
143*5113495bSYour Name  * @op: operation identifier
144*5113495bSYour Name  * @peer_id: peer id
145*5113495bSYour Name  * @mac_addr: mac address of peer, can be NULL
146*5113495bSYour Name  * @peer_obj: peer object address, can be NULL
147*5113495bSYour Name  * @arg1: extra argument #1
148*5113495bSYour Name  * @arg2: extra argument #2
149*5113495bSYour Name  *
150*5113495bSYour Name  * Return: none
151*5113495bSYour Name  */
152*5113495bSYour Name void wlan_roam_debug_log(uint8_t vdev_id, uint8_t op,
153*5113495bSYour Name 			uint16_t peer_id, void *mac_addr,
154*5113495bSYour Name 			void *peer_obj, uint32_t arg1, uint32_t arg2);
155*5113495bSYour Name /**
156*5113495bSYour Name  * wlan_rec_debug_log() - Add a debug log entry to wlan debug records
157*5113495bSYour Name  * @rec_type: record type
158*5113495bSYour Name  * @vdev_id: vdev identifier
159*5113495bSYour Name  * @op: operation identifier
160*5113495bSYour Name  * @peer_id: peer id
161*5113495bSYour Name  * @mac_addr: mac address of peer, can be NULL
162*5113495bSYour Name  * @peer_obj: peer object address, can be NULL
163*5113495bSYour Name  * @arg1: extra argument #1
164*5113495bSYour Name  * @arg2: extra argument #2
165*5113495bSYour Name  *
166*5113495bSYour Name  * Return: none
167*5113495bSYour Name  */
168*5113495bSYour Name void wlan_rec_debug_log(wlan_rec_type rec_type, uint8_t vdev_id, uint8_t op,
169*5113495bSYour Name 			uint16_t peer_id, const void *mac_addr,
170*5113495bSYour Name 			void *peer_obj, uint32_t arg1, uint32_t arg2);
171*5113495bSYour Name 
172*5113495bSYour Name /**
173*5113495bSYour Name  * wlan_roam_debug_dump_table() - Print the roam debug log records
174*5113495bSYour Name  * print all the valid debug records in the order of timestamp
175*5113495bSYour Name  *
176*5113495bSYour Name  * Return: none
177*5113495bSYour Name  */
178*5113495bSYour Name void wlan_roam_debug_dump_table(void);
179*5113495bSYour Name 
180*5113495bSYour Name /**
181*5113495bSYour Name  * wlan_rec_debug_dump_table() - Print the wlan roam debug log records
182*5113495bSYour Name  * @rec_type: recorad type
183*5113495bSYour Name  * @count: count of records to print
184*5113495bSYour Name  * @to_kernel: print to kernel or not
185*5113495bSYour Name  *
186*5113495bSYour Name  * print all the valid debug records in the order of timestamp
187*5113495bSYour Name  *
188*5113495bSYour Name  * Return: none
189*5113495bSYour Name  */
190*5113495bSYour Name void wlan_rec_debug_dump_table(wlan_rec_type rec_type, uint32_t count,
191*5113495bSYour Name 			       bool to_kernel);
192*5113495bSYour Name 
193*5113495bSYour Name #ifdef WLAN_LOGGING_BUFFERS_DYNAMICALLY
194*5113495bSYour Name /**
195*5113495bSYour Name  * wlan_roam_debug_init() - Allocate log buffer dynamically
196*5113495bSYour Name  *
197*5113495bSYour Name  * Return: none
198*5113495bSYour Name  */
199*5113495bSYour Name void wlan_roam_debug_init(void);
200*5113495bSYour Name /**
201*5113495bSYour Name  * wlan_roam_debug_deinit() - Free log buffer allocated dynamically
202*5113495bSYour Name  *
203*5113495bSYour Name  * Return: none
204*5113495bSYour Name  */
205*5113495bSYour Name void wlan_roam_debug_deinit(void);
206*5113495bSYour Name #else /* WLAN_LOGGING_BUFFERS_DYNAMICALLY */
wlan_roam_debug_init(void)207*5113495bSYour Name static inline void wlan_roam_debug_init(void)
208*5113495bSYour Name {
209*5113495bSYour Name }
210*5113495bSYour Name 
wlan_roam_debug_deinit(void)211*5113495bSYour Name static inline void wlan_roam_debug_deinit(void)
212*5113495bSYour Name {
213*5113495bSYour Name }
214*5113495bSYour Name #endif /* WLAN_LOGGING_BUFFERS_DYNAMICALLY */
215*5113495bSYour Name 
216*5113495bSYour Name #else /* FEATURE_ROAM_DEBUG */
217*5113495bSYour Name static inline void
wlan_roam_debug_log(uint8_t vdev_id,uint8_t op,uint16_t peer_id,void * mac_addr,void * peer_obj,uint32_t arg1,uint32_t arg2)218*5113495bSYour Name wlan_roam_debug_log(uint8_t vdev_id, uint8_t op,
219*5113495bSYour Name 		    uint16_t peer_id, void *mac_addr,
220*5113495bSYour Name 		    void *peer_obj, uint32_t arg1, uint32_t arg2)
221*5113495bSYour Name {
222*5113495bSYour Name }
223*5113495bSYour Name 
wlan_rec_debug_log(wlan_rec_type rec_type,uint8_t vdev_id,uint8_t op,uint16_t peer_id,const void * mac_addr,void * peer_obj,uint32_t arg1,uint32_t arg2)224*5113495bSYour Name static inline void wlan_rec_debug_log(
225*5113495bSYour Name 			wlan_rec_type rec_type, uint8_t vdev_id, uint8_t op,
226*5113495bSYour Name 			uint16_t peer_id, const void *mac_addr,
227*5113495bSYour Name 			void *peer_obj, uint32_t arg1, uint32_t arg2)
228*5113495bSYour Name {
229*5113495bSYour Name }
230*5113495bSYour Name 
wlan_roam_debug_dump_table(void)231*5113495bSYour Name static inline void wlan_roam_debug_dump_table(void)
232*5113495bSYour Name {
233*5113495bSYour Name }
234*5113495bSYour Name 
wlan_rec_debug_dump_table(wlan_rec_type rec_type,uint32_t count,bool to_kernel)235*5113495bSYour Name static inline void wlan_rec_debug_dump_table(wlan_rec_type rec_type,
236*5113495bSYour Name 					     uint32_t count,
237*5113495bSYour Name 					     bool to_kernel)
238*5113495bSYour Name {
239*5113495bSYour Name }
240*5113495bSYour Name 
wlan_roam_debug_init(void)241*5113495bSYour Name static inline void wlan_roam_debug_init(void)
242*5113495bSYour Name {
243*5113495bSYour Name }
244*5113495bSYour Name 
wlan_roam_debug_deinit(void)245*5113495bSYour Name static inline void wlan_roam_debug_deinit(void)
246*5113495bSYour Name {
247*5113495bSYour Name }
248*5113495bSYour Name #endif /* FEATURE_ROAM_DEBUG */
249*5113495bSYour Name 
250*5113495bSYour Name #endif /* _WLAN_ROAM_DEBUG_H_ */
251