qdf_trace.h 36 KB

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