wlan_roam_debug.h 7.3 KB

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