xref: /openbmc/qemu/hw/net/vmxnet_debug.h (revision e2d05011)
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_CB */
24 #define VMXNET_DEBUG_WARNINGS
25 #define VMXNET_DEBUG_ERRORS
26 /* #define VMXNET_DEBUG_INTERRUPTS */
27 /* #define VMXNET_DEBUG_CONFIG */
28 /* #define VMXNET_DEBUG_RINGS */
29 /* #define VMXNET_DEBUG_PACKETS */
30 /* #define VMXNET_DEBUG_SHMEM_ACCESS */
31 
32 #ifdef VMXNET_DEBUG_SHMEM_ACCESS
33 #define VMW_SHPRN(fmt, ...)                                                   \
34     do {                                                                      \
35         printf("[%s][SH][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,       \
36             ## __VA_ARGS__);                                                  \
37     } while (0)
38 #else
39 #define VMW_SHPRN(fmt, ...) do {} while (0)
40 #endif
41 
42 #ifdef VMXNET_DEBUG_CB
43 #define VMW_CBPRN(fmt, ...)                                                   \
44     do {                                                                      \
45         printf("[%s][CB][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,       \
46             ## __VA_ARGS__);                                                  \
47     } while (0)
48 #else
49 #define VMW_CBPRN(fmt, ...) do {} while (0)
50 #endif
51 
52 #ifdef VMXNET_DEBUG_PACKETS
53 #define VMW_PKPRN(fmt, ...)                                                   \
54     do {                                                                      \
55         printf("[%s][PK][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,       \
56             ## __VA_ARGS__);                                                  \
57     } while (0)
58 #else
59 #define VMW_PKPRN(fmt, ...) do {} while (0)
60 #endif
61 
62 #ifdef VMXNET_DEBUG_WARNINGS
63 #define VMW_WRPRN(fmt, ...)                                                   \
64     do {                                                                      \
65         printf("[%s][WR][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,       \
66             ## __VA_ARGS__);                                                  \
67     } while (0)
68 #else
69 #define VMW_WRPRN(fmt, ...) do {} while (0)
70 #endif
71 
72 #ifdef VMXNET_DEBUG_ERRORS
73 #define VMW_ERPRN(fmt, ...)                                                   \
74     do {                                                                      \
75         printf("[%s][ER][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,       \
76             ## __VA_ARGS__);                                                  \
77     } while (0)
78 #else
79 #define VMW_ERPRN(fmt, ...) do {} while (0)
80 #endif
81 
82 #ifdef VMXNET_DEBUG_INTERRUPTS
83 #define VMW_IRPRN(fmt, ...)                                                   \
84     do {                                                                      \
85         printf("[%s][IR][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,       \
86             ## __VA_ARGS__);                                                  \
87     } while (0)
88 #else
89 #define VMW_IRPRN(fmt, ...) do {} while (0)
90 #endif
91 
92 #ifdef VMXNET_DEBUG_CONFIG
93 #define VMW_CFPRN(fmt, ...)                                                   \
94     do {                                                                      \
95         printf("[%s][CF][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,       \
96             ## __VA_ARGS__);                                                  \
97     } while (0)
98 #else
99 #define VMW_CFPRN(fmt, ...) do {} while (0)
100 #endif
101 
102 #ifdef VMXNET_DEBUG_RINGS
103 #define VMW_RIPRN(fmt, ...)                                                   \
104     do {                                                                      \
105         printf("[%s][RI][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,       \
106             ## __VA_ARGS__);                                                  \
107     } while (0)
108 #else
109 #define VMW_RIPRN(fmt, ...) do {} while (0)
110 #endif
111 
112 #define VMXNET_MF       "%02X:%02X:%02X:%02X:%02X:%02X"
113 #define VMXNET_MA(a)    (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
114 
115 #endif /* _QEMU_VMXNET3_DEBUG_H  */
116