dp_htt_logger.c 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094
  1. /*
  2. * Copyright (c) 2019 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. #include <linux/debugfs.h>
  19. #include <linux/uaccess.h>
  20. #include "qdf_lock.h"
  21. #include "qdf_debugfs.h"
  22. #include "qdf_module.h"
  23. #include "qdf_list.h"
  24. #include "dp_htt_logger.h"
  25. #define HTT_DBG_FILE_PERM (QDF_FILE_USR_READ | QDF_FILE_USR_WRITE | \
  26. QDF_FILE_GRP_READ | \
  27. QDF_FILE_OTH_READ)
  28. /**
  29. * HTT_DISPLAY_SIZE : Supported Number of command/event/wbm_event to be
  30. * read at one shot through wdf debugfs framework
  31. */
  32. #define HTT_DISPLAY_SIZE 25
  33. /**
  34. * Used for stop_seq
  35. * Bit 0: htt_command_log
  36. * Bit 1: htt_event_log
  37. * Bit 2: htt_wbm_event_log
  38. * Bit 3: htt_log_size
  39. * Bit 4: htt_enable
  40. * Bit 5: htt_cmd_disable_list
  41. * Bit 6: htt_event_disable_list
  42. * Bit 7: htt_wbm_event_disable_list
  43. * Bit 8-15: Reserved
  44. */
  45. #define HTT_COMMAND_LOG_BP 0
  46. #define HTT_EVENT_LOG_BP 1
  47. #define HTT_WBM_EVENT_LOG_BP 2
  48. #define HTT_LOG_SIZE_BP 3
  49. #define HTT_ENABLE_BP 4
  50. #define HTT_CMD_DISABLE_LIST_BP 5
  51. #define HTT_EVENT_DISABLE_LIST 6
  52. #define HTT_WBM_EVENT_DISABLE_LIST 7
  53. /**
  54. * Host messages which needs to be enabled by default
  55. *
  56. * Note: Below macro definition is cloned from
  57. * enum htt_t2h_msg_type fw_hdr/fw/htt.h and any
  58. * change in enum htt_t2h_msg_type for below field
  59. * will need a change here as well.
  60. */
  61. #define HTT_T2H_MSG_TYPE_PEER_MAP_C 0x3
  62. #define HTT_T2H_MSG_TYPE_PEER_UNMAP_C 0x4
  63. #define HTT_T2H_MSG_TYPE_RX_ADDBA_C 0x5
  64. #define HTT_T2H_MSG_TYPE_RX_DELBA_C 0x6
  65. #define HTT_T2H_MSG_TYPE_PEER_MAP_V2_C 0x1e
  66. #define HTT_T2H_MSG_TYPE_PEER_UNMAP_V2_C 0x1f
  67. /**
  68. * disable_all_command(): Disable all command
  69. * disable_all_event(): Disable all event
  70. * enable_event(): Enable specific event
  71. */
  72. #define disable_all_command(htt_logger_handle) \
  73. htt_logger_handle->log_info.htt_cmd_disable_list = 0xFFFFFFFFFFFFFFFF
  74. #define disable_all_event(htt_logger_handle)\
  75. htt_logger_handle->log_info.htt_event_disable_list = 0xFFFFFFFFFFFFFFFF
  76. #define disable_wbm_success_status(htt_logger_handle) \
  77. htt_logger_handle->log_info.htt_wbm_event_disable_list = 0x1
  78. #define enable_htt_logging(htt_logger_handle) \
  79. htt_logger_handle->log_info.htt_logging_enable = 1
  80. #define enable_event(htt_logger_handle, eventid) \
  81. do { \
  82. htt_disable_mask = ~(0x1 << eventid); \
  83. htt_logger_handle->log_info.htt_event_disable_list &= \
  84. htt_disable_mask; \
  85. } while (0)
  86. /**
  87. * log_buf_init() - Initialize htt buffer
  88. */
  89. static inline void log_buf_init(struct htt_log_buf_t *buf)
  90. {
  91. buf->length = 0;
  92. buf->buf_tail_idx = 0;
  93. buf->size = HTT_EVENT_DEBUG_MAX_ENTRY;
  94. }
  95. /**
  96. * htt_command_record() - Record Command
  97. * @ h - htt logger handle
  98. * @ msg_type - Command Id
  99. * @ msg_data - Data to be logged
  100. */
  101. int htt_command_record(struct htt_logger *h, uint8_t msg_type,
  102. uint8_t *msg_data)
  103. {
  104. struct htt_command_debug *buf = NULL;
  105. uint32_t *p_buf_tail_idx = NULL;
  106. uint8_t tdata[HTT_COMMAND_DEBUG_ENTRY_MAX_LENGTH];
  107. struct htt_log_buf_t *cmd_log_buf;
  108. /* return 0 if:
  109. * 1. Initialization failed.
  110. * 2. htt_logging_enable is 0 -> can get disable from file ops
  111. * 3. This specific msg_type is disabled
  112. */
  113. if (!h)
  114. return 0;
  115. cmd_log_buf = &h->log_info.htt_command_log_buf_info;
  116. if ((0 == h->log_info.htt_logging_enable) ||
  117. ((1 << msg_type) & h->log_info.htt_cmd_disable_list))
  118. return 0;
  119. qdf_spin_lock(&cmd_log_buf->record_lock);
  120. if (!msg_data) {
  121. /* if msg_data is NULL then fill 0xFF in data field */
  122. qdf_mem_set(tdata, HTT_COMMAND_DEBUG_ENTRY_MAX_LENGTH, 0xFF);
  123. msg_data = tdata;
  124. }
  125. p_buf_tail_idx = &h->log_info.htt_command_log_buf_info.buf_tail_idx;
  126. /* rewind pointer index if buffer became full */
  127. if (HTT_EVENT_DEBUG_MAX_ENTRY <= *p_buf_tail_idx)
  128. *p_buf_tail_idx = 0;
  129. buf = h->log_info.htt_command_log_buf_info.buf;
  130. buf[*p_buf_tail_idx].command = msg_type;
  131. qdf_mem_copy(buf[*p_buf_tail_idx].data, msg_data,
  132. HTT_COMMAND_DEBUG_ENTRY_MAX_LENGTH);
  133. buf[*p_buf_tail_idx].time = qdf_get_log_timestamp();
  134. buf[*p_buf_tail_idx].cpu_id = smp_processor_id();
  135. (*p_buf_tail_idx)++;
  136. h->log_info.htt_command_log_buf_info.length++;
  137. qdf_spin_unlock(&cmd_log_buf->record_lock);
  138. return 0;
  139. }
  140. /**
  141. * htt_event_record() - Record Event
  142. * @ h - htt logger handle
  143. * @ msg_type - Event Id
  144. * @ msg_data - Data to be logged
  145. */
  146. int htt_event_record(struct htt_logger *h, uint8_t msg_type, uint8_t *msg_data)
  147. {
  148. struct htt_event_debug *buf = NULL;
  149. uint32_t *p_buf_tail_idx = NULL;
  150. uint8_t tdata[HTT_EVENT_DEBUG_ENTRY_MAX_LENGTH];
  151. struct htt_log_buf_t *event_log_buf;
  152. /* return 0 if:
  153. * 1. Initialization failed.
  154. * 2. htt_logging_enable is 0 -> can get disable from file ops
  155. * 3. This specific msg_type is disabled
  156. */
  157. if (!h)
  158. return 0;
  159. event_log_buf = &h->log_info.htt_event_log_buf_info;
  160. if ((0 == h->log_info.htt_logging_enable) ||
  161. ((1 << msg_type) & h->log_info.htt_event_disable_list))
  162. return 0;
  163. qdf_spin_lock(&event_log_buf->record_lock);
  164. if (!msg_data) {
  165. /* if msg_data is NULL then fill 0xFF in data field */
  166. qdf_mem_set(tdata, HTT_EVENT_DEBUG_ENTRY_MAX_LENGTH, 0xFF);
  167. msg_data = tdata;
  168. }
  169. p_buf_tail_idx = &h->log_info.htt_event_log_buf_info.buf_tail_idx;
  170. /* rewind pointer index if buffer became full */
  171. if (HTT_EVENT_DEBUG_MAX_ENTRY <= *p_buf_tail_idx)
  172. *p_buf_tail_idx = 0;
  173. buf = h->log_info.htt_event_log_buf_info.buf;
  174. buf[*p_buf_tail_idx].event = msg_type;
  175. qdf_mem_copy(buf[*p_buf_tail_idx].data, msg_data,
  176. HTT_EVENT_DEBUG_ENTRY_MAX_LENGTH);
  177. buf[*p_buf_tail_idx].time = qdf_get_log_timestamp();
  178. buf[*p_buf_tail_idx].cpu_id = smp_processor_id();
  179. (*p_buf_tail_idx)++;
  180. h->log_info.htt_event_log_buf_info.length++;
  181. qdf_spin_unlock(&event_log_buf->record_lock);
  182. return 0;
  183. }
  184. /**
  185. * htt_wbm_event_recored() - Record HTT wbm event
  186. *
  187. * @ h - Pointer for HTT tracer
  188. * @ tx_status - Status flag
  189. * @ msg_data - Event data
  190. */
  191. int htt_wbm_event_record(struct htt_logger *h, uint8_t tx_status,
  192. uint8_t *msg_data)
  193. {
  194. uint32_t *p_buf_tail_idx = NULL;
  195. struct htt_wbm_event_debug *buf = NULL;
  196. uint8_t tdata[HTT_WBM_EVENT_DEBUG_ENTRY_MAX_LENGTH];
  197. struct htt_log_buf_t *wbm_event_log_buf;
  198. /* return 0 if:
  199. * 1. Initialization failed.
  200. * 2. htt_logging_enable is 0 -> can get disable from file ops
  201. * 3. This specific tx_status is disabled can be used to disable
  202. * tx_Status when tx_status is successful.
  203. */
  204. if (!h)
  205. return 0;
  206. wbm_event_log_buf = &h->log_info.htt_wbm_event_log_buf_info;
  207. if ((0 == h->log_info.htt_logging_enable) ||
  208. ((1 << tx_status) & h->log_info.htt_wbm_event_disable_list))
  209. return 0;
  210. qdf_spin_lock(&wbm_event_log_buf->record_lock);
  211. if (!msg_data) {
  212. /* if msg_data is NULL then fill 0xFF in data field */
  213. qdf_mem_set(tdata, HTT_WBM_EVENT_DEBUG_ENTRY_MAX_LENGTH, 0xFF);
  214. msg_data = tdata;
  215. }
  216. p_buf_tail_idx = &h->log_info.htt_wbm_event_log_buf_info.buf_tail_idx;
  217. if (HTT_EVENT_DEBUG_MAX_ENTRY <= *p_buf_tail_idx)
  218. *p_buf_tail_idx = 0;
  219. buf = h->log_info.htt_wbm_event_log_buf_info.buf;
  220. buf[*p_buf_tail_idx].tx_status = tx_status;
  221. qdf_mem_copy(buf[*p_buf_tail_idx].data, msg_data,
  222. HTT_WBM_EVENT_DEBUG_ENTRY_MAX_LENGTH);
  223. buf[*p_buf_tail_idx].time = qdf_get_log_timestamp();
  224. buf[*p_buf_tail_idx].cpu_id = smp_processor_id();
  225. (*p_buf_tail_idx)++;
  226. h->log_info.htt_wbm_event_log_buf_info.length++;
  227. qdf_spin_unlock(&wbm_event_log_buf->record_lock);
  228. return 0;
  229. }
  230. /* debugfs routines */
  231. /**
  232. * debug_htt_command_log_show() - debugfs functions to display content of
  233. * command and event buffers. Macro uses max buffer length to display
  234. * buffer when it is wraparound.
  235. *
  236. * @m: qdf_debugfs handler to access htt_logger_handle
  237. * @arg: Private data htt_logger_hand here
  238. *
  239. * Return: Status
  240. */
  241. static QDF_STATUS debug_htt_command_log_show(qdf_debugfs_file_t file, void *arg)
  242. {
  243. struct htt_logger *htt_logger_handle = (struct htt_logger *)arg;
  244. struct htt_log_buf_t *htt_log = NULL;
  245. int pos, nread, i;
  246. uint64_t secs, usecs;
  247. htt_log = &htt_logger_handle->log_info.htt_command_log_buf_info;
  248. /* If message already read, return and reset this bit*/
  249. /* Bit set to 1 : indicates it is read
  250. * Bit set to 0 : indicates 1st time read
  251. */
  252. if ((htt_logger_handle->log_info.stop_seq &
  253. (0x1 << HTT_COMMAND_LOG_BP))) {
  254. htt_logger_handle->log_info.stop_seq &=
  255. (~(0x1 << HTT_COMMAND_LOG_BP));
  256. return QDF_STATUS_SUCCESS;
  257. }
  258. qdf_spin_lock(&htt_logger_handle->log_info.htt_record_lock);
  259. if (!htt_log->length) {
  260. qdf_spin_unlock(&htt_logger_handle->log_info.htt_record_lock);
  261. qdf_debugfs_printf(file,
  262. "no elements to read from ring buffer!\n");
  263. /* setting bit sothat in next come we will return in start */
  264. htt_logger_handle->log_info.stop_seq |=
  265. (0x1 << HTT_COMMAND_LOG_BP);
  266. return QDF_STATUS_SUCCESS;
  267. }
  268. if (htt_log->length <= HTT_DISPLAY_SIZE)
  269. nread = htt_log->length;
  270. else
  271. nread = HTT_DISPLAY_SIZE;
  272. if (htt_log->buf_tail_idx == 0)
  273. pos = HTT_DISPLAY_SIZE - 1;
  274. else
  275. pos = htt_log->buf_tail_idx - 1;
  276. qdf_debugfs_printf(file, "Length = %d\n", htt_log->length);
  277. qdf_spin_unlock(&htt_logger_handle->log_info.htt_record_lock);
  278. while (nread--) {
  279. struct htt_command_debug *htt_record;
  280. htt_record = (struct htt_command_debug *)
  281. &(((struct htt_command_debug *)htt_log->buf)[pos]);
  282. qdf_debugfs_printf(file, "CMD ID = %x\n",
  283. htt_record->command);
  284. qdf_debugfs_printf(file, "DATA[0-%d]:",
  285. HTT_COMMAND_DEBUG_ENTRY_MAX_LENGTH - 1);
  286. for (i = 0; i < HTT_COMMAND_DEBUG_ENTRY_MAX_LENGTH; i++)
  287. qdf_debugfs_printf(file, "%x ", htt_record->data[i]);
  288. qdf_log_timestamp_to_secs(htt_record->time, &secs, &usecs);
  289. qdf_debugfs_printf(file, "\nCPU ID = %d", htt_record->cpu_id);
  290. qdf_debugfs_printf(file, "\nCMD TIME = [%llu.%06llu]\n",
  291. secs, usecs);
  292. if (pos == 0)
  293. pos = HTT_DISPLAY_SIZE - 1;
  294. else
  295. pos--;
  296. }
  297. htt_logger_handle->log_info.stop_seq |=
  298. (0x1 << HTT_COMMAND_LOG_BP);
  299. return QDF_STATUS_SUCCESS;
  300. }
  301. static QDF_STATUS debug_htt_event_log_show(qdf_debugfs_file_t file, void *arg)
  302. {
  303. struct htt_logger *htt_logger_handle = (struct htt_logger *)arg;
  304. struct htt_log_buf_t *htt_log = NULL;
  305. int pos, nread, i;
  306. uint64_t secs, usecs;
  307. htt_log = &htt_logger_handle->log_info.htt_event_log_buf_info;
  308. if ((htt_logger_handle->log_info.stop_seq &
  309. (0x1 << HTT_EVENT_LOG_BP))) {
  310. htt_logger_handle->log_info.stop_seq &=
  311. (~(0x1 << HTT_EVENT_LOG_BP));
  312. return QDF_STATUS_SUCCESS;
  313. }
  314. qdf_spin_lock(&htt_logger_handle->log_info.htt_record_lock);
  315. if (!htt_log->length) {
  316. qdf_spin_unlock(&htt_logger_handle->log_info.htt_record_lock);
  317. qdf_debugfs_printf(file,
  318. "no elements to read from ring buffer!\n");
  319. htt_logger_handle->log_info.stop_seq |=
  320. (0x1 << HTT_EVENT_LOG_BP);
  321. return QDF_STATUS_SUCCESS;
  322. }
  323. if (htt_log->length <= HTT_DISPLAY_SIZE)
  324. nread = htt_log->length;
  325. else
  326. nread = HTT_DISPLAY_SIZE;
  327. if (htt_log->buf_tail_idx == 0)
  328. pos = HTT_DISPLAY_SIZE - 1;
  329. else
  330. pos = htt_log->buf_tail_idx - 1;
  331. qdf_debugfs_printf(file, "Length = %d\n", htt_log->length);
  332. qdf_spin_unlock(&htt_logger_handle->log_info.htt_record_lock);
  333. while (nread--) {
  334. struct htt_event_debug *htt_record;
  335. htt_record = (struct htt_event_debug *)
  336. &(((struct htt_event_debug *)htt_log->buf)[pos]);
  337. qdf_debugfs_printf(file, "EVENT ID = %x\n", htt_record->event);
  338. qdf_debugfs_printf(file, "DATA[0 - %d]:",
  339. HTT_EVENT_DEBUG_ENTRY_MAX_LENGTH - 1);
  340. for (i = 0; i < HTT_EVENT_DEBUG_ENTRY_MAX_LENGTH; i++)
  341. qdf_debugfs_printf(file, "%x ", htt_record->data[i]);
  342. qdf_log_timestamp_to_secs(htt_record->time, &secs, &usecs);
  343. qdf_debugfs_printf(file, "\nCPU ID = %d", (htt_record->cpu_id));
  344. qdf_debugfs_printf(file, "\nEVENT TIME = [%llu.%06llu]\n",
  345. secs, usecs);
  346. if (pos == 0)
  347. pos = HTT_DISPLAY_SIZE - 1;
  348. else
  349. pos--;
  350. }
  351. htt_logger_handle->log_info.stop_seq |=
  352. (0x1 << HTT_EVENT_LOG_BP);
  353. return QDF_STATUS_SUCCESS;
  354. }
  355. static QDF_STATUS debug_htt_wbm_event_log_show(qdf_debugfs_file_t file,
  356. void *arg)
  357. {
  358. struct htt_logger *htt_logger_handle = (struct htt_logger *)arg;
  359. struct htt_log_buf_t *htt_log = NULL;
  360. int pos, nread, i;
  361. uint64_t secs, usecs;
  362. htt_log = &htt_logger_handle->log_info.htt_wbm_event_log_buf_info;
  363. if ((htt_logger_handle->log_info.stop_seq &
  364. (0x1 << HTT_WBM_EVENT_LOG_BP))) {
  365. htt_logger_handle->log_info.stop_seq &=
  366. (~(0x1 << HTT_WBM_EVENT_LOG_BP));
  367. return QDF_STATUS_SUCCESS;
  368. }
  369. qdf_spin_lock(&htt_logger_handle->log_info.htt_record_lock);
  370. if (!htt_log->length) {
  371. qdf_spin_unlock(&htt_logger_handle->log_info.htt_record_lock);
  372. qdf_debugfs_printf(file,
  373. "no elements to read from ring buffer!\n");
  374. htt_logger_handle->log_info.stop_seq |=
  375. (0x1 << HTT_WBM_EVENT_LOG_BP);
  376. return QDF_STATUS_SUCCESS;
  377. }
  378. if (htt_log->length <= HTT_DISPLAY_SIZE)
  379. nread = htt_log->length;
  380. else
  381. nread = HTT_DISPLAY_SIZE;
  382. if (htt_log->buf_tail_idx == 0)
  383. pos = HTT_DISPLAY_SIZE - 1;
  384. else
  385. pos = htt_log->buf_tail_idx - 1;
  386. qdf_debugfs_printf(file, "Length = %d\n", htt_log->length);
  387. qdf_spin_unlock(&htt_logger_handle->log_info.htt_record_lock);
  388. while (nread--) {
  389. struct htt_wbm_event_debug *htt_record;
  390. htt_record = (struct htt_wbm_event_debug *)
  391. &(((struct htt_wbm_event_debug *)htt_log->buf)[pos]);
  392. qdf_debugfs_printf(file, "WBM Event Tx status = = %x\n",
  393. htt_record->tx_status);
  394. qdf_debugfs_printf(file, "DATA[0-%d]:",
  395. HTT_WBM_EVENT_DEBUG_ENTRY_MAX_LENGTH - 1);
  396. for (i = 0; i < HTT_WBM_EVENT_DEBUG_ENTRY_MAX_LENGTH; i++)
  397. qdf_debugfs_printf(file, "%x ", htt_record->data[i]);
  398. qdf_log_timestamp_to_secs(htt_record->time, &secs, &usecs);
  399. qdf_debugfs_printf(file, "\nCPU ID = %d", (htt_record->cpu_id));
  400. qdf_debugfs_printf(file, "\nWBM EVENT TIME = [%llu.%06llu]\n",
  401. secs, usecs);
  402. if (pos == 0)
  403. pos = HTT_DISPLAY_SIZE - 1;
  404. else
  405. pos--;
  406. }
  407. htt_logger_handle->log_info.stop_seq |=
  408. (0x1 << HTT_WBM_EVENT_LOG_BP);
  409. return QDF_STATUS_SUCCESS;
  410. }
  411. /**
  412. * debug_htt_enable_show() - debugfs functions to display enable state of
  413. * htt logging feature.
  414. *
  415. * @file: qdf debugfs handler
  416. * @arg: priv data used to get htt_logger_handler
  417. *
  418. * Return: Status
  419. */
  420. static QDF_STATUS debug_htt_enable_show(qdf_debugfs_file_t file, void *arg)
  421. {
  422. struct htt_logger *htt_logger_handle = (struct htt_logger *)arg;
  423. struct htt_debug_log_info *log_info_p = &htt_logger_handle->log_info;
  424. if ((htt_logger_handle->log_info.stop_seq &
  425. (0x1 << HTT_ENABLE_BP))) {
  426. htt_logger_handle->log_info.stop_seq &=
  427. (~(0x1 << HTT_ENABLE_BP));
  428. return QDF_STATUS_SUCCESS;
  429. }
  430. qdf_debugfs_printf(file, "%d\n",
  431. log_info_p->htt_logging_enable);
  432. htt_logger_handle->log_info.stop_seq |=
  433. (0x1 << HTT_ENABLE_BP);
  434. return QDF_STATUS_SUCCESS;
  435. }
  436. /**
  437. * debug_htt_cmd_disable_list_show() - debugfs functions to display disabled
  438. * command id for tracing.
  439. *
  440. * @file: qdf debugfs handler
  441. * @arg: priv data used to get htt_logger_handler
  442. *
  443. * Return: Status
  444. */
  445. static QDF_STATUS debug_htt_cmd_disable_list_show(qdf_debugfs_file_t file,
  446. void *arg)
  447. {
  448. struct htt_logger *htt_logger_handle = (struct htt_logger *)arg;
  449. struct htt_debug_log_info *log_info_p = &htt_logger_handle->log_info;
  450. if ((htt_logger_handle->log_info.stop_seq &
  451. (0x1 << HTT_CMD_DISABLE_LIST_BP))) {
  452. htt_logger_handle->log_info.stop_seq &=
  453. (~(0x1 << HTT_CMD_DISABLE_LIST_BP));
  454. return QDF_STATUS_SUCCESS;
  455. }
  456. qdf_debugfs_printf(file, "%llu\n",
  457. log_info_p->htt_cmd_disable_list);
  458. htt_logger_handle->log_info.stop_seq |=
  459. (0x1 << HTT_CMD_DISABLE_LIST_BP);
  460. return QDF_STATUS_SUCCESS;
  461. }
  462. /**
  463. * debug_htt_event_disable_list_show() - debugfs functions to display disabled
  464. * event id for tracing.
  465. *
  466. * @file: qdf debugfs handler
  467. * @arg: priv data used to get htt_logger_handler
  468. *
  469. * Return: Status
  470. */
  471. static QDF_STATUS debug_htt_event_disable_list_show(qdf_debugfs_file_t file,
  472. void *arg)
  473. {
  474. struct htt_logger *htt_logger_handle = (struct htt_logger *)arg;
  475. struct htt_debug_log_info *log_info_p = &htt_logger_handle->log_info;
  476. if ((htt_logger_handle->log_info.stop_seq &
  477. (0x1 << HTT_EVENT_DISABLE_LIST))) {
  478. htt_logger_handle->log_info.stop_seq &=
  479. (~(0x1 << HTT_EVENT_DISABLE_LIST));
  480. return QDF_STATUS_SUCCESS;
  481. }
  482. qdf_debugfs_printf(file, "%llu\n",
  483. log_info_p->htt_event_disable_list);
  484. htt_logger_handle->log_info.stop_seq |=
  485. (0x1 << HTT_EVENT_DISABLE_LIST);
  486. return QDF_STATUS_SUCCESS;
  487. }
  488. /**
  489. * debug_htt_cmd_disable_list_show() - debugfs functions to display disabled
  490. * wbm event id for tracing.
  491. *
  492. * @file: qdf debugfs handler
  493. * @arg: priv data used to get htt_logger_handler
  494. *
  495. * Return: Status
  496. */
  497. static QDF_STATUS debug_htt_wbm_event_disable_list_show(qdf_debugfs_file_t file
  498. , void *arg)
  499. {
  500. struct htt_logger *htt_logger_handle = (struct htt_logger *)arg;
  501. struct htt_debug_log_info *log_info_p = &htt_logger_handle->log_info;
  502. if ((htt_logger_handle->log_info.stop_seq &
  503. (0x1 << HTT_WBM_EVENT_DISABLE_LIST))) {
  504. htt_logger_handle->log_info.stop_seq &=
  505. (~(0x1 << HTT_WBM_EVENT_DISABLE_LIST));
  506. return QDF_STATUS_SUCCESS;
  507. }
  508. qdf_debugfs_printf(file, "%llu\n",
  509. log_info_p->htt_wbm_event_disable_list);
  510. htt_logger_handle->log_info.stop_seq |=
  511. (0x1 << HTT_WBM_EVENT_DISABLE_LIST);
  512. return QDF_STATUS_SUCCESS;
  513. }
  514. /**
  515. * debug_htt_log_size_show() - debugfs functions to display configured size of
  516. * htt logging command/event buffer and management command/event buffer.
  517. *
  518. * @file: qdf debugfs handler
  519. * @arg: priv data used to get htt_logger_handler
  520. *
  521. * Return: Status
  522. */
  523. static QDF_STATUS debug_htt_log_size_show(qdf_debugfs_file_t file, void *arg)
  524. {
  525. struct htt_logger *htt_logger_handle = (struct htt_logger *)arg;
  526. if ((htt_logger_handle->log_info.stop_seq &
  527. (0x1 << HTT_LOG_SIZE_BP))) {
  528. htt_logger_handle->log_info.stop_seq &=
  529. (~(0x1 << HTT_LOG_SIZE_BP));
  530. return QDF_STATUS_SUCCESS;
  531. }
  532. qdf_debugfs_printf(file, "HTT command/event log max size:%d\n",
  533. HTT_EVENT_DEBUG_MAX_ENTRY);
  534. htt_logger_handle->log_info.stop_seq |=
  535. (0x1 << HTT_LOG_SIZE_BP);
  536. return QDF_STATUS_SUCCESS;
  537. }
  538. /**
  539. * debug_htt_##func_base##_write() - debugfs functions to clear
  540. * htt logging command/event buffer and management command/event buffer.
  541. *
  542. * @priv: file handler to access htt_logger_handle
  543. * @buf: received data buffer
  544. * @len: length of received buffer
  545. *
  546. * Return: Status
  547. */
  548. #define GENERATE_DEBUG_WRITE_FUNCS(func_base, htt_ring_size, htt_record_type) \
  549. static QDF_STATUS debug_htt_##func_base##_write(void *priv, \
  550. const char *buf, qdf_size_t len) \
  551. { \
  552. int k, ret; \
  553. struct htt_logger *htt_logger_handle = (struct htt_logger *)priv; \
  554. struct htt_log_buf_t *htt_log = &htt_logger_handle->log_info. \
  555. htt_##func_base##_buf_info; \
  556. ret = kstrtoint(buf, 0, &k); \
  557. if ((ret != 0) || (k != 0)) { \
  558. return QDF_STATUS_E_PERM; \
  559. } \
  560. qdf_spin_lock(&htt_logger_handle->log_info.htt_record_lock); \
  561. qdf_mem_zero(htt_log->buf, (htt_ring_size) * \
  562. sizeof(struct htt_record_type)); \
  563. htt_log->length = 0; \
  564. htt_log->buf_tail_idx = 0; \
  565. qdf_spin_unlock(&htt_logger_handle->log_info.htt_record_lock); \
  566. return QDF_STATUS_SUCCESS ; \
  567. }
  568. GENERATE_DEBUG_WRITE_FUNCS(command_log, HTT_EVENT_DEBUG_MAX_ENTRY,
  569. htt_command_debug);
  570. GENERATE_DEBUG_WRITE_FUNCS(event_log, HTT_EVENT_DEBUG_MAX_ENTRY,
  571. htt_event_debug);
  572. GENERATE_DEBUG_WRITE_FUNCS(wbm_event_log, HTT_EVENT_DEBUG_MAX_ENTRY,
  573. htt_wbm_event_debug);
  574. /**
  575. * debug_htt_enable_write() - debugfs functions to enable/disable
  576. * htt logging feature.
  577. *
  578. * @priv: file handler to access htt_logger_handle
  579. * @buf: received data buffer
  580. * @len: length of received buffer
  581. *
  582. * Return: QDF_STATUS
  583. */
  584. static QDF_STATUS debug_htt_enable_write(void *priv, const char *buf,
  585. qdf_size_t len)
  586. {
  587. struct htt_logger *htt_logger_handle = (struct htt_logger *)priv;
  588. int k, ret;
  589. ret = kstrtoint(buf, 0, &k);
  590. if ((ret != 1) || ((k != 0) && (k != 1)))
  591. return QDF_STATUS_E_PERM;
  592. htt_logger_handle->log_info.htt_logging_enable = k;
  593. return QDF_STATUS_SUCCESS;
  594. }
  595. /**
  596. * debug_htt_cmd_disable_list_write() - Debugfs write for command
  597. * to be disabled for tracing
  598. * @priv: file handler to access htt_logger_handle
  599. * @buf: received data buffer
  600. * @len: length of received buffer
  601. *
  602. * Return: QDF_STATUS
  603. */
  604. static QDF_STATUS debug_htt_cmd_disable_list_write(void *priv,
  605. const char *buf,
  606. qdf_size_t len)
  607. {
  608. struct htt_logger *htt_logger_handle = (struct htt_logger *)priv;
  609. int ret;
  610. uint64_t k;
  611. ret = kstrtou64(buf, 0, &k);
  612. if ((ret != 0) || ((k < 0) || (k > 0xFFFFFFFF)))
  613. return QDF_STATUS_E_PERM;
  614. htt_logger_handle->log_info.htt_cmd_disable_list = k;
  615. return QDF_STATUS_SUCCESS;
  616. }
  617. /**
  618. * debug_htt_event_disable_list_write() - Debugfs write for event
  619. * to be disabled for tracing
  620. * @priv: file handler to access htt_logger_handle
  621. * @buf: received data buffer
  622. * @len: length of received buffer
  623. *
  624. * Return: QDF_STATUS
  625. */
  626. static QDF_STATUS debug_htt_event_disable_list_write(void *priv,
  627. const char *buf,
  628. qdf_size_t len)
  629. {
  630. struct htt_logger *htt_logger_handle = (struct htt_logger *)priv;
  631. int ret;
  632. uint64_t k;
  633. ret = kstrtou64(buf, 0, &k);
  634. if ((ret != 0) || ((k < 0) || (k > 0xFFFFFFFF)))
  635. return QDF_STATUS_E_PERM;
  636. htt_logger_handle->log_info.htt_event_disable_list = k;
  637. return QDF_STATUS_SUCCESS;
  638. }
  639. /**
  640. * debug_htt_wbm_event_disable_list_write() - Debugfs write for wbm event
  641. * to be disabled for tracing
  642. * @priv: file handler to access htt_logger_handle
  643. * @buf: received data buffer
  644. * @len: length of received buffer
  645. *
  646. * Return: QDF_STATUS
  647. */
  648. static QDF_STATUS debug_htt_wbm_event_disable_list_write(void *priv,
  649. const char *buf,
  650. qdf_size_t len)
  651. {
  652. struct htt_logger *htt_logger_handle = (struct htt_logger *)priv;
  653. int ret;
  654. uint64_t k;
  655. ret = kstrtou64(buf, 0, &k);
  656. if ((ret != 0) || ((k < 0) || (k > 0xFFFFFFFF)))
  657. return QDF_STATUS_E_PERM;
  658. htt_logger_handle->log_info.htt_wbm_event_disable_list = k;
  659. return QDF_STATUS_SUCCESS;
  660. }
  661. /**
  662. * debug_htt_log_size_write() - reserved.
  663. *
  664. * @priv: file handler to access htt_logger_handle
  665. * @buf: received data buffer
  666. * @len: length of received buffer
  667. *
  668. * Return: QDF_STATUS
  669. */
  670. static QDF_STATUS debug_htt_log_size_write(void *priv,
  671. const char *buf,
  672. qdf_size_t len)
  673. {
  674. return -EINVAL;
  675. }
  676. /* Structure to maintain debug information */
  677. struct htt_debugfs_info {
  678. const char *name;
  679. struct qdf_debugfs_fops *ops;
  680. };
  681. #define DEBUGFS_FOPS(func_base) { .name = #func_base, \
  682. .ops = &debug_##func_base##_ops }
  683. #define GENERATE_DEBUG_STRUCTS(func_base) \
  684. \
  685. static struct qdf_debugfs_fops debug_##func_base##_ops = { \
  686. .show = debug_##func_base##_show, \
  687. .write = debug_##func_base##_write, \
  688. .priv = NULL, \
  689. }
  690. GENERATE_DEBUG_STRUCTS(htt_command_log);
  691. GENERATE_DEBUG_STRUCTS(htt_event_log);
  692. GENERATE_DEBUG_STRUCTS(htt_wbm_event_log);
  693. GENERATE_DEBUG_STRUCTS(htt_enable);
  694. GENERATE_DEBUG_STRUCTS(htt_log_size);
  695. GENERATE_DEBUG_STRUCTS(htt_cmd_disable_list);
  696. GENERATE_DEBUG_STRUCTS(htt_event_disable_list);
  697. GENERATE_DEBUG_STRUCTS(htt_wbm_event_disable_list);
  698. struct htt_debugfs_info htt_debugfs_infos[NUM_HTT_DEBUG_INFOS] = {
  699. DEBUGFS_FOPS(htt_command_log),
  700. DEBUGFS_FOPS(htt_event_log),
  701. DEBUGFS_FOPS(htt_wbm_event_log),
  702. DEBUGFS_FOPS(htt_enable),
  703. DEBUGFS_FOPS(htt_log_size),
  704. DEBUGFS_FOPS(htt_cmd_disable_list),
  705. DEBUGFS_FOPS(htt_event_disable_list),
  706. DEBUGFS_FOPS(htt_wbm_event_disable_list),
  707. };
  708. /**
  709. * htt_log_buffer_free() - Free all dynamic allocated buffer memory for
  710. * event logging
  711. * @htt_logger_handle: HTT handle.
  712. *
  713. * Return: None
  714. */
  715. static inline void htt_log_buffer_free(struct htt_logger *htt_logger_handle)
  716. {
  717. struct htt_debug_log_info *log_info_p = &htt_logger_handle->log_info;
  718. /* first disable logging and then free buffer and release lock */
  719. log_info_p->htt_logging_enable = 0;
  720. /* Free allocated buffer */
  721. if (log_info_p->htt_command_log_buf_info.buf) {
  722. qdf_mem_free(log_info_p->htt_command_log_buf_info.buf);
  723. log_info_p->htt_command_log_buf_info.buf = NULL;
  724. }
  725. if (log_info_p->htt_event_log_buf_info.buf) {
  726. qdf_mem_free(log_info_p->htt_event_log_buf_info.buf);
  727. log_info_p->htt_event_log_buf_info.buf = NULL;
  728. }
  729. if (log_info_p->htt_wbm_event_log_buf_info.buf) {
  730. qdf_mem_free(log_info_p->htt_wbm_event_log_buf_info.buf);
  731. log_info_p->htt_wbm_event_log_buf_info.buf = NULL;
  732. }
  733. }
  734. /**
  735. * htt_log_buffer_alloc() - Allocate all dynamic allocated buffer memory for
  736. * event logging
  737. * @htt_logger_handle: HTT handle.
  738. *
  739. * Return: None
  740. */
  741. static QDF_STATUS htt_log_buffer_alloc(struct htt_logger *htt_logger_handle)
  742. {
  743. struct htt_log_buf_t *cmd_log_buf;
  744. struct htt_log_buf_t *event_log_buf;
  745. struct htt_log_buf_t *wbm_event_log_buf;
  746. cmd_log_buf =
  747. &htt_logger_handle->log_info.htt_command_log_buf_info;
  748. event_log_buf =
  749. &htt_logger_handle->log_info.htt_event_log_buf_info;
  750. wbm_event_log_buf =
  751. &htt_logger_handle->log_info.htt_wbm_event_log_buf_info;
  752. /* first disable logging and then free buffer and release lock */
  753. htt_logger_handle->log_info.htt_logging_enable = 0;
  754. /* Allocate data buffer */
  755. cmd_log_buf->buf = (struct htt_command_debug *)qdf_mem_malloc(
  756. HTT_EVENT_DEBUG_MAX_ENTRY *
  757. sizeof(struct htt_command_debug));
  758. if (!cmd_log_buf->buf) {
  759. HTT_LOGE("Memory allocation for HTT CMD log failed.");
  760. goto error_mem_fail;
  761. }
  762. event_log_buf->buf = (struct htt_event_debug *)qdf_mem_malloc(
  763. HTT_EVENT_DEBUG_MAX_ENTRY *
  764. sizeof(struct htt_event_debug));
  765. if (!event_log_buf->buf) {
  766. HTT_LOGE("Memory allocation for HTT EVENT log failed.");
  767. goto error_mem_fail;
  768. }
  769. wbm_event_log_buf->buf = (struct htt_wbm_event_debug *)qdf_mem_malloc(
  770. HTT_EVENT_DEBUG_MAX_ENTRY *
  771. sizeof(struct htt_wbm_event_debug));
  772. if (!wbm_event_log_buf->buf) {
  773. HTT_LOGE("Memory allocation for HTT WBM EVENT log failed.");
  774. goto error_mem_fail;
  775. }
  776. return QDF_STATUS_SUCCESS;
  777. error_mem_fail:
  778. htt_log_buffer_free(htt_logger_handle);
  779. return QDF_STATUS_E_NOMEM;
  780. }
  781. /**
  782. * htt_log_lock_free - Destroy lock
  783. */
  784. static inline void htt_log_lock_alloc(struct htt_logger *htt_logger_handle)
  785. {
  786. struct htt_debug_log_info *log_info_p = &htt_logger_handle->log_info;
  787. struct htt_log_buf_t *cmd_log_buf =
  788. &htt_logger_handle->log_info.htt_command_log_buf_info;
  789. struct htt_log_buf_t *event_log_buf =
  790. &htt_logger_handle->log_info.htt_event_log_buf_info;
  791. struct htt_log_buf_t *wbm_event_log_buf =
  792. &htt_logger_handle->log_info.htt_wbm_event_log_buf_info;
  793. /* Create lock for cmd/event/wbm */
  794. qdf_spinlock_create(&cmd_log_buf->record_lock);
  795. qdf_spinlock_create(&event_log_buf->record_lock);
  796. qdf_spinlock_create(&wbm_event_log_buf->record_lock);
  797. /* Create recording lock in read through debugfs */
  798. qdf_spinlock_create(&log_info_p->htt_record_lock);
  799. }
  800. /**
  801. * htt_log_lock_free - Destroy lock
  802. */
  803. static inline void htt_log_lock_free(struct htt_logger *htt_logger_handle)
  804. {
  805. struct htt_debug_log_info *log_info_p = &htt_logger_handle->log_info;
  806. struct htt_log_buf_t *cmd_log_buf =
  807. &htt_logger_handle->log_info.htt_command_log_buf_info;
  808. struct htt_log_buf_t *event_log_buf =
  809. &htt_logger_handle->log_info.htt_event_log_buf_info;
  810. struct htt_log_buf_t *wbm_event_log_buf =
  811. &htt_logger_handle->log_info.htt_wbm_event_log_buf_info;
  812. /* Destroy lock for cmd/event/wbm */
  813. qdf_spinlock_destroy(&cmd_log_buf->record_lock);
  814. qdf_spinlock_destroy(&event_log_buf->record_lock);
  815. qdf_spinlock_destroy(&wbm_event_log_buf->record_lock);
  816. /* Destroy recording lock in read through debugfs */
  817. qdf_spinlock_destroy(&log_info_p->htt_record_lock);
  818. }
  819. /**
  820. * htt_debugfs_remove() - Remove debugfs entry for htt logging.
  821. * @htt_logger_handle: htt handle
  822. * @dentry: qdf_debugfs directory entry
  823. * @id: Index to debug info data array
  824. *
  825. * Return: none
  826. */
  827. static void htt_debugfs_remove(struct htt_logger *htt_logger_handle)
  828. {
  829. int i;
  830. qdf_dentry_t dentry = htt_logger_handle->log_info.htt_log_debugfs_dir;
  831. if (dentry) {
  832. for (i = 0; i < NUM_HTT_DEBUG_INFOS; ++i) {
  833. if (htt_logger_handle->debugfs_de[i])
  834. htt_logger_handle->debugfs_de[i] = NULL;
  835. }
  836. }
  837. if (dentry)
  838. qdf_debugfs_remove_dir_recursive(dentry);
  839. }
  840. /**
  841. * htt_debugfs_init() - debugfs functions to create debugfs directory and to
  842. * create debugfs enteries.
  843. *
  844. * @ htt_logger_handle: htt logger handler
  845. *
  846. * Return: init status
  847. */
  848. static QDF_STATUS htt_debugfs_init(struct htt_logger *htt_logger_handle)
  849. {
  850. char buf[32];
  851. int i;
  852. snprintf(buf, sizeof(buf), "HTT_SOC_LOGGER");
  853. htt_logger_handle->log_info.htt_log_debugfs_dir =
  854. qdf_debugfs_create_dir(buf, NULL);
  855. if (!htt_logger_handle->log_info.htt_log_debugfs_dir) {
  856. HTT_LOGE("error while creating debugfs dir for %s", buf);
  857. return QDF_STATUS_E_FAILURE;
  858. }
  859. for (i = 0; i < NUM_HTT_DEBUG_INFOS; ++i) {
  860. htt_debugfs_infos[i].ops->priv = htt_logger_handle;
  861. htt_logger_handle->debugfs_de[i] = qdf_debugfs_create_file(
  862. htt_debugfs_infos[i].name, HTT_DBG_FILE_PERM,
  863. htt_logger_handle->log_info.htt_log_debugfs_dir,
  864. htt_debugfs_infos[i].ops);
  865. if (!htt_logger_handle->debugfs_de[i])
  866. goto out;
  867. }
  868. return QDF_STATUS_SUCCESS;
  869. out:
  870. HTT_LOGE("debug Entry creation failed[%s]!", htt_debugfs_infos[i].name);
  871. htt_debugfs_remove(htt_logger_handle);
  872. return QDF_STATUS_E_FAILURE;
  873. }
  874. /**
  875. * htt_interface_logging_init() - Initialize HTT tracer
  876. * @ htt_logger_handle: htt logger handler
  877. */
  878. void htt_interface_logging_init(struct htt_logger **phtt_logger_handle)
  879. {
  880. QDF_STATUS ret;
  881. struct htt_logger *htt_logger_handle;
  882. struct htt_log_buf_t *cmd_log_buf;
  883. struct htt_log_buf_t *event_log_buf;
  884. struct htt_log_buf_t *wbm_event_log_buf;
  885. uint64_t htt_disable_mask;
  886. *phtt_logger_handle = (struct htt_logger *)qdf_mem_malloc(
  887. sizeof(struct htt_logger));
  888. if (!*phtt_logger_handle) {
  889. HTT_LOGE("Memory allocation for HTT logger buffer failed.");
  890. return;
  891. }
  892. /* Allocate Buffer */
  893. if (QDF_STATUS_SUCCESS != htt_log_buffer_alloc(*phtt_logger_handle)) {
  894. qdf_mem_free(*phtt_logger_handle);
  895. *phtt_logger_handle = NULL;
  896. return;
  897. }
  898. htt_logger_handle = *phtt_logger_handle;
  899. cmd_log_buf =
  900. &htt_logger_handle->log_info.htt_command_log_buf_info;
  901. event_log_buf =
  902. &htt_logger_handle->log_info.htt_event_log_buf_info;
  903. wbm_event_log_buf =
  904. &htt_logger_handle->log_info.htt_wbm_event_log_buf_info;
  905. /* Initialize HTT Cmd/Event/WBM Event */
  906. log_buf_init(cmd_log_buf);
  907. log_buf_init(event_log_buf);
  908. log_buf_init(wbm_event_log_buf);
  909. /* Disable all command */
  910. disable_all_command(htt_logger_handle);
  911. /* Disable all event except:
  912. * HTT_T2H_MSG_TYPE_PEER_MAP, HTT_T2H_MSG_TYPE_PEER_UNMAP
  913. * HTT_T2H_MSG_TYPE_RX_ADDBA HTT_T2H_MSG_TYPE_RX_DELBA
  914. * HTT_T2H_MSG_TYPE_PEER_MAP_V2 HTT_T2H_MSG_TYPE_PEER_UNMAP_V2
  915. */
  916. disable_all_event(htt_logger_handle);
  917. enable_event(htt_logger_handle, HTT_T2H_MSG_TYPE_PEER_MAP_C);
  918. enable_event(htt_logger_handle, HTT_T2H_MSG_TYPE_PEER_UNMAP_C);
  919. enable_event(htt_logger_handle, HTT_T2H_MSG_TYPE_RX_ADDBA_C);
  920. enable_event(htt_logger_handle, HTT_T2H_MSG_TYPE_RX_DELBA_C);
  921. enable_event(htt_logger_handle, HTT_T2H_MSG_TYPE_PEER_MAP_V2_C);
  922. enable_event(htt_logger_handle, HTT_T2H_MSG_TYPE_PEER_UNMAP_V2_C);
  923. /* Disable success status*/
  924. disable_wbm_success_status(htt_logger_handle);
  925. /* Create lock for all event */
  926. htt_log_lock_alloc(htt_logger_handle);
  927. /* Enable HTT logging */
  928. enable_htt_logging(htt_logger_handle);
  929. ret = htt_debugfs_init(*phtt_logger_handle);
  930. if (QDF_STATUS_SUCCESS != ret)
  931. goto debugfs_init_failed;
  932. return;
  933. debugfs_init_failed:
  934. htt_log_buffer_free(*phtt_logger_handle);
  935. htt_log_lock_free(*phtt_logger_handle);
  936. (*phtt_logger_handle)->log_info.htt_logging_enable = 0;
  937. qdf_mem_free(*phtt_logger_handle);
  938. *phtt_logger_handle = NULL;
  939. }
  940. /**
  941. * htt_interface_logging_deinit() - Deinitialize HTT tracer
  942. * @ htt_logger_handle: htt logger handler
  943. */
  944. void htt_interface_logging_deinit(struct htt_logger *htt_logger_handle)
  945. {
  946. /**
  947. * This case will hit in deinit path
  948. * if htt_initialization failed
  949. */
  950. if (!htt_logger_handle)
  951. return;
  952. htt_debugfs_remove(htt_logger_handle);
  953. htt_log_buffer_free(htt_logger_handle);
  954. htt_log_lock_free(htt_logger_handle);
  955. qdf_mem_free(htt_logger_handle);
  956. }