xref: /wlan-dirver/qca-wifi-host-cmn/utils/logging/inc/wlan_roam_debug.h (revision fffcebf2e926a46534518e770b63d1ab6574e139)
1 /*
2  * Copyright (c) 2013-2017 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  * DOC: Roaming debug log operations declarations
20  */
21 #ifndef _WLAN_ROAM_DEBUG_H_
22 #define _WLAN_ROAM_DEBUG_H_
23 
24 
25 /**
26  * struct wlan_roam_debug_rec - roam debug information record definition
27  * @time: timestamp when record was added
28  * @operation: identifier for operation, command, event, etc.
29  * @vdev_id: vdev identifier
30  * @peer_id: peer_id. Range 0 - 255, 0xffff is invalid peer_id.
31  * @mac_addr: mac address of peer
32  * @peer_obj: pointer to peer object
33  * @arg1: Optional argument #1
34  * @arg2: Opttional argument #2
35  */
36 struct wlan_roam_debug_rec {
37 	uint64_t time;
38 	uint8_t operation;
39 	uint8_t vdev_id;
40 	uint16_t peer_id;
41 	struct qdf_mac_addr mac_addr;
42 	void *peer_obj;
43 	uint32_t arg1;
44 	uint32_t arg2;
45 };
46 
47 #define WLAN_ROAM_DEBUG_MAX_REC 256
48 /**
49  * struct wlan_roam_debug_info - Buffer to store the wma debug records
50  * @index: index of the most recent entry in the circular buffer
51  * @num_max_rec: maximum records stored in the records array
52  * @rec: array to store wma debug records, used in circular fashion
53  */
54 struct wlan_roam_debug_info {
55 	qdf_atomic_t index;
56 	uint32_t num_max_rec;
57 	struct wlan_roam_debug_rec rec[WLAN_ROAM_DEBUG_MAX_REC];
58 };
59 
60 /**
61  * @DEBUG_PEER_CREATE_SEND: sent peer_create command to firmware
62  * @DEBUG_PEER_CREATE_RESP: received peer create response
63  * @DEBUG_PEER_DELETE_SEND: sent peer delete command to firmware
64  * @DEBUG_PEER_DELETE_RESP: received peer delete response
65  * @DEBUG_PEER_MAP_EVENT: received peer map event
66  * @DEBUG_PEER_UNMAP_EVENT: received peer unmap event
67  * @DEBUG_PEER_UNREF_DELETE: peer reference is decremented
68  * @DEBUG_DELETING_PEER_OBJ: peer object is deleted
69  * @DEBUG_ROAM_SYNCH_IND: received roam offload sync indication
70  * @DEBUG_ROAM_SYNCH_CNF: sent roam offload sync confirmation
71  * @DEBUG_ROAM_SYNCH_FAIL: received roam sync failure indication
72  * @DEBUG_ROAM_EVENT: received roam event
73  * @DEBUG_BUS_SUSPEND: host going into suspend mode
74  * @DEBUG_BUS_RESUME: host operation resumed
75  */
76 
77 enum peer_debug_op {
78 	DEBUG_PEER_CREATE_SEND = 0,
79 	DEBUG_PEER_CREATE_RESP,
80 	DEBUG_PEER_DELETE_SEND,
81 	DEBUG_PEER_DELETE_RESP,
82 	DEBUG_PEER_MAP_EVENT,
83 	DEBUG_PEER_UNMAP_EVENT,
84 	DEBUG_PEER_UNREF_DELETE,
85 	DEBUG_DELETING_PEER_OBJ,
86 	DEBUG_ROAM_SYNCH_IND,
87 	DEBUG_ROAM_SYNCH_CNF,
88 	DEBUG_ROAM_SYNCH_FAIL,
89 	DEBUG_ROAM_EVENT,
90 	DEBUG_WOW_ROAM_EVENT,
91 	DEBUG_BUS_SUSPEND,
92 	DEBUG_BUS_RESUME,
93 	DEBUG_WOW_REASON,
94 };
95 
96 #define DEBUG_INVALID_PEER_ID 0xffff
97 #define DEBUG_INVALID_VDEV_ID 0xff
98 
99 /**
100  * wlan_roam_debug_log() - Add a debug log entry to wlan roam debug records
101  * @vdev_id: vdev identifier
102  * @op: operation identifier
103  * @peer_id: peer id
104  * @mac_addr: mac address of peer, can be NULL
105  * @peer_obj: peer object address, can be NULL
106  * @arg1: extra argument #1
107  * @arg2: extra argument #2
108  *
109  * Return: none
110  */
111 void wlan_roam_debug_log(uint8_t vdev_id, uint8_t op,
112 			uint16_t peer_id, void *mac_addr,
113 			void *peer_obj, uint32_t arg1, uint32_t arg2);
114 
115 /**
116  * wlan_roam_debug_dump_table() - Print the roam debug log records
117  * print all the valid debug records in the order of timestamp
118  *
119  * Return: none
120  */
121 void wlan_roam_debug_dump_table(void);
122 #endif /* _WLAN_ROAM_DEBUG_H_ */
123