]> git.proxmox.com Git - mirror_ovs.git/blob - datapath-windows/ovsext/Debug.h
935f8584a8324c0bc0d6eef6b328be6b93d0139b
[mirror_ovs.git] / datapath-windows / ovsext / Debug.h
1 /*
2 * Copyright (c) 2014 VMware, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef __DEBUG_H_
18 #define __DEBUG_H_ 1
19
20 #define OVS_DBG_INIT BIT32(0)
21 #define OVS_DBG_SWITCH BIT32(1)
22 #define OVS_DBG_VPORT BIT32(2)
23 #define OVS_DBG_FLOW BIT32(3)
24 #define OVS_DBG_QOS BIT32(4)
25 #define OVS_DBG_USER BIT32(5)
26 #define OVS_DBG_EXECUTE BIT32(6)
27 #define OVS_DBG_EVENT BIT32(7)
28 #define OVS_DBG_DISPATCH BIT32(8)
29 #define OVS_DBG_OID BIT32(9)
30 #define OVS_DBG_STATUS BIT32(10)
31 #define OVS_DBG_CHECKSUM BIT32(11)
32 #define OVS_DBG_VXLAN BIT32(12)
33 #define OVS_DBG_GRE BIT32(13)
34 #define OVS_DBG_ACTION BIT32(14)
35 #define OVS_DBG_DATAPATH BIT32(15)
36 #define OVS_DBG_PROPERTY BIT32(16)
37 #define OVS_DBG_IPHELPER BIT32(17)
38 #define OVS_DBG_BUFMGMT BIT32(18)
39 #define OVS_DBG_OTHERS BIT32(19)
40 #define OVS_DBG_NETLINK BIT32(20)
41 #define OVS_DBG_TUNFLT BIT32(21)
42 #define OVS_DBG_STT BIT32(22)
43 #define OVS_DBG_CONTRK BIT32(23)
44 #define OVS_DBG_GENEVE BIT32(24)
45
46 #define OVS_DBG_RESERVED BIT32(31)
47 //Please add above OVS_DBG_RESERVED.
48
49 #define OVS_DBG_ERROR DPFLTR_ERROR_LEVEL
50 #define OVS_DBG_WARN DPFLTR_WARNING_LEVEL
51 #define OVS_DBG_TRACE DPFLTR_TRACE_LEVEL
52 #define OVS_DBG_INFO DPFLTR_INFO_LEVEL
53 #define OVS_DBG_LOUD (DPFLTR_INFO_LEVEL + 1)
54
55
56
57 VOID OvsLog(UINT32 level, UINT32 flag, CHAR *funcName,
58 UINT32 line, CHAR *format, ...);
59
60
61 #define OVS_LOG_LOUD(_format, ...) \
62 OvsLog(OVS_DBG_LOUD, OVS_DBG_MOD, __FUNCTION__, __LINE__, _format, __VA_ARGS__)
63
64 #define OVS_LOG_INFO(_format, ...) \
65 OvsLog(OVS_DBG_INFO, OVS_DBG_MOD, __FUNCTION__, __LINE__, _format, __VA_ARGS__)
66
67 #define OVS_LOG_TRACE(_format, ...) \
68 OvsLog(OVS_DBG_TRACE, OVS_DBG_MOD, __FUNCTION__, __LINE__, _format, __VA_ARGS__)
69
70 #define OVS_LOG_ERROR(_format, ...) \
71 OvsLog(OVS_DBG_ERROR, OVS_DBG_MOD, __FUNCTION__, __LINE__, _format, __VA_ARGS__)
72
73 #define OVS_LOG_WARN(_format, ...) \
74 OvsLog(OVS_DBG_WARN, OVS_DBG_MOD, __FUNCTION__, __LINE__, _format, __VA_ARGS__)
75
76 #if DBG
77 #define OVS_VERIFY_IRQL(_x) \
78 if (KeGetCurrentIrql() != (KIRQL)_x) { \
79 OVS_LOG_WARN("expected IRQL %u, actual IRQL: %u", \
80 _x, KeGetCurrentIrql()); \
81 }
82
83 #define OVS_VERIFY_IRQL_LE(_x) \
84 if (KeGetCurrentIrql() > (KIRQL)_x) { \
85 OVS_LOG_WARN("expected IRQL <= %u, actual IRQL: %u", \
86 _x, KeGetCurrentIrql()); \
87 }
88
89 #else
90 #define OVS_VERIFY_IRQL(_x)
91 #define OVS_VERIFY_IRQL_LE(_x)
92 #endif
93
94 #endif /* __DEBUG_H_ */