wlan_roam_debug.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. #define roam_debug(args ...) \
  24. QDF_TRACE_DEBUG(QDF_MODULE_ID_ROAM_DEBUG, ## args)
  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. #ifndef WLAN_ROAM_DEBUG_MAX_REC
  47. #define WLAN_ROAM_DEBUG_MAX_REC 256
  48. #endif
  49. /**
  50. * struct wlan_roam_debug_info - Buffer to store the wma debug records
  51. * @index: index of the most recent entry in the circular buffer
  52. * @num_max_rec: maximum records stored in the records array
  53. * @rec: array to store wma debug records, used in circular fashion
  54. */
  55. struct wlan_roam_debug_info {
  56. qdf_atomic_t index;
  57. uint32_t num_max_rec;
  58. struct wlan_roam_debug_rec rec[WLAN_ROAM_DEBUG_MAX_REC];
  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. enum peer_debug_op {
  77. DEBUG_PEER_CREATE_SEND = 0,
  78. DEBUG_PEER_CREATE_RESP,
  79. DEBUG_PEER_DELETE_SEND,
  80. DEBUG_PEER_DELETE_RESP,
  81. DEBUG_PEER_MAP_EVENT,
  82. DEBUG_PEER_UNMAP_EVENT,
  83. DEBUG_PEER_UNREF_DELETE,
  84. DEBUG_DELETING_PEER_OBJ,
  85. DEBUG_ROAM_SYNCH_IND,
  86. DEBUG_ROAM_SYNCH_CNF,
  87. DEBUG_ROAM_SYNCH_FAIL,
  88. DEBUG_ROAM_EVENT,
  89. DEBUG_WOW_ROAM_EVENT,
  90. DEBUG_BUS_SUSPEND,
  91. DEBUG_BUS_RESUME,
  92. DEBUG_WOW_REASON,
  93. };
  94. #define DEBUG_INVALID_PEER_ID 0xffff
  95. #define DEBUG_INVALID_VDEV_ID 0xff
  96. #ifdef FEATURE_ROAM_DEBUG
  97. /**
  98. * wlan_roam_debug_log() - Add a debug log entry to wlan roam debug records
  99. * @vdev_id: vdev identifier
  100. * @op: operation identifier
  101. * @peer_id: peer id
  102. * @mac_addr: mac address of peer, can be NULL
  103. * @peer_obj: peer object address, can be NULL
  104. * @arg1: extra argument #1
  105. * @arg2: extra argument #2
  106. *
  107. * Return: none
  108. */
  109. void wlan_roam_debug_log(uint8_t vdev_id, uint8_t op,
  110. uint16_t peer_id, void *mac_addr,
  111. void *peer_obj, uint32_t arg1, uint32_t arg2);
  112. /**
  113. * wlan_roam_debug_dump_table() - Print the roam debug log records
  114. * print all the valid debug records in the order of timestamp
  115. *
  116. * Return: none
  117. */
  118. void wlan_roam_debug_dump_table(void);
  119. #ifdef WLAN_LOGGING_BUFFERS_DYNAMICALLY
  120. /**
  121. * wlan_roam_debug_init() - Allocate log buffer dynamically
  122. *
  123. * Return: none
  124. */
  125. void wlan_roam_debug_init(void);
  126. /**
  127. * wlan_roam_debug_deinit() - Free log buffer allocated dynamically
  128. *
  129. * Return: none
  130. */
  131. void wlan_roam_debug_deinit(void);
  132. #else /* WLAN_LOGGING_BUFFERS_DYNAMICALLY */
  133. static inline void wlan_roam_debug_init(void)
  134. {
  135. }
  136. static inline void wlan_roam_debug_deinit(void)
  137. {
  138. }
  139. #endif /* WLAN_LOGGING_BUFFERS_DYNAMICALLY */
  140. #else /* FEATURE_ROAM_DEBUG */
  141. static inline void
  142. wlan_roam_debug_log(uint8_t vdev_id, uint8_t op,
  143. uint16_t peer_id, void *mac_addr,
  144. void *peer_obj, uint32_t arg1, uint32_t arg2)
  145. {
  146. }
  147. static inline void wlan_roam_debug_dump_table(void)
  148. {
  149. }
  150. #endif /* FEATURE_ROAM_DEBUG */
  151. #endif /* _WLAN_ROAM_DEBUG_H_ */