1 /* 2 * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022-2023 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 20 #if !defined(__QDF_TRACE_H) 21 #define __QDF_TRACE_H 22 23 /** 24 * DOC: qdf_trace 25 * QCA driver framework trace APIs 26 * Trace, logging, and debugging definitions and APIs 27 */ 28 29 /* Include Files */ 30 #include <qdf_types.h> /* For QDF_MODULE_ID... */ 31 #include <qdf_status.h> 32 #include <qdf_nbuf.h> 33 #include <i_qdf_types.h> 34 #include <qdf_debugfs.h> 35 36 37 /* Type declarations */ 38 39 #ifdef LOG_LINE_NUMBER 40 #define FL(x) "%s: %d: " x, __func__, __LINE__ 41 #else 42 #define FL(x) "%s: " x, __func__ 43 #endif 44 45 #define QDF_TRACE_BUFFER_SIZE (512) 46 47 /* 48 * Extracts the 8-bit group id from the wmi command id by performing the 49 * reverse operation of WMI_CMD_GRP_START_ID 50 */ 51 #define QDF_WMI_MTRACE_GRP_ID(message_id) (((message_id) >> 12) & 0xFF) 52 /* 53 * Number of bits reserved for WMI mtrace command id 54 */ 55 #define QDF_WMI_MTRACE_CMD_NUM_BITS 7 56 /* 57 * Extracts the 7-bit group specific command id from the wmi command id 58 */ 59 #define QDF_WMI_MTRACE_CMD_ID(message_id) ((message_id) & 0x7F) 60 61 #ifdef QDF_TRACE_PRINT_ENABLE 62 #define QDF_DEFAULT_TRACE_LEVEL (1 << QDF_TRACE_LEVEL_INFO) 63 #endif 64 65 #define QDF_CATEGORY_INFO_U16(val) (((val >> 16) & 0x0000FFFF)) 66 #define QDF_TRACE_LEVEL_INFO_L16(val) (val & 0x0000FFFF) 67 68 typedef int (qdf_abstract_print)(void *priv, const char *fmt, ...); 69 70 /* 71 * Log levels 72 */ 73 #define QDF_DEBUG_FUNCTRACE 0x01 74 #define QDF_DEBUG_LEVEL0 0x02 75 #define QDF_DEBUG_LEVEL1 0x04 76 #define QDF_DEBUG_LEVEL2 0x08 77 #define QDF_DEBUG_LEVEL3 0x10 78 #define QDF_DEBUG_ERROR 0x20 79 #define QDF_DEBUG_CFG 0x40 80 81 /* 82 * Rate limit based on pkt prototype 83 */ 84 #define QDF_MAX_DHCP_PKTS_PER_SEC (20) 85 #define QDF_MAX_EAPOL_PKTS_PER_SEC (50) 86 #define QDF_MAX_ARP_PKTS_PER_SEC (5) 87 #define QDF_MAX_DNS_PKTS_PER_SEC (5) 88 #define QDF_MAX_OTHER_PKTS_PER_SEC (1) 89 90 /* DP Trace Implementation */ 91 #ifdef CONFIG_DP_TRACE 92 #define DPTRACE(p) p 93 #define DPTRACE_PRINT(args...) \ 94 QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_DEBUG, args) 95 #else 96 #define DPTRACE(p) 97 #define DPTRACE_PRINT(args...) 98 #endif 99 100 /* By default Data Path module will have all log levels enabled, except debug 101 * log level. Debug level will be left up to the framework or user space modules 102 * to be enabled when issue is detected 103 */ 104 #define QDF_DATA_PATH_TRACE_LEVEL \ 105 ((1 << QDF_TRACE_LEVEL_FATAL) | (1 << QDF_TRACE_LEVEL_ERROR) | \ 106 (1 << QDF_TRACE_LEVEL_WARN) | (1 << QDF_TRACE_LEVEL_INFO) | \ 107 (1 << QDF_TRACE_LEVEL_INFO_HIGH) | (1 << QDF_TRACE_LEVEL_INFO_MED) | \ 108 (1 << QDF_TRACE_LEVEL_INFO_LOW)) 109 110 /* Preprocessor definitions and constants */ 111 #define ASSERT_BUFFER_SIZE (512) 112 113 #ifndef MAX_QDF_TRACE_RECORDS 114 #define MAX_QDF_TRACE_RECORDS 4000 115 #endif 116 117 #define QDF_TRACE_DEFAULT_PDEV_ID 0xff 118 #define INVALID_QDF_TRACE_ADDR 0xffffffff 119 #define DEFAULT_QDF_TRACE_DUMP_COUNT 0 120 #define QDF_TRACE_DEFAULT_MSDU_ID 0 121 122 /* 123 * first parameter to iwpriv command - dump_dp_trace 124 * iwpriv wlan0 dump_dp_trace 0 0 -> dump full buffer 125 * iwpriv wlan0 dump_dp_trace 1 0 -> enable live view mode 126 * iwpriv wlan0 dump_dp_trace 2 0 -> clear dp trace buffer 127 * iwpriv wlan0 dump_dp_trace 3 0 -> disable live view mode 128 */ 129 #define DUMP_DP_TRACE 0 130 #define ENABLE_DP_TRACE_LIVE_MODE 1 131 #define CLEAR_DP_TRACE_BUFFER 2 132 #define DISABLE_DP_TRACE_LIVE_MODE 3 133 134 135 #ifdef TRACE_RECORD 136 137 #define MTRACE(p) p 138 139 #else 140 #define MTRACE(p) do { } while (0) 141 142 #endif 143 #define NO_SESSION 0xFF 144 145 /** 146 * struct qdf_trace_record_s - keep trace record 147 * @qtime: qtimer ticks 148 * @time: user timestamp 149 * @module: module name 150 * @code: hold record of code 151 * @session: hold record of session 152 * @data: hold data 153 * @pid: hold pid of the process 154 */ 155 typedef struct qdf_trace_record_s { 156 uint64_t qtime; 157 char time[18]; 158 uint8_t module; 159 uint16_t code; 160 uint16_t session; 161 uint32_t data; 162 uint32_t pid; 163 } qdf_trace_record_t, *tp_qdf_trace_record; 164 165 /** 166 * struct s_qdf_trace_data - MTRACE logs are stored in ring buffer 167 * @head: position of first record 168 * @tail: position of last record 169 * @num: count of total record 170 * @num_since_last_dump: count from last dump 171 * @enable: config for controlling the trace 172 * @dump_count: Dump after number of records reach this number 173 */ 174 typedef struct s_qdf_trace_data { 175 uint32_t head; 176 uint32_t tail; 177 uint32_t num; 178 uint16_t num_since_last_dump; 179 uint8_t enable; 180 uint16_t dump_count; 181 } t_qdf_trace_data; 182 183 #ifdef CONNECTIVITY_DIAG_EVENT 184 /** 185 * enum diag_dp_tx_rx_status - TX/RX packet status 186 * @DIAG_TX_RX_STATUS_INVALID: default invalid status 187 * @DIAG_TX_RX_STATUS_OK: successfully sent + acked 188 * @DIAG_TX_RX_STATUS_FW_DISCARD: queued but not sent over air 189 * @DIAG_TX_RX_STATUS_NO_ACK: packet sent but no ack received 190 * @DIAG_TX_RX_STATUS_DROP: packet dropped due to congestion 191 * @DIAG_TX_RX_STATUS_DOWNLOAD_SUCC: packet delivered to target 192 * @DIAG_TX_RX_STATUS_DEFAULT: default status 193 * @DIAG_TX_RX_STATUS_MAX: 194 */ 195 enum diag_dp_tx_rx_status { 196 DIAG_TX_RX_STATUS_INVALID, 197 DIAG_TX_RX_STATUS_OK, 198 DIAG_TX_RX_STATUS_FW_DISCARD, 199 DIAG_TX_RX_STATUS_NO_ACK, 200 DIAG_TX_RX_STATUS_DROP, 201 DIAG_TX_RX_STATUS_DOWNLOAD_SUCC, 202 DIAG_TX_RX_STATUS_DEFAULT, 203 DIAG_TX_RX_STATUS_MAX 204 }; 205 206 /** 207 * enum diag_tx_status - Used by attribute 208 * @DIAG_TX_STATUS_FAIL: Indicates frame is not sent over the air. 209 * @DIAG_TX_STATUS_NO_ACK: Indicates packet sent but acknowledgment 210 * is not received. 211 * @DIAG_TX_STATUS_ACK: Indicates the frame is successfully sent and 212 * acknowledged. 213 */ 214 enum diag_tx_status { 215 DIAG_TX_STATUS_FAIL = 1, 216 DIAG_TX_STATUS_NO_ACK = 2, 217 DIAG_TX_STATUS_ACK = 3 218 }; 219 220 /** 221 * wlan_get_diag_tx_status() - Gives the diag logging specific tx status 222 * @tx_status: fw specific TX status 223 * 224 * Returns TX status specified in enum diag_tx_status 225 */ 226 enum diag_tx_status wlan_get_diag_tx_status(enum qdf_dp_tx_rx_status tx_status); 227 #endif 228 229 #define CASE_RETURN_STRING(str) case ((str)): return (uint8_t *)(# str); 230 231 #ifndef MAX_QDF_DP_TRACE_RECORDS 232 #define MAX_QDF_DP_TRACE_RECORDS 2000 233 #endif 234 235 #define QDF_DP_TRACE_RECORD_SIZE 66 /* bytes */ 236 #define INVALID_QDF_DP_TRACE_ADDR 0xffffffff 237 #define QDF_DP_TRACE_VERBOSITY_HIGH 4 238 #define QDF_DP_TRACE_VERBOSITY_MEDIUM 3 239 #define QDF_DP_TRACE_VERBOSITY_LOW 2 240 #define QDF_DP_TRACE_VERBOSITY_ULTRA_LOW 1 241 #define QDF_DP_TRACE_VERBOSITY_BASE 0 242 243 /** 244 * enum QDF_DP_TRACE_ID - Generic ID to identify various events in data path 245 * @QDF_DP_TRACE_INVALID: invalid 246 * @QDF_DP_TRACE_DROP_PACKET_RECORD: record drop packet 247 * @QDF_DP_TRACE_EAPOL_PACKET_RECORD: record EAPOL packet 248 * @QDF_DP_TRACE_DHCP_PACKET_RECORD: record DHCP packet 249 * @QDF_DP_TRACE_ARP_PACKET_RECORD: record ARP packet 250 * @QDF_DP_TRACE_MGMT_PACKET_RECORD: record MGMT pacekt 251 * @QDF_DP_TRACE_EVENT_RECORD: record events 252 * @QDF_DP_TRACE_BASE_VERBOSITY: below this are part of base verbosity 253 * @QDF_DP_TRACE_ICMP_PACKET_RECORD: record ICMP packet 254 * @QDF_DP_TRACE_ICMPv6_PACKET_RECORD: record ICMPv6 packet 255 * @QDF_DP_TRACE_HDD_TX_TIMEOUT: HDD tx timeout 256 * @QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT: SOFTAP HDD tx timeout 257 * @QDF_DP_TRACE_TX_CREDIT_RECORD: credit update record 258 * @QDF_DP_TRACE_ULTRA_LOW_VERBOSITY: Below this is not logged for >4PPS 259 * @QDF_DP_TRACE_TX_PACKET_RECORD: record 32 bytes of tx pkt at any layer 260 * @QDF_DP_TRACE_RX_PACKET_RECORD: record 32 bytes of rx pkt at any layer 261 * @QDF_DP_TRACE_HDD_TX_PACKET_RECORD: record 32 bytes of tx pkt at HDD 262 * @QDF_DP_TRACE_HDD_RX_PACKET_RECORD: record 32 bytes of rx pkt at HDD 263 * @QDF_DP_TRACE_LI_DP_TX_PACKET_RECORD: record data bytes of tx pkt at LI_DP 264 * @QDF_DP_TRACE_LI_DP_RX_PACKET_RECORD: record data bytes of rx pkt at LI_DP 265 * @QDF_DP_TRACE_LI_DP_FREE_PACKET_PTR_RECORD: tx completion ptr record for 266 * lithium 267 * @QDF_DP_TRACE_FREE_PACKET_PTR_RECORD: tx completion ptr record 268 * @QDF_DP_TRACE_LOW_VERBOSITY: below this are part of low verbosity 269 * @QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD: HDD layer ptr record 270 * @QDF_DP_TRACE_TX_PACKET_PTR_RECORD: DP component Tx ptr record 271 * @QDF_DP_TRACE_LI_DP_TX_PACKET_PTR_RECORD: Lithium DP layer ptr record 272 * @QDF_DP_TRACE_RX_PACKET_PTR_RECORD: DP component Rx ptr record 273 * @QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD: HDD RX record 274 * @QDF_DP_TRACE_CE_PACKET_PTR_RECORD: CE layer ptr record 275 * @QDF_DP_TRACE_CE_FAST_PACKET_PTR_RECORD: CE fastpath ptr record 276 * @QDF_DP_TRACE_CE_FAST_PACKET_ERR_RECORD: CE fastpath error record 277 * @QDF_DP_TRACE_RX_HTT_PACKET_PTR_RECORD: HTT RX record 278 * @QDF_DP_TRACE_RX_OFFLOAD_HTT_PACKET_PTR_RECORD: HTT RX offload record 279 * @QDF_DP_TRACE_RX_LI_DP_PACKET_PTR_RECORD: Lithium DP RX record 280 * @QDF_DP_TRACE_MED_VERBOSITY: below this are part of med verbosity 281 * @QDF_DP_TRACE_TXRX_QUEUE_PACKET_PTR_RECORD: tx queue ptr record 282 * @QDF_DP_TRACE_TXRX_PACKET_PTR_RECORD: txrx packet ptr record 283 * @QDF_DP_TRACE_TXRX_FAST_PACKET_PTR_RECORD: txrx fast path record 284 * @QDF_DP_TRACE_HTT_PACKET_PTR_RECORD: htt packet ptr record 285 * @QDF_DP_TRACE_HTC_PACKET_PTR_RECORD: htc packet ptr record 286 * @QDF_DP_TRACE_HIF_PACKET_PTR_RECORD: hif packet ptr record 287 * @QDF_DP_TRACE_RX_TXRX_PACKET_PTR_RECORD: txrx packet ptr record 288 * @QDF_DP_TRACE_LI_DP_NULL_RX_PACKET_RECORD: 289 * record data bytes of rx null_queue pkt at LI_DP 290 * @QDF_DP_TRACE_HIGH_VERBOSITY: below this are part of high verbosity 291 * @QDF_DP_TRACE_MAX: Max enumeration 292 */ 293 294 enum QDF_DP_TRACE_ID { 295 QDF_DP_TRACE_INVALID, 296 QDF_DP_TRACE_DROP_PACKET_RECORD, 297 QDF_DP_TRACE_EAPOL_PACKET_RECORD, 298 QDF_DP_TRACE_DHCP_PACKET_RECORD, 299 QDF_DP_TRACE_ARP_PACKET_RECORD, 300 QDF_DP_TRACE_MGMT_PACKET_RECORD, 301 QDF_DP_TRACE_EVENT_RECORD, 302 QDF_DP_TRACE_BASE_VERBOSITY, 303 QDF_DP_TRACE_ICMP_PACKET_RECORD, 304 QDF_DP_TRACE_ICMPv6_PACKET_RECORD, 305 QDF_DP_TRACE_HDD_TX_TIMEOUT, 306 QDF_DP_TRACE_HDD_SOFTAP_TX_TIMEOUT, 307 QDF_DP_TRACE_TX_CREDIT_RECORD, 308 QDF_DP_TRACE_ULTRA_LOW_VERBOSITY, 309 QDF_DP_TRACE_TX_PACKET_RECORD, 310 QDF_DP_TRACE_RX_PACKET_RECORD, 311 QDF_DP_TRACE_HDD_TX_PACKET_RECORD, 312 QDF_DP_TRACE_HDD_RX_PACKET_RECORD, 313 QDF_DP_TRACE_LI_DP_TX_PACKET_RECORD, 314 QDF_DP_TRACE_LI_DP_RX_PACKET_RECORD, 315 QDF_DP_TRACE_LI_DP_FREE_PACKET_PTR_RECORD, 316 QDF_DP_TRACE_FREE_PACKET_PTR_RECORD, 317 QDF_DP_TRACE_LOW_VERBOSITY, 318 QDF_DP_TRACE_HDD_TX_PACKET_PTR_RECORD, 319 QDF_DP_TRACE_TX_PACKET_PTR_RECORD, 320 QDF_DP_TRACE_LI_DP_TX_PACKET_PTR_RECORD, 321 QDF_DP_TRACE_RX_PACKET_PTR_RECORD, 322 QDF_DP_TRACE_RX_HDD_PACKET_PTR_RECORD, 323 QDF_DP_TRACE_CE_PACKET_PTR_RECORD, 324 QDF_DP_TRACE_CE_FAST_PACKET_PTR_RECORD, 325 QDF_DP_TRACE_CE_FAST_PACKET_ERR_RECORD, 326 QDF_DP_TRACE_RX_HTT_PACKET_PTR_RECORD, 327 QDF_DP_TRACE_RX_OFFLOAD_HTT_PACKET_PTR_RECORD, 328 QDF_DP_TRACE_RX_LI_DP_PACKET_PTR_RECORD, 329 QDF_DP_TRACE_MED_VERBOSITY, 330 QDF_DP_TRACE_TXRX_QUEUE_PACKET_PTR_RECORD, 331 QDF_DP_TRACE_TXRX_PACKET_PTR_RECORD, 332 QDF_DP_TRACE_TXRX_FAST_PACKET_PTR_RECORD, 333 QDF_DP_TRACE_HTT_PACKET_PTR_RECORD, 334 QDF_DP_TRACE_HTC_PACKET_PTR_RECORD, 335 QDF_DP_TRACE_HIF_PACKET_PTR_RECORD, 336 QDF_DP_TRACE_RX_TXRX_PACKET_PTR_RECORD, 337 QDF_DP_TRACE_LI_DP_NULL_RX_PACKET_RECORD, 338 QDF_DP_TRACE_HIGH_VERBOSITY, 339 QDF_DP_TRACE_MAX 340 }; 341 342 /** 343 * enum qdf_proto_dir - direction 344 * @QDF_TX: TX direction 345 * @QDF_RX: RX direction 346 * @QDF_NA: not applicable 347 */ 348 enum qdf_proto_dir { 349 QDF_TX, 350 QDF_RX, 351 QDF_NA 352 }; 353 354 /** 355 * enum QDF_CREDIT_UPDATE_SOURCE - source of credit record 356 * @QDF_TX_SCHED: Tx scheduler 357 * @QDF_TX_COMP: TX completion 358 * @QDF_TX_CREDIT_UPDATE: credit update indication 359 * @QDF_HTT_ATTACH: HTT attach 360 * @QDF_TX_HTT_MSG: HTT TX message 361 */ 362 enum QDF_CREDIT_UPDATE_SOURCE { 363 QDF_TX_SCHED, 364 QDF_TX_COMP, 365 QDF_TX_CREDIT_UPDATE, 366 QDF_HTT_ATTACH, 367 QDF_TX_HTT_MSG 368 }; 369 370 /** 371 * enum QDF_CREDIT_OPERATION - operation on credit 372 * @QDF_CREDIT_INC: credit increment 373 * @QDF_CREDIT_DEC: credit decrement 374 * @QDF_CREDIT_ABS: Abosolute credit 375 * @QDF_OP_NA: Not applicable 376 */ 377 enum QDF_CREDIT_OPERATION { 378 QDF_CREDIT_INC, 379 QDF_CREDIT_DEC, 380 QDF_CREDIT_ABS, 381 QDF_OP_NA 382 }; 383 384 /** 385 * struct qdf_dp_trace_ptr_buf - pointer record buffer 386 * @cookie: cookie value 387 * @msdu_id: msdu_id 388 * @status: completion status 389 */ 390 struct qdf_dp_trace_ptr_buf { 391 uint64_t cookie; 392 uint16_t msdu_id; 393 uint16_t status; 394 }; 395 396 /** 397 * struct qdf_dp_trace_proto_buf - proto packet buffer 398 * @sa: source address 399 * @da: destination address 400 * @vdev_id: vdev id 401 * @type: packet type 402 * @subtype: packet subtype 403 * @dir: direction 404 * @proto_priv_data: protocol private data 405 * can be stored in this. 406 */ 407 struct qdf_dp_trace_proto_buf { 408 struct qdf_mac_addr sa; 409 struct qdf_mac_addr da; 410 uint8_t vdev_id; 411 uint8_t type; 412 uint8_t subtype; 413 uint8_t dir; 414 /* for ICMP priv data is bit offset 38 to 42 415 * 38-40 ICMP_ICMP_ID and 416 * 40-42 ICMP_SEQ_NUM_OFFSET 417 */ 418 uint32_t proto_priv_data; 419 }; 420 421 /** 422 * struct qdf_dp_trace_mgmt_buf - mgmt packet buffer 423 * @vdev_id: vdev id 424 * @type: packet type 425 * @subtype: packet subtype 426 */ 427 struct qdf_dp_trace_mgmt_buf { 428 uint8_t vdev_id; 429 uint8_t type; 430 uint8_t subtype; 431 }; 432 433 /** 434 * struct qdf_dp_trace_credit_record - tx credit record 435 * @source: credit record source 436 * @operation: credit operation 437 * @delta: delta of credit 438 * @total_credits: total credit 439 * @g0_credit: group 0 credit 440 * @g1_credit: group 1 credit 441 */ 442 struct qdf_dp_trace_credit_record { 443 enum QDF_CREDIT_UPDATE_SOURCE source; 444 enum QDF_CREDIT_OPERATION operation; 445 int delta; 446 int total_credits; 447 int g0_credit; 448 int g1_credit; 449 }; 450 451 /** 452 * struct qdf_dp_trace_event_buf - event buffer 453 * @vdev_id: vdev id 454 * @type: packet type 455 * @subtype: packet subtype 456 */ 457 struct qdf_dp_trace_event_buf { 458 uint8_t vdev_id; 459 uint8_t type; 460 uint8_t subtype; 461 }; 462 463 /** 464 * struct qdf_dp_trace_data_buf - nbuf data buffer 465 * @msdu_id: msdu id 466 */ 467 struct qdf_dp_trace_data_buf { 468 uint16_t msdu_id; 469 }; 470 471 /** 472 * struct qdf_dp_trace_record_s - Describes a record in DP trace 473 * @time: time when it got stored 474 * @code: Describes the particular event 475 * @data: buffer to store data 476 * @size: Length of the valid data stored in this record 477 * @pid: process id which stored the data in this record 478 * @pdev_id: pdev associated with the event 479 */ 480 struct qdf_dp_trace_record_s { 481 uint64_t time; 482 uint8_t code; 483 uint8_t data[QDF_DP_TRACE_RECORD_SIZE]; 484 uint8_t size; 485 uint32_t pid; 486 uint8_t pdev_id; 487 }; 488 489 /** 490 * struct s_qdf_dp_trace_data - Parameters to configure/control DP trace 491 * @head: Position of first record 492 * @tail: Position of last record 493 * @num: Current index 494 * @proto_bitmap: defines which protocol to be traced 495 * @no_of_record: defines every nth packet to be traced 496 * @num_records_to_dump: defines number of records to be dumped 497 * @dump_counter: counter to track number of records dumped 498 * @verbosity: defines verbosity level 499 * @ini_conf_verbosity: Configured verbosity from INI 500 * @enable: enable/disable DP trace 501 * @count: current packet number 502 * @live_mode_config: configuration as received during initialization 503 * @live_mode: current live mode, enabled or disabled, can be throttled based 504 * on throughput 505 * @curr_pos: 506 * @saved_tail: 507 * @force_live_mode: flag to enable live mode all the time for all packets. 508 * This can be set/unset from userspace and overrides other 509 * live mode flags. 510 * @dynamic_verbosity_modify: Dynamic user configured verbosity overrides all 511 * @print_pkt_cnt: count of number of packets printed in live mode 512 * @high_tput_thresh: thresh beyond which live mode is turned off 513 * @thresh_time_limit: max time, in terms of BW timer intervals to wait, 514 * for determining if high_tput_thresh has been crossed. ~1s 515 * @tx_count: tx counter 516 * @rx_count: rx counter 517 * @arp_req: stats for arp reqs 518 * @arp_resp: stats for arp resps 519 * @icmp_req: stats for icmp reqs 520 * @icmp_resp: stats for icmp resps 521 * @dhcp_disc: stats for dhcp discover msgs 522 * @dhcp_req: stats for dhcp req msgs 523 * @dhcp_off: stats for dhcp offer msgs 524 * @dhcp_ack: stats for dhcp ack msgs 525 * @dhcp_nack: stats for dhcp nack msgs 526 * @dhcp_others: stats for other dhcp pkts types 527 * @eapol_m1: stats for eapol m1 528 * @eapol_m2: stats for eapol m2 529 * @eapol_m3: stats for eapol m3 530 * @eapol_m4: stats for eapol m4 531 * @eapol_others: stats for other eapol pkt types 532 * @icmpv6_req: stats for icmpv6 reqs 533 * @icmpv6_resp: stats for icmpv6 resps 534 * @icmpv6_ns: stats for icmpv6 nss 535 * @icmpv6_na: stats for icmpv6 nas 536 * @icmpv6_rs: stats for icmpv6 rss 537 * @icmpv6_ra: stats for icmpv6 ras 538 * @proto_event_bitmap: defines which protocol to be diag logged. 539 * refer QDF_NBUF_PKT_TRAC_TYPE_DNS to QDF_NBUF_PKT_TRAC_TYPE_ARP 540 * for bitmap. 541 */ 542 struct s_qdf_dp_trace_data { 543 uint32_t head; 544 uint32_t tail; 545 uint32_t num; 546 uint32_t proto_bitmap; 547 uint8_t no_of_record; 548 uint16_t num_records_to_dump; 549 uint16_t dump_counter; 550 uint8_t verbosity; 551 uint8_t ini_conf_verbosity; 552 bool enable; 553 bool live_mode_config; 554 bool live_mode; 555 uint32_t curr_pos; 556 uint32_t saved_tail; 557 bool force_live_mode; 558 bool dynamic_verbosity_modify; 559 uint8_t print_pkt_cnt; 560 uint8_t high_tput_thresh; 561 uint16_t thresh_time_limit; 562 /* Stats */ 563 uint32_t tx_count; 564 uint32_t rx_count; 565 u16 arp_req; 566 u16 arp_resp; 567 u16 dhcp_disc; 568 u16 dhcp_req; 569 u16 dhcp_off; 570 u16 dhcp_ack; 571 u16 dhcp_nack; 572 u16 dhcp_others; 573 u16 eapol_m1; 574 u16 eapol_m2; 575 u16 eapol_m3; 576 u16 eapol_m4; 577 u16 eapol_others; 578 u16 icmp_req; 579 u16 icmp_resp; 580 u16 icmpv6_req; 581 u16 icmpv6_resp; 582 u16 icmpv6_ns; 583 u16 icmpv6_na; 584 u16 icmpv6_rs; 585 u16 icmpv6_ra; 586 uint32_t proto_event_bitmap; 587 }; 588 589 /** 590 * enum qdf_dpt_debugfs_state - state to control read to debugfs file 591 * @QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INVALID: invalid state 592 * @QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INIT: initial state 593 * @QDF_DPT_DEBUGFS_STATE_SHOW_IN_PROGRESS: read is in progress 594 * @QDF_DPT_DEBUGFS_STATE_SHOW_COMPLETE: read complete 595 */ 596 597 enum qdf_dpt_debugfs_state { 598 QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INVALID, 599 QDF_DPT_DEBUGFS_STATE_SHOW_STATE_INIT, 600 QDF_DPT_DEBUGFS_STATE_SHOW_IN_PROGRESS, 601 QDF_DPT_DEBUGFS_STATE_SHOW_COMPLETE, 602 }; 603 604 #define QDF_WIFI_MODULE_PARAMS_FILE "wifi_module_param.ini" 605 606 typedef void (*tp_qdf_trace_cb)(void *p_mac, tp_qdf_trace_record, uint16_t); 607 typedef void (*tp_qdf_state_info_cb) (char **buf, uint16_t *size); 608 #ifdef WLAN_FEATURE_MEMDUMP_ENABLE 609 610 /** 611 * qdf_register_debugcb_init() - initializes debug callbacks 612 * to NULL 613 * 614 * Return: None 615 */ 616 void qdf_register_debugcb_init(void); 617 618 /** 619 * qdf_register_debug_callback() - stores callback handlers to print 620 * state information 621 * @module_id: module id of layer 622 * @qdf_state_infocb: callback to be registered 623 * 624 * This function is used to store callback handlers to print 625 * state information 626 * 627 * Return: None 628 */ 629 void qdf_register_debug_callback(QDF_MODULE_ID module_id, 630 tp_qdf_state_info_cb qdf_state_infocb); 631 632 /** 633 * qdf_state_info_dump_all() - it invokes callback of layer which registered 634 * its callback to print its state information. 635 * @buf: buffer pointer to be passed 636 * @size: size of buffer to be filled 637 * @driver_dump_size: actual size of buffer used 638 * 639 * Return: QDF_STATUS_SUCCESS on success 640 */ 641 QDF_STATUS qdf_state_info_dump_all(char *buf, uint16_t size, 642 uint16_t *driver_dump_size); 643 #else /* WLAN_FEATURE_MEMDUMP_ENABLE */ 644 static inline void qdf_register_debugcb_init(void) 645 { 646 } 647 #endif /* WLAN_FEATURE_MEMDUMP_ENABLE */ 648 649 #ifdef TRACE_RECORD 650 /** 651 * qdf_trace_register() - registers the call back functions 652 * @module_id: enum value of module 653 * @qdf_trace_callback: call back functions to display the messages in 654 * particular format. 655 * 656 * Registers the call back functions to display the messages in particular 657 * format mentioned in these call back functions. This functions should be 658 * called by interested module in their init part as we will be ready to 659 * register as soon as modules are up. 660 * 661 * Return: None 662 */ 663 void qdf_trace_register(QDF_MODULE_ID module_id, 664 tp_qdf_trace_cb qdf_trace_callback); 665 666 /** 667 * qdf_trace_init() - initializes qdf trace structures and variables 668 * 669 * Called immediately after cds_preopen, so that we can start recording HDD 670 * events ASAP. 671 * 672 * Return: None 673 */ 674 void qdf_trace_init(void); 675 676 /** 677 * qdf_trace_deinit() - frees memory allocated dynamically 678 * 679 * Called from cds_deinit, so that we can free the memory and resets 680 * the variables 681 * 682 * Return: None 683 */ 684 void qdf_trace_deinit(void); 685 686 /** 687 * qdf_trace() - puts the messages in to ring-buffer 688 * @module: Enum of module, basically module id. 689 * @code: Code to be recorded 690 * @session: Session ID of the log 691 * @data: Actual message contents 692 * 693 * This function will be called from each module who wants record the messages 694 * in circular queue. Before calling this functions make sure you have 695 * registered your module with qdf through qdf_trace_register function. 696 * 697 * Return: None 698 */ 699 void qdf_trace(uint8_t module, uint16_t code, uint16_t session, uint32_t data); 700 701 /** 702 * qdf_trace_enable() - Enable MTRACE for specific modules 703 * @bitmask_of_module_id: Bitmask according to enum of the modules. 704 * 32[dec] = 0010 0000 [bin] <enum of HDD is 5> 705 * 64[dec] = 0100 0000 [bin] <enum of SME is 6> 706 * 128[dec] = 1000 0000 [bin] <enum of PE is 7> 707 * @enable: can be true or false true implies enabling MTRACE false implies 708 * disabling MTRACE. 709 * 710 * Enable MTRACE for specific modules whose bits are set in bitmask and enable 711 * is true. if enable is false it disables MTRACE for that module. set the 712 * bitmask according to enum value of the modules. 713 * This functions will be called when you issue ioctl as mentioned following 714 * [iwpriv wlan0 setdumplog <value> <enable>]. 715 * <value> - Decimal number, i.e. 64 decimal value shows only SME module, 716 * 128 decimal value shows only PE module, 192 decimal value shows PE and SME. 717 * 718 * Return: None 719 */ 720 void qdf_trace_enable(uint32_t bitmask_of_module_id, uint8_t enable); 721 722 /** 723 * qdf_trace_dump_all() - Dump data from ring buffer via call back functions 724 * registered with QDF 725 * @p_mac: Context of particular module 726 * @code: Reason code 727 * @session: Session id of log 728 * @count: Number of lines to dump starting from tail to head 729 * @bitmask_of_module: Bitmask according to enum of the modules. 730 * 731 * This function will be called up on issuing ioctl call as mentioned following 732 * [iwpriv wlan0 dumplog 0 0 <n> <bitmask_of_module>] 733 * 734 * <n> - number lines to dump starting from tail to head. 735 * 736 * <bitmask_of_module> - if anybody wants to know how many messages were 737 * recorded for particular module/s mentioned by setbit in bitmask from last 738 * <n> messages. It is optional, if you don't provide then it will dump 739 * everything from buffer. 740 * 741 * Return: None 742 */ 743 void qdf_trace_dump_all(void *p_mac, uint8_t code, uint8_t session, 744 uint32_t count, uint32_t bitmask_of_module); 745 746 /** 747 * qdf_trace_spin_lock_init() - initializes the lock variable before use 748 * 749 * This function will be called from cds_alloc_global_context, we will have lock 750 * available to use ASAP 751 * 752 * Return: None 753 */ 754 QDF_STATUS qdf_trace_spin_lock_init(void); 755 #else 756 #ifndef QDF_TRACE_PRINT_ENABLE 757 static inline 758 void qdf_trace_init(void) 759 { 760 } 761 762 static inline 763 void qdf_trace_deinit(void) 764 { 765 } 766 767 static inline 768 void qdf_trace_enable(uint32_t bitmask_of_module_id, uint8_t enable) 769 { 770 } 771 772 static inline 773 void qdf_trace(uint8_t module, uint16_t code, uint16_t session, uint32_t data) 774 { 775 } 776 777 static inline 778 void qdf_trace_dump_all(void *p_mac, uint8_t code, uint8_t session, 779 uint32_t count, uint32_t bitmask_of_module) 780 { 781 } 782 783 static inline 784 QDF_STATUS qdf_trace_spin_lock_init(void) 785 { 786 return QDF_STATUS_SUCCESS; 787 } 788 #endif 789 #endif 790 791 #ifdef WLAN_MAX_LOGS_PER_SEC 792 /** 793 * qdf_detected_excessive_logging() - Excessive logging detected 794 * 795 * Track logging count using a quasi-tumbling window. 796 * If the max logging count for a given window is exceeded, 797 * return true else fails. 798 * 799 * Return: true/false 800 */ 801 bool qdf_detected_excessive_logging(void); 802 803 /** 804 * qdf_rl_print_count_set() - set the ratelimiting print count 805 * @rl_print_count: ratelimiting print count 806 * 807 * Return: none 808 */ 809 void qdf_rl_print_count_set(uint32_t rl_print_count); 810 811 /** 812 * qdf_rl_print_time_set() - set the ratelimiting print time 813 * @rl_print_time: ratelimiting print time 814 * 815 * Return: none 816 */ 817 void qdf_rl_print_time_set(uint32_t rl_print_time); 818 819 /** 820 * qdf_rl_print_suppressed_log() - print the suppressed logs count 821 * 822 * Return: none 823 */ 824 void qdf_rl_print_suppressed_log(void); 825 826 /** 827 * qdf_rl_print_suppressed_inc() - increment the suppressed logs count 828 * 829 * Return: none 830 */ 831 void qdf_rl_print_suppressed_inc(void); 832 833 #else /* WLAN_MAX_LOGS_PER_SEC */ 834 static inline bool qdf_detected_excessive_logging(void) 835 { 836 return false; 837 } 838 static inline void qdf_rl_print_count_set(uint32_t rl_print_count) {} 839 static inline void qdf_rl_print_time_set(uint32_t rl_print_time) {} 840 static inline void qdf_rl_print_suppressed_log(void) {} 841 static inline void qdf_rl_print_suppressed_inc(void) {} 842 #endif /* WLAN_MAX_LOGS_PER_SEC */ 843 844 #ifdef ENABLE_MTRACE_LOG 845 /** 846 * qdf_mtrace_log() - Logs a message tracepoint to DIAG 847 * Infrastructure. 848 * @src_module: Enum of source module (basically module id) 849 * from where the message with message_id is posted. 850 * @dst_module: Enum of destination module (basically module id) 851 * to which the message with message_id is posted. 852 * @message_id: Id of the message to be posted 853 * @vdev_id: Vdev Id 854 * 855 * This function logs to the DIAG Infrastructure a tracepoint for a 856 * message being sent from a source module to a destination module 857 * with a specific ID for the benefit of a specific vdev. 858 * For non-vdev messages vdev_id will be NO_SESSION 859 * Return: None 860 */ 861 void qdf_mtrace_log(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module, 862 uint16_t message_id, uint8_t vdev_id); 863 #else 864 static inline 865 void qdf_mtrace_log(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module, 866 uint16_t message_id, uint8_t vdev_id) 867 { 868 } 869 #endif 870 871 #ifdef TRACE_RECORD 872 /** 873 * qdf_mtrace() - puts the messages in to ring-buffer 874 * and logs a message tracepoint to DIAG Infrastructure. 875 * @src_module: Enum of source module (basically module id) 876 * from where the message with message_id is posted. 877 * @dst_module: Enum of destination module (basically module id) 878 * to which the message with message_id is posted. 879 * @message_id: Id of the message to be posted 880 * @vdev_id: Vdev Id 881 * @data: Actual message contents 882 * 883 * This function will be called from each module which wants to record the 884 * messages in circular queue. Before calling this function make sure you 885 * have registered your module with qdf through qdf_trace_register function. 886 * In addition of the recording the messages in circular queue this function 887 * will log the message tracepoint to the DIAG infrastructure. 888 * these logs will be later used by post processing script. 889 * 890 * Return: None 891 */ 892 void qdf_mtrace(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module, 893 uint16_t message_id, uint8_t vdev_id, uint32_t data); 894 #else 895 static inline 896 void qdf_mtrace(QDF_MODULE_ID src_module, QDF_MODULE_ID dst_module, 897 uint16_t message_id, uint8_t vdev_id, uint32_t data) 898 { 899 } 900 #endif 901 902 #ifdef CONFIG_DP_TRACE 903 /** 904 * qdf_dp_set_proto_bitmap() - set dp trace proto bitmap 905 * @val: unsigned bitmap to set 906 * 907 * Return: proto bitmap 908 */ 909 void qdf_dp_set_proto_bitmap(uint32_t val); 910 911 /** 912 * qdf_dp_trace_set_verbosity() - set verbosity value 913 * @val: Value to set 914 * 915 * Return: Null 916 */ 917 void qdf_dp_trace_set_verbosity(uint32_t val); 918 919 /** 920 * qdf_dp_set_no_of_record() - set dp trace no_of_record 921 * @val: unsigned no_of_record to set 922 * 923 * Return: null 924 */ 925 void qdf_dp_set_no_of_record(uint32_t val); 926 927 #define QDF_DP_TRACE_RECORD_INFO_LIVE (0x1) 928 #define QDF_DP_TRACE_RECORD_INFO_THROTTLED (0x1 << 1) 929 930 /** 931 * qdf_dp_trace_log_pkt() - log packet type enabled through iwpriv 932 * @vdev_id: vdev_id 933 * @skb: skb pointer 934 * @dir: direction 935 * @pdev_id: pdev_id 936 * @op_mode: Vdev Operation mode 937 * 938 * Return: true: some protocol was logged, false: no protocol was logged. 939 */ 940 bool qdf_dp_trace_log_pkt(uint8_t vdev_id, struct sk_buff *skb, 941 enum qdf_proto_dir dir, uint8_t pdev_id, 942 enum QDF_OPMODE op_mode); 943 944 /** 945 * qdf_dp_trace_init() - enables the DP trace 946 * @live_mode_config: live mode configuration 947 * @thresh: high throughput threshold for disabling live mode 948 * @time_limit: max time to wait before deciding if thresh is crossed 949 * @verbosity: dptrace verbosity level 950 * @proto_bitmap: bitmap to enable/disable specific protocols 951 * 952 * Called during driver load to init dptrace 953 * 954 * A brief note on the 'thresh' param - 955 * Total # of packets received in a bandwidth timer interval beyond which 956 * DP Trace logging for data packets (including ICMP) will be disabled. 957 * In memory logging will still continue for these packets. Other packets for 958 * which proto.bitmap is set will continue to be recorded in logs and in memory. 959 * 960 * Return: None 961 */ 962 void qdf_dp_trace_init(bool live_mode_config, uint8_t thresh, 963 uint16_t time_limit, uint8_t verbosity, 964 uint32_t proto_bitmap); 965 966 void qdf_dp_trace_deinit(void); 967 968 /** 969 * qdf_dp_trace_spin_lock_init() - initializes the lock variable before use 970 * This function will be called from cds_alloc_global_context, we will have lock 971 * available to use ASAP 972 * 973 * Return: None 974 */ 975 void qdf_dp_trace_spin_lock_init(void); 976 977 /** 978 * qdf_dp_trace_set_value() - Configure the value to control DP trace 979 * @proto_bitmap: defines the protocol to be tracked 980 * @no_of_records: defines the nth packet which is traced 981 * @verbosity: defines the verbosity level 982 * 983 * Return: None 984 */ 985 void qdf_dp_trace_set_value(uint32_t proto_bitmap, uint8_t no_of_records, 986 uint8_t verbosity); 987 988 /** 989 * qdf_dp_trace_set_track() - Marks whether the packet needs to be traced 990 * @nbuf: defines the netbuf 991 * @dir: direction 992 * 993 * Return: None 994 */ 995 void qdf_dp_trace_set_track(qdf_nbuf_t nbuf, enum qdf_proto_dir dir); 996 997 /** 998 * qdf_dp_trace() - Stores the data in buffer 999 * @nbuf: defines the netbuf 1000 * @code: defines the event 1001 * @pdev_id: pdev_id 1002 * @data: defines the data to be stored 1003 * @size: defines the size of the data record 1004 * @dir: direction 1005 * 1006 * Return: None 1007 */ 1008 void qdf_dp_trace(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code, uint8_t pdev_id, 1009 uint8_t *data, uint8_t size, enum qdf_proto_dir dir); 1010 1011 /** 1012 * qdf_dp_trace_dump_all() - Dump data from ring buffer via call back functions 1013 * registered with QDF 1014 * @count: Number of lines to dump starting from tail to head 1015 * @pdev_id: pdev_id 1016 * 1017 * Return: None 1018 */ 1019 void qdf_dp_trace_dump_all(uint32_t count, uint8_t pdev_id); 1020 1021 /** 1022 * qdf_dpt_get_curr_pos_debugfs() - get curr position to start read 1023 * @file: debugfs file to read 1024 * @state: state to control read to debugfs file 1025 * 1026 * Return: curr pos 1027 */ 1028 uint32_t qdf_dpt_get_curr_pos_debugfs(qdf_debugfs_file_t file, 1029 enum qdf_dpt_debugfs_state state); 1030 /** 1031 * qdf_dpt_dump_stats_debugfs() - dump DP Trace stats to debugfs file 1032 * @file: debugfs file to read 1033 * @curr_pos: curr position to start read 1034 * 1035 * Return: QDF_STATUS 1036 */ 1037 QDF_STATUS qdf_dpt_dump_stats_debugfs(qdf_debugfs_file_t file, 1038 uint32_t curr_pos); 1039 1040 /** 1041 * qdf_dpt_set_value_debugfs() - set value of DP Trace debugfs params 1042 * @proto_bitmap: defines which protocol to be traced 1043 * @no_of_record: defines every nth packet to be traced 1044 * @verbosity: defines verbosity level 1045 * @num_records_to_dump: defines number of records to be dumped 1046 * 1047 * Return: none 1048 */ 1049 void qdf_dpt_set_value_debugfs(uint8_t proto_bitmap, uint8_t no_of_record, 1050 uint8_t verbosity, uint16_t num_records_to_dump); 1051 1052 1053 /** 1054 * qdf_dp_trace_dump_stats() - dump DP Trace stats 1055 * 1056 * Return: none 1057 */ 1058 void qdf_dp_trace_dump_stats(void); 1059 typedef void (*tp_qdf_dp_trace_cb)(struct qdf_dp_trace_record_s*, 1060 uint16_t, uint8_t, uint8_t info); 1061 /** 1062 * qdf_dp_display_record() - Displays a record in DP trace 1063 * @record: pointer to a record in DP trace 1064 * @index: record index 1065 * @pdev_id: pdev id for the mgmt pkt 1066 * @info: info used to display pkt (live mode, throttling) 1067 * 1068 * Return: None 1069 */ 1070 void qdf_dp_display_record(struct qdf_dp_trace_record_s *record, 1071 uint16_t index, uint8_t pdev_id, 1072 uint8_t info); 1073 1074 /** 1075 * qdf_dp_display_ptr_record() - display record 1076 * @record: dptrace record 1077 * @rec_index: index 1078 * @pdev_id: pdev id for the mgmt pkt 1079 * @info: info used to display pkt (live mode, throttling) 1080 * 1081 * Return: none 1082 */ 1083 void qdf_dp_display_ptr_record(struct qdf_dp_trace_record_s *record, 1084 uint16_t rec_index, uint8_t pdev_id, 1085 uint8_t info); 1086 1087 /** 1088 * qdf_dp_display_proto_pkt() - display proto packet 1089 * @record: dptrace record 1090 * @index: index 1091 * @pdev_id: pdev id for the mgmt pkt 1092 * @info: info used to display pkt (live mode, throttling) 1093 * 1094 * Return: none 1095 */ 1096 void qdf_dp_display_proto_pkt(struct qdf_dp_trace_record_s *record, 1097 uint16_t index, uint8_t pdev_id, 1098 uint8_t info); 1099 /** 1100 * qdf_dp_display_data_pkt_record() - Displays a data packet in DP trace 1101 * @record: pointer to a record in DP trace 1102 * @rec_index: record index 1103 * @pdev_id: pdev id 1104 * @info: display info regarding record 1105 * 1106 * Return: None 1107 */ 1108 void 1109 qdf_dp_display_data_pkt_record(struct qdf_dp_trace_record_s *record, 1110 uint16_t rec_index, uint8_t pdev_id, 1111 uint8_t info); 1112 1113 /** 1114 * qdf_dp_get_status_from_htt() - Convert htt tx status to qdf dp status 1115 * @status: htt_tx_status which needs to be converted 1116 * 1117 * Return: the status that from qdf_dp_tx_rx_status 1118 */ 1119 enum qdf_dp_tx_rx_status qdf_dp_get_status_from_htt(uint8_t status); 1120 1121 /** 1122 * qdf_dp_get_status_from_a_status() - Convert A_STATUS to qdf dp status 1123 * @status: A_STATUS which needs to be converted 1124 * 1125 * Return: the status that from qdf_dp_tx_rx_status 1126 */ 1127 enum qdf_dp_tx_rx_status qdf_dp_get_status_from_a_status(uint8_t status); 1128 1129 /** 1130 * qdf_dp_trace_ptr() - record dptrace 1131 * @nbuf: network buffer 1132 * @code: dptrace code 1133 * @pdev_id: pdev_id 1134 * @data: data 1135 * @size: size of data 1136 * @msdu_id: msdu_id 1137 * @buf_arg_status: return status 1138 * @qdf_tx_status: qdf tx rx status 1139 * @op_mode: Vdev Operation mode 1140 * 1141 * Return: none 1142 */ 1143 void qdf_dp_trace_ptr(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code, 1144 uint8_t pdev_id, uint8_t *data, uint8_t size, 1145 uint16_t msdu_id, uint16_t buf_arg_status, 1146 enum qdf_dp_tx_rx_status qdf_tx_status, 1147 enum QDF_OPMODE op_mode); 1148 1149 /** 1150 * qdf_dp_trace_throttle_live_mode() - Throttle DP Trace live mode 1151 * @high_bw_request: whether this is a high BW req or not 1152 * 1153 * The function tries to prevent excessive logging into the live buffer by 1154 * having an upper limit on number of packets that can be logged per second. 1155 * 1156 * The intention is to allow occasional pings and data packets and really low 1157 * throughput levels while suppressing bursts and higher throughput levels so 1158 * that we donot hog the live buffer. 1159 * 1160 * If the number of packets printed in a particular second exceeds the thresh, 1161 * disable printing in the next second. 1162 * 1163 * Return: None 1164 */ 1165 void qdf_dp_trace_throttle_live_mode(bool high_bw_request); 1166 1167 /** 1168 * qdf_dp_trace_apply_tput_policy() - Change verbosity based on the TPUT 1169 * @is_data_traffic: Is traffic more than low TPUT threashould 1170 * 1171 * Return: None 1172 */ 1173 void qdf_dp_trace_apply_tput_policy(bool is_data_traffic); 1174 1175 /** 1176 * qdf_dp_trace_data_pkt() - trace data packet 1177 * @nbuf: nbuf which needs to be traced 1178 * @pdev_id: pdev_id 1179 * @code: QDF_DP_TRACE_ID for the packet (TX or RX) 1180 * @msdu_id: tx desc id for the nbuf (Only applies to TX packets) 1181 * @dir: TX or RX packet direction 1182 * 1183 * Return: None 1184 */ 1185 void qdf_dp_trace_data_pkt(qdf_nbuf_t nbuf, uint8_t pdev_id, 1186 enum QDF_DP_TRACE_ID code, uint16_t msdu_id, 1187 enum qdf_proto_dir dir); 1188 1189 /** 1190 * qdf_dp_get_proto_bitmap() - get dp trace proto bitmap 1191 * 1192 * Return: proto bitmap 1193 */ 1194 uint32_t qdf_dp_get_proto_bitmap(void); 1195 1196 uint8_t qdf_dp_get_verbosity(void); 1197 1198 /** 1199 * qdf_dp_get_no_of_record() - get dp trace no_of_record 1200 * 1201 * Return: number of records 1202 */ 1203 uint8_t qdf_dp_get_no_of_record(void); 1204 1205 /** 1206 * qdf_dp_trace_proto_pkt() - record proto packet 1207 * @code: dptrace code 1208 * @vdev_id: vdev id 1209 * @sa: source mac address 1210 * @da: destination mac address 1211 * @type: proto type 1212 * @subtype: proto subtype 1213 * @dir: direction 1214 * @pdev_id: pdev id 1215 * @print: to print this proto pkt or not 1216 * @proto_priv_data: protocol specific private 1217 * data. 1218 * Return: none 1219 */ 1220 void 1221 qdf_dp_trace_proto_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id, 1222 uint8_t *sa, uint8_t *da, enum qdf_proto_type type, 1223 enum qdf_proto_subtype subtype, enum qdf_proto_dir dir, 1224 uint8_t pdev_id, bool print, uint32_t proto_priv_data); 1225 1226 /** 1227 * qdf_dp_trace_disable_live_mode() - disable live mode for dptrace 1228 * 1229 * Return: none 1230 */ 1231 void qdf_dp_trace_disable_live_mode(void); 1232 1233 /** 1234 * qdf_dp_trace_enable_live_mode() - enable live mode for dptrace 1235 * 1236 * Return: none 1237 */ 1238 void qdf_dp_trace_enable_live_mode(void); 1239 1240 /** 1241 * qdf_dp_trace_clear_buffer() - clear dp trace buffer 1242 * 1243 * Return: none 1244 */ 1245 void qdf_dp_trace_clear_buffer(void); 1246 1247 /** 1248 * qdf_dp_trace_mgmt_pkt() - record mgmt packet 1249 * @code: dptrace code 1250 * @vdev_id: vdev id 1251 * @pdev_id: pdev_id 1252 * @type: proto type 1253 * @subtype: proto subtype 1254 * 1255 * Return: none 1256 */ 1257 void qdf_dp_trace_mgmt_pkt(enum QDF_DP_TRACE_ID code, uint8_t vdev_id, 1258 uint8_t pdev_id, enum qdf_proto_type type, 1259 enum qdf_proto_subtype subtype); 1260 1261 /** 1262 * qdf_dp_trace_credit_record() - record credit update 1263 * @source: source of record 1264 * @operation: credit operation 1265 * @delta: credit delta 1266 * @total_credits: total credit 1267 * @g0_credit: group 0 credit 1268 * @g1_credit: group 1 credit 1269 */ 1270 void qdf_dp_trace_credit_record(enum QDF_CREDIT_UPDATE_SOURCE source, 1271 enum QDF_CREDIT_OPERATION operation, 1272 int delta, int total_credits, 1273 int g0_credit, int g1_credit); 1274 1275 /** 1276 * qdf_dp_display_mgmt_pkt() - display proto packet 1277 * @record: dptrace record 1278 * @index: index 1279 * @pdev_id: pdev id for the mgmt pkt 1280 * @info: info used to display pkt (live mode, throttling) 1281 * 1282 * Return: none 1283 */ 1284 void qdf_dp_display_mgmt_pkt(struct qdf_dp_trace_record_s *record, 1285 uint16_t index, uint8_t pdev_id, uint8_t info); 1286 1287 /** 1288 * qdf_dp_display_credit_record() - display credit record 1289 * @record: dptrace record 1290 * @index: index 1291 * @pdev_id: pdev id 1292 * @info: metadeta info 1293 */ 1294 void qdf_dp_display_credit_record(struct qdf_dp_trace_record_s *record, 1295 uint16_t index, uint8_t pdev_id, 1296 uint8_t info); 1297 1298 /** 1299 * qdf_dp_display_event_record() - display event records 1300 * @record: dptrace record 1301 * @index: index 1302 * @pdev_id: pdev id for the mgmt pkt 1303 * @info: info used to display pkt (live mode, throttling) 1304 * 1305 * Return: none 1306 */ 1307 void qdf_dp_display_event_record(struct qdf_dp_trace_record_s *record, 1308 uint16_t index, uint8_t pdev_id, uint8_t info); 1309 1310 /** 1311 * qdf_dp_trace_record_event() - record events 1312 * @code: dptrace code 1313 * @vdev_id: vdev id 1314 * @pdev_id: pdev_id 1315 * @type: proto type 1316 * @subtype: proto subtype 1317 * 1318 * Return: none 1319 */ 1320 void qdf_dp_trace_record_event(enum QDF_DP_TRACE_ID code, uint8_t vdev_id, 1321 uint8_t pdev_id, enum qdf_proto_type type, 1322 enum qdf_proto_subtype subtype); 1323 1324 /** 1325 * qdf_dp_set_proto_event_bitmap() - Set the protocol event bitmap 1326 * @value: proto event bitmap value. 1327 * 1328 * QDF_NBUF_PKT_TRAC_TYPE_DNS 0x01 1329 * QDF_NBUF_PKT_TRAC_TYPE_EAPOL 0x02 1330 * QDF_NBUF_PKT_TRAC_TYPE_DHCP 0x04 1331 * QDF_NBUF_PKT_TRAC_TYPE_ARP 0x10 1332 * 1333 * Return: none 1334 */ 1335 void qdf_dp_set_proto_event_bitmap(uint32_t value); 1336 1337 /** 1338 * qdf_dp_log_proto_pkt_info() - Send diag log event 1339 * @sa: source MAC address 1340 * @da: destination MAC address 1341 * @type: pkt type 1342 * @subtype: pkt subtype 1343 * @dir: tx or rx 1344 * @msdu_id: msdu id 1345 * @status: status 1346 * 1347 * Return: none 1348 */ 1349 void qdf_dp_log_proto_pkt_info(uint8_t *sa, uint8_t *da, uint8_t type, 1350 uint8_t subtype, uint8_t dir, uint16_t msdu_id, 1351 uint8_t status); 1352 1353 /** 1354 * qdf_dp_track_noack_check() - Check if no ack count should be tracked for 1355 * the configured protocol packet types 1356 * @nbuf: nbuf 1357 * @subtype: subtype of packet to be tracked 1358 * 1359 * Return: none 1360 */ 1361 void qdf_dp_track_noack_check(qdf_nbuf_t nbuf, enum qdf_proto_subtype *subtype); 1362 #else 1363 static inline 1364 bool qdf_dp_trace_log_pkt(uint8_t vdev_id, struct sk_buff *skb, 1365 enum qdf_proto_dir dir, uint8_t pdev_id, 1366 enum QDF_OPMODE op_mode) 1367 { 1368 return false; 1369 } 1370 static inline 1371 void qdf_dp_trace_init(bool live_mode_config, uint8_t thresh, 1372 uint16_t time_limit, uint8_t verbosity, 1373 uint32_t proto_bitmap) 1374 { 1375 } 1376 1377 static inline 1378 void qdf_dp_trace_deinit(void) 1379 { 1380 } 1381 1382 static inline 1383 void qdf_dp_trace_set_track(qdf_nbuf_t nbuf, enum qdf_proto_dir dir) 1384 { 1385 } 1386 static inline 1387 void qdf_dp_trace_set_value(uint32_t proto_bitmap, uint8_t no_of_records, 1388 uint8_t verbosity) 1389 { 1390 } 1391 1392 static inline 1393 void qdf_dp_trace_dump_all(uint32_t count, uint8_t pdev_id) 1394 { 1395 } 1396 1397 static inline 1398 uint32_t qdf_dpt_get_curr_pos_debugfs(qdf_debugfs_file_t file, 1399 enum qdf_dpt_debugfs_state state) 1400 { 1401 return 0; 1402 } 1403 1404 static inline 1405 QDF_STATUS qdf_dpt_dump_stats_debugfs(qdf_debugfs_file_t file, 1406 uint32_t curr_pos) 1407 { 1408 return QDF_STATUS_SUCCESS; 1409 } 1410 1411 static inline 1412 void qdf_dpt_set_value_debugfs(uint8_t proto_bitmap, uint8_t no_of_record, 1413 uint8_t verbosity, uint16_t num_records_to_dump) 1414 { 1415 } 1416 1417 static inline void qdf_dp_trace_dump_stats(void) 1418 { 1419 } 1420 1421 static inline 1422 void qdf_dp_trace_disable_live_mode(void) 1423 { 1424 } 1425 1426 static inline 1427 void qdf_dp_trace_enable_live_mode(void) 1428 { 1429 } 1430 1431 static inline 1432 void qdf_dp_trace_throttle_live_mode(bool high_bw_request) 1433 { 1434 } 1435 1436 static inline 1437 void qdf_dp_trace_clear_buffer(void) 1438 { 1439 } 1440 1441 static inline 1442 void qdf_dp_trace_apply_tput_policy(bool is_data_traffic) 1443 { 1444 } 1445 1446 static inline 1447 void qdf_dp_trace_data_pkt(qdf_nbuf_t nbuf, uint8_t pdev_id, 1448 enum QDF_DP_TRACE_ID code, uint16_t msdu_id, 1449 enum qdf_proto_dir dir) 1450 { 1451 } 1452 1453 static inline 1454 void qdf_dp_log_proto_pkt_info(uint8_t *sa, uint8_t *da, uint8_t type, 1455 uint8_t subtype, uint8_t dir, uint16_t msdu_id, 1456 uint8_t status) 1457 { 1458 } 1459 1460 static inline 1461 void qdf_dp_track_noack_check(qdf_nbuf_t nbuf, enum qdf_proto_subtype *subtype) 1462 { 1463 } 1464 1465 static inline 1466 enum qdf_dp_tx_rx_status qdf_dp_get_status_from_htt(uint8_t status) 1467 { 1468 return QDF_TX_RX_STATUS_OK; 1469 } 1470 1471 static inline 1472 enum qdf_dp_tx_rx_status qdf_dp_get_status_from_a_status(uint8_t status) 1473 { 1474 return QDF_TX_RX_STATUS_OK; 1475 } 1476 #endif 1477 1478 /** 1479 * qdf_trace_display() - Display trace 1480 * 1481 * Return: None 1482 */ 1483 void qdf_trace_display(void); 1484 1485 /** 1486 * qdf_snprintf() - wrapper function to snprintf 1487 * @str_buffer: string Buffer 1488 * @size: defines the size of the data record 1489 * @str_format: Format string in which the message to be logged. This format 1490 * string contains printf-like replacement parameters, which follow 1491 * this parameter in the variable argument list. 1492 * 1493 * Return: num of bytes written to buffer 1494 */ 1495 int __printf(3, 4) qdf_snprintf(char *str_buffer, unsigned int size, 1496 char *str_format, ...); 1497 1498 #define QDF_SNPRINTF qdf_snprintf 1499 1500 #ifdef TSOSEG_DEBUG 1501 1502 static inline void qdf_tso_seg_dbg_bug(char *msg) 1503 { 1504 qdf_print("%s", msg); 1505 QDF_BUG(0); 1506 }; 1507 1508 /** 1509 * qdf_tso_seg_dbg_init - initialize TSO segment debug structure 1510 * @tsoseg: structure to initialize 1511 * 1512 * TSO segment dbg structures are attached to qdf_tso_seg_elem_t 1513 * structures and are allocated only of TSOSEG_DEBUG is defined. 1514 * When allocated, at the time of the tso_seg_pool initialization, 1515 * which goes with tx_desc initialization (1:1), each structure holds 1516 * a number of (currently 16) history entries, basically describing 1517 * what operation has been performed on this particular tso_seg_elem. 1518 * This history buffer is a circular buffer and the current index is 1519 * held in an atomic variable called cur. It is incremented every 1520 * operation. Each of these operations are added with the function 1521 * qdf_tso_seg_dbg_record. 1522 * For each segment, this initialization function MUST be called PRIOR 1523 * TO any _dbg_record() function calls. 1524 * On free, qdf_tso_seg_elem structure is cleared (using qdf_tso_seg_dbg_zero) 1525 * which clears the tso_desc, BUT DOES NOT CLEAR THE HISTORY element. 1526 * 1527 * Return: 1528 * None 1529 */ 1530 static inline 1531 void qdf_tso_seg_dbg_init(struct qdf_tso_seg_elem_t *tsoseg) 1532 { 1533 tsoseg->dbg.txdesc = NULL; 1534 qdf_atomic_init(&tsoseg->dbg.cur); /* history empty */ 1535 } 1536 1537 /** 1538 * qdf_tso_seg_dbg_record - add a history entry to TSO debug structure 1539 * @tsoseg: structure to initialize 1540 * @id: operation ID (identifies the caller) 1541 * 1542 * Adds a history entry to the history circular buffer. Each entry 1543 * contains an operation id (caller, as currently each ID is used only 1544 * once in the source, so it directly identifies the src line that invoked 1545 * the recording. 1546 * 1547 * qdf_tso_seg_dbg_record CAN ONLY BE CALLED AFTER the entry is initialized 1548 * by qdf_tso_seg_dbg_init. 1549 * 1550 * The entry to be added is written at the location pointed by the atomic 1551 * variable called cur. Cur is an ever increasing atomic variable. It is 1552 * masked so that only the lower 4 bits are used (16 history entries). 1553 * 1554 * Return: 1555 * int: the entry this record was recorded at 1556 */ 1557 static inline 1558 int qdf_tso_seg_dbg_record(struct qdf_tso_seg_elem_t *tsoseg, short id) 1559 { 1560 int rc = -1; 1561 unsigned int c; 1562 1563 qdf_assert(tsoseg); 1564 1565 if (id == TSOSEG_LOC_ALLOC) { 1566 c = qdf_atomic_read(&tsoseg->dbg.cur); 1567 /* dont crash on the very first alloc on the segment */ 1568 c &= 0x0f; 1569 /* allow only INIT and FREE ops before ALLOC */ 1570 if (tsoseg->dbg.h[c].id >= id) 1571 qdf_tso_seg_dbg_bug("Rogue TSO seg alloc"); 1572 } 1573 c = qdf_atomic_inc_return(&tsoseg->dbg.cur); 1574 1575 c &= 0x0f; 1576 tsoseg->dbg.h[c].ts = qdf_get_log_timestamp(); 1577 tsoseg->dbg.h[c].id = id; 1578 rc = c; 1579 1580 return rc; 1581 }; 1582 1583 static inline void 1584 qdf_tso_seg_dbg_setowner(struct qdf_tso_seg_elem_t *tsoseg, void *owner) 1585 { 1586 if (tsoseg) 1587 tsoseg->dbg.txdesc = owner; 1588 }; 1589 1590 static inline void 1591 qdf_tso_seg_dbg_zero(struct qdf_tso_seg_elem_t *tsoseg) 1592 { 1593 memset(tsoseg, 0, offsetof(struct qdf_tso_seg_elem_t, dbg)); 1594 return; 1595 }; 1596 1597 #else 1598 static inline 1599 void qdf_tso_seg_dbg_init(struct qdf_tso_seg_elem_t *tsoseg) 1600 { 1601 }; 1602 static inline 1603 int qdf_tso_seg_dbg_record(struct qdf_tso_seg_elem_t *tsoseg, short id) 1604 { 1605 return 0; 1606 }; 1607 static inline void qdf_tso_seg_dbg_bug(char *msg) 1608 { 1609 }; 1610 static inline void 1611 qdf_tso_seg_dbg_setowner(struct qdf_tso_seg_elem_t *tsoseg, void *owner) 1612 { 1613 }; 1614 static inline int 1615 qdf_tso_seg_dbg_zero(struct qdf_tso_seg_elem_t *tsoseg) 1616 { 1617 memset(tsoseg, 0, sizeof(struct qdf_tso_seg_elem_t)); 1618 return 0; 1619 }; 1620 1621 #endif /* TSOSEG_DEBUG */ 1622 1623 /** 1624 * qdf_trace_hex_dump() - externally called hex dump function 1625 * @module: Module identifier a member of the QDF_MODULE_ID enumeration that 1626 * identifies the module issuing the trace message. 1627 * @level: Trace level a member of the QDF_TRACE_LEVEL enumeration indicating 1628 * the severity of the condition causing the trace message to be 1629 * issued. More severe conditions are more likely to be logged. 1630 * @data: The base address of the buffer to be logged. 1631 * @buf_len: The size of the buffer to be logged. 1632 * 1633 * Checks the level of severity and accordingly prints the trace messages 1634 * 1635 * Return: None 1636 */ 1637 void qdf_trace_hex_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level, 1638 void *data, int buf_len); 1639 1640 /** 1641 * qdf_trace_hex_ascii_dump() - externally called hex and ascii dump function 1642 * @module: Module identifier a member of the QDF_MODULE_ID enumeration that 1643 * identifies the module issuing the trace message. 1644 * @level: Trace level a member of the QDF_TRACE_LEVEL enumeration indicating 1645 * the severity of the condition causing the trace message to be 1646 * issued. More severe conditions are more likely to be logged. 1647 * @data: The base address of the buffer to be logged. 1648 * @buf_len: The size of the buffer to be logged. 1649 * 1650 * Checks the level of severity and accordingly prints the trace messages 1651 * 1652 * Return: None 1653 */ 1654 void qdf_trace_hex_ascii_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level, 1655 void *data, int buf_len); 1656 1657 #define ERROR_CODE -1 1658 #define QDF_MAX_NAME_SIZE 32 1659 #define MAX_PRINT_CONFIG_SUPPORTED 32 1660 1661 #define MAX_SUPPORTED_CATEGORY QDF_MODULE_ID_MAX 1662 1663 /** 1664 * qdf_set_pidx() - Sets the global qdf_pidx. 1665 * @pidx: Index of print control object assigned to the module 1666 * 1667 */ 1668 void qdf_set_pidx(int pidx); 1669 1670 /** 1671 * qdf_get_pidx() - Returns the global qdf_pidx. 1672 * 1673 * Return: Current qdf print index. 1674 */ 1675 int qdf_get_pidx(void); 1676 /* 1677 * Shared print control index 1678 * for converged debug framework 1679 */ 1680 1681 #define QDF_PRINT_IDX_SHARED -1 1682 1683 /** 1684 * QDF_PRINT_INFO() - Generic wrapper API for logging 1685 * @idx: Index of print control object 1686 * @module: Module identifier. A member of QDF_MODULE_ID enumeration that 1687 * identifies the module issuing the trace message 1688 * @level: Trace level. A member of QDF_TRACE_LEVEL enumeration indicating 1689 * the severity of the condition causing the trace message to be 1690 * issued. 1691 * @str_format: Format string that contains the message to be logged. 1692 * 1693 * 1694 * This wrapper will be used for any generic logging messages. Wrapper will 1695 * compile a call to converged QDF trace message API. 1696 * 1697 * Return: Nothing 1698 * 1699 */ 1700 void QDF_PRINT_INFO(unsigned int idx, QDF_MODULE_ID module, 1701 QDF_TRACE_LEVEL level, 1702 char *str_format, ...); 1703 1704 /** 1705 * struct category_info - Category information structure 1706 * @category_verbose_mask: Embeds information about category's verbose level 1707 */ 1708 struct category_info { 1709 uint16_t category_verbose_mask; 1710 }; 1711 1712 /** 1713 * struct category_name_info - Category name information structure 1714 * @category_name_str: Embeds information about category name 1715 */ 1716 struct category_name_info { 1717 unsigned char category_name_str[QDF_MAX_NAME_SIZE]; 1718 }; 1719 1720 /** 1721 * qdf_trace_msg_cmn() - Converged logging API 1722 * @idx: Index of print control object assigned to the module 1723 * @category: Category identifier. A member of the QDF_MODULE_ID enumeration 1724 * that identifies the category issuing the trace message. 1725 * @verbose: Verbose level. A member of the QDF_TRACE_LEVEL enumeration 1726 * indicating the severity of the condition causing the trace 1727 * message to be issued. More severe conditions are more likely 1728 * to be logged. 1729 * @str_format: Format string. The message to be logged. This format string 1730 * contains printf-like replacement parameters, which follow this 1731 * parameter in the variable argument list. 1732 * @val: Variable argument list part of the log message 1733 * 1734 * Return: nothing 1735 * 1736 */ 1737 void qdf_trace_msg_cmn(unsigned int idx, 1738 QDF_MODULE_ID category, 1739 QDF_TRACE_LEVEL verbose, 1740 const char *str_format, 1741 va_list val); 1742 1743 /** 1744 * struct qdf_print_ctrl - QDF Print Control structure 1745 * Statically allocated objects of print control 1746 * structure are declared that will support maximum of 1747 * 32 print control objects. Any module that needs to 1748 * register to the print control framework needs to 1749 * obtain a print control object using 1750 * qdf_print_ctrl_register API. It will have to pass 1751 * pointer to category info structure, name and 1752 * custom print function to be used if required. 1753 * @name: Optional name for the control object 1754 * @cat_info: Array of category_info struct 1755 * @custom_print: Custom print handler 1756 * @custom_ctxt: Custom print context 1757 * @dbglvlmac_on: Flag to enable/disable MAC level filtering 1758 * @in_use: Boolean to indicate if control object is in use 1759 */ 1760 struct qdf_print_ctrl { 1761 char name[QDF_MAX_NAME_SIZE]; 1762 struct category_info cat_info[MAX_SUPPORTED_CATEGORY]; 1763 void (*custom_print)(void *ctxt, const char *fmt, va_list args); 1764 void *custom_ctxt; 1765 #ifdef DBG_LVL_MAC_FILTERING 1766 unsigned char dbglvlmac_on; 1767 #endif 1768 bool in_use; 1769 }; 1770 1771 /** 1772 * qdf_print_ctrl_register() - Allocate QDF print control object, assign 1773 * pointer to category info or print control 1774 * structure and return the index to the callee 1775 * @cinfo: Pointer to array of category info structure 1776 * @custom_print_handler: Pointer to custom print handler 1777 * @custom_ctx: Pointer to custom context 1778 * @pctrl_name: Pointer to print control object name 1779 * 1780 * Return: Index of qdf_print_ctrl structure 1781 * 1782 */ 1783 int qdf_print_ctrl_register(const struct category_info *cinfo, 1784 void *custom_print_handler, 1785 void *custom_ctx, 1786 const char *pctrl_name); 1787 1788 #ifdef QCA_WIFI_MODULE_PARAMS_FROM_INI 1789 /** 1790 * qdf_initialize_module_param_from_ini() - Update qdf module params 1791 * 1792 * Read the file which has wifi module params, parse and update 1793 * qdf module params. 1794 * 1795 * Return: void 1796 */ 1797 void qdf_initialize_module_param_from_ini(void); 1798 #else 1799 static inline 1800 void qdf_initialize_module_param_from_ini(void) 1801 { 1802 } 1803 #endif 1804 1805 /** 1806 * qdf_shared_print_ctrl_init() - Initialize the shared print ctrl obj with 1807 * all categories set to the default level 1808 * 1809 * Return: void 1810 * 1811 */ 1812 void qdf_shared_print_ctrl_init(void); 1813 1814 /** 1815 * qdf_print_setup() - Setup default values to all the print control objects 1816 * 1817 * Register new print control object for the callee 1818 * 1819 * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE 1820 * on failure 1821 */ 1822 QDF_STATUS qdf_print_setup(void); 1823 1824 /** 1825 * qdf_print_ctrl_cleanup() - Clean up a print control object 1826 * @idx: Index of print control object 1827 * 1828 * Cleanup the print control object for the callee 1829 * 1830 * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE on failure 1831 */ 1832 QDF_STATUS qdf_print_ctrl_cleanup(unsigned int idx); 1833 1834 /** 1835 * qdf_shared_print_ctrl_cleanup() - Clean up of the shared object 1836 * 1837 * Cleanup the shared print-ctrl-object 1838 * 1839 * Return: void 1840 */ 1841 void qdf_shared_print_ctrl_cleanup(void); 1842 1843 /** 1844 * qdf_print_set_category_verbose() - Enable/Disable category for a 1845 * print control object with 1846 * user provided verbose level 1847 * @idx: Index of the print control object assigned to callee 1848 * @category: Category information 1849 * @verbose: Verbose information 1850 * @is_set: Flag indicating if verbose level needs to be enabled or disabled 1851 * 1852 * Return: QDF_STATUS_SUCCESS for success and QDF_STATUS_E_FAILURE for failure 1853 */ 1854 QDF_STATUS qdf_print_set_category_verbose(unsigned int idx, 1855 QDF_MODULE_ID category, 1856 QDF_TRACE_LEVEL verbose, 1857 bool is_set); 1858 1859 /** 1860 * qdf_log_dump_at_kernel_level() - Enable/Disable printk call 1861 * @enable: Indicates whether printk is enabled in QDF_TRACE 1862 * 1863 * Return: void 1864 */ 1865 void qdf_log_dump_at_kernel_level(bool enable); 1866 1867 /** 1868 * qdf_logging_set_flush_timer() - Set the time period in which host logs 1869 * should be flushed out to user-space 1870 * @milliseconds: milliseconds after which the logs should be flushed out to 1871 * user-space 1872 * 1873 * Return: QDF_STATUS_SUCCESS for success and QDF_STATUS_E_FAILURE for failure 1874 */ 1875 int qdf_logging_set_flush_timer(uint32_t milliseconds); 1876 1877 /** 1878 * qdf_logging_flush_logs() - Flush out the logs to user-space one time 1879 * 1880 * Return: void 1881 */ 1882 void qdf_logging_flush_logs(void); 1883 1884 /** 1885 * qdf_print_is_category_enabled() - Get category information for the 1886 * print control object 1887 * 1888 * @idx: Index of print control object 1889 * @category: Category information 1890 * 1891 * Return: Verbose enabled(true) or disabled(false) or invalid input (false) 1892 */ 1893 bool qdf_print_is_category_enabled(unsigned int idx, 1894 QDF_MODULE_ID category); 1895 1896 /** 1897 * qdf_print_is_verbose_enabled() - Get verbose information of a category for 1898 * the print control object 1899 * 1900 * @idx: Index of print control object 1901 * @category: Category information 1902 * @verbose: Verbose information 1903 * 1904 * Return: Verbose enabled(true) or disabled(false) or invalid input (false) 1905 */ 1906 bool qdf_print_is_verbose_enabled(unsigned int idx, 1907 QDF_MODULE_ID category, 1908 QDF_TRACE_LEVEL verbose); 1909 1910 /** 1911 * qdf_print_clean_node_flag() - Clean up node flag for print control object 1912 * 1913 * @idx: Index of print control object 1914 * 1915 * Return: None 1916 */ 1917 void qdf_print_clean_node_flag(unsigned int idx); 1918 1919 #ifdef DBG_LVL_MAC_FILTERING 1920 1921 /** 1922 * qdf_print_set_node_flag() - Set flag to enable MAC level filtering 1923 * 1924 * @idx: Index of print control object 1925 * @enable: Enable/Disable bit sent by callee 1926 * 1927 * Return: QDF_STATUS_SUCCESS on Success and QDF_STATUS_E_FAILURE on Failure 1928 */ 1929 QDF_STATUS qdf_print_set_node_flag(unsigned int idx, 1930 uint8_t enable); 1931 1932 /** 1933 * qdf_print_get_node_flag() - Get flag that controls MAC level filtering 1934 * 1935 * @idx: Index of print control object 1936 * 1937 * Return: Flag that indicates enable(1) or disable(0) or invalid(-1) 1938 */ 1939 bool qdf_print_get_node_flag(unsigned int idx); 1940 1941 #endif 1942 1943 #ifdef QCA_WIFI_MODULE_PARAMS_FROM_INI 1944 /** 1945 * qdf_module_param_handler() - Function to store module params 1946 * 1947 * @context: NULL, unused. 1948 * @key: Name of the module param 1949 * @value: Value of the module param 1950 * 1951 * Handler function to be called from qdf_ini_parse() 1952 * function when a valid parameter is found in a file. 1953 * 1954 * Return: QDF_STATUS_SUCCESS on Success 1955 */ 1956 QDF_STATUS qdf_module_param_handler(void *context, const char *key, 1957 const char *value); 1958 #else 1959 static inline 1960 QDF_STATUS qdf_module_param_handler(void *context, const char *key, 1961 const char *value) 1962 { 1963 return QDF_STATUS_SUCCESS; 1964 } 1965 #endif 1966 1967 /** 1968 * qdf_logging_init() - Initialize msg logging functionality 1969 * 1970 * Return: void 1971 */ 1972 void qdf_logging_init(void); 1973 1974 /** 1975 * qdf_logging_exit() - Cleanup msg logging functionality 1976 * 1977 * Return: void 1978 */ 1979 void qdf_logging_exit(void); 1980 1981 #define QDF_SYMBOL_LEN __QDF_SYMBOL_LEN 1982 1983 /** 1984 * qdf_sprint_symbol() - prints the name of a symbol into a string buffer 1985 * @buffer: the string buffer to print into 1986 * @addr: address of the symbol to lookup and print 1987 * 1988 * Return: number of characters printed 1989 */ 1990 int qdf_sprint_symbol(char *buffer, void *addr); 1991 1992 /** 1993 * qdf_minidump_init() - Initialize minidump functionality 1994 * 1995 * 1996 * Return: void 1997 */ 1998 static inline 1999 void qdf_minidump_init(void) 2000 { 2001 __qdf_minidump_init(); 2002 } 2003 2004 /** 2005 * qdf_minidump_deinit() - De-initialize minidump functionality 2006 * 2007 * 2008 * Return: void 2009 */ 2010 static inline 2011 void qdf_minidump_deinit(void) 2012 { 2013 __qdf_minidump_deinit(); 2014 } 2015 2016 /** 2017 * qdf_minidump_log() - Log memory address to be included in minidump 2018 * @start_addr: Start address of the memory to be dumped 2019 * @size: Size in bytes 2020 * @name: String to identify this entry 2021 */ 2022 static inline 2023 void qdf_minidump_log(void *start_addr, 2024 const size_t size, const char *name) 2025 { 2026 __qdf_minidump_log(start_addr, size, name); 2027 } 2028 2029 /** 2030 * qdf_minidump_remove() - Remove memory address from minidump 2031 * @start_addr: Start address of the memory previously added 2032 * @size: Size in bytes 2033 * @name: String to identify this entry 2034 */ 2035 static inline 2036 void qdf_minidump_remove(void *start_addr, 2037 const size_t size, const char *name) 2038 { 2039 __qdf_minidump_remove(start_addr, size, name); 2040 } 2041 2042 #endif /* __QDF_TRACE_H */ 2043