wlan_roam_debug.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /*
  2. * Copyright (c) 2013-2019, 2021 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. #define roam_debug(args ...) \
  24. QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_ROAM_DEBUG, ## args)
  25. #define roam_info(args ...) \
  26. QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_ROAM_DEBUG, ## args)
  27. #define wlan_rec_conn_info(vdev_id, op, mac_addr, arg1, arg2) \
  28. wlan_rec_debug_log(REC_CONN, vdev_id, op, 0, mac_addr, 0, arg1,\
  29. arg2)
  30. #ifndef WLAN_ROAM_DEBUG_MAX_REC
  31. #define WLAN_ROAM_DEBUG_MAX_REC 128
  32. #endif
  33. typedef enum {
  34. REC_ROAM,
  35. REC_CONN,
  36. REC_MAX,
  37. } wlan_rec_type;
  38. /**
  39. * @DEBUG_PEER_CREATE_SEND: sent peer_create command to firmware
  40. * @DEBUG_PEER_CREATE_RESP: received peer create response
  41. * @DEBUG_PEER_DELETE_SEND: sent peer delete command to firmware
  42. * @DEBUG_PEER_DELETE_RESP: received peer delete response
  43. * @DEBUG_PEER_MAP_EVENT: received peer map event
  44. * @DEBUG_PEER_UNMAP_EVENT: received peer unmap event
  45. * @DEBUG_PEER_UNREF_DELETE: peer reference is decremented
  46. * @DEBUG_DELETING_PEER_OBJ: peer object is deleted
  47. * @DEBUG_ROAM_SYNCH_IND: received roam offload sync indication
  48. * @DEBUG_ROAM_SYNCH_CNF: sent roam offload sync confirmation
  49. * @DEBUG_ROAM_SYNCH_FAIL: received roam sync failure indication
  50. * @DEBUG_ROAM_EVENT: received roam event
  51. * @DEBUG_BUS_SUSPEND: host going into suspend mode
  52. * @DEBUG_BUS_RESUME: host operation resumed
  53. * @DEBUG_CONN_CONNECTING: trace connecting to bssid
  54. * @DEBUG_CONN_ASSOCIATION: trace association completion
  55. * @DEBUG_CONN_CONNECT_RESULT: trace connect result to os
  56. * @DEBUG_CONN_ROAMING: trace station roaming propagtion
  57. * @DEBUG_CONN_ROAMED: trace roamed to bssid
  58. * @DEBUG_CONN_ROAMED_IND: trace roam indication
  59. * @DEBUG_CONN_DISCONNECT: trace station disconnect
  60. * @DEBUG_CONN_DISCONNECT_HANDLER: trace disconnect handler
  61. * @DEBUG_CONN_DISCONNECT_IND: trace disconnect indication
  62. */
  63. enum peer_debug_op {
  64. DEBUG_PEER_CREATE_SEND = 0,
  65. DEBUG_PEER_CREATE_RESP,
  66. DEBUG_PEER_DELETE_SEND,
  67. DEBUG_PEER_DELETE_RESP,
  68. DEBUG_PEER_MAP_EVENT,
  69. DEBUG_PEER_UNMAP_EVENT,
  70. DEBUG_PEER_UNREF_DELETE,
  71. DEBUG_DELETING_PEER_OBJ,
  72. DEBUG_ROAM_SYNCH_IND,
  73. DEBUG_ROAM_SYNCH_CNF,
  74. DEBUG_ROAM_SYNCH_FAIL,
  75. DEBUG_ROAM_EVENT,
  76. DEBUG_WOW_ROAM_EVENT,
  77. DEBUG_BUS_SUSPEND,
  78. DEBUG_BUS_RESUME,
  79. DEBUG_WOW_REASON,
  80. DEBUG_CONN_CONNECTING,
  81. DEBUG_CONN_ASSOCIATION,
  82. DEBUG_CONN_CONNECT_RESULT,
  83. DEBUG_CONN_ROAMING,
  84. DEBUG_CONN_ROAMED,
  85. DEBUG_CONN_ROAMED_IND,
  86. DEBUG_CONN_DISCONNECT,
  87. DEBUG_CONN_DISCONNECT_HANDLER,
  88. DEBUG_CONN_DISCONNECT_IND,
  89. };
  90. /**
  91. * struct wlan_roam_debug_rec - roam debug information record definition
  92. * @time: timestamp when record was added
  93. * @operation: identifier for operation, command, event, etc.
  94. * @vdev_id: vdev identifier
  95. * @peer_id: peer_id. Range 0 - 255, 0xffff is invalid peer_id.
  96. * @mac_addr: mac address of peer
  97. * @peer_obj: pointer to peer object
  98. * @arg1: Optional argument #1
  99. * @arg2: Opttional argument #2
  100. */
  101. struct wlan_roam_debug_rec {
  102. uint64_t time;
  103. enum peer_debug_op operation;
  104. uint8_t vdev_id;
  105. uint16_t peer_id;
  106. struct qdf_mac_addr mac_addr;
  107. void *peer_obj;
  108. uint32_t arg1;
  109. uint32_t arg2;
  110. };
  111. /**
  112. * struct wlan_roam_debug_info - Buffer to store the wma debug records
  113. * @index: index of the most recent entry in the circular buffer
  114. * @num_max_rec: maximum records stored in the records array
  115. * @rec: array to store wma debug records, used in circular fashion
  116. */
  117. struct wlan_roam_debug_info {
  118. qdf_atomic_t index;
  119. uint32_t num_max_rec;
  120. void (*rec_print)(struct wlan_roam_debug_rec *dbg_rec,
  121. uint32_t idx, uint32_t delta,
  122. bool to_kernel);
  123. struct wlan_roam_debug_rec rec[WLAN_ROAM_DEBUG_MAX_REC];
  124. };
  125. #define DEBUG_INVALID_PEER_ID 0xffff
  126. #define DEBUG_INVALID_VDEV_ID 0xff
  127. #ifdef FEATURE_ROAM_DEBUG
  128. /**
  129. * wlan_roam_debug_log() - Add a debug log entry to wlan roam debug records
  130. * @vdev_id: vdev identifier
  131. * @op: operation identifier
  132. * @peer_id: peer id
  133. * @mac_addr: mac address of peer, can be NULL
  134. * @peer_obj: peer object address, can be NULL
  135. * @arg1: extra argument #1
  136. * @arg2: extra argument #2
  137. *
  138. * Return: none
  139. */
  140. void wlan_roam_debug_log(uint8_t vdev_id, uint8_t op,
  141. uint16_t peer_id, void *mac_addr,
  142. void *peer_obj, uint32_t arg1, uint32_t arg2);
  143. /**
  144. * wlan_rec_debug_log() - Add a debug log entry to wlan debug records
  145. * @rec_type: record type
  146. * @vdev_id: vdev identifier
  147. * @op: operation identifier
  148. * @peer_id: peer id
  149. * @mac_addr: mac address of peer, can be NULL
  150. * @peer_obj: peer object address, can be NULL
  151. * @arg1: extra argument #1
  152. * @arg2: extra argument #2
  153. *
  154. * Return: none
  155. */
  156. void wlan_rec_debug_log(wlan_rec_type rec_type, uint8_t vdev_id, uint8_t op,
  157. uint16_t peer_id, const void *mac_addr,
  158. void *peer_obj, uint32_t arg1, uint32_t arg2);
  159. /**
  160. * wlan_roam_debug_dump_table() - Print the roam debug log records
  161. * print all the valid debug records in the order of timestamp
  162. *
  163. * Return: none
  164. */
  165. void wlan_roam_debug_dump_table(void);
  166. /**
  167. * wlan_rec_debug_dump_table() - Print the wlan roam debug log records
  168. * @rec_type: recorad type
  169. * @count: count of records to print
  170. * @to_kernel: print to kernel or not
  171. *
  172. * print all the valid debug records in the order of timestamp
  173. *
  174. * Return: none
  175. */
  176. void wlan_rec_debug_dump_table(wlan_rec_type rec_type, uint32_t count,
  177. bool to_kernel);
  178. #ifdef WLAN_LOGGING_BUFFERS_DYNAMICALLY
  179. /**
  180. * wlan_roam_debug_init() - Allocate log buffer dynamically
  181. *
  182. * Return: none
  183. */
  184. void wlan_roam_debug_init(void);
  185. /**
  186. * wlan_roam_debug_deinit() - Free log buffer allocated dynamically
  187. *
  188. * Return: none
  189. */
  190. void wlan_roam_debug_deinit(void);
  191. #else /* WLAN_LOGGING_BUFFERS_DYNAMICALLY */
  192. static inline void wlan_roam_debug_init(void)
  193. {
  194. }
  195. static inline void wlan_roam_debug_deinit(void)
  196. {
  197. }
  198. #endif /* WLAN_LOGGING_BUFFERS_DYNAMICALLY */
  199. #else /* FEATURE_ROAM_DEBUG */
  200. static inline void
  201. wlan_roam_debug_log(uint8_t vdev_id, uint8_t op,
  202. uint16_t peer_id, void *mac_addr,
  203. void *peer_obj, uint32_t arg1, uint32_t arg2)
  204. {
  205. }
  206. static inline void wlan_rec_debug_log(
  207. wlan_rec_type rec_type, uint8_t vdev_id, uint8_t op,
  208. uint16_t peer_id, const void *mac_addr,
  209. void *peer_obj, uint32_t arg1, uint32_t arg2)
  210. {
  211. }
  212. static inline void wlan_roam_debug_dump_table(void)
  213. {
  214. }
  215. static inline void wlan_rec_debug_dump_table(wlan_rec_type rec_type,
  216. uint32_t count,
  217. bool to_kernel)
  218. {
  219. }
  220. static inline void wlan_roam_debug_init(void)
  221. {
  222. }
  223. static inline void wlan_roam_debug_deinit(void)
  224. {
  225. }
  226. #endif /* FEATURE_ROAM_DEBUG */
  227. #endif /* _WLAN_ROAM_DEBUG_H_ */