]>
Commit | Line | Data |
---|---|---|
9f95a23c TL |
1 | /* SPDX-License-Identifier: BSD-3-Clause |
2 | * Copyright (c) 2015-2018 Atomic Rules LLC | |
11fdf7f2 TL |
3 | */ |
4 | ||
5 | #ifndef _ARK_DEBUG_H_ | |
6 | #define _ARK_DEBUG_H_ | |
7 | ||
8 | #include <inttypes.h> | |
9 | #include <rte_log.h> | |
10 | ||
11 | ||
12 | /* Configuration option to pad TX packets to 60 bytes */ | |
13 | #ifdef RTE_LIBRTE_ARK_PAD_TX | |
14 | #define ARK_TX_PAD_TO_60 1 | |
15 | #else | |
16 | #define ARK_TX_PAD_TO_60 0 | |
17 | #endif | |
18 | ||
19 | /* system camel case definition changed to upper case */ | |
20 | #define PRIU32 PRIu32 | |
21 | #define PRIU64 PRIu64 | |
22 | ||
23 | /* Format specifiers for string data pairs */ | |
24 | #define ARK_SU32 "\n\t%-20s %'20" PRIU32 | |
25 | #define ARK_SU64 "\n\t%-20s %'20" PRIU64 | |
26 | #define ARK_SU64X "\n\t%-20s %#20" PRIx64 | |
27 | #define ARK_SPTR "\n\t%-20s %20p" | |
28 | ||
29 | ||
30 | ||
31 | #define PMD_DRV_LOG(level, fmt, args...) \ | |
32 | RTE_LOG(level, PMD, fmt, ## args) | |
33 | ||
34 | /* Conditional trace definitions */ | |
35 | #define ARK_TRACE_ON(level, fmt, ...) \ | |
36 | RTE_LOG(level, PMD, fmt, ##__VA_ARGS__) | |
37 | ||
38 | /* This pattern allows compiler check arguments even if disabled */ | |
39 | #define ARK_TRACE_OFF(level, fmt, ...) \ | |
40 | do {if (0) RTE_LOG(level, PMD, fmt, ##__VA_ARGS__); } \ | |
41 | while (0) | |
42 | ||
43 | ||
44 | /* tracing including the function name */ | |
45 | #define ARK_FUNC_ON(level, fmt, args...) \ | |
46 | RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args) | |
47 | ||
48 | /* tracing including the function name */ | |
49 | #define ARK_FUNC_OFF(level, fmt, args...) \ | |
50 | do { if (0) RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args); } \ | |
51 | while (0) | |
52 | ||
53 | ||
54 | /* Debug macro for tracing full behavior, function tracing and messages*/ | |
55 | #ifdef RTE_LIBRTE_ARK_DEBUG_TRACE | |
56 | #define PMD_FUNC_LOG(level, fmt, ...) ARK_FUNC_ON(level, fmt, ##__VA_ARGS__) | |
57 | #define PMD_DEBUG_LOG(level, fmt, ...) ARK_TRACE_ON(level, fmt, ##__VA_ARGS__) | |
58 | #else | |
59 | #define PMD_FUNC_LOG(level, fmt, ...) ARK_FUNC_OFF(level, fmt, ##__VA_ARGS__) | |
60 | #define PMD_DEBUG_LOG(level, fmt, ...) ARK_TRACE_OFF(level, fmt, ##__VA_ARGS__) | |
61 | #endif | |
62 | ||
63 | ||
64 | /* Debug macro for reporting FPGA statistics */ | |
65 | #ifdef RTE_LIBRTE_ARK_DEBUG_STATS | |
66 | #define PMD_STATS_LOG(level, fmt, ...) ARK_TRACE_ON(level, fmt, ##__VA_ARGS__) | |
67 | #else | |
68 | #define PMD_STATS_LOG(level, fmt, ...) ARK_TRACE_OFF(level, fmt, ##__VA_ARGS__) | |
69 | #endif | |
70 | ||
71 | ||
72 | /* Debug macro for RX path */ | |
73 | #ifdef RTE_LIBRTE_ARK_DEBUG_RX | |
74 | #define ARK_RX_DEBUG 1 | |
75 | #define PMD_RX_LOG(level, fmt, ...) ARK_TRACE_ON(level, fmt, ##__VA_ARGS__) | |
76 | #else | |
77 | #define ARK_RX_DEBUG 0 | |
78 | #define PMD_RX_LOG(level, fmt, ...) ARK_TRACE_OFF(level, fmt, ##__VA_ARGS__) | |
79 | #endif | |
80 | ||
81 | /* Debug macro for TX path */ | |
82 | #ifdef RTE_LIBRTE_ARK_DEBUG_TX | |
83 | #define ARK_TX_DEBUG 1 | |
84 | #define PMD_TX_LOG(level, fmt, ...) ARK_TRACE_ON(level, fmt, ##__VA_ARGS__) | |
85 | #else | |
86 | #define ARK_TX_DEBUG 0 | |
87 | #define PMD_TX_LOG(level, fmt, ...) ARK_TRACE_OFF(level, fmt, ##__VA_ARGS__) | |
88 | #endif | |
89 | ||
90 | #endif |