4 * Copyright (c) 2015-2017 Atomic Rules LLC
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of copyright holder nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 /* Configuration option to pad TX packets to 60 bytes */
42 #ifdef RTE_LIBRTE_ARK_PAD_TX
43 #define ARK_TX_PAD_TO_60 1
45 #define ARK_TX_PAD_TO_60 0
48 /* system camel case definition changed to upper case */
52 /* Format specifiers for string data pairs */
53 #define ARK_SU32 "\n\t%-20s %'20" PRIU32
54 #define ARK_SU64 "\n\t%-20s %'20" PRIU64
55 #define ARK_SU64X "\n\t%-20s %#20" PRIx64
56 #define ARK_SPTR "\n\t%-20s %20p"
60 #define PMD_DRV_LOG(level, fmt, args...) \
61 RTE_LOG(level, PMD, fmt, ## args)
63 /* Conditional trace definitions */
64 #define ARK_TRACE_ON(level, fmt, ...) \
65 RTE_LOG(level, PMD, fmt, ##__VA_ARGS__)
67 /* This pattern allows compiler check arguments even if disabled */
68 #define ARK_TRACE_OFF(level, fmt, ...) \
69 do {if (0) RTE_LOG(level, PMD, fmt, ##__VA_ARGS__); } \
73 /* tracing including the function name */
74 #define ARK_FUNC_ON(level, fmt, args...) \
75 RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
77 /* tracing including the function name */
78 #define ARK_FUNC_OFF(level, fmt, args...) \
79 do { if (0) RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args); } \
83 /* Debug macro for tracing full behavior, function tracing and messages*/
84 #ifdef RTE_LIBRTE_ARK_DEBUG_TRACE
85 #define PMD_FUNC_LOG(level, fmt, ...) ARK_FUNC_ON(level, fmt, ##__VA_ARGS__)
86 #define PMD_DEBUG_LOG(level, fmt, ...) ARK_TRACE_ON(level, fmt, ##__VA_ARGS__)
88 #define PMD_FUNC_LOG(level, fmt, ...) ARK_FUNC_OFF(level, fmt, ##__VA_ARGS__)
89 #define PMD_DEBUG_LOG(level, fmt, ...) ARK_TRACE_OFF(level, fmt, ##__VA_ARGS__)
93 /* Debug macro for reporting FPGA statistics */
94 #ifdef RTE_LIBRTE_ARK_DEBUG_STATS
95 #define PMD_STATS_LOG(level, fmt, ...) ARK_TRACE_ON(level, fmt, ##__VA_ARGS__)
97 #define PMD_STATS_LOG(level, fmt, ...) ARK_TRACE_OFF(level, fmt, ##__VA_ARGS__)
101 /* Debug macro for RX path */
102 #ifdef RTE_LIBRTE_ARK_DEBUG_RX
103 #define ARK_RX_DEBUG 1
104 #define PMD_RX_LOG(level, fmt, ...) ARK_TRACE_ON(level, fmt, ##__VA_ARGS__)
106 #define ARK_RX_DEBUG 0
107 #define PMD_RX_LOG(level, fmt, ...) ARK_TRACE_OFF(level, fmt, ##__VA_ARGS__)
110 /* Debug macro for TX path */
111 #ifdef RTE_LIBRTE_ARK_DEBUG_TX
112 #define ARK_TX_DEBUG 1
113 #define PMD_TX_LOG(level, fmt, ...) ARK_TRACE_ON(level, fmt, ##__VA_ARGS__)
115 #define ARK_TX_DEBUG 0
116 #define PMD_TX_LOG(level, fmt, ...) ARK_TRACE_OFF(level, fmt, ##__VA_ARGS__)