xref: /openbmc/qemu/hw/net/vmxnet_debug.h (revision f6476697)
1 /*
2  * QEMU VMWARE VMXNET* paravirtual NICs - debugging facilities
3  *
4  * Copyright (c) 2012 Ravello Systems LTD (http://ravellosystems.com)
5  *
6  * Developed by Daynix Computing LTD (http://www.daynix.com)
7  *
8  * Authors:
9  * Dmitry Fleytman <dmitry@daynix.com>
10  * Tamir Shomer <tamirs@daynix.com>
11  * Yan Vugenfirer <yan@daynix.com>
12  *
13  * This work is licensed under the terms of the GNU GPL, version 2 or later.
14  * See the COPYING file in the top-level directory.
15  *
16  */
17 
18 #ifndef QEMU_VMXNET_DEBUG_H
19 #define QEMU_VMXNET_DEBUG_H
20 
21 #define VMXNET_DEVICE_NAME "vmxnet3"
22 
23 #define VMXNET_DEBUG_WARNINGS
24 #define VMXNET_DEBUG_ERRORS
25 
26 #undef VMXNET_DEBUG_CB
27 #undef VMXNET_DEBUG_INTERRUPTS
28 #undef VMXNET_DEBUG_CONFIG
29 #undef VMXNET_DEBUG_RINGS
30 #undef VMXNET_DEBUG_PACKETS
31 #undef VMXNET_DEBUG_SHMEM_ACCESS
32 
33 #ifdef VMXNET_DEBUG_CB
34 #  define VMXNET_DEBUG_CB_ENABLED 1
35 #else
36 #  define VMXNET_DEBUG_CB_ENABLED 0
37 #endif
38 
39 #ifdef VMXNET_DEBUG_WARNINGS
40 #  define VMXNET_DEBUG_WARNINGS_ENABLED 1
41 #else
42 #  define VMXNET_DEBUG_WARNINGS_ENABLED 0
43 #endif
44 
45 #ifdef VMXNET_DEBUG_ERRORS
46 #  define VMXNET_DEBUG_ERRORS_ENABLED 1
47 #else
48 #  define VMXNET_DEBUG_ERRORS_ENABLED 0
49 #endif
50 
51 #ifdef VMXNET_DEBUG_CONFIG
52 #  define VMXNET_DEBUG_CONFIG_ENABLED 1
53 #else
54 #  define VMXNET_DEBUG_CONFIG_ENABLED 0
55 #endif
56 
57 #ifdef VMXNET_DEBUG_RINGS
58 #  define VMXNET_DEBUG_RINGS_ENABLED 1
59 #else
60 #  define VMXNET_DEBUG_RINGS_ENABLED 0
61 #endif
62 
63 #ifdef VMXNET_DEBUG_PACKETS
64 #  define VMXNET_DEBUG_PACKETS_ENABLED 1
65 #else
66 #  define VMXNET_DEBUG_PACKETS_ENABLED 0
67 #endif
68 
69 #ifdef VMXNET_DEBUG_INTERRUPTS
70 #  define VMXNET_DEBUG_INTERRUPTS_ENABLED 1
71 #else
72 #  define VMXNET_DEBUG_INTERRUPTS_ENABLED 0
73 #endif
74 
75 #ifdef VMXNET_DEBUG_SHMEM_ACCESS
76 #  define VMXNET_DEBUG_SHMEM_ACCESS_ENABLED 1
77 #else
78 #  define VMXNET_DEBUG_SHMEM_ACCESS_ENABLED 0
79 #endif
80 
81 #define VMW_SHPRN(fmt, ...)                                                   \
82     do {                                                                      \
83         if (VMXNET_DEBUG_SHMEM_ACCESS_ENABLED) {                              \
84             printf("[%s][SH][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
85                 ## __VA_ARGS__);                                              \
86        }                                                                      \
87     } while (0)
88 
89 #define VMW_CBPRN(fmt, ...)                                                   \
90     do {                                                                      \
91         if (VMXNET_DEBUG_CB_ENABLED) {                                        \
92             printf("[%s][CB][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
93                 ## __VA_ARGS__);                                              \
94         }                                                                     \
95     } while (0)
96 
97 #define VMW_PKPRN(fmt, ...)                                                   \
98     do {                                                                      \
99         if (VMXNET_DEBUG_PACKETS_ENABLED) {                                   \
100             printf("[%s][PK][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
101                 ## __VA_ARGS__);                                              \
102         }                                                                     \
103     } while (0)
104 
105 #define VMW_WRPRN(fmt, ...)                                                   \
106     do {                                                                      \
107         if (VMXNET_DEBUG_WARNINGS_ENABLED) {                                  \
108             printf("[%s][WR][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
109                 ## __VA_ARGS__);                                              \
110         }                                                                     \
111     } while (0)
112 
113 #define VMW_ERPRN(fmt, ...)                                                   \
114     do {                                                                      \
115         if (VMXNET_DEBUG_ERRORS_ENABLED) {                                    \
116             printf("[%s][ER][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
117                 ## __VA_ARGS__);                                              \
118         }                                                                     \
119     } while (0)
120 
121 #define VMW_IRPRN(fmt, ...)                                                   \
122     do {                                                                      \
123         if (VMXNET_DEBUG_INTERRUPTS_ENABLED) {                                \
124             printf("[%s][IR][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
125                 ## __VA_ARGS__);                                              \
126         }                                                                     \
127     } while (0)
128 
129 #define VMW_CFPRN(fmt, ...)                                                   \
130     do {                                                                      \
131         if (VMXNET_DEBUG_CONFIG_ENABLED) {                                    \
132             printf("[%s][CF][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
133                 ## __VA_ARGS__);                                              \
134         }                                                                     \
135     } while (0)
136 
137 #define VMW_RIPRN(fmt, ...)                                                   \
138     do {                                                                      \
139         if (VMXNET_DEBUG_RINGS_ENABLED) {                                     \
140             printf("[%s][RI][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
141                 ## __VA_ARGS__);                                              \
142         }                                                                     \
143     } while (0)
144 
145 #endif /* QEMU_VMXNET_DEBUG_H */
146