qdf_trace.h 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674
  1. /*
  2. * Copyright (c) 2014-2021 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. #ifdef LOG_LINE_NUMBER
  34. #define FL(x) "%s: %d: " x, __func__, __LINE__
  35. #else
  36. #define FL(x) "%s: " x, __func__
  37. #endif
  38. #define QDF_TRACE_BUFFER_SIZE (512)
  39. /*
  40. * Extracts the 8-bit group id from the wmi command id by performing the
  41. * reverse operation of WMI_CMD_GRP_START_ID
  42. */
  43. #define QDF_WMI_MTRACE_GRP_ID(message_id) (((message_id) >> 12) & 0xFF)
  44. /*
  45. * Number of bits reserved for WMI mtrace command id
  46. */
  47. #define QDF_WMI_MTRACE_CMD_NUM_BITS 7
  48. /*
  49. * Extracts the 7-bit group specific command id from the wmi command id
  50. */
  51. #define QDF_WMI_MTRACE_CMD_ID(message_id) ((message_id) & 0x7F)
  52. #ifdef QDF_TRACE_PRINT_ENABLE
  53. #define QDF_DEFAULT_TRACE_LEVEL (1 << QDF_TRACE_LEVEL_INFO)
  54. #endif
  55. #define QDF_CATEGORY_INFO_U16(val) (((val >> 16) & 0x0000FFFF))
  56. #define QDF_TRACE_LEVEL_INFO_L16(val) (val & 0x0000FFFF)
  57. typedef int (qdf_abstract_print)(void *priv, const char *fmt, ...);
  58. /*
  59. * Log levels
  60. */
  61. #define QDF_DEBUG_FUNCTRACE 0x01
  62. #define QDF_DEBUG_LEVEL0 0x02
  63. #define QDF_DEBUG_LEVEL1 0x04
  64. #define QDF_DEBUG_LEVEL2 0x08
  65. #define QDF_DEBUG_LEVEL3 0x10
  66. #define QDF_DEBUG_ERROR 0x20
  67. #define QDF_DEBUG_CFG 0x40
  68. /*
  69. * Rate limit based on pkt prototype
  70. */
  71. #define QDF_MAX_DHCP_PKTS_PER_SEC (20)
  72. #define QDF_MAX_EAPOL_PKTS_PER_SEC (50)
  73. #define QDF_MAX_ARP_PKTS_PER_SEC (5)
  74. #define QDF_MAX_DNS_PKTS_PER_SEC (5)
  75. #define QDF_MAX_OTHER_PKTS_PER_SEC (1)
  76. /* DP Trace Implementation */
  77. #ifdef CONFIG_DP_TRACE
  78. #define DPTRACE(p) p
  79. #define DPTRACE_PRINT(args...) \
  80. QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_DEBUG, args)
  81. #else
  82. #define DPTRACE(p)
  83. #define DPTRACE_PRINT(args...)
  84. #endif
  85. /* By default Data Path module will have all log levels enabled, except debug
  86. * log level. Debug level will be left up to the framework or user space modules
  87. * to be enabled when issue is detected
  88. */
  89. #define QDF_DATA_PATH_TRACE_LEVEL \
  90. ((1 << QDF_TRACE_LEVEL_FATAL) | (1 << QDF_TRACE_LEVEL_ERROR) | \
  91. (1 << QDF_TRACE_LEVEL_WARN) | (1 << QDF_TRACE_LEVEL_INFO) | \
  92. (1 << QDF_TRACE_LEVEL_INFO_HIGH) | (1 << QDF_TRACE_LEVEL_INFO_MED) | \
  93. (1 << QDF_TRACE_LEVEL_INFO_LOW))
  94. /* Preprocessor definitions and constants */
  95. #define ASSERT_BUFFER_SIZE (512)
  96. #ifndef MAX_QDF_TRACE_RECORDS
  97. #define MAX_QDF_TRACE_RECORDS 4000
  98. #endif
  99. #define QDF_TRACE_DEFAULT_PDEV_ID 0xff
  100. #define INVALID_QDF_TRACE_ADDR 0xffffffff
  101. #define DEFAULT_QDF_TRACE_DUMP_COUNT 0
  102. #define QDF_TRACE_DEFAULT_MSDU_ID 0
  103. /*
  104. * first parameter to iwpriv command - dump_dp_trace
  105. * iwpriv wlan0 dump_dp_trace 0 0 -> dump full buffer
  106. * iwpriv wlan0 dump_dp_trace 1 0 -> enable live view mode
  107. * iwpriv wlan0 dump_dp_trace 2 0 -> clear dp trace buffer
  108. * iwpriv wlan0 dump_dp_trace 3 0 -> disable live view mode
  109. */
  110. #define DUMP_DP_TRACE 0
  111. #define ENABLE_DP_TRACE_LIVE_MODE 1
  112. #define CLEAR_DP_TRACE_BUFFER 2
  113. #define DISABLE_DP_TRACE_LIVE_MODE 3
  114. #ifdef TRACE_RECORD
  115. #define MTRACE(p) p
  116. #else
  117. #define MTRACE(p) do { } while (0)
  118. #endif
  119. #define NO_SESSION 0xFF
  120. /**
  121. * typedef struct qdf_trace_record_s - keep trace record
  122. * @qtime: qtimer ticks
  123. * @time: user timestamp
  124. * @module: module name
  125. * @code: hold record of code
  126. * @session: hold record of session
  127. * @data: hold data
  128. * @pid: hold pid of the process
  129. */
  130. typedef struct qdf_trace_record_s {
  131. uint64_t qtime;
  132. char time[18];
  133. uint8_t module;
  134. uint16_t code;
  135. uint16_t session;
  136. uint32_t data;
  137. uint32_t pid;
  138. } qdf_trace_record_t, *tp_qdf_trace_record;
  139. /**
  140. * typedef struct s_qdf_trace_data - MTRACE logs are stored in ring buffer
  141. * @head: position of first record
  142. * @tail: position of last record
  143. * @num: count of total record
  144. * @num_since_last_dump: count from last dump
  145. * @enable: config for controlling the trace
  146. * @dump_count: Dump after number of records reach this number
  147. */
  148. typedef struct s_qdf_trace_data {
  149. uint32_t head;
  150. uint32_t tail;
  151. uint32_t num;
  152. uint16_t num_since_last_dump;
  153. uint8_t enable;
  154. uint16_t dump_count;
  155. } t_qdf_trace_data;
  156. #define CASE_RETURN_STRING(str) case ((str)): return (uint8_t *)(# str);
  157. #ifndef MAX_QDF_DP_TRACE_RECORDS
  158. #define MAX_QDF_DP_TRACE_RECORDS 2000
  159. #endif
  160. #define QDF_DP_TRACE_RECORD_SIZE 50 /* bytes */
  161. #define INVALID_QDF_DP_TRACE_ADDR 0xffffffff
  162. #define QDF_DP_TRACE_VERBOSITY_HIGH 4
  163. #define QDF_DP_TRACE_VERBOSITY_MEDIUM 3
  164. #define QDF_DP_TRACE_VERBOSITY_LOW 2
  165. #define QDF_DP_TRACE_VERBOSITY_ULTRA_LOW 1
  166. #define QDF_DP_TRACE_VERBOSITY_BASE 0
  167. /**
  168. * enum QDF_DP_TRACE_ID - Generic ID to identify various events in data path
  169. * @QDF_DP_TRACE_INVALID - invalid
  170. * @QDF_DP_TRACE_DROP_PACKET_RECORD - record drop packet
  171. * @QDF_DP_TRACE_EAPOL_PACKET_RECORD - record EAPOL packet
  172. * @QDF_DP_TRACE_DHCP_PACKET_RECORD - record DHCP packet
  173. * @QDF_DP_TRACE_ARP_PACKET_RECORD - record ARP packet
  174. * @QDF_DP_TRACE_MGMT_PACKET_RECORD - record MGMT pacekt
  175. * @QDF_DP_TRACE_EVENT_RECORD - record events
  176. * @QDF_DP_TRACE_BASE_VERBOSITY - below this are part of base verbosity
  177. * @QDF_DP_TRACE_ICMP_PACKET_RECORD - record ICMP packet
  178. * @QDF_DP_TRACE_ICMPv6_PACKET_RECORD - record ICMPv6 packet
  179. * @QDF_DP_TRACE_HDD_TX_TIMEOUT - HDD tx timeout
  180. * @QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT- SOFTAP HDD tx timeout
  181. * @QDF_DP_TRACE_TX_CREDIT_RECORD - credit update record
  182. * @QDF_DP_TRACE_ULTRA_LOW_VERBOSITY - Below this is not logged for >4PPS
  183. * @QDF_DP_TRACE_TX_PACKET_RECORD - record 32 bytes of tx pkt at any layer
  184. * @QDF_DP_TRACE_RX_PACKET_RECORD - record 32 bytes of rx pkt at any layer
  185. * @QDF_DP_TRACE_HDD_TX_PACKET_RECORD - record 32 bytes of tx pkt at HDD
  186. * @QDF_DP_TRACE_HDD_RX_PACKET_RECORD - record 32 bytes of rx pkt at HDD
  187. * @QDF_DP_TRACE_LI_DP_TX_PACKET_RECORD - record data bytes of tx pkt at LI_DP
  188. * @QDF_DP_TRACE_LI_DP_RX_PACKET_RECORD - record data bytes of rx pkt at LI_DP
  189. * @QDF_DP_TRACE_LI_DP_FREE_PACKET_PTR_RECORD - tx completion ptr record for
  190. * lithium
  191. * @QDF_DP_TRACE_FREE_PACKET_PTR_RECORD - tx completion ptr record
  192. * @QDF_DP_TRACE_LOW_VERBOSITY - below this are part of low verbosity
  193. * @QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD - HDD layer ptr record
  194. * @QDF_DP_TRACE_LI_DP_TX_PACKET_PTR_RECORD - Lithium DP layer ptr record
  195. * @QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD - HDD RX record
  196. * @QDF_DP_TRACE_CE_PACKET_PTR_RECORD - CE layer ptr record
  197. * @QDF_DP_TRACE_CE_FAST_PACKET_PTR_RECORD- CE fastpath ptr record
  198. * @QDF_DP_TRACE_CE_FAST_PACKET_ERR_RECORD- CE fastpath error record
  199. * @QDF_DP_TRACE_RX_HTT_PACKET_PTR_RECORD - HTT RX record
  200. * @QDF_DP_TRACE_RX_OFFLOAD_HTT_PACKET_PTR_RECORD- HTT RX offload record
  201. * @QDF_DP_TRACE_RX_LI_DP_PACKET_PTR_RECORD - Lithium DP RX record
  202. * @QDF_DP_TRACE_MED_VERBOSITY - below this are part of med verbosity
  203. * @QDF_DP_TRACE_TXRX_QUEUE_PACKET_PTR_RECORD -tx queue ptr record
  204. * @QDF_DP_TRACE_TXRX_PACKET_PTR_RECORD - txrx packet ptr record
  205. * @QDF_DP_TRACE_TXRX_FAST_PACKET_PTR_RECORD - txrx fast path record
  206. * @QDF_DP_TRACE_HTT_PACKET_PTR_RECORD - htt packet ptr record
  207. * @QDF_DP_TRACE_HTC_PACKET_PTR_RECORD - htc packet ptr record
  208. * @QDF_DP_TRACE_HIF_PACKET_PTR_RECORD - hif packet ptr record
  209. * @QDF_DP_TRACE_RX_TXRX_PACKET_PTR_RECORD - txrx packet ptr record
  210. * @QDF_DP_TRACE_LI_DP_NULL_RX_PACKET_RECORD
  211. * - record data bytes of rx null_queue pkt at LI_DP
  212. * @QDF_DP_TRACE_HIGH_VERBOSITY - below this are part of high verbosity
  213. */
  214. enum QDF_DP_TRACE_ID {
  215. QDF_DP_TRACE_INVALID,
  216. QDF_DP_TRACE_DROP_PACKET_RECORD,
  217. QDF_DP_TRACE_EAPOL_PACKET_RECORD,
  218. QDF_DP_TRACE_DHCP_PACKET_RECORD,
  219. QDF_DP_TRACE_ARP_PACKET_RECORD,
  220. QDF_DP_TRACE_MGMT_PACKET_RECORD,
  221. QDF_DP_TRACE_EVENT_RECORD,
  222. QDF_DP_TRACE_BASE_VERBOSITY,
  223. QDF_DP_TRACE_ICMP_PACKET_RECORD,
  224. QDF_DP_TRACE_ICMPv6_PACKET_RECORD,
  225. QDF_DP_TRACE_HDD_TX_TIMEOUT,
  226. QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT,
  227. QDF_DP_TRACE_TX_CREDIT_RECORD,
  228. QDF_DP_TRACE_ULTRA_LOW_VERBOSITY,
  229. QDF_DP_TRACE_TX_PACKET_RECORD,
  230. QDF_DP_TRACE_RX_PACKET_RECORD,
  231. QDF_DP_TRACE_HDD_TX_PACKET_RECORD,
  232. QDF_DP_TRACE_HDD_RX_PACKET_RECORD,
  233. QDF_DP_TRACE_LI_DP_TX_PACKET_RECORD,
  234. QDF_DP_TRACE_LI_DP_RX_PACKET_RECORD,
  235. QDF_DP_TRACE_LI_DP_FREE_PACKET_PTR_RECORD,
  236. QDF_DP_TRACE_FREE_PACKET_PTR_RECORD,
  237. QDF_DP_TRACE_LOW_VERBOSITY,
  238. QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD,
  239. QDF_DP_TRACE_LI_DP_TX_PACKET_PTR_RECORD,
  240. QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD,
  241. QDF_DP_TRACE_CE_PACKET_PTR_RECORD,
  242. QDF_DP_TRACE_CE_FAST_PACKET_PTR_RECORD,
  243. QDF_DP_TRACE_CE_FAST_PACKET_ERR_RECORD,
  244. QDF_DP_TRACE_RX_HTT_PACKET_PTR_RECORD,
  245. QDF_DP_TRACE_RX_OFFLOAD_HTT_PACKET_PTR_RECORD,
  246. QDF_DP_TRACE_RX_LI_DP_PACKET_PTR_RECORD,
  247. QDF_DP_TRACE_MED_VERBOSITY,
  248. QDF_DP_TRACE_TXRX_QUEUE_PACKET_PTR_RECORD,
  249. QDF_DP_TRACE_TXRX_PACKET_PTR_RECORD,
  250. QDF_DP_TRACE_TXRX_FAST_PACKET_PTR_RECORD,
  251. QDF_DP_TRACE_HTT_PACKET_PTR_RECORD,
  252. QDF_DP_TRACE_HTC_PACKET_PTR_RECORD,
  253. QDF_DP_TRACE_HIF_PACKET_PTR_RECORD,
  254. QDF_DP_TRACE_RX_TXRX_PACKET_PTR_RECORD,
  255. QDF_DP_TRACE_LI_DP_NULL_RX_PACKET_RECORD,
  256. QDF_DP_TRACE_HIGH_VERBOSITY,
  257. QDF_DP_TRACE_MAX
  258. };
  259. /**
  260. * qdf_proto_dir - direction
  261. * @QDF_TX: TX direction
  262. * @QDF_RX: RX direction
  263. * @QDF_NA: not applicable
  264. */
  265. enum qdf_proto_dir {
  266. QDF_TX,
  267. QDF_RX,
  268. QDF_NA
  269. };
  270. /**
  271. * QDF_CREDIT_UPDATE_SOURCE - source of credit record
  272. * @QDF_TX_SCHED: Tx scheduler
  273. * @QDF_TX_COMP: TX completion
  274. * @QDF_TX_CREDIT_UPDATE: credit update indication
  275. * @QDF_HTT_ATTACH: HTT attach
  276. * @QDF_TX_HTT_MSG: HTT TX message
  277. */
  278. enum QDF_CREDIT_UPDATE_SOURCE {
  279. QDF_TX_SCHED,
  280. QDF_TX_COMP,
  281. QDF_TX_CREDIT_UPDATE,
  282. QDF_HTT_ATTACH,
  283. QDF_TX_HTT_MSG
  284. };
  285. /**
  286. * QDF_CREDIT_OPERATION - operation on credit
  287. * @QDF_CREDIT_INC: credit increment
  288. * @QDF_CREDIT_DEC: credit decrement
  289. * @QDF_CREDIT_ABS: Abosolute credit
  290. * @QDF_OP_NA: Not applicable
  291. */
  292. enum QDF_CREDIT_OPERATION {
  293. QDF_CREDIT_INC,
  294. QDF_CREDIT_DEC,
  295. QDF_CREDIT_ABS,
  296. QDF_OP_NA
  297. };
  298. /**
  299. * struct qdf_dp_trace_ptr_buf - pointer record buffer
  300. * @cookie: cookie value
  301. * @msdu_id: msdu_id
  302. * @status: completion status
  303. */
  304. struct qdf_dp_trace_ptr_buf {
  305. uint64_t cookie;
  306. uint16_t msdu_id;
  307. uint16_t status;
  308. };
  309. /**
  310. * struct qdf_dp_trace_proto_buf - proto packet buffer
  311. * @sa: source address
  312. * @da: destination address
  313. * @vdev_id : vdev id
  314. * @type: packet type
  315. * @subtype: packet subtype
  316. * @dir: direction
  317. * @proto_priv_data: protocol private data
  318. * can be stored in this.
  319. */
  320. struct qdf_dp_trace_proto_buf {
  321. struct qdf_mac_addr sa;
  322. struct qdf_mac_addr da;
  323. uint8_t vdev_id;
  324. uint8_t type;
  325. uint8_t subtype;
  326. uint8_t dir;
  327. /* for ICMP priv data is bit offset 38 to 42
  328. * 38-40 ICMP_ICMP_ID and
  329. * 40-42 ICMP_SEQ_NUM_OFFSET
  330. */
  331. uint32_t proto_priv_data;
  332. };
  333. /**
  334. * struct qdf_dp_trace_mgmt_buf - mgmt packet buffer
  335. * @vdev_id : vdev id
  336. * @type: packet type
  337. * @subtype: packet subtype
  338. */
  339. struct qdf_dp_trace_mgmt_buf {
  340. uint8_t vdev_id;
  341. uint8_t type;
  342. uint8_t subtype;
  343. };
  344. /**
  345. * struct qdf_dp_trace_credit_record - tx credit record
  346. * @source: credit record source
  347. * @operation: credit operation
  348. * @delta: delta of credit
  349. * @total_credits: total credit
  350. * @g0_credit: group 0 credit
  351. * @g1_credit: group 1 credit
  352. */
  353. struct qdf_dp_trace_credit_record {
  354. enum QDF_CREDIT_UPDATE_SOURCE source;
  355. enum QDF_CREDIT_OPERATION operation;
  356. int delta;
  357. int total_credits;
  358. int g0_credit;
  359. int g1_credit;
  360. };
  361. /**
  362. * struct qdf_dp_trace_event_buf - event buffer
  363. * @vdev_id : vdev id
  364. * @type: packet type
  365. * @subtype: packet subtype
  366. */
  367. struct qdf_dp_trace_event_buf {
  368. uint8_t vdev_id;
  369. uint8_t type;
  370. uint8_t subtype;
  371. };
  372. /**
  373. * struct qdf_dp_trace_data_buf - nbuf data buffer
  374. * @msdu_id : msdu id
  375. */
  376. struct qdf_dp_trace_data_buf {
  377. uint16_t msdu_id;
  378. };
  379. /**
  380. * struct qdf_dp_trace_record_s - Describes a record in DP trace
  381. * @time: time when it got stored
  382. * @code: Describes the particular event
  383. * @data: buffer to store data
  384. * @size: Length of the valid data stored in this record
  385. * @pid : process id which stored the data in this record
  386. */
  387. struct qdf_dp_trace_record_s {
  388. uint64_t time;
  389. uint8_t code;
  390. uint8_t data[QDF_DP_TRACE_RECORD_SIZE];
  391. uint8_t size;
  392. uint32_t pid;
  393. uint8_t pdev_id;
  394. };
  395. /**
  396. * struct qdf_dp_trace_data - Parameters to configure/control DP trace
  397. * @head: Position of first record
  398. * @tail: Position of last record
  399. * @num: Current index
  400. * @proto_bitmap: defines which protocol to be traced
  401. * @no_of_record: defines every nth packet to be traced
  402. * @num_records_to_dump: defines number of records to be dumped
  403. * @dump_counter: counter to track number of records dumped
  404. * @verbosity : defines verbosity level
  405. * @ini_conf_verbosity: Configured verbosity from INI
  406. * @enable: enable/disable DP trace
  407. * @count: current packet number
  408. * @live_mode_config: configuration as received during initialization
  409. * @live_mode: current live mode, enabled or disabled, can be throttled based
  410. * on throughput
  411. * @force_live_mode: flag to enable live mode all the time for all packets.
  412. * This can be set/unset from userspace and overrides other
  413. * live mode flags.
  414. * @dynamic_verbosity_modify: Dynamic user configured verbosity overrides all
  415. * @print_pkt_cnt: count of number of packets printed in live mode
  416. * @high_tput_thresh: thresh beyond which live mode is turned off
  417. * @thresh_time_limit: max time, in terms of BW timer intervals to wait,
  418. * for determining if high_tput_thresh has been crossed. ~1s
  419. * @arp_req: stats for arp reqs
  420. * @arp_resp: stats for arp resps
  421. * @icmp_req: stats for icmp reqs
  422. * @icmp_resp: stats for icmp resps
  423. * @dhcp_disc: stats for dhcp discover msgs
  424. * @dhcp_req: stats for dhcp req msgs
  425. * @dhcp_off: stats for dhcp offer msgs
  426. * @dhcp_ack: stats for dhcp ack msgs
  427. * @dhcp_nack: stats for dhcp nack msgs
  428. * @dhcp_others: stats for other dhcp pkts types
  429. * @eapol_m1: stats for eapol m1
  430. * @eapol_m2: stats for eapol m2
  431. * @eapol_m3: stats for eapol m3
  432. * @eapol_m4: stats for eapol m4
  433. * @eapol_others: stats for other eapol pkt types
  434. * @icmpv6_req: stats for icmpv6 reqs
  435. * @icmpv6_resp: stats for icmpv6 resps
  436. * @icmpv6_ns: stats for icmpv6 nss
  437. * @icmpv6_na: stats for icmpv6 nas
  438. * @icmpv6_rs: stats for icmpv6 rss
  439. * @icmpv6_ra: stats for icmpv6 ras
  440. * @proto_event_bitmap: defines which protocol to be diag logged.
  441. * refer QDF_NBUF_PKT_TRAC_TYPE_DNS to QDF_NBUF_PKT_TRAC_TYPE_ARP
  442. * for bitmap.
  443. */
  444. struct s_qdf_dp_trace_data {
  445. uint32_t head;
  446. uint32_t tail;
  447. uint32_t num;
  448. uint32_t proto_bitmap;
  449. uint8_t no_of_record;
  450. uint16_t num_records_to_dump;
  451. uint16_t dump_counter;
  452. uint8_t verbosity;
  453. uint8_t ini_conf_verbosity;
  454. bool enable;
  455. bool live_mode_config;
  456. bool live_mode;
  457. uint32_t curr_pos;
  458. uint32_t saved_tail;
  459. bool force_live_mode;
  460. bool dynamic_verbosity_modify;
  461. uint8_t print_pkt_cnt;
  462. uint8_t high_tput_thresh;
  463. uint16_t thresh_time_limit;
  464. /* Stats */
  465. uint32_t tx_count;
  466. uint32_t rx_count;
  467. u16 arp_req;
  468. u16 arp_resp;
  469. u16 dhcp_disc;
  470. u16 dhcp_req;
  471. u16 dhcp_off;
  472. u16 dhcp_ack;
  473. u16 dhcp_nack;
  474. u16 dhcp_others;
  475. u16 eapol_m1;
  476. u16 eapol_m2;
  477. u16 eapol_m3;
  478. u16 eapol_m4;
  479. u16 eapol_others;
  480. u16 icmp_req;
  481. u16 icmp_resp;
  482. u16 icmpv6_req;
  483. u16 icmpv6_resp;
  484. u16 icmpv6_ns;
  485. u16 icmpv6_na;
  486. u16 icmpv6_rs;
  487. u16 icmpv6_ra;
  488. uint32_t proto_event_bitmap;
  489. };
  490. /**
  491. * struct qdf_dpt_debugfs_state - state to control read to debugfs file
  492. * @QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INVALID: invalid state
  493. * @QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INIT: initial state
  494. * @QDF_DPT_DEBUGFS_STATE_SHOW_IN_PROGRESS: read is in progress
  495. * @QDF_DPT_DEBUGFS_STATE_SHOW_COMPLETE: read complete
  496. */
  497. enum qdf_dpt_debugfs_state {
  498. QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INVALID,
  499. QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INIT,
  500. QDF_DPT_DEBUGFS_STATE_SHOW_IN_PROGRESS,
  501. QDF_DPT_DEBUGFS_STATE_SHOW_COMPLETE,
  502. };
  503. #define QDF_WIFI_MODULE_PARAMS_FILE "wifi_module_param.ini"
  504. typedef void (*tp_qdf_trace_cb)(void *p_mac, tp_qdf_trace_record, uint16_t);
  505. typedef void (*tp_qdf_state_info_cb) (char **buf, uint16_t *size);
  506. #ifdef WLAN_FEATURE_MEMDUMP_ENABLE
  507. void qdf_register_debugcb_init(void);
  508. void qdf_register_debug_callback(QDF_MODULE_ID module_id,
  509. tp_qdf_state_info_cb qdf_state_infocb);
  510. QDF_STATUS qdf_state_info_dump_all(char *buf, uint16_t size,
  511. uint16_t *driver_dump_size);
  512. #else /* WLAN_FEATURE_MEMDUMP_ENABLE */
  513. static inline void qdf_register_debugcb_init(void)
  514. {
  515. }
  516. #endif /* WLAN_FEATURE_MEMDUMP_ENABLE */
  517. #ifdef TRACE_RECORD
  518. void qdf_trace_register(QDF_MODULE_ID, tp_qdf_trace_cb);
  519. void qdf_trace_init(void);
  520. void qdf_trace_deinit(void);
  521. void qdf_trace(uint8_t module, uint16_t code, uint16_t session, uint32_t data);
  522. void qdf_trace_enable(uint32_t, uint8_t enable);
  523. void qdf_trace_dump_all(void *, uint8_t, uint8_t, uint32_t, uint32_t);
  524. QDF_STATUS qdf_trace_spin_lock_init(void);
  525. #else
  526. #ifndef QDF_TRACE_PRINT_ENABLE
  527. static inline
  528. void qdf_trace_init(void)
  529. {
  530. }
  531. static inline
  532. void qdf_trace_deinit(void)
  533. {
  534. }
  535. static inline
  536. void qdf_trace_enable(uint32_t bitmask_of_module_id, uint8_t enable)
  537. {
  538. }
  539. static inline
  540. void qdf_trace(uint8_t module, uint16_t code, uint16_t session, uint32_t data)
  541. {
  542. }
  543. static inline
  544. void qdf_trace_dump_all(void *p_mac, uint8_t code, uint8_t session,
  545. uint32_t count, uint32_t bitmask_of_module)
  546. {
  547. }
  548. static inline
  549. QDF_STATUS qdf_trace_spin_lock_init(void)
  550. {
  551. return QDF_STATUS_SUCCESS;
  552. }
  553. #endif
  554. #endif
  555. #ifdef WLAN_MAX_LOGS_PER_SEC
  556. /**
  557. * qdf_detected_excessive_logging() - Excessive logging detected
  558. *
  559. * Track logging count using a quasi-tumbling window.
  560. * If the max logging count for a given window is exceeded,
  561. * return true else fails.
  562. *
  563. * Return: true/false
  564. */
  565. bool qdf_detected_excessive_logging(void);
  566. /**
  567. * qdf_rl_print_count_set() - set the ratelimiting print count
  568. * @rl_print_time: ratelimiting print count
  569. *
  570. * Return: none
  571. */
  572. void qdf_rl_print_count_set(uint32_t rl_print_count);
  573. /**
  574. * qdf_rl_print_time_set() - set the ratelimiting print time
  575. * @rl_print_time: ratelimiting print time
  576. *
  577. * Return: none
  578. */
  579. void qdf_rl_print_time_set(uint32_t rl_print_time);
  580. /**
  581. * qdf_rl_print_supressed_log() - print the supressed logs count
  582. *
  583. * Return: none
  584. */
  585. void qdf_rl_print_supressed_log(void);
  586. /**
  587. * qdf_rl_print_supressed_inc() - increment the supressed logs count
  588. *
  589. * Return: none
  590. */
  591. void qdf_rl_print_supressed_inc(void);
  592. #else /* WLAN_MAX_LOGS_PER_SEC */
  593. static inline bool qdf_detected_excessive_logging(void)
  594. {
  595. return false;
  596. }
  597. static inline void qdf_rl_print_count_set(uint32_t rl_print_count) {}
  598. static inline void qdf_rl_print_time_set(uint32_t rl_print_time) {}
  599. static inline void qdf_rl_print_supressed_log(void) {}
  600. static inline void qdf_rl_print_supressed_inc(void) {}
  601. #endif /* WLAN_MAX_LOGS_PER_SEC */
  602. #ifdef ENABLE_MTRACE_LOG
  603. /**
  604. * qdf_mtrace_log() - Logs a message tracepoint to DIAG
  605. * Infrastructure.
  606. * @src_module: Enum of source module (basically module id)
  607. * from where the message with message_id is posted.
  608. * @dst_module: Enum of destination module (basically module id)
  609. * to which the message with message_id is posted.
  610. * @message_id: Id of the message to be posted
  611. * @vdev_id: Vdev Id
  612. *
  613. * This function logs to the DIAG Infrastructure a tracepoint for a
  614. * message being sent from a source module to a destination module
  615. * with a specific ID for the benefit of a specific vdev.
  616. * For non-vdev messages vdev_id will be NO_SESSION
  617. * Return: None
  618. */
  619. void qdf_mtrace_log(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module,
  620. uint16_t message_id, uint8_t vdev_id);
  621. #else
  622. static inline
  623. void qdf_mtrace_log(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module,
  624. uint16_t message_id, uint8_t vdev_id)
  625. {
  626. }
  627. #endif
  628. #ifdef TRACE_RECORD
  629. /**
  630. * qdf_mtrace() - puts the messages in to ring-buffer
  631. * and logs a message tracepoint to DIAG Infrastructure.
  632. * @src_module: Enum of source module (basically module id)
  633. * from where the message with message_id is posted.
  634. * @dst_module: Enum of destination module (basically module id)
  635. * to which the message with message_id is posted.
  636. * @message_id: Id of the message to be posted
  637. * @vdev_id: Vdev Id
  638. * @data: Actual message contents
  639. *
  640. * This function will be called from each module which wants to record the
  641. * messages in circular queue. Before calling this function make sure you
  642. * have registered your module with qdf through qdf_trace_register function.
  643. * In addition of the recording the messages in circular queue this function
  644. * will log the message tracepoint to the DIAG infrastructure.
  645. * these logs will be later used by post processing script.
  646. *
  647. * Return: None
  648. */
  649. void qdf_mtrace(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module,
  650. uint16_t message_id, uint8_t vdev_id, uint32_t data);
  651. #else
  652. static inline
  653. void qdf_mtrace(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module,
  654. uint16_t message_id, uint8_t vdev_id, uint32_t data)
  655. {
  656. }
  657. #endif
  658. #ifdef CONFIG_DP_TRACE
  659. void qdf_dp_set_proto_bitmap(uint32_t val);
  660. void qdf_dp_trace_set_verbosity(uint32_t val);
  661. void qdf_dp_set_no_of_record(uint32_t val);
  662. #define QDF_DP_TRACE_RECORD_INFO_LIVE (0x1)
  663. #define QDF_DP_TRACE_RECORD_INFO_THROTTLED (0x1 << 1)
  664. /**
  665. * qdf_dp_trace_log_pkt() - log packet type enabled through iwpriv
  666. * @vdev_id: vdev_id
  667. * @skb: skb pointer
  668. * @dir: direction
  669. * @pdev_id: pdev_id
  670. *
  671. * Return: true: some protocol was logged, false: no protocol was logged.
  672. */
  673. bool qdf_dp_trace_log_pkt(uint8_t vdev_id, struct sk_buff *skb,
  674. enum qdf_proto_dir dir, uint8_t pdev_id);
  675. void qdf_dp_trace_init(bool live_mode_config, uint8_t thresh,
  676. uint16_t time_limit, uint8_t verbosity,
  677. uint32_t proto_bitmap);
  678. void qdf_dp_trace_deinit(void);
  679. void qdf_dp_trace_spin_lock_init(void);
  680. void qdf_dp_trace_set_value(uint32_t proto_bitmap, uint8_t no_of_records,
  681. uint8_t verbosity);
  682. void qdf_dp_trace_set_track(qdf_nbuf_t nbuf, enum qdf_proto_dir dir);
  683. void qdf_dp_trace(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code, uint8_t pdev_id,
  684. uint8_t *data, uint8_t size, enum qdf_proto_dir dir);
  685. void qdf_dp_trace_dump_all(uint32_t count, uint8_t pdev_id);
  686. /**
  687. * qdf_dpt_get_curr_pos_debugfs() - get curr position to start read
  688. * @file: debugfs file to read
  689. * @state: state to control read to debugfs file
  690. *
  691. * Return: curr pos
  692. */
  693. uint32_t qdf_dpt_get_curr_pos_debugfs(qdf_debugfs_file_t file,
  694. enum qdf_dpt_debugfs_state state);
  695. /**
  696. * qdf_dpt_dump_stats_debugfs() - dump DP Trace stats to debugfs file
  697. * @file: debugfs file to read
  698. * @curr_pos: curr position to start read
  699. *
  700. * Return: QDF_STATUS
  701. */
  702. QDF_STATUS qdf_dpt_dump_stats_debugfs(qdf_debugfs_file_t file,
  703. uint32_t curr_pos);
  704. /**
  705. * qdf_dpt_set_value_debugfs() - set value of DP Trace debugfs params
  706. * @proto_bitmap: defines which protocol to be traced
  707. * @no_of_record: defines every nth packet to be traced
  708. * @verbosity : defines verbosity level
  709. * @num_records_to_dump: defines number of records to be dumped
  710. *
  711. * Return: none
  712. */
  713. void qdf_dpt_set_value_debugfs(uint8_t proto_bitmap, uint8_t no_of_record,
  714. uint8_t verbosity, uint16_t num_records_to_dump);
  715. /**
  716. * qdf_dp_trace_dump_stats() - dump DP Trace stats
  717. *
  718. * Return: none
  719. */
  720. void qdf_dp_trace_dump_stats(void);
  721. typedef void (*tp_qdf_dp_trace_cb)(struct qdf_dp_trace_record_s*,
  722. uint16_t, uint8_t, uint8_t info);
  723. /**
  724. * qdf_dp_display_record() - Displays a record in DP trace
  725. * @record: pointer to a record in DP trace
  726. * @index: record index
  727. * @pdev_id: pdev id for the mgmt pkt
  728. * @info: info used to display pkt (live mode, throttling)
  729. *
  730. * Return: None
  731. */
  732. void qdf_dp_display_record(struct qdf_dp_trace_record_s *record,
  733. uint16_t index, uint8_t pdev_id,
  734. uint8_t info);
  735. /**
  736. * qdf_dp_display_ptr_record() - display record
  737. * @record: dptrace record
  738. * @rec_index: index
  739. * @pdev_id: pdev id for the mgmt pkt
  740. * @info: info used to display pkt (live mode, throttling)
  741. *
  742. * Return: none
  743. */
  744. void qdf_dp_display_ptr_record(struct qdf_dp_trace_record_s *record,
  745. uint16_t rec_index, uint8_t pdev_id,
  746. uint8_t info);
  747. /**
  748. * qdf_dp_display_proto_pkt() - display proto packet
  749. * @record: dptrace record
  750. * @index: index
  751. * @pdev_id: pdev id for the mgmt pkt
  752. * @info: info used to display pkt (live mode, throttling)
  753. *
  754. * Return: none
  755. */
  756. void qdf_dp_display_proto_pkt(struct qdf_dp_trace_record_s *record,
  757. uint16_t index, uint8_t pdev_id,
  758. uint8_t info);
  759. /**
  760. * qdf_dp_display_data_pkt_record() - Displays a data packet in DP trace
  761. * @record: pointer to a record in DP trace
  762. * @rec_index: record index
  763. * @pdev_id: pdev id
  764. * @info: display info regarding record
  765. *
  766. * Return: None
  767. */
  768. void
  769. qdf_dp_display_data_pkt_record(struct qdf_dp_trace_record_s *record,
  770. uint16_t rec_index, uint8_t pdev_id,
  771. uint8_t info);
  772. /**
  773. * qdf_dp_get_status_from_htt() - Convert htt tx status to qdf dp status
  774. * @status : htt_tx_status which needs to be converted
  775. *
  776. * Return : the status that from qdf_dp_tx_rx_status
  777. */
  778. enum qdf_dp_tx_rx_status qdf_dp_get_status_from_htt(uint8_t status);
  779. /**
  780. * qdf_dp_get_status_from_a_status() - Convert A_STATUS to qdf dp status
  781. * @status : A_STATUS which needs to be converted
  782. *
  783. * Return : the status that from qdf_dp_tx_rx_status
  784. */
  785. enum qdf_dp_tx_rx_status qdf_dp_get_status_from_a_status(uint8_t status);
  786. /**
  787. * qdf_dp_trace_ptr() - record dptrace
  788. * @code: dptrace code
  789. * @pdev_id: pdev_id
  790. * @data: data
  791. * @size: size of data
  792. * @msdu_id: msdu_id
  793. * @status: return status
  794. * @qdf_tx_status: qdf tx rx status
  795. *
  796. * Return: none
  797. */
  798. void qdf_dp_trace_ptr(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code,
  799. uint8_t pdev_id, uint8_t *data, uint8_t size,
  800. uint16_t msdu_id, uint16_t buf_arg_status,
  801. enum qdf_dp_tx_rx_status qdf_tx_status);
  802. void qdf_dp_trace_throttle_live_mode(bool high_bw_request);
  803. /**
  804. * qdf_dp_trace_tput_policy() - Change verbosity based on the TPUT
  805. * @is_data_traffic: Is traffic more than low TPUT threashould
  806. *
  807. * Return: None
  808. */
  809. void qdf_dp_trace_apply_tput_policy(bool is_data_traffic);
  810. /**
  811. * qdf_dp_trace_data_pkt() - trace data packet
  812. * @nbuf: nbuf which needs to be traced
  813. * @pdev_id: pdev_id
  814. * @code: QDF_DP_TRACE_ID for the packet (TX or RX)
  815. * @msdu_id: tx desc id for the nbuf (Only applies to TX packets)
  816. * @dir: TX or RX packet direction
  817. *
  818. * Return: None
  819. */
  820. void qdf_dp_trace_data_pkt(qdf_nbuf_t nbuf, uint8_t pdev_id,
  821. enum QDF_DP_TRACE_ID code, uint16_t msdu_id,
  822. enum qdf_proto_dir dir);
  823. uint32_t qdf_dp_get_proto_bitmap(void);
  824. uint8_t qdf_dp_get_verbosity(void);
  825. uint8_t qdf_dp_get_no_of_record(void);
  826. /**
  827. * qdf_dp_trace_proto_pkt() - record proto packet
  828. * @code: dptrace code
  829. * @vdev_id: vdev id
  830. * @sa: source mac address
  831. * @da: destination mac address
  832. * @type: proto type
  833. * @subtype: proto subtype
  834. * @dir: direction
  835. * @pdev_id: pdev id
  836. * @print: to print this proto pkt or not
  837. * @proto_priv_data: protocol specific private
  838. * data.
  839. * Return: none
  840. */
  841. void
  842. qdf_dp_trace_proto_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
  843. uint8_t *sa, uint8_t *da, enum qdf_proto_type type,
  844. enum qdf_proto_subtype subtype, enum qdf_proto_dir dir,
  845. uint8_t pdev_id, bool print, uint32_t proto_priv_data);
  846. void qdf_dp_trace_disable_live_mode(void);
  847. void qdf_dp_trace_enable_live_mode(void);
  848. void qdf_dp_trace_clear_buffer(void);
  849. /**
  850. * qdf_dp_trace_mgmt_pkt() - record mgmt packet
  851. * @code: dptrace code
  852. * @vdev_id: vdev id
  853. * @pdev_id: pdev_id
  854. * @type: proto type
  855. * @subtype: proto subtype
  856. *
  857. * Return: none
  858. */
  859. void qdf_dp_trace_mgmt_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
  860. uint8_t pdev_id, enum qdf_proto_type type,
  861. enum qdf_proto_subtype subtype);
  862. /**
  863. * qdf_dp_trace_credit_record() - record credit update
  864. * @source: source of record
  865. * @operation: credit operation
  866. * @delta: credit delta
  867. * @total_credits: total credit
  868. * @g0_credit: group 0 credit
  869. * @g1_credit: group 1 credit
  870. */
  871. void qdf_dp_trace_credit_record(enum QDF_CREDIT_UPDATE_SOURCE source,
  872. enum QDF_CREDIT_OPERATION operation,
  873. int delta, int total_credits,
  874. int g0_credit, int g1_credit);
  875. /**
  876. * qdf_dp_display_mgmt_pkt() - display proto packet
  877. * @record: dptrace record
  878. * @index: index
  879. * @pdev_id: pdev id for the mgmt pkt
  880. * @info: info used to display pkt (live mode, throttling)
  881. *
  882. * Return: none
  883. */
  884. void qdf_dp_display_mgmt_pkt(struct qdf_dp_trace_record_s *record,
  885. uint16_t index, uint8_t pdev_id, uint8_t info);
  886. /**
  887. * qdf_dp_display_credit_record() - display credit record
  888. * @record: dptrace record
  889. * @index: index
  890. * @pdev_id: pdev id
  891. * @info: metadeta info
  892. */
  893. void qdf_dp_display_credit_record(struct qdf_dp_trace_record_s *record,
  894. uint16_t index, uint8_t pdev_id,
  895. uint8_t info);
  896. /**
  897. * qdf_dp_display_event_record() - display event records
  898. * @record: dptrace record
  899. * @index: index
  900. * @pdev_id: pdev id for the mgmt pkt
  901. * @info: info used to display pkt (live mode, throttling)
  902. *
  903. * Return: none
  904. */
  905. void qdf_dp_display_event_record(struct qdf_dp_trace_record_s *record,
  906. uint16_t index, uint8_t pdev_id, uint8_t info);
  907. void qdf_dp_trace_record_event(enum QDF_DP_TRACE_ID code, uint8_t vdev_id,
  908. uint8_t pdev_id, enum qdf_proto_type type,
  909. enum qdf_proto_subtype subtype);
  910. /**
  911. * qdf_dp_set_proto_event_bitmap() - Set the protocol event bitmap
  912. * @value: proto event bitmap value.
  913. *
  914. * QDF_NBUF_PKT_TRAC_TYPE_DNS 0x01
  915. * QDF_NBUF_PKT_TRAC_TYPE_EAPOL 0x02
  916. * QDF_NBUF_PKT_TRAC_TYPE_DHCP 0x04
  917. * QDF_NBUF_PKT_TRAC_TYPE_ARP 0x10
  918. *
  919. * Return: none
  920. */
  921. void qdf_dp_set_proto_event_bitmap(uint32_t value);
  922. /**
  923. * qdf_dp_log_proto_pkt_info() - Send diag log event
  924. * @sa: source MAC address
  925. * @da: destination MAC address
  926. * @type: pkt type
  927. * @subtype: pkt subtype
  928. * @dir: tx or rx
  929. * @msdu_id: msdu id
  930. * @status: status
  931. *
  932. * Return: none
  933. */
  934. void qdf_dp_log_proto_pkt_info(uint8_t *sa, uint8_t *da, uint8_t type,
  935. uint8_t subtype, uint8_t dir, uint16_t msdu_id,
  936. uint8_t status);
  937. /**
  938. * qdf_dp_track_noack_check() - Check if no ack count should be tracked for
  939. * the configured protocol packet types
  940. * @nbuf: nbuf
  941. * @subtype: subtype of packet to be tracked
  942. *
  943. * Return: none
  944. */
  945. void qdf_dp_track_noack_check(qdf_nbuf_t nbuf, enum qdf_proto_subtype *subtype);
  946. #else
  947. static inline
  948. bool qdf_dp_trace_log_pkt(uint8_t vdev_id, struct sk_buff *skb,
  949. enum qdf_proto_dir dir, uint8_t pdev_id)
  950. {
  951. return false;
  952. }
  953. static inline
  954. void qdf_dp_trace_init(bool live_mode_config, uint8_t thresh,
  955. uint16_t time_limit, uint8_t verbosity,
  956. uint32_t proto_bitmap)
  957. {
  958. }
  959. static inline
  960. void qdf_dp_trace_deinit(void)
  961. {
  962. }
  963. static inline
  964. void qdf_dp_trace_set_track(qdf_nbuf_t nbuf, enum qdf_proto_dir dir)
  965. {
  966. }
  967. static inline
  968. void qdf_dp_trace_set_value(uint32_t proto_bitmap, uint8_t no_of_records,
  969. uint8_t verbosity)
  970. {
  971. }
  972. static inline
  973. void qdf_dp_trace_dump_all(uint32_t count, uint8_t pdev_id)
  974. {
  975. }
  976. static inline
  977. uint32_t qdf_dpt_get_curr_pos_debugfs(qdf_debugfs_file_t file,
  978. enum qdf_dpt_debugfs_state state)
  979. {
  980. return 0;
  981. }
  982. static inline
  983. QDF_STATUS qdf_dpt_dump_stats_debugfs(qdf_debugfs_file_t file,
  984. uint32_t curr_pos)
  985. {
  986. return QDF_STATUS_SUCCESS;
  987. }
  988. static inline
  989. void qdf_dpt_set_value_debugfs(uint8_t proto_bitmap, uint8_t no_of_record,
  990. uint8_t verbosity, uint16_t num_records_to_dump)
  991. {
  992. }
  993. static inline void qdf_dp_trace_dump_stats(void)
  994. {
  995. }
  996. static inline
  997. void qdf_dp_trace_disable_live_mode(void)
  998. {
  999. }
  1000. static inline
  1001. void qdf_dp_trace_enable_live_mode(void)
  1002. {
  1003. }
  1004. static inline
  1005. void qdf_dp_trace_throttle_live_mode(bool high_bw_request)
  1006. {
  1007. }
  1008. static inline
  1009. void qdf_dp_trace_clear_buffer(void)
  1010. {
  1011. }
  1012. static inline
  1013. void qdf_dp_trace_apply_tput_policy(bool is_data_traffic)
  1014. {
  1015. }
  1016. static inline
  1017. void qdf_dp_trace_data_pkt(qdf_nbuf_t nbuf, uint8_t pdev_id,
  1018. enum QDF_DP_TRACE_ID code, uint16_t msdu_id,
  1019. enum qdf_proto_dir dir)
  1020. {
  1021. }
  1022. static inline
  1023. void qdf_dp_log_proto_pkt_info(uint8_t *sa, uint8_t *da, uint8_t type,
  1024. uint8_t subtype, uint8_t dir, uint16_t msdu_id,
  1025. uint8_t status)
  1026. {
  1027. }
  1028. static inline
  1029. void qdf_dp_track_noack_check(qdf_nbuf_t nbuf, enum qdf_proto_subtype *subtype)
  1030. {
  1031. }
  1032. static inline
  1033. enum qdf_dp_tx_rx_status qdf_dp_get_status_from_htt(uint8_t status)
  1034. {
  1035. return QDF_TX_RX_STATUS_OK;
  1036. }
  1037. static inline
  1038. enum qdf_dp_tx_rx_status qdf_dp_get_status_from_a_status(uint8_t status)
  1039. {
  1040. return QDF_TX_RX_STATUS_OK;
  1041. }
  1042. #endif
  1043. void qdf_trace_display(void);
  1044. void __printf(3, 4) qdf_snprintf(char *str_buffer, unsigned int size,
  1045. char *str_format, ...);
  1046. #define QDF_SNPRINTF qdf_snprintf
  1047. #ifdef TSOSEG_DEBUG
  1048. static inline void qdf_tso_seg_dbg_bug(char *msg)
  1049. {
  1050. qdf_print("%s", msg);
  1051. QDF_BUG(0);
  1052. };
  1053. /**
  1054. * qdf_tso_seg_dbg_init - initialize TSO segment debug structure
  1055. * @tsoseg : structure to initialize
  1056. *
  1057. * TSO segment dbg structures are attached to qdf_tso_seg_elem_t
  1058. * structures and are allocated only of TSOSEG_DEBUG is defined.
  1059. * When allocated, at the time of the tso_seg_pool initialization,
  1060. * which goes with tx_desc initialization (1:1), each structure holds
  1061. * a number of (currently 16) history entries, basically describing
  1062. * what operation has been performed on this particular tso_seg_elem.
  1063. * This history buffer is a circular buffer and the current index is
  1064. * held in an atomic variable called cur. It is incremented every
  1065. * operation. Each of these operations are added with the function
  1066. * qdf_tso_seg_dbg_record.
  1067. * For each segment, this initialization function MUST be called PRIOR
  1068. * TO any _dbg_record() function calls.
  1069. * On free, qdf_tso_seg_elem structure is cleared (using qdf_tso_seg_dbg_zero)
  1070. * which clears the tso_desc, BUT DOES NOT CLEAR THE HISTORY element.
  1071. *
  1072. * Return:
  1073. * None
  1074. */
  1075. static inline
  1076. void qdf_tso_seg_dbg_init(struct qdf_tso_seg_elem_t *tsoseg)
  1077. {
  1078. tsoseg->dbg.txdesc = NULL;
  1079. qdf_atomic_init(&tsoseg->dbg.cur); /* history empty */
  1080. }
  1081. /**
  1082. * qdf_tso_seg_dbg_record - add a history entry to TSO debug structure
  1083. * @tsoseg : structure to initialize
  1084. * @id : operation ID (identifies the caller)
  1085. *
  1086. * Adds a history entry to the history circular buffer. Each entry
  1087. * contains an operation id (caller, as currently each ID is used only
  1088. * once in the source, so it directly identifies the src line that invoked
  1089. * the recording.
  1090. *
  1091. * qdf_tso_seg_dbg_record CAN ONLY BE CALLED AFTER the entry is initialized
  1092. * by qdf_tso_seg_dbg_init.
  1093. *
  1094. * The entry to be added is written at the location pointed by the atomic
  1095. * variable called cur. Cur is an ever increasing atomic variable. It is
  1096. * masked so that only the lower 4 bits are used (16 history entries).
  1097. *
  1098. * Return:
  1099. * int: the entry this record was recorded at
  1100. */
  1101. static inline
  1102. int qdf_tso_seg_dbg_record(struct qdf_tso_seg_elem_t *tsoseg, short id)
  1103. {
  1104. int rc = -1;
  1105. unsigned int c;
  1106. qdf_assert(tsoseg);
  1107. if (id == TSOSEG_LOC_ALLOC) {
  1108. c = qdf_atomic_read(&tsoseg->dbg.cur);
  1109. /* dont crash on the very first alloc on the segment */
  1110. c &= 0x0f;
  1111. /* allow only INIT and FREE ops before ALLOC */
  1112. if (tsoseg->dbg.h[c].id >= id)
  1113. qdf_tso_seg_dbg_bug("Rogue TSO seg alloc");
  1114. }
  1115. c = qdf_atomic_inc_return(&tsoseg->dbg.cur);
  1116. c &= 0x0f;
  1117. tsoseg->dbg.h[c].ts = qdf_get_log_timestamp();
  1118. tsoseg->dbg.h[c].id = id;
  1119. rc = c;
  1120. return rc;
  1121. };
  1122. static inline void
  1123. qdf_tso_seg_dbg_setowner(struct qdf_tso_seg_elem_t *tsoseg, void *owner)
  1124. {
  1125. if (tsoseg)
  1126. tsoseg->dbg.txdesc = owner;
  1127. };
  1128. static inline void
  1129. qdf_tso_seg_dbg_zero(struct qdf_tso_seg_elem_t *tsoseg)
  1130. {
  1131. memset(tsoseg, 0, offsetof(struct qdf_tso_seg_elem_t, dbg));
  1132. return;
  1133. };
  1134. #else
  1135. static inline
  1136. void qdf_tso_seg_dbg_init(struct qdf_tso_seg_elem_t *tsoseg)
  1137. {
  1138. };
  1139. static inline
  1140. int qdf_tso_seg_dbg_record(struct qdf_tso_seg_elem_t *tsoseg, short id)
  1141. {
  1142. return 0;
  1143. };
  1144. static inline void qdf_tso_seg_dbg_bug(char *msg)
  1145. {
  1146. };
  1147. static inline void
  1148. qdf_tso_seg_dbg_setowner(struct qdf_tso_seg_elem_t *tsoseg, void *owner)
  1149. {
  1150. };
  1151. static inline int
  1152. qdf_tso_seg_dbg_zero(struct qdf_tso_seg_elem_t *tsoseg)
  1153. {
  1154. memset(tsoseg, 0, sizeof(struct qdf_tso_seg_elem_t));
  1155. return 0;
  1156. };
  1157. #endif /* TSOSEG_DEBUG */
  1158. /**
  1159. * qdf_trace_hex_dump() - externally called hex dump function
  1160. * @module: Module identifier a member of the QDF_MODULE_ID enumeration that
  1161. * identifies the module issuing the trace message.
  1162. * @level: Trace level a member of the QDF_TRACE_LEVEL enumeration indicating
  1163. * the severity of the condition causing the trace message to be
  1164. * issued. More severe conditions are more likely to be logged.
  1165. * @data: The base address of the buffer to be logged.
  1166. * @buf_len: The size of the buffer to be logged.
  1167. *
  1168. * Checks the level of severity and accordingly prints the trace messages
  1169. *
  1170. * Return: None
  1171. */
  1172. void qdf_trace_hex_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
  1173. void *data, int buf_len);
  1174. /**
  1175. * qdf_trace_hex_ascii_dump() - externally called hex and ascii dump function
  1176. * @module: Module identifier a member of the QDF_MODULE_ID enumeration that
  1177. * identifies the module issuing the trace message.
  1178. * @level: Trace level a member of the QDF_TRACE_LEVEL enumeration indicating
  1179. * the severity of the condition causing the trace message to be
  1180. * issued. More severe conditions are more likely to be logged.
  1181. * @data: The base address of the buffer to be logged.
  1182. * @buf_len: The size of the buffer to be logged.
  1183. *
  1184. * Checks the level of severity and accordingly prints the trace messages
  1185. *
  1186. * Return: None
  1187. */
  1188. void qdf_trace_hex_ascii_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
  1189. void *data, int buf_len);
  1190. #define ERROR_CODE -1
  1191. #define QDF_MAX_NAME_SIZE 32
  1192. #define MAX_PRINT_CONFIG_SUPPORTED 32
  1193. #define MAX_SUPPORTED_CATEGORY QDF_MODULE_ID_MAX
  1194. /**
  1195. * qdf_set_pidx() - Sets the global qdf_pidx.
  1196. * @pidx : Index of print control object assigned to the module
  1197. *
  1198. */
  1199. void qdf_set_pidx(int pidx);
  1200. /**
  1201. * qdf_get_pidx() - Returns the global qdf_pidx.
  1202. *
  1203. * Return : Current qdf print index.
  1204. */
  1205. int qdf_get_pidx(void);
  1206. /*
  1207. * Shared print control index
  1208. * for converged debug framework
  1209. */
  1210. #define QDF_PRINT_IDX_SHARED -1
  1211. /**
  1212. * QDF_PRINT_INFO() - Generic wrapper API for logging
  1213. * @idx : Index of print control object
  1214. * @module : Module identifier. A member of QDF_MODULE_ID enumeration that
  1215. * identifies the module issuing the trace message
  1216. * @level : Trace level. A member of QDF_TRACE_LEVEL enumeration indicating
  1217. * the severity of the condition causing the trace message to be
  1218. * issued.
  1219. * @str_format : Format string that contains the message to be logged.
  1220. *
  1221. *
  1222. * This wrapper will be used for any generic logging messages. Wrapper will
  1223. * compile a call to converged QDF trace message API.
  1224. *
  1225. * Return : Nothing
  1226. *
  1227. */
  1228. void QDF_PRINT_INFO(unsigned int idx, QDF_MODULE_ID module,
  1229. QDF_TRACE_LEVEL level,
  1230. char *str_format, ...);
  1231. /**
  1232. * struct category_info : Category information structure
  1233. * @category_verbose_mask: Embeds information about category's verbose level
  1234. */
  1235. struct category_info {
  1236. uint16_t category_verbose_mask;
  1237. };
  1238. /**
  1239. * struct category_name_info : Category name information structure
  1240. * @category_name_str: Embeds information about category name
  1241. */
  1242. struct category_name_info {
  1243. unsigned char category_name_str[QDF_MAX_NAME_SIZE];
  1244. };
  1245. /**
  1246. * qdf_trace_msg_cmn()- Converged logging API
  1247. * @idx: Index of print control object assigned to the module
  1248. * @category: Category identifier. A member of the QDF_MODULE_ID enumeration
  1249. * that identifies the category issuing the trace message.
  1250. * @verbose: Verbose level. A member of the QDF_TRACE_LEVEL enumeration
  1251. * indicating the severity of the condition causing the trace
  1252. * message to be issued. More severe conditions are more likely
  1253. * to be logged.
  1254. * @str_format: Format string. The message to be logged. This format string
  1255. * contains printf-like replacement parameters, which follow this
  1256. * parameter in the variable argument list.
  1257. * @val: Variable argument list part of the log message
  1258. *
  1259. * Return: nothing
  1260. *
  1261. */
  1262. void qdf_trace_msg_cmn(unsigned int idx,
  1263. QDF_MODULE_ID category,
  1264. QDF_TRACE_LEVEL verbose,
  1265. const char *str_format,
  1266. va_list val);
  1267. /**
  1268. * struct qdf_print_ctrl: QDF Print Control structure
  1269. * Statically allocated objects of print control
  1270. * structure are declared that will support maximum of
  1271. * 32 print control objects. Any module that needs to
  1272. * register to the print control framework needs to
  1273. * obtain a print control object using
  1274. * qdf_print_ctrl_register API. It will have to pass
  1275. * pointer to category info structure, name and
  1276. * custom print function to be used if required.
  1277. * @name : Optional name for the control object
  1278. * @cat_info : Array of category_info struct
  1279. * @custom_print : Custom print handler
  1280. * @custom_ctxt : Custom print context
  1281. * @dbglvlmac_on : Flag to enable/disable MAC level filtering
  1282. * @in_use : Boolean to indicate if control object is in use
  1283. */
  1284. struct qdf_print_ctrl {
  1285. char name[QDF_MAX_NAME_SIZE];
  1286. struct category_info cat_info[MAX_SUPPORTED_CATEGORY];
  1287. void (*custom_print)(void *ctxt, const char *fmt, va_list args);
  1288. void *custom_ctxt;
  1289. #ifdef DBG_LVL_MAC_FILTERING
  1290. unsigned char dbglvlmac_on;
  1291. #endif
  1292. bool in_use;
  1293. };
  1294. /**
  1295. * qdf_print_ctrl_register() - Allocate QDF print control object, assign
  1296. * pointer to category info or print control
  1297. * structure and return the index to the callee
  1298. * @cinfo : Pointer to array of category info structure
  1299. * @custom_print_handler : Pointer to custom print handler
  1300. * @custom_ctx : Pointer to custom context
  1301. * @pctrl_name : Pointer to print control object name
  1302. *
  1303. * Return : Index of qdf_print_ctrl structure
  1304. *
  1305. */
  1306. int qdf_print_ctrl_register(const struct category_info *cinfo,
  1307. void *custom_print_handler,
  1308. void *custom_ctx,
  1309. const char *pctrl_name);
  1310. #ifdef QCA_WIFI_MODULE_PARAMS_FROM_INI
  1311. /**
  1312. * qdf_update_module_param() - Update qdf module params
  1313. *
  1314. *
  1315. * Read the file which has wifi module params, parse and update
  1316. * qdf module params.
  1317. *
  1318. * Return: void
  1319. */
  1320. void qdf_initialize_module_param_from_ini(void);
  1321. #else
  1322. static inline
  1323. void qdf_initialize_module_param_from_ini(void)
  1324. {
  1325. }
  1326. #endif
  1327. /**
  1328. * qdf_shared_print_ctrl_init() - Initialize the shared print ctrl obj with
  1329. * all categories set to the default level
  1330. *
  1331. * Return : void
  1332. *
  1333. */
  1334. void qdf_shared_print_ctrl_init(void);
  1335. /**
  1336. * qdf_print_setup() - Setup default values to all the print control objects
  1337. *
  1338. * Register new print control object for the callee
  1339. *
  1340. * Return : QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE
  1341. * on failure
  1342. */
  1343. QDF_STATUS qdf_print_setup(void);
  1344. /**
  1345. * qdf_print_ctrl_cleanup() - Clean up a print control object
  1346. *
  1347. * Cleanup the print control object for the callee
  1348. *
  1349. * @pctrl : Index of print control object
  1350. *
  1351. * Return : QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE on failure
  1352. */
  1353. QDF_STATUS qdf_print_ctrl_cleanup(unsigned int idx);
  1354. /**
  1355. * qdf_print_ctrl_shared_cleanup() - Clean up of the shared object
  1356. *
  1357. * Cleanup the shared print-ctrl-object
  1358. *
  1359. * Return : void
  1360. */
  1361. void qdf_shared_print_ctrl_cleanup(void);
  1362. /**
  1363. * qdf_print_set_category_verbose() - Enable/Disable category for a
  1364. * print control object with
  1365. * user provided verbose level
  1366. *
  1367. * @idx : Index of the print control object assigned to callee
  1368. * @category : Category information
  1369. * @verbose: Verbose information
  1370. * @is_set: Flag indicating if verbose level needs to be enabled or disabled
  1371. *
  1372. * Return : QDF_STATUS_SUCCESS for success and QDF_STATUS_E_FAILURE for failure
  1373. */
  1374. QDF_STATUS qdf_print_set_category_verbose(unsigned int idx,
  1375. QDF_MODULE_ID category,
  1376. QDF_TRACE_LEVEL verbose,
  1377. bool is_set);
  1378. /**
  1379. * qdf_log_dump_at_kernel_level() - Enable/Disable printk call
  1380. * @enable: Indicates whether printk is enabled in QDF_TRACE
  1381. *
  1382. * Return: void
  1383. */
  1384. void qdf_log_dump_at_kernel_level(bool enable);
  1385. /**
  1386. * qdf_logging_set_flush_timer() - Set the time period in which host logs
  1387. * should be flushed out to user-space
  1388. * @milliseconds: milliseconds after which the logs should be flushed out to
  1389. * user-space
  1390. *
  1391. * Return: QDF_STATUS_SUCCESS for success and QDF_STATUS_E_FAILURE for failure
  1392. */
  1393. int qdf_logging_set_flush_timer(uint32_t milliseconds);
  1394. /**
  1395. * qdf_logging_flush_logs() - Flush out the logs to user-space one time
  1396. *
  1397. * Return: void
  1398. */
  1399. void qdf_logging_flush_logs(void);
  1400. /**
  1401. * qdf_print_is_category_enabled() - Get category information for the
  1402. * print control object
  1403. *
  1404. * @idx : Index of print control object
  1405. * @category : Category information
  1406. *
  1407. * Return : Verbose enabled(true) or disabled(false) or invalid input (false)
  1408. */
  1409. bool qdf_print_is_category_enabled(unsigned int idx,
  1410. QDF_MODULE_ID category);
  1411. /**
  1412. * qdf_print_is_verbose_enabled() - Get verbose information of a category for
  1413. * the print control object
  1414. *
  1415. * @idx : Index of print control object
  1416. * @category : Category information
  1417. * @verbose : Verbose information
  1418. *
  1419. * Return : Verbose enabled(true) or disabled(false) or invalid input (false)
  1420. */
  1421. bool qdf_print_is_verbose_enabled(unsigned int idx,
  1422. QDF_MODULE_ID category,
  1423. QDF_TRACE_LEVEL verbose);
  1424. /**
  1425. * qdf_print_clean_node_flag() - Clean up node flag for print control object
  1426. *
  1427. * @idx : Index of print control object
  1428. *
  1429. * Return : None
  1430. */
  1431. void qdf_print_clean_node_flag(unsigned int idx);
  1432. #ifdef DBG_LVL_MAC_FILTERING
  1433. /**
  1434. * qdf_print_set_node_flag() - Set flag to enable MAC level filtering
  1435. *
  1436. * @idx : Index of print control object
  1437. * @enable : Enable/Disable bit sent by callee
  1438. *
  1439. * Return : QDF_STATUS_SUCCESS on Success and QDF_STATUS_E_FAILURE on Failure
  1440. */
  1441. QDF_STATUS qdf_print_set_node_flag(unsigned int idx,
  1442. uint8_t enable);
  1443. /**
  1444. * qdf_print_get_node_flag() - Get flag that controls MAC level filtering
  1445. *
  1446. * @idx : Index of print control object
  1447. *
  1448. * Return : Flag that indicates enable(1) or disable(0) or invalid(-1)
  1449. */
  1450. bool qdf_print_get_node_flag(unsigned int idx);
  1451. #endif
  1452. #ifdef QCA_WIFI_MODULE_PARAMS_FROM_INI
  1453. /**
  1454. * qdf_module_param_handler() - Function to store module params
  1455. *
  1456. * @context : NULL, unused.
  1457. * @key : Name of the module param
  1458. * @value: Value of the module param
  1459. *
  1460. * Handler function to be called from qdf_ini_parse()
  1461. * function when a valid parameter is found in a file.
  1462. *
  1463. * Return : QDF_STATUS_SUCCESS on Success
  1464. */
  1465. QDF_STATUS qdf_module_param_handler(void *context, const char *key,
  1466. const char *value);
  1467. #else
  1468. static inline
  1469. QDF_STATUS qdf_module_param_handler(void *context, const char *key,
  1470. const char *value)
  1471. {
  1472. return QDF_STATUS_SUCCESS;
  1473. }
  1474. #endif
  1475. /**
  1476. * qdf_logging_init() - Initialize msg logging functionality
  1477. *
  1478. *
  1479. * Return : void
  1480. */
  1481. void qdf_logging_init(void);
  1482. /**
  1483. * qdf_logging_exit() - Cleanup msg logging functionality
  1484. *
  1485. *
  1486. * Return : void
  1487. */
  1488. void qdf_logging_exit(void);
  1489. #define QDF_SYMBOL_LEN __QDF_SYMBOL_LEN
  1490. /**
  1491. * qdf_sprint_symbol() - prints the name of a symbol into a string buffer
  1492. * @buffer: the string buffer to print into
  1493. * @addr: address of the symbol to lookup and print
  1494. *
  1495. * Return: number of characters printed
  1496. */
  1497. int qdf_sprint_symbol(char *buffer, void *addr);
  1498. /**
  1499. * qdf_minidump_log() - Log memory address to be included in minidump
  1500. * @start_addr: Start address of the memory to be dumped
  1501. * @size: Size in bytes
  1502. * @name: String to identify this entry
  1503. */
  1504. static inline
  1505. void qdf_minidump_log(void *start_addr,
  1506. const size_t size, const char *name)
  1507. {
  1508. __qdf_minidump_log(start_addr, size, name);
  1509. }
  1510. /**
  1511. * qdf_minidump_remove() - Remove memory address from minidump
  1512. * @start_addr: Start address of the memory previously added
  1513. * @size: Size in bytes
  1514. * @name: String to identify this entry
  1515. */
  1516. static inline
  1517. void qdf_minidump_remove(void *start_addr,
  1518. const size_t size, const char *name)
  1519. {
  1520. __qdf_minidump_remove(start_addr, size, name);
  1521. }
  1522. #endif /* __QDF_TRACE_H */