qdf_trace.h 48 KB

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