1 /*
2 * DebugFS code for XRadio drivers
3 *
4 * Copyright (c) 2013
5 * Xradio Technology Co., Ltd. <www.xradiotech.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11 #ifndef XRADIO_DEBUG_H_INCLUDED
12 #define XRADIO_DEBUG_H_INCLUDED
13
14 #include "itp.h"
15 #include "xradio.h"
16
17 /* Message always need to be present even in release version. */
18 #define XRADIO_DBG_ALWY 0x01
19
20 /* Error message to report an error, it can hardly works. */
21 #define XRADIO_DBG_ERROR 0x02
22
23 /* Warning message to inform us of something unnormal or
24 * something very important, but it still work. */
25 #define XRADIO_DBG_WARN 0x04
26
27 /* Important message we need to know in unstable version. */
28 #define XRADIO_DBG_NIY 0x08
29
30 /* Normal message just for debug in developing stage. */
31 #define XRADIO_DBG_MSG 0x10
32
33 /* Trace of functions, for sequence of functions called. Normally,
34 * don't set this level because there are too more print. */
35 #define XRADIO_DBG_TRC 0x20
36
37 #define XRADIO_DBG_LEVEL 0xFF
38
39 /* for host debuglevel*/
40 extern u8 dbg_common ;
41 extern u8 dbg_sbus ;
42 extern u8 dbg_bh ;
43 extern u8 dbg_txrx ;
44 extern u8 dbg_wsm ;
45 extern u8 dbg_sta ;
46 extern u8 dbg_scan ;
47 extern u8 dbg_ap ;
48 extern u8 dbg_pm ;
49 extern u8 dbg_itp ;
50 extern u8 dbg_etf ;
51 extern u8 dbg_logfile;
52
53 /*for sdio clk debug*/
54 extern u32 dbg_sdio_clk;
55
56 /*hang driver for debug when error occurs.*/
57 #ifdef ERROR_HANG_DRIVER
58 extern u8 error_hang_driver;
59 #endif
60
61 /* for ps debug */
62 extern u8 ps_disable;
63 extern u8 ps_idleperiod;
64 extern u8 ps_changeperiod;
65 /* info of bh thread*/
66 extern u32 irq_count;
67 extern u32 int_miss_cnt;
68 extern u32 fix_miss_cnt;
69 extern u32 next_rx_cnt;
70 extern u32 rx_total_cnt;
71 extern u32 tx_total_cnt;
72 extern u32 tx_buf_limit;
73 extern u32 tx_limit;
74 extern u32 tx_rx_idle;
75 extern u32 bh_idle;
76 extern u32 queue_lock_cnt;
77 extern u32 overfull_lock_cnt;
78 extern u32 policy_lock_cnt;
79 extern u32 dbg_txconfirm[32];
80 extern int tx_burst_limit;
81 extern u32 dbg_tx_delay_min;
82 extern u32 dbg_tx_delay_max;
83 extern u32 dbg_tx_media_delay[16];
84
85 extern u32 sdio_reg_cnt1;
86 extern u32 sdio_reg_cnt2;
87 extern u32 sdio_reg_cnt3;
88 extern u32 sdio_reg_cnt4;
89 extern u32 sdio_reg_cnt5;
90 extern u32 sdio_reg_cnt6;
91 extern u32 tx_limit_cnt1;
92 extern u32 tx_limit_cnt2;
93 extern u32 tx_limit_cnt3;
94 extern u32 tx_limit_cnt4;
95 extern u32 tx_limit_cnt5;
96 extern u32 tx_limit_cnt6;
97
98 /* time info of bh tx and rx */
99 #define PERF_INFO_TEST 0
100 #if PERF_INFO_TEST
101 #define TEST_GETTIME 0
102 struct perf_info {
103 u32 count;
104 u32 totaltime;
105 u32 totalsize;
106 u32 min_time;
107 u32 max_time;
108 };
109 extern struct perf_info data_tx;
110 extern struct perf_info data_rx;
111 extern struct perf_info bh_others;
112 extern struct perf_info bh_wait;
113 extern struct perf_info sdio_reg;
114 extern struct perf_info prepare_tx;
115 extern struct perf_info sdio_write;
116 extern struct perf_info dev_wake;
117 extern struct perf_info prepare_rx;
118 extern struct perf_info sdio_read;
119 extern struct perf_info handle_rx;
120 #ifdef BH_PROC_THREAD
121 extern struct perf_info get_item;
122 extern struct perf_info wake_proc;
123 extern struct perf_info proc_rx;
124 extern struct perf_info proc_tx;
125 extern struct perf_info proc_wait;
126 #endif
127 extern struct perf_info ind_rx;
128 extern struct perf_info mac_rx;
129 extern struct perf_info mac_tx;
130
131 #if TEST_GETTIME
132 extern struct perf_info get_time;
133 #define PERF_INFO_GETTIME(t) do { \
134 xr_do_gettimeofday(t); \
135 perf_info_stamp(t, &get_time, 0, NULL); \
136 } while (0)
137 #else
138 #define PERF_INFO_GETTIME(t) xr_do_gettimeofday(t)
139 #endif
140 #define PERF_INFO_STAMP(t, p, s) perf_info_stamp(t, p, s, NULL)
141 #define PERF_INFO_STAMP_GET(t, p, s, g) perf_info_stamp(t, p, s, g)
142 #define PERF_INFO_STAMP_UPDATE(t, p, s) perf_info_stamp(t, p, s, t)
143
144 #include <linux/rtc.h>
145 #include <linux/time.h>
perf_info_stamp(struct timespec64 * oldtime,struct perf_info * info,u32 size,struct timespec64 * gettime)146 static inline void perf_info_stamp(struct timespec64 *oldtime,
147 struct perf_info *info, u32 size, struct timespec64 *gettime)
148 {
149 u32 time_int;
150 struct timespec64 newtime;
151 xr_do_gettimeofday(&newtime);
152 time_int = (newtime.tv_sec - oldtime->tv_sec) * 1000000 + \
153 (long)(newtime.tv_usec - oldtime->tv_usec);
154 if (time_int <= info->min_time)
155 info->min_time = time_int;
156 if (time_int > info->max_time)
157 info->max_time = time_int;
158 info->totalsize += size;
159 info->totaltime += time_int;
160 info->count++; /*do_gettimeofday consume 0.5us*/
161 if (gettime != NULL) {
162 memcpy(gettime, &newtime, sizeof(newtime));
163 }
164 }
165
166 #else /* #if PERF_INFO_TEST */
167
168 #define PERF_INFO_GETTIME(t)
169 #define PERF_INFO_STAMP(t, p, s)
170 #define PERF_INFO_STAMP_GET(t, p, s, g)
171 #define PERF_INFO_STAMP_UPDATE(t, p, s)
172 #endif /* #if PERF_INFO_TEST */
173
174 #ifdef SUPPORT_HT40
175
176 extern u32 TxedHtofdmRateMap[4][8];
177 extern u32 TxedLegacyRateMap[2][8];
178
179 extern u32 RxedHtofdmRateMap[4][8];
180 extern u32 RxedLegacyRateMap[2][8];
181
182 #else
183
184 extern u32 TxedRateIdx_Map[24];
185 extern u32 RxedRateIdx_Map[24];
186
187 #endif
188
189 #ifdef CONFIG_XRADIO_DEBUGFS
190 #if (SUPPORT_EPTA)
191 extern u32 epta_stat_dbg_ctrl;
192 #endif
193 #endif
194
195 #define WSM_DUMP_MAX_SIZE 20
196
197 #if defined(CONFIG_XRADIO_DEBUG)
198 #define DGB_LOG_FILE 0 /*Don't log more than 500byte once.*/
199 #define DGB_XRADIO_QC 1 /*Enable this only in QC test.*/
200 #define DGB_XRADIO_HWT 0 /*Only in hardware test with special fw.*/
201 #define DBG_XRADIO_HIF 1
202 #define DBG_READ_HWINFO 0
203 #else
204 #define DGB_LOG_FILE 0 /*Don't log more than 500byte once.*/
205 #define DGB_XRADIO_QC 0 /*Enable this only in QC test.*/
206 #define DGB_XRADIO_HWT 0 /*Only in hardware test with special fw.*/
207 #define DBG_XRADIO_HIF 0
208 #define DBG_READ_HWINFO 0
209 #endif
210
211 #if (DBG_XRADIO_HIF)
212
213 #define WRITE_READ_MAX_LEN 0x1000
214 #define PAS_RAM_START_ADDR 0x09010000
215 #define PAS_RAM_END_ADDR 0X09017fff
216
217 #endif
218
219 #if DGB_LOG_FILE
220 #define DGB_LOG_BUF_LEN 1500
221 #define DGB_LOG_PATH0 "/data/xradio_err.log"
222
223 extern u8 log_buffer[DGB_LOG_BUF_LEN];
224 extern u16 log_pos;
225 int xradio_logfile(char *buffer, int buf_len, u8 b_time);
226
227 #define LOG_FILE(b_time, msg) xradio_logfile(msg, -1, b_time)
228 #define LOG_FILE_VARS(b_time, ...) do { \
229 if (!log_pos) \
230 memset(log_buffer, 0, DGB_LOG_BUF_LEN); \
231 if (log_pos <= 1000) \
232 log_pos += sprintf((char *)(log_buffer+log_pos), __VA_ARGS__); \
233 if (xradio_logfile(log_buffer, log_pos, b_time) >= 0) \
234 log_pos = 0; \
235 } while (0)
236
237 #else /*DGB_LOG_FILE disable*/
238
239 #define LOG_FILE(b_time, msg)
240 #define LOG_FILE_VARS(b_time, ...)
241 #endif
242
243 #if (defined(CONFIG_XRADIO_DEBUG))
244 /****************************** debug version *******************************/
245 #if (defined(CONFIG_XRADIO_DUMP_ON_ERROR))
246 #define SYS_BUG(c) BUG_ON(c)
247 #define SYS_WARN(c) WARN_ON(c)
248 #else
249 #define SYS_BUG(c) WARN_ON(c)
250 #define SYS_WARN(c) WARN_ON(c)
251 #endif
252
253 #define xradio_dbg(level, ...) \
254 do { \
255 if ((level) & dbg_common & XRADIO_DBG_ERROR) \
256 printk(KERN_ERR "[XRADIO_ERR] " __VA_ARGS__); \
257 else if ((level) & dbg_common & XRADIO_DBG_WARN) \
258 printk(KERN_ERR "[XRADIO_WRN] " __VA_ARGS__); \
259 else if ((level) & dbg_common) \
260 printk(KERN_ERR "[XRADIO] " __VA_ARGS__); \
261 if ((level) & dbg_logfile) \
262 LOG_FILE_VARS(((level)&XRADIO_DBG_ERROR), \
263 "[XRADIO_ERR] " __VA_ARGS__); \
264 } while (0)
265
266 #define sbus_printk(level, ...) \
267 do { \
268 if ((level) & dbg_sbus & XRADIO_DBG_ERROR) \
269 printk(KERN_ERR "[SBUS_ERR] " __VA_ARGS__); \
270 else if ((level) & dbg_sbus & XRADIO_DBG_WARN) \
271 printk(KERN_ERR "[SBUS_WRN] " __VA_ARGS__); \
272 else if ((level) & dbg_sbus) \
273 printk(KERN_ERR "[SBUS] " __VA_ARGS__); \
274 if ((level) & dbg_logfile) \
275 LOG_FILE_VARS(((level)&XRADIO_DBG_ERROR), \
276 "[SBUS_ERR] " __VA_ARGS__); \
277 } while (0)
278
279 #define txrx_printk(level, ...) \
280 do { \
281 if ((level) & dbg_txrx & XRADIO_DBG_ERROR) \
282 printk(KERN_ERR "[TXRX_ERR] " __VA_ARGS__); \
283 else if ((level) & dbg_txrx & XRADIO_DBG_WARN) \
284 printk(KERN_ERR "[TXRX_WRN] " __VA_ARGS__); \
285 else if ((level) & dbg_txrx) \
286 printk(KERN_ERR "[TXRX] " __VA_ARGS__); \
287 if ((level) & dbg_logfile) \
288 LOG_FILE_VARS(((level)&XRADIO_DBG_ERROR), \
289 "[TXRX_ERR] " __VA_ARGS__); \
290 } while (0)
291
292 #define bh_printk(level, ...) \
293 do { \
294 if ((level) & dbg_bh & XRADIO_DBG_ERROR) \
295 printk(KERN_ERR "[BH_ERR] " __VA_ARGS__); \
296 else if ((level) & dbg_bh & XRADIO_DBG_WARN) \
297 printk(KERN_ERR "[BH_WRN] " __VA_ARGS__); \
298 else if ((level) & dbg_bh) \
299 printk(KERN_ERR "[BH] " __VA_ARGS__); \
300 if ((level) & dbg_logfile) \
301 LOG_FILE_VARS(((level)&XRADIO_DBG_ERROR), \
302 "[BH_ERR] " __VA_ARGS__); \
303 } while (0)
304
305 #define wsm_printk(level, ...) \
306 do { \
307 if ((level) & dbg_wsm & XRADIO_DBG_ERROR) \
308 printk(KERN_ERR "[WSM_ERR] " __VA_ARGS__); \
309 else if ((level) & dbg_wsm & XRADIO_DBG_WARN) \
310 printk(KERN_ERR "[WSM_WRN] " __VA_ARGS__); \
311 else if ((level) & dbg_wsm) \
312 printk(KERN_ERR "[WSM] " __VA_ARGS__); \
313 if ((level) & dbg_logfile) \
314 LOG_FILE_VARS(((level)&XRADIO_DBG_ERROR), \
315 "[WSM_ERR] " __VA_ARGS__); \
316 } while (0)
317
318 #define sta_printk(level, ...) \
319 do { \
320 if ((level) & dbg_sta & XRADIO_DBG_ERROR) \
321 printk(KERN_ERR "[STA_ERR] " __VA_ARGS__); \
322 else if ((level) & dbg_sta & XRADIO_DBG_WARN) \
323 printk(KERN_ERR "[STA_WRN] " __VA_ARGS__); \
324 else if ((level) & dbg_sta) \
325 printk(KERN_ERR "[STA] " __VA_ARGS__); \
326 if ((level) & dbg_logfile) \
327 LOG_FILE_VARS(((level)&XRADIO_DBG_ERROR), \
328 "[STA_ERR] " __VA_ARGS__); \
329 } while (0)
330
331 #define scan_printk(level, ...) \
332 do { \
333 if ((level) & dbg_scan & XRADIO_DBG_ERROR) \
334 printk(KERN_ERR "[SCAN_ERR] " __VA_ARGS__); \
335 else if ((level) & dbg_scan & XRADIO_DBG_WARN) \
336 printk(KERN_ERR "[SCAN_WRN] " __VA_ARGS__); \
337 else if ((level) & dbg_scan) \
338 printk(KERN_ERR "[SCAN] " __VA_ARGS__); \
339 if ((level) & dbg_logfile) \
340 LOG_FILE_VARS(((level)&XRADIO_DBG_ERROR), \
341 "[SCAN_ERR] " __VA_ARGS__); \
342 } while (0)
343
344 #define ap_printk(level, ...) \
345 do { \
346 if ((level) & dbg_ap & XRADIO_DBG_ERROR) \
347 printk(KERN_ERR "[AP_ERR] " __VA_ARGS__); \
348 else if ((level) & dbg_ap & XRADIO_DBG_WARN) \
349 printk(KERN_ERR "[AP_WRN] " __VA_ARGS__); \
350 else if ((level) & dbg_ap) \
351 printk(KERN_ERR "[AP] " __VA_ARGS__); \
352 if ((level) & dbg_logfile) \
353 LOG_FILE_VARS(((level)&XRADIO_DBG_ERROR), \
354 "[AP_ERR] " __VA_ARGS__); \
355 } while (0)
356
357 #define pm_printk(level, ...) \
358 do { \
359 if ((level) & dbg_pm & XRADIO_DBG_ERROR) \
360 printk(KERN_ERR "[PM_ERR] " __VA_ARGS__); \
361 else if ((level) & dbg_pm & XRADIO_DBG_WARN) \
362 printk(KERN_ERR "[PM_WRN] " __VA_ARGS__); \
363 else if ((level) & dbg_pm) \
364 printk(KERN_ERR "[PM] " __VA_ARGS__); \
365 if ((level) & dbg_logfile) \
366 LOG_FILE_VARS(((level)&XRADIO_DBG_ERROR), \
367 "[PM_ERR] " __VA_ARGS__); \
368 } while (0)
369
370 #define itp_printk(level, ...) \
371 do { \
372 if ((level) & dbg_itp & XRADIO_DBG_ERROR) \
373 printk(KERN_ERR "[ITP_ERR] " __VA_ARGS__); \
374 else if ((level) & dbg_itp & XRADIO_DBG_WARN) \
375 printk(KERN_ERR "[ITP_WRN] " __VA_ARGS__); \
376 else if ((level) & dbg_itp) \
377 printk(KERN_ERR "[ITP] " __VA_ARGS__); \
378 if ((level) & dbg_logfile) \
379 LOG_FILE_VARS(((level)&XRADIO_DBG_ERROR), \
380 "[ITP_ERR] " __VA_ARGS__); \
381 } while (0)
382
383 #define etf_printk(level, ...) \
384 do { \
385 if ((level) & dbg_etf & XRADIO_DBG_ERROR) \
386 printk(KERN_ERR "[ETF_ERR] " __VA_ARGS__); \
387 else if ((level) & dbg_etf & XRADIO_DBG_WARN) \
388 printk(KERN_ERR "[ETF_WRN] " __VA_ARGS__); \
389 else if ((level) & dbg_etf) \
390 printk(KERN_ERR "[ETF] " __VA_ARGS__); \
391 if ((level) & dbg_logfile) \
392 LOG_FILE_VARS(((level)&XRADIO_DBG_ERROR), \
393 "[ETF_ERR] " __VA_ARGS__); \
394 } while (0)
395
396
397 #define DBG_FUN_LINE printk(KERN_ERR "%s, line=%d", __func__, __LINE__)
398 #define PARAM_CHECK_FALSE(p) \
399 do { \
400 if (!p) \
401 DBG_FUN_LINE; \
402 } while (0)
403
404 #define PARAM_CHECK_TRUE(p) \
405 do { \
406 if (p) \
407 DBG_FUN_LINE; \
408 } while (0)
409
410
411 /*interfaces to debug packet's information.*/
412 /*for802.11*/
413 #define PF_CTRL 0x0001
414 #define PF_MGMT 0x0002
415 #define PF_DATA 0x0004
416 #define PF_SCAN 0x0008
417
418 /*for ip data*/
419 #define PF_TCP 0x0010
420 #define PF_UDP 0x0020
421 #define PF_DHCP 0x0040
422 #define PF_ICMP 0x0080
423
424 /*for special frames or info.*/
425 #define PF_8021X 0x0100 /*action frames*/
426 #define PF_MAC_SN 0x0200 /*mac seq*/
427 #define PF_OWNMAC 0x0400 /*TA in Tx, RA in Rx.*/
428 #define PF_SA_DA 0x0800 /*SA, DA for Ethernet.*/
429
430 #define PF_MACADDR 0x1000 /*RA in Tx, TA in Rx.*/
431 #define PF_IPADDR 0x2000 /*ip address of ip packets.*/
432 #define PF_UNKNWN 0x4000 /*print frames of unknown flag.*/
433 #define PF_RX 0x8000 /*0:TX, 1:RX. So, need to add PF_RX in Rx path.*/
434 void xradio_parse_frame(u8 *mac_data, u8 iv_len, u16 flags, u8 if_id);
435
436 #if (DGB_XRADIO_HWT) /*hardware test*/
437 typedef struct HWT_PARAMETERS_S {
438 u16 Msglen;
439 u16 MsgID;
440 u16 TestID;
441 u16 Params;
442 u16 Datalen;
443 u16 Data;
444 } HWT_PARAMETERS;
445 int get_hwt_hif_tx(struct xradio_common *hw_priv, u8 **data,
446 size_t *tx_len, int *burst, int *vif_selected);
447 #endif /*DGB_XRADIO_HWT*/
448
449 #else
450 /****************************** release version *******************************/
451 #define SYS_BUG(c) WARN_ON(c)
452 #define SYS_WARN(c) WARN_ON(c)
453
454 #define xradio_dbg(level, ...)
455 #define sbus_printk(level, ...)
456 #define txrx_printk(level, ...)
457 #define bh_printk(level, ...)
458 #define wsm_printk(level, ...)
459 #define sta_printk(level, ...)
460 #define scan_printk(level, ...)
461 #define ap_printk(level, ...)
462 #define pm_printk(level, ...)
463 #define itp_printk(level, ...)
464
465 #define DBG_FUN_LINE
466 #define PARAM_CHECK_FALSE
467 #define PARAM_CHECK_TRUE
468
xradio_parse_frame(u8 * mac_data,u8 iv_len,u16 flags,u8 if_id)469 static inline void xradio_parse_frame(u8 *mac_data, u8 iv_len,
470 u16 flags, u8 if_id)
471 {
472 }
473 #endif /*CONFIG_XRADIO_DEBUG*/
474
475 #ifdef CONFIG_XRADIO_DEBUGFS
476 /************************* debugfs version *****************************/
477 struct xradio_debug_common {
478 struct dentry *debugfs_phy;
479 int tx_cache_miss;
480 int tx_burst;
481 int rx_burst;
482 int ba_cnt;
483 int ba_acc;
484 int ba_cnt_rx;
485 int ba_acc_rx;
486 #ifdef CONFIG_XRADIO_ITP
487 struct xradio_itp itp;
488 #endif /* CONFIG_XRADIO_ITP */
489 };
490
491 struct xradio_debug_priv {
492 struct dentry *debugfs_phy;
493 int tx;
494 int tx_agg;
495 int rx;
496 int rx_agg;
497 int tx_multi;
498 int tx_multi_frames;
499 int tx_align;
500 int tx_ttl;
501 };
502
503
504 #define DBG_INT_ADD(count) (++count)
505 #define DBG_ARRY_ADD(a, i) (++a[i])
506
507 #ifdef ERROR_HANG_DRIVER
508 void xradio_hang_driver_for_debug(struct xradio_common *hw_priv, int error);
509 #endif
510 int xradio_debug_init_common(struct xradio_common *hw_priv);
511 int xradio_debug_init_priv(struct xradio_common *hw_priv,
512 struct xradio_vif *priv);
513 void xradio_debug_release_common(struct xradio_common *hw_priv);
514 void xradio_debug_release_priv(struct xradio_vif *priv);
515
516 void xradio_debug_tx_delay(u32 media_delay, u32 queue_delay);
517
xradio_debug_txed(struct xradio_vif * priv)518 static inline void xradio_debug_txed(struct xradio_vif *priv)
519 {
520 if (!priv->debug)
521 return;
522 ++priv->debug->tx;
523 }
524
xradio_debug_txed_agg(struct xradio_vif * priv)525 static inline void xradio_debug_txed_agg(struct xradio_vif *priv)
526 {
527 if (!priv->debug)
528 return;
529 ++priv->debug->tx_agg;
530 }
531
xradio_debug_txed_multi(struct xradio_vif * priv,int count)532 static inline void xradio_debug_txed_multi(struct xradio_vif *priv,
533 int count)
534 {
535 if (!priv->debug)
536 return;
537 ++priv->debug->tx_multi;
538 priv->debug->tx_multi_frames += count;
539 }
540
xradio_debug_rxed(struct xradio_vif * priv)541 static inline void xradio_debug_rxed(struct xradio_vif *priv)
542 {
543 if (!priv->debug)
544 return;
545 ++priv->debug->rx;
546 }
547
xradio_debug_rxed_agg(struct xradio_vif * priv)548 static inline void xradio_debug_rxed_agg(struct xradio_vif *priv)
549 {
550 if (!priv->debug)
551 return;
552 ++priv->debug->rx_agg;
553 }
554
xradio_debug_tx_cache_miss(struct xradio_common * hw_priv)555 static inline void xradio_debug_tx_cache_miss(struct xradio_common *hw_priv)
556 {
557 if (!hw_priv->debug)
558 return;
559 ++hw_priv->debug->tx_cache_miss;
560 }
561
xradio_debug_tx_align(struct xradio_vif * priv)562 static inline void xradio_debug_tx_align(struct xradio_vif *priv)
563 {
564 if (!priv->debug)
565 return;
566 ++priv->debug->tx_align;
567 }
568
xradio_debug_tx_ttl(struct xradio_vif * priv)569 static inline void xradio_debug_tx_ttl(struct xradio_vif *priv)
570 {
571 if (!priv->debug)
572 return;
573 ++priv->debug->tx_ttl;
574 }
575
xradio_debug_tx_burst(struct xradio_common * hw_priv)576 static inline void xradio_debug_tx_burst(struct xradio_common *hw_priv)
577 {
578 if (!hw_priv->debug)
579 return;
580 ++hw_priv->debug->tx_burst;
581 }
582
xradio_debug_rx_burst(struct xradio_common * hw_priv)583 static inline void xradio_debug_rx_burst(struct xradio_common *hw_priv)
584 {
585 if (!hw_priv->debug)
586 return;
587 ++hw_priv->debug->rx_burst;
588 }
589
xradio_debug_ba(struct xradio_common * hw_priv,int ba_cnt,int ba_acc,int ba_cnt_rx,int ba_acc_rx)590 static inline void xradio_debug_ba(struct xradio_common *hw_priv,
591 int ba_cnt, int ba_acc, int ba_cnt_rx,
592 int ba_acc_rx)
593 {
594 if (!hw_priv->debug)
595 return;
596 hw_priv->debug->ba_cnt = ba_cnt;
597 hw_priv->debug->ba_acc = ba_acc;
598 hw_priv->debug->ba_cnt_rx = ba_cnt_rx;
599 hw_priv->debug->ba_acc_rx = ba_acc_rx;
600 }
601
602 int xradio_print_fw_version(struct xradio_common *hw_priv,
603 u8 *buf, size_t len);
604
605 int xradio_host_dbg_init(void);
606 void xradio_host_dbg_deinit(void);
607
608 #else /* CONFIG_XRADIO_DEBUGFS */
609 /************************ no debugfs version **************************/
610 #define DBG_INT_ADD(count)
611 #define DBG_ARRY_ADD(a, i)
612
xradio_debug_init_common(struct xradio_common * hw_priv)613 static inline int xradio_debug_init_common(struct xradio_common *hw_priv)
614 {
615 return 0;
616 }
617
xradio_debug_init_priv(struct xradio_common * hw_priv,struct xradio_vif * priv)618 static inline int xradio_debug_init_priv(struct xradio_common *hw_priv,
619 struct xradio_vif *priv)
620 {
621 return 0;
622 }
623
xradio_debug_release_common(struct xradio_common * hw_priv)624 static inline void xradio_debug_release_common(struct xradio_common *hw_priv)
625 {
626 }
627
xradio_debug_release_priv(struct xradio_vif * priv)628 static inline void xradio_debug_release_priv(struct xradio_vif *priv)
629 {
630 }
631
xradio_debug_txed(struct xradio_vif * priv)632 static inline void xradio_debug_txed(struct xradio_vif *priv)
633 {
634 }
635
xradio_debug_txed_agg(struct xradio_vif * priv)636 static inline void xradio_debug_txed_agg(struct xradio_vif *priv)
637 {
638 }
639
xradio_debug_txed_multi(struct xradio_vif * priv,int count)640 static inline void xradio_debug_txed_multi(struct xradio_vif *priv,
641 int count)
642 {
643 }
644
xradio_debug_rxed(struct xradio_vif * priv)645 static inline void xradio_debug_rxed(struct xradio_vif *priv)
646 {
647 }
648
xradio_debug_rxed_agg(struct xradio_vif * priv)649 static inline void xradio_debug_rxed_agg(struct xradio_vif *priv)
650 {
651 }
652
xradio_debug_tx_cache_miss(struct xradio_common * hw_priv)653 static inline void xradio_debug_tx_cache_miss(struct xradio_common *hw_priv)
654 {
655 }
656
xradio_debug_tx_align(struct xradio_vif * priv)657 static inline void xradio_debug_tx_align(struct xradio_vif *priv)
658 {
659 }
660
xradio_debug_tx_ttl(struct xradio_vif * priv)661 static inline void xradio_debug_tx_ttl(struct xradio_vif *priv)
662 {
663 }
664
xradio_debug_tx_burst(struct xradio_common * hw_priv)665 static inline void xradio_debug_tx_burst(struct xradio_common *hw_priv)
666 {
667 }
668
xradio_debug_rx_burst(struct xradio_common * hw_priv)669 static inline void xradio_debug_rx_burst(struct xradio_common *hw_priv)
670 {
671 }
672
xradio_debug_ba(struct xradio_common * hw_priv,int ba_cnt,int ba_acc,int ba_cnt_rx,int ba_acc_rx)673 static inline void xradio_debug_ba(struct xradio_common *hw_priv,
674 int ba_cnt, int ba_acc, int ba_cnt_rx,
675 int ba_acc_rx)
676 {
677 }
678
xradio_debug_tx_delay(u32 media_delay,u32 queue_delay)679 static inline void xradio_debug_tx_delay(u32 media_delay, u32 queue_delay)
680 {
681 }
682
xradio_print_fw_version(struct xradio_vif * priv,u8 * buf,size_t len)683 static inline int xradio_print_fw_version(struct xradio_vif *priv,
684 u8 *buf, size_t len)
685 {
686 return 0;
687 }
688
xradio_hang_driver_for_debug(struct xradio_common * hw_priv,int error)689 static inline void xradio_hang_driver_for_debug(struct xradio_common *hw_priv, int error)
690 {
691
692 }
693
xradio_host_dbg_init(void)694 static inline int xradio_host_dbg_init(void)
695 {
696 return 0;
697 }
698
xradio_host_dbg_deinit(void)699 static inline void xradio_host_dbg_deinit(void)
700 {
701 }
702 #endif /* CONFIG_XRADIO_DEBUGFS */
703
704 #endif /* XRADIO_DEBUG_H_INCLUDED */
705