qdf_trace.h 36 KB

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