summaryrefslogtreecommitdiffstats
path: root/hw/net/vmxnet_debug.h
blob: cb50aa95dbeb5683d8420b59907afc212db7c89f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
 * QEMU VMWARE VMXNET* paravirtual NICs - debugging facilities
 *
 * Copyright (c) 2012 Ravello Systems LTD (http://ravellosystems.com)
 *
 * Developed by Daynix Computing LTD (http://www.daynix.com)
 *
 * Authors:
 * Dmitry Fleytman <dmitry@daynix.com>
 * Tamir Shomer <tamirs@daynix.com>
 * Yan Vugenfirer <yan@daynix.com>
 *
 * This work is licensed under the terms of the GNU GPL, version 2 or later.
 * See the COPYING file in the top-level directory.
 *
 */

#ifndef QEMU_VMXNET_DEBUG_H
#define QEMU_VMXNET_DEBUG_H

#define VMXNET_DEVICE_NAME "vmxnet3"

#define VMXNET_DEBUG_WARNINGS
#define VMXNET_DEBUG_ERRORS

#undef VMXNET_DEBUG_CB
#undef VMXNET_DEBUG_INTERRUPTS
#undef VMXNET_DEBUG_CONFIG
#undef VMXNET_DEBUG_RINGS
#undef VMXNET_DEBUG_PACKETS
#undef VMXNET_DEBUG_SHMEM_ACCESS

#ifdef VMXNET_DEBUG_CB
#  define VMXNET_DEBUG_CB_ENABLED 1
#else
#  define VMXNET_DEBUG_CB_ENABLED 0
#endif

#ifdef VMXNET_DEBUG_WARNINGS
#  define VMXNET_DEBUG_WARNINGS_ENABLED 1
#else
#  define VMXNET_DEBUG_WARNINGS_ENABLED 0
#endif

#ifdef VMXNET_DEBUG_ERRORS
#  define VMXNET_DEBUG_ERRORS_ENABLED 1
#else
#  define VMXNET_DEBUG_ERRORS_ENABLED 0
#endif

#ifdef VMXNET_DEBUG_CONFIG
#  define VMXNET_DEBUG_CONFIG_ENABLED 1
#else
#  define VMXNET_DEBUG_CONFIG_ENABLED 0
#endif

#ifdef VMXNET_DEBUG_RINGS
#  define VMXNET_DEBUG_RINGS_ENABLED 1
#else
#  define VMXNET_DEBUG_RINGS_ENABLED 0
#endif

#ifdef VMXNET_DEBUG_PACKETS
#  define VMXNET_DEBUG_PACKETS_ENABLED 1
#else
#  define VMXNET_DEBUG_PACKETS_ENABLED 0
#endif

#ifdef VMXNET_DEBUG_INTERRUPTS
#  define VMXNET_DEBUG_INTERRUPTS_ENABLED 1
#else
#  define VMXNET_DEBUG_INTERRUPTS_ENABLED 0
#endif

#ifdef VMXNET_DEBUG_SHMEM_ACCESS
#  define VMXNET_DEBUG_SHMEM_ACCESS_ENABLED 1
#else
#  define VMXNET_DEBUG_SHMEM_ACCESS_ENABLED 0
#endif

#define VMW_SHPRN(fmt, ...)                                                   \
    do {                                                                      \
        if (VMXNET_DEBUG_SHMEM_ACCESS_ENABLED) {                              \
            printf("[%s][SH][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
                ## __VA_ARGS__);                                              \
       }                                                                      \
    } while (0)

#define VMW_CBPRN(fmt, ...)                                                   \
    do {                                                                      \
        if (VMXNET_DEBUG_CB_ENABLED) {                                        \
            printf("[%s][CB][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
                ## __VA_ARGS__);                                              \
        }                                                                     \
    } while (0)

#define VMW_PKPRN(fmt, ...)                                                   \
    do {                                                                      \
        if (VMXNET_DEBUG_PACKETS_ENABLED) {                                   \
            printf("[%s][PK][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
                ## __VA_ARGS__);                                              \
        }                                                                     \
    } while (0)

#define VMW_WRPRN(fmt, ...)                                                   \
    do {                                                                      \
        if (VMXNET_DEBUG_WARNINGS_ENABLED) {                                  \
            printf("[%s][WR][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
                ## __VA_ARGS__);                                              \
        }                                                                     \
    } while (0)

#define VMW_ERPRN(fmt, ...)                                                   \
    do {                                                                      \
        if (VMXNET_DEBUG_ERRORS_ENABLED) {                                    \
            printf("[%s][ER][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
                ## __VA_ARGS__);                                              \
        }                                                                     \
    } while (0)

#define VMW_IRPRN(fmt, ...)                                                   \
    do {                                                                      \
        if (VMXNET_DEBUG_INTERRUPTS_ENABLED) {                                \
            printf("[%s][IR][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
                ## __VA_ARGS__);                                              \
        }                                                                     \
    } while (0)

#define VMW_CFPRN(fmt, ...)                                                   \
    do {                                                                      \
        if (VMXNET_DEBUG_CONFIG_ENABLED) {                                    \
            printf("[%s][CF][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
                ## __VA_ARGS__);                                              \
        }                                                                     \
    } while (0)

#define VMW_RIPRN(fmt, ...)                                                   \
    do {                                                                      \
        if (VMXNET_DEBUG_RINGS_ENABLED) {                                     \
            printf("[%s][RI][%s]: " fmt "\n", VMXNET_DEVICE_NAME, __func__,   \
                ## __VA_ARGS__);                                              \
        }                                                                     \
    } while (0)

#endif /* QEMU_VMXNET_DEBUG_H */