qdf_trace.h 50 KB

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