qdf_trace.h 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212
  1. /*
  2. * Copyright (c) 2014-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. #if !defined(__QDF_TRACE_H)
  19. #define __QDF_TRACE_H
  20. /**
  21. * DOC: qdf_trace
  22. * QCA driver framework trace APIs
  23. * Trace, logging, and debugging definitions and APIs
  24. */
  25. /* Include Files */
  26. #include <qdf_types.h> /* For QDF_MODULE_ID... */
  27. #include <stdarg.h> /* For va_list... */
  28. #include <qdf_status.h>
  29. #include <qdf_nbuf.h>
  30. #include <i_qdf_types.h>
  31. #include <qdf_debugfs.h>
  32. /* Type declarations */
  33. #define FL(x) "%s: %d: " x, __func__, __LINE__
  34. #define QDF_TRACE_BUFFER_SIZE (512)
  35. #ifdef CONFIG_MCL
  36. #define QDF_DEFAULT_TRACE_LEVEL \
  37. ((1 << QDF_TRACE_LEVEL_FATAL) | (1 << QDF_TRACE_LEVEL_ERROR))
  38. #else
  39. #define QDF_DEFAULT_TRACE_LEVEL (1 << QDF_TRACE_LEVEL_INFO)
  40. #endif
  41. #define QDF_CATEGORY_INFO_U16(val) (((val >> 16) & 0x0000FFFF))
  42. #define QDF_TRACE_LEVEL_INFO_L16(val) (val & 0x0000FFFF)
  43. typedef int (qdf_abstract_print)(void *priv, const char *fmt, ...);
  44. /*
  45. * Log levels
  46. */
  47. #define QDF_DEBUG_FUNCTRACE 0x01
  48. #define QDF_DEBUG_LEVEL0 0x02
  49. #define QDF_DEBUG_LEVEL1 0x04
  50. #define QDF_DEBUG_LEVEL2 0x08
  51. #define QDF_DEBUG_LEVEL3 0x10
  52. #define QDF_DEBUG_ERROR 0x20
  53. #define QDF_DEBUG_CFG 0x40
  54. /* DP Trace Implementation */
  55. #ifdef CONFIG_DP_TRACE
  56. #define DPTRACE(p) p
  57. #define DPTRACE_PRINT(args...) QDF_TRACE_DEBUG(QDF_MODULE_ID_QDF, args)
  58. #else
  59. #define DPTRACE(p)
  60. #define DPTRACE_PRINT(args...)
  61. #endif
  62. /* By default Data Path module will have all log levels enabled, except debug
  63. * log level. Debug level will be left up to the framework or user space modules
  64. * to be enabled when issue is detected
  65. */
  66. #define QDF_DATA_PATH_TRACE_LEVEL \
  67. ((1 << QDF_TRACE_LEVEL_FATAL) | (1 << QDF_TRACE_LEVEL_ERROR) | \
  68. (1 << QDF_TRACE_LEVEL_WARN) | (1 << QDF_TRACE_LEVEL_INFO) | \
  69. (1 << QDF_TRACE_LEVEL_INFO_HIGH) | (1 << QDF_TRACE_LEVEL_INFO_MED) | \
  70. (1 << QDF_TRACE_LEVEL_INFO_LOW))
  71. /* Preprocessor definitions and constants */
  72. #define ASSERT_BUFFER_SIZE (512)
  73. #define QDF_TRACE_DEFAULT_PDEV_ID 0xff
  74. #define MAX_QDF_TRACE_RECORDS 4000
  75. #define INVALID_QDF_TRACE_ADDR 0xffffffff
  76. #define DEFAULT_QDF_TRACE_DUMP_COUNT 0
  77. /*
  78. * first parameter to iwpriv command - dump_dp_trace
  79. * iwpriv wlan0 dump_dp_trace 0 0 -> dump full buffer
  80. * iwpriv wlan0 dump_dp_trace 1 0 -> enable live view mode
  81. * iwpriv wlan0 dump_dp_trace 2 0 -> clear dp trace buffer
  82. * iwpriv wlan0 dump_dp_trace 3 0 -> disable live view mode
  83. */
  84. #define DUMP_DP_TRACE 0
  85. #define ENABLE_DP_TRACE_LIVE_MODE 1
  86. #define CLEAR_DP_TRACE_BUFFER 2
  87. #define DISABLE_DP_TRACE_LIVE_MODE 3
  88. #ifdef TRACE_RECORD
  89. #define MTRACE(p) p
  90. #else
  91. #define MTRACE(p) do { } while (0)
  92. #endif
  93. #define NO_SESSION 0xFF
  94. /**
  95. * typedef struct qdf_trace_record_s - keep trace record
  96. * @qtime: qtimer ticks
  97. * @time: user timestamp
  98. * @module: module name
  99. * @code: hold record of code
  100. * @session: hold record of session
  101. * @data: hold data
  102. * @pid: hold pid of the process
  103. */
  104. typedef struct qdf_trace_record_s {
  105. uint64_t qtime;
  106. char time[18];
  107. uint8_t module;
  108. uint8_t code;
  109. uint16_t session;
  110. uint32_t data;
  111. uint32_t pid;
  112. } qdf_trace_record_t, *tp_qdf_trace_record;
  113. /**
  114. * typedef struct s_qdf_trace_data - MTRACE logs are stored in ring buffer
  115. * @head: position of first record
  116. * @tail: position of last record
  117. * @num: count of total record
  118. * @num_since_last_dump: count from last dump
  119. * @enable: config for controlling the trace
  120. * @dump_count: Dump after number of records reach this number
  121. */
  122. typedef struct s_qdf_trace_data {
  123. uint32_t head;
  124. uint32_t tail;
  125. uint32_t num;
  126. uint16_t num_since_last_dump;
  127. uint8_t enable;
  128. uint16_t dump_count;
  129. } t_qdf_trace_data;
  130. #define CASE_RETURN_STRING(str) case ((str)): return (uint8_t *)(# str);
  131. #define MAX_QDF_DP_TRACE_RECORDS 2000
  132. #define QDF_DP_TRACE_RECORD_SIZE 40
  133. #define INVALID_QDF_DP_TRACE_ADDR 0xffffffff
  134. #define QDF_DP_TRACE_VERBOSITY_HIGH 3
  135. #define QDF_DP_TRACE_VERBOSITY_MEDIUM 2
  136. #define QDF_DP_TRACE_VERBOSITY_LOW 1
  137. #define QDF_DP_TRACE_VERBOSITY_BASE 0
  138. /**
  139. * enum QDF_DP_TRACE_ID - Generic ID to identify various events in data path
  140. * @QDF_DP_TRACE_INVALID - invalid
  141. * @QDF_DP_TRACE_DROP_PACKET_RECORD - record drop packet
  142. * @QDF_DP_TRACE_EAPOL_PACKET_RECORD - record EAPOL packet
  143. * @QDF_DP_TRACE_DHCP_PACKET_RECORD - record DHCP packet
  144. * @QDF_DP_TRACE_ARP_PACKET_RECORD - record ARP packet
  145. * @QDF_DP_TRACE_MGMT_PACKET_RECORD - record MGMT pacekt
  146. * QDF_DP_TRACE_EVENT_RECORD - record events
  147. * @QDF_DP_TRACE_BASE_VERBOSITY - below this are part of base verbosity
  148. * @QDF_DP_TRACE_ICMP_PACKET_RECORD - record ICMP packet
  149. * @QDF_DP_TRACE_ICMPv6_PACKET_RECORD - record ICMPv6 packet
  150. * @QDF_DP_TRACE_HDD_TX_PACKET_RECORD - record 32 bytes of tx pkt at HDD
  151. * @QDF_DP_TRACE_HDD_RX_PACKET_RECORD - record 32 bytes of rx pkt at HDD
  152. * @QDF_DP_TRACE_TX_PACKET_RECORD - record 32 bytes of tx pkt at any layer
  153. * @QDF_DP_TRACE_RX_PACKET_RECORD - record 32 bytes of rx pkt at any layer
  154. * @QDF_DP_TRACE_HDD_TX_TIMEOUT - HDD tx timeout
  155. * @QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT- SOFTAP HDD tx timeout
  156. * @QDF_DP_TRACE_FREE_PACKET_PTR_RECORD - tx completion ptr record
  157. * @QDF_DP_TRACE_LOW_VERBOSITY - below this are part of low verbosity
  158. * @QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD - HDD layer ptr record
  159. * @QDF_DP_TRACE_LI_DP_TX_PACKET_PTR_RECORD - Lithium DP layer ptr record
  160. * @QDF_DP_TRACE_CE_PACKET_PTR_RECORD - CE layer ptr record
  161. * @QDF_DP_TRACE_CE_FAST_PACKET_PTR_RECORD- CE fastpath ptr record
  162. * @QDF_DP_TRACE_CE_FAST_PACKET_ERR_RECORD- CE fastpath error record
  163. * @QDF_DP_TRACE_RX_HTT_PACKET_PTR_RECORD - HTT RX record
  164. * @QDF_DP_TRACE_RX_OFFLOAD_HTT_PACKET_PTR_RECORD- HTT RX offload record
  165. * @QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD - HDD RX record
  166. * @QDF_DP_TRACE_RX_LI_DP_PACKET_PTR_RECORD - Lithium DP RX record
  167. * @QDF_DP_TRACE_MED_VERBOSITY - below this are part of med verbosity
  168. * @QDF_DP_TRACE_TXRX_QUEUE_PACKET_PTR_RECORD -tx queue ptr record
  169. * @QDF_DP_TRACE_TXRX_PACKET_PTR_RECORD - txrx packet ptr record
  170. * @QDF_DP_TRACE_TXRX_FAST_PACKET_PTR_RECORD - txrx fast path record
  171. * @QDF_DP_TRACE_HTT_PACKET_PTR_RECORD - htt packet ptr record
  172. * @QDF_DP_TRACE_HTC_PACKET_PTR_RECORD - htc packet ptr record
  173. * @QDF_DP_TRACE_HIF_PACKET_PTR_RECORD - hif packet ptr record
  174. * @QDF_DP_TRACE_RX_TXRX_PACKET_PTR_RECORD - txrx packet ptr record
  175. * @QDF_DP_TRACE_LI_DP_TX_PACKET_RECORD - record 32 bytes of tx pkt at LI_DP
  176. * @QDF_DP_TRACE_LI_DP_RX_PACKET_RECORD - record 32 bytes of rx pkt at LI_DP
  177. * @QDF_DP_TRACE_LI_DP_NULL_RX_PACKET_RECORD
  178. * - record 32 bytes of rx null_queue pkt at LI_DP
  179. * @QDF_DP_TRACE_HIGH_VERBOSITY - below this are part of high verbosity
  180. */
  181. enum QDF_DP_TRACE_ID {
  182. QDF_DP_TRACE_INVALID,
  183. QDF_DP_TRACE_DROP_PACKET_RECORD,
  184. QDF_DP_TRACE_EAPOL_PACKET_RECORD,
  185. QDF_DP_TRACE_DHCP_PACKET_RECORD,
  186. QDF_DP_TRACE_ARP_PACKET_RECORD,
  187. QDF_DP_TRACE_MGMT_PACKET_RECORD,
  188. QDF_DP_TRACE_EVENT_RECORD,
  189. QDF_DP_TRACE_BASE_VERBOSITY,
  190. QDF_DP_TRACE_ICMP_PACKET_RECORD,
  191. QDF_DP_TRACE_ICMPv6_PACKET_RECORD,
  192. QDF_DP_TRACE_HDD_TX_PACKET_RECORD,
  193. QDF_DP_TRACE_HDD_RX_PACKET_RECORD,
  194. QDF_DP_TRACE_TX_PACKET_RECORD,
  195. QDF_DP_TRACE_RX_PACKET_RECORD,
  196. QDF_DP_TRACE_HDD_TX_TIMEOUT,
  197. QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT,
  198. QDF_DP_TRACE_FREE_PACKET_PTR_RECORD,
  199. QDF_DP_TRACE_LOW_VERBOSITY,
  200. QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD,
  201. QDF_DP_TRACE_LI_DP_TX_PACKET_PTR_RECORD,
  202. QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD,
  203. QDF_DP_TRACE_CE_PACKET_PTR_RECORD,
  204. QDF_DP_TRACE_CE_FAST_PACKET_PTR_RECORD,
  205. QDF_DP_TRACE_CE_FAST_PACKET_ERR_RECORD,
  206. QDF_DP_TRACE_RX_HTT_PACKET_PTR_RECORD,
  207. QDF_DP_TRACE_RX_OFFLOAD_HTT_PACKET_PTR_RECORD,
  208. QDF_DP_TRACE_RX_LI_DP_PACKET_PTR_RECORD,
  209. QDF_DP_TRACE_MED_VERBOSITY,
  210. QDF_DP_TRACE_TXRX_QUEUE_PACKET_PTR_RECORD,
  211. QDF_DP_TRACE_TXRX_PACKET_PTR_RECORD,
  212. QDF_DP_TRACE_TXRX_FAST_PACKET_PTR_RECORD,
  213. QDF_DP_TRACE_HTT_PACKET_PTR_RECORD,
  214. QDF_DP_TRACE_HTC_PACKET_PTR_RECORD,
  215. QDF_DP_TRACE_HIF_PACKET_PTR_RECORD,
  216. QDF_DP_TRACE_RX_TXRX_PACKET_PTR_RECORD,
  217. QDF_DP_TRACE_LI_DP_TX_PACKET_RECORD,
  218. QDF_DP_TRACE_LI_DP_RX_PACKET_RECORD,
  219. QDF_DP_TRACE_LI_DP_NULL_RX_PACKET_RECORD,
  220. QDF_DP_TRACE_HIGH_VERBOSITY,
  221. QDF_DP_TRACE_MAX
  222. };
  223. /**
  224. * qdf_proto_dir - direction
  225. * @QDF_TX: TX direction
  226. * @QDF_RX: RX direction
  227. * @QDF_NA: not applicable
  228. */
  229. enum qdf_proto_dir {
  230. QDF_TX,
  231. QDF_RX,
  232. QDF_NA
  233. };
  234. /**
  235. * struct qdf_dp_trace_ptr_buf - pointer record buffer
  236. * @cookie: cookie value
  237. * @msdu_id: msdu_id
  238. * @status: completion status
  239. */
  240. struct qdf_dp_trace_ptr_buf {
  241. uint64_t cookie;
  242. uint16_t msdu_id;
  243. uint16_t status;
  244. };
  245. /**
  246. * struct qdf_dp_trace_proto_buf - proto packet buffer
  247. * @sa: source address
  248. * @da: destination address
  249. * @vdev_id : vdev id
  250. * @type: packet type
  251. * @subtype: packet subtype
  252. * @dir: direction
  253. */
  254. struct qdf_dp_trace_proto_buf {
  255. struct qdf_mac_addr sa;
  256. struct qdf_mac_addr da;
  257. uint8_t vdev_id;
  258. uint8_t type;
  259. uint8_t subtype;
  260. uint8_t dir;
  261. };
  262. /**
  263. * struct qdf_dp_trace_mgmt_buf - mgmt packet buffer
  264. * @vdev_id : vdev id
  265. * @type: packet type
  266. * @subtype: packet subtype
  267. */
  268. struct qdf_dp_trace_mgmt_buf {
  269. uint8_t vdev_id;
  270. uint8_t type;
  271. uint8_t subtype;
  272. };
  273. /**
  274. * struct qdf_dp_trace_event_buf - event buffer
  275. * @vdev_id : vdev id
  276. * @type: packet type
  277. * @subtype: packet subtype
  278. */
  279. struct qdf_dp_trace_event_buf {
  280. uint8_t vdev_id;
  281. uint8_t type;
  282. uint8_t subtype;
  283. };
  284. /**
  285. * struct qdf_dp_trace_data_buf - nbuf data buffer
  286. * @msdu_id : msdu id
  287. */
  288. struct qdf_dp_trace_data_buf {
  289. uint16_t msdu_id;
  290. };
  291. /**
  292. * struct qdf_dp_trace_record_s - Describes a record in DP trace
  293. * @time: time when it got stored
  294. * @code: Describes the particular event
  295. * @data: buffer to store data
  296. * @size: Length of the valid data stored in this record
  297. * @pid : process id which stored the data in this record
  298. */
  299. struct qdf_dp_trace_record_s {
  300. uint64_t time;
  301. uint8_t code;
  302. uint8_t data[QDF_DP_TRACE_RECORD_SIZE];
  303. uint8_t size;
  304. uint32_t pid;
  305. uint8_t pdev_id;
  306. };
  307. /**
  308. * struct qdf_dp_trace_data - Parameters to configure/control DP trace
  309. * @head: Position of first record
  310. * @tail: Position of last record
  311. * @num: Current index
  312. * @proto_bitmap: defines which protocol to be traced
  313. * @no_of_record: defines every nth packet to be traced
  314. * @verbosity : defines verbosity level
  315. * @enable: enable/disable DP trace
  316. * @count: current packet number
  317. * @live_mode_config: configuration as received during initialization
  318. * @live_mode: current live mode, enabled or disabled, can be throttled based
  319. * on throughput
  320. * @force_live_mode: flag to enable live mode all the time for all packets.
  321. * This can be set/unset from userspace and overrides other
  322. * live mode flags.
  323. * @print_pkt_cnt: count of number of packets printed in live mode
  324. * @high_tput_thresh: thresh beyond which live mode is turned off
  325. * @thresh_time_limit: max time, in terms of BW timer intervals to wait,
  326. * for determining if high_tput_thresh has been crossed. ~1s
  327. * @arp_req: stats for arp reqs
  328. * @arp_resp: stats for arp resps
  329. * @icmp_req: stats for icmp reqs
  330. * @icmp_resp: stats for icmp resps
  331. * @dhcp_disc: stats for dhcp discover msgs
  332. * @dhcp_req: stats for dhcp req msgs
  333. * @dhcp_off: stats for dhcp offer msgs
  334. * @dhcp_ack: stats for dhcp ack msgs
  335. * @dhcp_nack: stats for dhcp nack msgs
  336. * @dhcp_others: stats for other dhcp pkts types
  337. * @eapol_m1: stats for eapol m1
  338. * @eapol_m2: stats for eapol m2
  339. * @eapol_m3: stats for eapol m3
  340. * @eapol_m4: stats for eapol m4
  341. * @eapol_others: stats for other eapol pkt types
  342. * @icmpv6_req: stats for icmpv6 reqs
  343. * @icmpv6_resp: stats for icmpv6 resps
  344. * @icmpv6_ns: stats for icmpv6 nss
  345. * @icmpv6_na: stats for icmpv6 nas
  346. * @icmpv6_rs: stats for icmpv6 rss
  347. * @icmpv6_ra: stats for icmpv6 ras
  348. */
  349. struct s_qdf_dp_trace_data {
  350. uint32_t head;
  351. uint32_t tail;
  352. uint32_t num;
  353. uint8_t proto_bitmap;
  354. uint8_t no_of_record;
  355. uint8_t verbosity;
  356. bool enable;
  357. bool live_mode_config;
  358. bool live_mode;
  359. uint32_t curr_pos;
  360. uint32_t saved_tail;
  361. bool force_live_mode;
  362. uint8_t print_pkt_cnt;
  363. uint8_t high_tput_thresh;
  364. uint16_t thresh_time_limit;
  365. /* Stats */
  366. uint32_t tx_count;
  367. uint32_t rx_count;
  368. u16 arp_req;
  369. u16 arp_resp;
  370. u16 dhcp_disc;
  371. u16 dhcp_req;
  372. u16 dhcp_off;
  373. u16 dhcp_ack;
  374. u16 dhcp_nack;
  375. u16 dhcp_others;
  376. u16 eapol_m1;
  377. u16 eapol_m2;
  378. u16 eapol_m3;
  379. u16 eapol_m4;
  380. u16 eapol_others;
  381. u16 icmp_req;
  382. u16 icmp_resp;
  383. u16 icmpv6_req;
  384. u16 icmpv6_resp;
  385. u16 icmpv6_ns;
  386. u16 icmpv6_na;
  387. u16 icmpv6_rs;
  388. u16 icmpv6_ra;
  389. };
  390. /**
  391. * struct qdf_dpt_debugfs_state - state to control read to debugfs file
  392. * @QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INVALID: invalid state
  393. * @QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INIT: initial state
  394. * @QDF_DPT_DEBUGFS_STATE_SHOW_IN_PROGRESS: read is in progress
  395. * @QDF_DPT_DEBUGFS_STATE_SHOW_COMPLETE: read complete
  396. */
  397. enum qdf_dpt_debugfs_state {
  398. QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INVALID,
  399. QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INIT,
  400. QDF_DPT_DEBUGFS_STATE_SHOW_IN_PROGRESS,
  401. QDF_DPT_DEBUGFS_STATE_SHOW_COMPLETE,
  402. };
  403. /* Function declarations and documenation */
  404. /**
  405. * qdf_trace_set_level() - Set the trace level for a particular module
  406. * @level : trace level
  407. *
  408. * Trace level is a member of the QDF_TRACE_LEVEL enumeration indicating
  409. * the severity of the condition causing the trace message to be issued.
  410. * More severe conditions are more likely to be logged.
  411. *
  412. * This is an external API that allows trace levels to be set for each module.
  413. *
  414. * Return: nothing
  415. */
  416. void qdf_trace_set_level(QDF_MODULE_ID module, QDF_TRACE_LEVEL level);
  417. /**
  418. * qdf_trace_get_level() - get the trace level
  419. * @level : trace level
  420. *
  421. * This is an external API that returns a bool value to signify if a
  422. * particular trace level is set for the specified module.
  423. * A member of the QDF_TRACE_LEVEL enumeration indicating the severity
  424. * of the condition causing the trace message to be issued.
  425. *
  426. * Note that individual trace levels are the only valid values
  427. * for this API. QDF_TRACE_LEVEL_NONE and QDF_TRACE_LEVEL_ALL
  428. * are not valid input and will return false
  429. *
  430. * Return:
  431. * false - the specified trace level for the specified module is OFF
  432. * true - the specified trace level for the specified module is ON
  433. */
  434. bool qdf_trace_get_level(QDF_MODULE_ID module, QDF_TRACE_LEVEL level);
  435. typedef void (*tp_qdf_trace_cb)(void *p_mac, tp_qdf_trace_record, uint16_t);
  436. typedef void (*tp_qdf_state_info_cb) (char **buf, uint16_t *size);
  437. #ifdef WLAN_FEATURE_MEMDUMP_ENABLE
  438. void qdf_register_debugcb_init(void);
  439. void qdf_register_debug_callback(QDF_MODULE_ID module_id,
  440. tp_qdf_state_info_cb qdf_state_infocb);
  441. QDF_STATUS qdf_state_info_dump_all(char *buf, uint16_t size,
  442. uint16_t *driver_dump_size);
  443. #else /* WLAN_FEATURE_MEMDUMP_ENABLE */
  444. static inline void qdf_register_debugcb_init(void)
  445. {
  446. }
  447. #endif /* WLAN_FEATURE_MEMDUMP_ENABLE */
  448. #ifdef TRACE_RECORD
  449. void qdf_trace_register(QDF_MODULE_ID, tp_qdf_trace_cb);
  450. void qdf_trace_init(void);
  451. void qdf_trace(uint8_t module, uint8_t code, uint16_t session, uint32_t data);
  452. void qdf_trace_enable(uint32_t, uint8_t enable);
  453. void qdf_trace_dump_all(void *, uint8_t, uint8_t, uint32_t, uint32_t);
  454. QDF_STATUS qdf_trace_spin_lock_init(void);
  455. #else
  456. #ifdef CONFIG_MCL
  457. static inline
  458. void qdf_trace_init(void)
  459. {
  460. }
  461. static inline
  462. void qdf_trace_enable(uint32_t bitmask_of_module_id, uint8_t enable)
  463. {
  464. }
  465. static inline
  466. void qdf_trace(uint8_t module, uint8_t code, uint16_t session, uint32_t data)
  467. {
  468. }
  469. static inline
  470. void qdf_trace_dump_all(void *p_mac, uint8_t code, uint8_t session,
  471. uint32_t count, uint32_t bitmask_of_module)
  472. {
  473. }
  474. static inline
  475. QDF_STATUS qdf_trace_spin_lock_init(void)
  476. {
  477. return QDF_STATUS_E_INVAL;
  478. }
  479. #endif
  480. #endif
  481. #ifdef CONFIG_DP_TRACE
  482. void qdf_dp_set_proto_bitmap(uint32_t val);
  483. void qdf_dp_trace_set_verbosity(uint32_t val);
  484. void qdf_dp_set_no_of_record(uint32_t val);
  485. #define QDF_DP_TRACE_RECORD_INFO_LIVE (0x1)
  486. #define QDF_DP_TRACE_RECORD_INFO_THROTTLED (0x1 << 1)
  487. bool qdf_dp_trace_log_pkt(uint8_t session_id, struct sk_buff *skb,
  488. enum qdf_proto_dir dir, uint8_t pdev_id);
  489. void qdf_dp_trace_init(bool live_mode_config, uint8_t thresh,
  490. uint16_t time_limit, uint8_t verbosity,
  491. uint8_t proto_bitmap);
  492. void qdf_dp_trace_spin_lock_init(void);
  493. void qdf_dp_trace_set_value(uint8_t proto_bitmap, uint8_t no_of_records,
  494. uint8_t verbosity);
  495. void qdf_dp_trace_set_track(qdf_nbuf_t nbuf, enum qdf_proto_dir dir);
  496. void qdf_dp_trace(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code, uint8_t pdev_id,
  497. uint8_t *data, uint8_t size, enum qdf_proto_dir dir);
  498. void qdf_dp_trace_dump_all(uint32_t count, uint8_t pdev_id);
  499. /**
  500. * qdf_dpt_get_curr_pos_debugfs() - get curr position to start read
  501. * @file: debugfs file to read
  502. * @state: state to control read to debugfs file
  503. *
  504. * Return: curr pos
  505. */
  506. uint32_t qdf_dpt_get_curr_pos_debugfs(qdf_debugfs_file_t file,
  507. enum qdf_dpt_debugfs_state state);
  508. /**
  509. * qdf_dpt_dump_stats_debugfs() - dump DP Trace stats to debugfs file
  510. * @file: debugfs file to read
  511. * @curr_pos: curr position to start read
  512. *
  513. * Return: QDF_STATUS
  514. */
  515. QDF_STATUS qdf_dpt_dump_stats_debugfs(qdf_debugfs_file_t file,
  516. uint32_t curr_pos);
  517. /**
  518. * qdf_dpt_set_value_debugfs() - dump DP Trace stats to debugfs file
  519. * @file: debugfs file to read
  520. * @curr_pos: curr position to start read
  521. *
  522. * Return: none
  523. */
  524. void qdf_dpt_set_value_debugfs(uint8_t proto_bitmap, uint8_t no_of_record,
  525. uint8_t verbosity);
  526. /**
  527. * qdf_dp_trace_dump_stats() - dump DP Trace stats
  528. *
  529. * Return: none
  530. */
  531. void qdf_dp_trace_dump_stats(void);
  532. typedef void (*tp_qdf_dp_trace_cb)(struct qdf_dp_trace_record_s*,
  533. uint16_t, uint8_t, uint8_t info);
  534. /**
  535. * qdf_dp_display_record() - Displays a record in DP trace
  536. * @record: pointer to a record in DP trace
  537. * @index: record index
  538. * @pdev_id: pdev id for the mgmt pkt
  539. * @info: info used to display pkt (live mode, throttling)
  540. *
  541. * Return: None
  542. */
  543. void qdf_dp_display_record(struct qdf_dp_trace_record_s *record,
  544. uint16_t index, uint8_t pdev_id,
  545. uint8_t info);
  546. /**
  547. * qdf_dp_display_ptr_record() - display record
  548. * @record: dptrace record
  549. * @rec_index: index
  550. * @pdev_id: pdev id for the mgmt pkt
  551. * @info: info used to display pkt (live mode, throttling)
  552. *
  553. * Return: none
  554. */
  555. void qdf_dp_display_ptr_record(struct qdf_dp_trace_record_s *record,
  556. uint16_t rec_index, uint8_t pdev_id,
  557. uint8_t info);
  558. /**
  559. * qdf_dp_display_proto_pkt() - display proto packet
  560. * @record: dptrace record
  561. * @index: index
  562. * @pdev_id: pdev id for the mgmt pkt
  563. * @info: info used to display pkt (live mode, throttling)
  564. *
  565. * Return: none
  566. */
  567. void qdf_dp_display_proto_pkt(struct qdf_dp_trace_record_s *record,
  568. uint16_t index, uint8_t pdev_id,
  569. uint8_t info);
  570. /**
  571. * qdf_dp_display_data_pkt_record() - Displays a data packet in DP trace
  572. * @record: pointer to a record in DP trace
  573. * @rec_index: record index
  574. * @pdev_id: pdev id
  575. * @info: display info regarding record
  576. *
  577. * Return: None
  578. */
  579. void
  580. qdf_dp_display_data_pkt_record(struct qdf_dp_trace_record_s *record,
  581. uint16_t rec_index, uint8_t pdev_id,
  582. uint8_t info);
  583. void qdf_dp_trace_ptr(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code,
  584. uint8_t pdev_id, uint8_t *data, uint8_t size,
  585. uint16_t msdu_id, uint16_t status);
  586. void qdf_dp_trace_throttle_live_mode(bool high_bw_request);
  587. /**
  588. * qdf_dp_trace_data_pkt() - trace data packet
  589. * @nbuf: nbuf which needs to be traced
  590. * @pdev_id: pdev_id
  591. * @code: QDF_DP_TRACE_ID for the packet (TX or RX)
  592. * @msdu_id: tx desc id for the nbuf (Only applies to TX packets)
  593. * @dir: TX or RX packet direction
  594. *
  595. * Return: None
  596. */
  597. void qdf_dp_trace_data_pkt(qdf_nbuf_t nbuf, uint8_t pdev_id,
  598. enum QDF_DP_TRACE_ID code, uint16_t msdu_id,
  599. enum qdf_proto_dir dir);
  600. uint8_t qdf_dp_get_proto_bitmap(void);
  601. uint8_t qdf_dp_get_verbosity(void);
  602. uint8_t qdf_dp_get_no_of_record(void);
  603. /**
  604. * qdf_dp_trace_proto_pkt() - record proto packet
  605. * @code: dptrace code
  606. * @vdev_id: vdev id
  607. * @sa: source mac address
  608. * @da: destination mac address
  609. * @type: proto type
  610. * @subtype: proto subtype
  611. * @dir: direction
  612. * @pdev_id: pdev id
  613. * @print: to print this proto pkt or not
  614. *
  615. * Return: none
  616. */
  617. void
  618. qdf_dp_trace_proto_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
  619. uint8_t *sa, uint8_t *da, enum qdf_proto_type type,
  620. enum qdf_proto_subtype subtype, enum qdf_proto_dir dir,
  621. uint8_t pdev_id, bool print);
  622. void qdf_dp_trace_disable_live_mode(void);
  623. void qdf_dp_trace_enable_live_mode(void);
  624. void qdf_dp_trace_clear_buffer(void);
  625. /**
  626. * qdf_dp_trace_mgmt_pkt() - record mgmt packet
  627. * @code: dptrace code
  628. * @vdev_id: vdev id
  629. * @pdev_id: pdev_id
  630. * @type: proto type
  631. * @subtype: proto subtype
  632. *
  633. * Return: none
  634. */
  635. void qdf_dp_trace_mgmt_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
  636. uint8_t pdev_id, enum qdf_proto_type type,
  637. enum qdf_proto_subtype subtype);
  638. /**
  639. * qdf_dp_display_mgmt_pkt() - display proto packet
  640. * @record: dptrace record
  641. * @index: index
  642. * @pdev_id: pdev id for the mgmt pkt
  643. * @info: info used to display pkt (live mode, throttling)
  644. *
  645. * Return: none
  646. */
  647. void qdf_dp_display_mgmt_pkt(struct qdf_dp_trace_record_s *record,
  648. uint16_t index, uint8_t pdev_id, uint8_t info);
  649. /**
  650. * qdf_dp_display_event_record() - display event records
  651. * @record: dptrace record
  652. * @index: index
  653. * @pdev_id: pdev id for the mgmt pkt
  654. * @info: info used to display pkt (live mode, throttling)
  655. *
  656. * Return: none
  657. */
  658. void qdf_dp_display_event_record(struct qdf_dp_trace_record_s *record,
  659. uint16_t index, uint8_t pdev_id, uint8_t info);
  660. void qdf_dp_trace_record_event(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
  661. uint8_t pdev_id, enum qdf_proto_type type,
  662. enum qdf_proto_subtype subtype);
  663. #else
  664. static inline
  665. bool qdf_dp_trace_log_pkt(uint8_t session_id, struct sk_buff *skb,
  666. enum qdf_proto_dir dir, uint8_t pdev_id)
  667. {
  668. return false;
  669. }
  670. static inline
  671. void qdf_dp_trace_init(bool live_mode_config, uint8_t thresh,
  672. uint16_t time_limit, uint8_t verbosity,
  673. uint8_t proto_bitmap)
  674. {
  675. }
  676. static inline
  677. void qdf_dp_trace_set_track(qdf_nbuf_t nbuf, enum qdf_proto_dir dir)
  678. {
  679. }
  680. static inline
  681. void qdf_dp_trace_set_value(uint8_t proto_bitmap, uint8_t no_of_records,
  682. uint8_t verbosity)
  683. {
  684. }
  685. static inline
  686. void qdf_dp_trace_dump_all(uint32_t count, uint8_t pdev_id)
  687. {
  688. }
  689. static inline
  690. uint32_t qdf_dpt_get_curr_pos_debugfs(qdf_debugfs_file_t file,
  691. enum qdf_dpt_debugfs_state state)
  692. {
  693. }
  694. static inline
  695. QDF_STATUS qdf_dpt_dump_stats_debugfs(qdf_debugfs_file_t file,
  696. uint32_t curr_pos)
  697. {
  698. }
  699. static inline
  700. void qdf_dpt_set_value_debugfs(uint8_t proto_bitmap, uint8_t no_of_record,
  701. uint8_t verbosity)
  702. {
  703. }
  704. static inline void qdf_dp_trace_dump_stats(void)
  705. {
  706. }
  707. static inline
  708. void qdf_dp_trace_disable_live_mode(void)
  709. {
  710. }
  711. static inline
  712. void qdf_dp_trace_enable_live_mode(void)
  713. {
  714. }
  715. static inline
  716. void qdf_dp_trace_throttle_live_mode(bool high_bw_request)
  717. {
  718. }
  719. static inline
  720. void qdf_dp_trace_clear_buffer(void)
  721. {
  722. }
  723. void qdf_dp_trace_data_pkt(qdf_nbuf_t nbuf, uint8_t pdev_id,
  724. enum QDF_DP_TRACE_ID code, uint16_t msdu_id,
  725. enum qdf_proto_dir dir)
  726. {
  727. }
  728. #endif
  729. void qdf_trace_display(void);
  730. void qdf_trace_set_value(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
  731. uint8_t on);
  732. void qdf_trace_set_module_trace_level(QDF_MODULE_ID module, uint32_t level);
  733. void __printf(3, 4) qdf_snprintf(char *str_buffer, unsigned int size,
  734. char *str_format, ...);
  735. #define QDF_SNPRINTF qdf_snprintf
  736. #ifdef TSOSEG_DEBUG
  737. static inline void qdf_tso_seg_dbg_bug(char *msg)
  738. {
  739. qdf_print("%s", msg);
  740. QDF_BUG(0);
  741. };
  742. /**
  743. * qdf_tso_seg_dbg_init - initialize TSO segment debug structure
  744. * @tsoseg : structure to initialize
  745. *
  746. * TSO segment dbg structures are attached to qdf_tso_seg_elem_t
  747. * structures and are allocated only of TSOSEG_DEBUG is defined.
  748. * When allocated, at the time of the tso_seg_pool initialization,
  749. * which goes with tx_desc initialization (1:1), each structure holds
  750. * a number of (currently 16) history entries, basically describing
  751. * what operation has been performed on this particular tso_seg_elem.
  752. * This history buffer is a circular buffer and the current index is
  753. * held in an atomic variable called cur. It is incremented every
  754. * operation. Each of these operations are added with the function
  755. * qdf_tso_seg_dbg_record.
  756. * For each segment, this initialization function MUST be called PRIOR
  757. * TO any _dbg_record() function calls.
  758. * On free, qdf_tso_seg_elem structure is cleared (using qdf_tso_seg_dbg_zero)
  759. * which clears the tso_desc, BUT DOES NOT CLEAR THE HISTORY element.
  760. *
  761. * Return:
  762. * None
  763. */
  764. static inline
  765. void qdf_tso_seg_dbg_init(struct qdf_tso_seg_elem_t *tsoseg)
  766. {
  767. tsoseg->dbg.txdesc = NULL;
  768. qdf_atomic_init(&tsoseg->dbg.cur); /* history empty */
  769. }
  770. /**
  771. * qdf_tso_seg_dbg_record - add a history entry to TSO debug structure
  772. * @tsoseg : structure to initialize
  773. * @id : operation ID (identifies the caller)
  774. *
  775. * Adds a history entry to the history circular buffer. Each entry
  776. * contains an operation id (caller, as currently each ID is used only
  777. * once in the source, so it directly identifies the src line that invoked
  778. * the recording.
  779. *
  780. * qdf_tso_seg_dbg_record CAN ONLY BE CALLED AFTER the entry is initialized
  781. * by qdf_tso_seg_dbg_init.
  782. *
  783. * The entry to be added is written at the location pointed by the atomic
  784. * variable called cur. Cur is an ever increasing atomic variable. It is
  785. * masked so that only the lower 4 bits are used (16 history entries).
  786. *
  787. * Return:
  788. * int: the entry this record was recorded at
  789. */
  790. static inline
  791. int qdf_tso_seg_dbg_record(struct qdf_tso_seg_elem_t *tsoseg, short id)
  792. {
  793. int rc = -1;
  794. unsigned int c;
  795. qdf_assert(tsoseg);
  796. if (id == TSOSEG_LOC_ALLOC) {
  797. c = qdf_atomic_read(&tsoseg->dbg.cur);
  798. /* dont crash on the very first alloc on the segment */
  799. c &= 0x0f;
  800. /* allow only INIT and FREE ops before ALLOC */
  801. if (tsoseg->dbg.h[c].id >= id)
  802. qdf_tso_seg_dbg_bug("Rogue TSO seg alloc");
  803. }
  804. c = qdf_atomic_inc_return(&tsoseg->dbg.cur);
  805. c &= 0x0f;
  806. tsoseg->dbg.h[c].ts = qdf_get_log_timestamp();
  807. tsoseg->dbg.h[c].id = id;
  808. rc = c;
  809. return rc;
  810. };
  811. static inline void
  812. qdf_tso_seg_dbg_setowner(struct qdf_tso_seg_elem_t *tsoseg, void *owner)
  813. {
  814. if (tsoseg)
  815. tsoseg->dbg.txdesc = owner;
  816. };
  817. static inline void
  818. qdf_tso_seg_dbg_zero(struct qdf_tso_seg_elem_t *tsoseg)
  819. {
  820. memset(tsoseg, 0, offsetof(struct qdf_tso_seg_elem_t, dbg));
  821. return;
  822. };
  823. #else
  824. static inline
  825. void qdf_tso_seg_dbg_init(struct qdf_tso_seg_elem_t *tsoseg)
  826. {
  827. };
  828. static inline
  829. int qdf_tso_seg_dbg_record(struct qdf_tso_seg_elem_t *tsoseg, short id)
  830. {
  831. return 0;
  832. };
  833. static inline void qdf_tso_seg_dbg_bug(char *msg)
  834. {
  835. };
  836. static inline void
  837. qdf_tso_seg_dbg_setowner(struct qdf_tso_seg_elem_t *tsoseg, void *owner)
  838. {
  839. };
  840. static inline int
  841. qdf_tso_seg_dbg_zero(struct qdf_tso_seg_elem_t *tsoseg)
  842. {
  843. memset(tsoseg, 0, sizeof(struct qdf_tso_seg_elem_t));
  844. return 0;
  845. };
  846. #endif /* TSOSEG_DEBUG */
  847. void qdf_trace_hex_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
  848. void *data, int buf_len);
  849. #define ERROR_CODE -1
  850. #define QDF_MAX_NAME_SIZE 32
  851. #define MAX_PRINT_CONFIG_SUPPORTED 32
  852. #define MAX_SUPPORTED_CATEGORY QDF_MODULE_ID_MAX
  853. /**
  854. * qdf_set_pidx() - Sets the global qdf_pidx.
  855. * @pidx : Index of print control object assigned to the module
  856. *
  857. */
  858. void qdf_set_pidx(int pidx);
  859. /**
  860. * qdf_get_pidx() - Returns the global qdf_pidx.
  861. *
  862. * Return : Current qdf print index.
  863. */
  864. int qdf_get_pidx(void);
  865. /*
  866. * Shared print control index
  867. * for converged debug framework
  868. */
  869. #define QDF_PRINT_IDX_SHARED -1
  870. /**
  871. * QDF_PRINT_INFO() - Generic wrapper API for logging
  872. * @idx : Index of print control object
  873. * @module : Module identifier. A member of QDF_MODULE_ID enumeration that
  874. * identifies the module issuing the trace message
  875. * @level : Trace level. A member of QDF_TRACE_LEVEL enumeration indicating
  876. * the severity of the condition causing the trace message to be
  877. * issued.
  878. * @str_format : Format string that contains the message to be logged.
  879. *
  880. *
  881. * This wrapper will be used for any generic logging messages. Wrapper will
  882. * compile a call to converged QDF trace message API.
  883. *
  884. * Return : Nothing
  885. *
  886. */
  887. void QDF_PRINT_INFO(unsigned int idx, QDF_MODULE_ID module,
  888. QDF_TRACE_LEVEL level,
  889. char *str_format, ...);
  890. /**
  891. * struct category_info : Category information structure
  892. * @category_verbose_mask: Embeds information about category's verbose level
  893. */
  894. struct category_info {
  895. uint16_t category_verbose_mask;
  896. };
  897. /**
  898. * struct category_name_info : Category name information structure
  899. * @category_name_str: Embeds information about category name
  900. */
  901. struct category_name_info {
  902. unsigned char category_name_str[QDF_MAX_NAME_SIZE];
  903. };
  904. /**
  905. * qdf_trace_msg_cmn()- Converged logging API
  906. * @idx: Index of print control object assigned to the module
  907. * @category: Category identifier. A member of the QDF_MODULE_ID enumeration
  908. * that identifies the category issuing the trace message.
  909. * @verbose: Verbose level. A member of the QDF_TRACE_LEVEL enumeration
  910. * indicating the severity of the condition causing the trace
  911. * message to be issued. More severe conditions are more likely
  912. * to be logged.
  913. * @str_format: Format string. The message to be logged. This format string
  914. * contains printf-like replacement parameters, which follow this
  915. * parameter in the variable argument list.
  916. * @val: Variable argument list part of the log message
  917. *
  918. * Return: nothing
  919. *
  920. */
  921. void qdf_trace_msg_cmn(unsigned int idx,
  922. QDF_MODULE_ID category,
  923. QDF_TRACE_LEVEL verbose,
  924. const char *str_format,
  925. va_list val);
  926. /**
  927. * struct qdf_print_ctrl: QDF Print Control structure
  928. * Statically allocated objects of print control
  929. * structure are declared that will support maximum of
  930. * 32 print control objects. Any module that needs to
  931. * register to the print control framework needs to
  932. * obtain a print control object using
  933. * qdf_print_ctrl_register API. It will have to pass
  934. * pointer to category info structure, name and
  935. * custom print function to be used if required.
  936. * @name : Optional name for the control object
  937. * @cat_info : Array of category_info struct
  938. * @custom_print : Custom print handler
  939. * @custom_ctxt : Custom print context
  940. * @dbglvlmac_on : Flag to enable/disable MAC level filtering
  941. * @in_use : Boolean to indicate if control object is in use
  942. */
  943. struct qdf_print_ctrl {
  944. char name[QDF_MAX_NAME_SIZE];
  945. struct category_info cat_info[MAX_SUPPORTED_CATEGORY];
  946. void (*custom_print)(void *ctxt, const char *fmt, va_list args);
  947. void *custom_ctxt;
  948. #ifdef DBG_LVL_MAC_FILTERING
  949. unsigned char dbglvlmac_on;
  950. #endif
  951. bool in_use;
  952. };
  953. /**
  954. * qdf_print_ctrl_register() - Allocate QDF print control object, assign
  955. * pointer to category info or print control
  956. * structure and return the index to the callee
  957. * @cinfo : Pointer to array of category info structure
  958. * @custom_print_handler : Pointer to custom print handler
  959. * @custom_ctx : Pointer to custom context
  960. * @pctrl_name : Pointer to print control object name
  961. *
  962. * Return : Index of qdf_print_ctrl structure
  963. *
  964. */
  965. int qdf_print_ctrl_register(const struct category_info *cinfo,
  966. void *custom_print_handler,
  967. void *custom_ctx,
  968. const char *pctrl_name);
  969. /**
  970. * qdf_shared_print_ctrl_init() - Initialize the shared print ctrl obj with
  971. * all categories set to the default level
  972. *
  973. * Return : void
  974. *
  975. */
  976. void qdf_shared_print_ctrl_init(void);
  977. /**
  978. * qdf_print_setup() - Setup default values to all the print control objects
  979. *
  980. * Register new print control object for the callee
  981. *
  982. * Return : QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE
  983. * on failure
  984. */
  985. QDF_STATUS qdf_print_setup(void);
  986. /**
  987. * qdf_print_ctrl_cleanup() - Clean up a print control object
  988. *
  989. * Cleanup the print control object for the callee
  990. *
  991. * @pctrl : Index of print control object
  992. *
  993. * Return : QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE on failure
  994. */
  995. QDF_STATUS qdf_print_ctrl_cleanup(unsigned int idx);
  996. /**
  997. * qdf_print_ctrl_shared_cleanup() - Clean up of the shared object
  998. *
  999. * Cleanup the shared print-ctrl-object
  1000. *
  1001. * Return : void
  1002. */
  1003. void qdf_shared_print_ctrl_cleanup(void);
  1004. /**
  1005. * qdf_print_set_category_verbose() - Enable/Disable category for a
  1006. * print control object with
  1007. * user provided verbose level
  1008. *
  1009. * @idx : Index of the print control object assigned to callee
  1010. * @category : Category information
  1011. * @verbose: Verbose information
  1012. * @is_set: Flag indicating if verbose level needs to be enabled or disabled
  1013. *
  1014. * Return : QDF_STATUS_SUCCESS for success and QDF_STATUS_E_FAILURE for failure
  1015. */
  1016. QDF_STATUS qdf_print_set_category_verbose(unsigned int idx,
  1017. QDF_MODULE_ID category,
  1018. QDF_TRACE_LEVEL verbose,
  1019. bool is_set);
  1020. /**
  1021. * qdf_print_is_category_enabled() - Get category information for the
  1022. * print control object
  1023. *
  1024. * @idx : Index of print control object
  1025. * @category : Category information
  1026. *
  1027. * Return : Verbose enabled(true) or disabled(false) or invalid input (false)
  1028. */
  1029. bool qdf_print_is_category_enabled(unsigned int idx,
  1030. QDF_MODULE_ID category);
  1031. /**
  1032. * qdf_print_is_verbose_enabled() - Get verbose information of a category for
  1033. * the print control object
  1034. *
  1035. * @idx : Index of print control object
  1036. * @category : Category information
  1037. * @verbose : Verbose information
  1038. *
  1039. * Return : Verbose enabled(true) or disabled(false) or invalid input (false)
  1040. */
  1041. bool qdf_print_is_verbose_enabled(unsigned int idx,
  1042. QDF_MODULE_ID category,
  1043. QDF_TRACE_LEVEL verbose);
  1044. /**
  1045. * qdf_print_clean_node_flag() - Clean up node flag for print control object
  1046. *
  1047. * @idx : Index of print control object
  1048. *
  1049. * Return : None
  1050. */
  1051. void qdf_print_clean_node_flag(unsigned int idx);
  1052. #ifdef DBG_LVL_MAC_FILTERING
  1053. /**
  1054. * qdf_print_set_node_flag() - Set flag to enable MAC level filtering
  1055. *
  1056. * @idx : Index of print control object
  1057. * @enable : Enable/Disable bit sent by callee
  1058. *
  1059. * Return : QDF_STATUS_SUCCESS on Success and QDF_STATUS_E_FAILURE on Failure
  1060. */
  1061. QDF_STATUS qdf_print_set_node_flag(unsigned int idx,
  1062. uint8_t enable);
  1063. /**
  1064. * qdf_print_get_node_flag() - Get flag that controls MAC level filtering
  1065. *
  1066. * @idx : Index of print control object
  1067. *
  1068. * Return : Flag that indicates enable(1) or disable(0) or invalid(-1)
  1069. */
  1070. bool qdf_print_get_node_flag(unsigned int idx);
  1071. #endif
  1072. /**
  1073. * qdf_logging_init() - Initialize msg logging functionality
  1074. *
  1075. *
  1076. * Return : void
  1077. */
  1078. void qdf_logging_init(void);
  1079. /**
  1080. * qdf_logging_exit() - Cleanup msg logging functionality
  1081. *
  1082. *
  1083. * Return : void
  1084. */
  1085. void qdf_logging_exit(void);
  1086. #define QDF_SYMBOL_LEN __QDF_SYMBOL_LEN
  1087. /**
  1088. * qdf_sprint_symbol() - prints the name of a symbol into a string buffer
  1089. * @buffer: the string buffer to print into
  1090. * @addr: address of the symbol to lookup and print
  1091. *
  1092. * Return: number of characters printed
  1093. */
  1094. int qdf_sprint_symbol(char *buffer, void *addr);
  1095. #endif /* __QDF_TRACE_H */