wlan_roam_debug.h 4.2 KB

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