1 /* 2 * Copyright (c) 2013-2018 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 #ifndef WLAN_ROAM_DEBUG_MAX_REC 48 #define WLAN_ROAM_DEBUG_MAX_REC 256 49 #endif 50 51 /** 52 * struct wlan_roam_debug_info - Buffer to store the wma debug records 53 * @index: index of the most recent entry in the circular buffer 54 * @num_max_rec: maximum records stored in the records array 55 * @rec: array to store wma debug records, used in circular fashion 56 */ 57 struct wlan_roam_debug_info { 58 qdf_atomic_t index; 59 uint32_t num_max_rec; 60 struct wlan_roam_debug_rec rec[WLAN_ROAM_DEBUG_MAX_REC]; 61 }; 62 63 /** 64 * @DEBUG_PEER_CREATE_SEND: sent peer_create command to firmware 65 * @DEBUG_PEER_CREATE_RESP: received peer create response 66 * @DEBUG_PEER_DELETE_SEND: sent peer delete command to firmware 67 * @DEBUG_PEER_DELETE_RESP: received peer delete response 68 * @DEBUG_PEER_MAP_EVENT: received peer map event 69 * @DEBUG_PEER_UNMAP_EVENT: received peer unmap event 70 * @DEBUG_PEER_UNREF_DELETE: peer reference is decremented 71 * @DEBUG_DELETING_PEER_OBJ: peer object is deleted 72 * @DEBUG_ROAM_SYNCH_IND: received roam offload sync indication 73 * @DEBUG_ROAM_SYNCH_CNF: sent roam offload sync confirmation 74 * @DEBUG_ROAM_SYNCH_FAIL: received roam sync failure indication 75 * @DEBUG_ROAM_EVENT: received roam event 76 * @DEBUG_BUS_SUSPEND: host going into suspend mode 77 * @DEBUG_BUS_RESUME: host operation resumed 78 */ 79 80 enum peer_debug_op { 81 DEBUG_PEER_CREATE_SEND = 0, 82 DEBUG_PEER_CREATE_RESP, 83 DEBUG_PEER_DELETE_SEND, 84 DEBUG_PEER_DELETE_RESP, 85 DEBUG_PEER_MAP_EVENT, 86 DEBUG_PEER_UNMAP_EVENT, 87 DEBUG_PEER_UNREF_DELETE, 88 DEBUG_DELETING_PEER_OBJ, 89 DEBUG_ROAM_SYNCH_IND, 90 DEBUG_ROAM_SYNCH_CNF, 91 DEBUG_ROAM_SYNCH_FAIL, 92 DEBUG_ROAM_EVENT, 93 DEBUG_WOW_ROAM_EVENT, 94 DEBUG_BUS_SUSPEND, 95 DEBUG_BUS_RESUME, 96 DEBUG_WOW_REASON, 97 }; 98 99 #define DEBUG_INVALID_PEER_ID 0xffff 100 #define DEBUG_INVALID_VDEV_ID 0xff 101 102 #ifdef FEATURE_ROAM_DEBUG 103 /** 104 * wlan_roam_debug_log() - Add a debug log entry to wlan roam debug records 105 * @vdev_id: vdev identifier 106 * @op: operation identifier 107 * @peer_id: peer id 108 * @mac_addr: mac address of peer, can be NULL 109 * @peer_obj: peer object address, can be NULL 110 * @arg1: extra argument #1 111 * @arg2: extra argument #2 112 * 113 * Return: none 114 */ 115 void wlan_roam_debug_log(uint8_t vdev_id, uint8_t op, 116 uint16_t peer_id, void *mac_addr, 117 void *peer_obj, uint32_t arg1, uint32_t arg2); 118 119 /** 120 * wlan_roam_debug_dump_table() - Print the roam debug log records 121 * print all the valid debug records in the order of timestamp 122 * 123 * Return: none 124 */ 125 void wlan_roam_debug_dump_table(void); 126 127 #ifdef WLAN_LOGGING_BUFFERS_DYNAMICALLY 128 /** 129 * wlan_roam_debug_init() - Allocate log buffer dynamically 130 * 131 * Return: none 132 */ 133 void wlan_roam_debug_init(void); 134 /** 135 * wlan_roam_debug_deinit() - Free log buffer allocated dynamically 136 * 137 * Return: none 138 */ 139 void wlan_roam_debug_deinit(void); 140 #else /* WLAN_LOGGING_BUFFERS_DYNAMICALLY */ 141 static inline void wlan_roam_debug_init(void) 142 { 143 } 144 145 static inline void wlan_roam_debug_deinit(void) 146 { 147 } 148 #endif /* WLAN_LOGGING_BUFFERS_DYNAMICALLY */ 149 150 #else /* FEATURE_ROAM_DEBUG */ 151 static inline void 152 wlan_roam_debug_log(uint8_t vdev_id, uint8_t op, 153 uint16_t peer_id, void *mac_addr, 154 void *peer_obj, uint32_t arg1, uint32_t arg2) 155 { 156 } 157 158 static inline void wlan_roam_debug_dump_table(void) 159 { 160 } 161 #endif /* FEATURE_ROAM_DEBUG */ 162 163 #endif /* _WLAN_ROAM_DEBUG_H_ */ 164