datapath-windows: Remove the old IOCTL vport functions.
[cascardo/ovs.git] / lib / ovs-numa.h
1 /*
2  * Copyright (c) 2014 Nicira, 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 OVS_NUMA_H
18 #define OVS_NUMA_H 1
19
20 #include <limits.h>
21 #include <stdbool.h>
22
23 #include "compiler.h"
24
25 #define OVS_CORE_UNSPEC INT_MAX
26 #define OVS_NUMA_UNSPEC INT_MAX
27
28 #ifdef __linux__
29
30 void ovs_numa_init(void);
31 bool ovs_numa_numa_id_is_valid(int numa_id);
32 bool ovs_numa_core_id_is_valid(int core_id);
33 int ovs_numa_get_n_numas(void);
34 void ovs_numa_set_cpu_mask(const char *cmask);
35 int ovs_numa_get_n_cores(void);
36 int ovs_numa_get_numa_id(int core_id);
37 int ovs_numa_get_n_cores_on_numa(int numa_id);
38 int ovs_numa_get_n_unpinned_cores_on_numa(int numa_id);
39 bool ovs_numa_try_pin_core_specific(int core_id);
40 int ovs_numa_get_unpinned_core_any(void);
41 int ovs_numa_get_unpinned_core_on_numa(int numa_id);
42 void ovs_numa_unpin_core(int core_id);
43
44 #else
45
46 static inline void
47 ovs_numa_init(void)
48 {
49     /* Nothing */
50 }
51
52 static inline bool
53 ovs_numa_numa_id_is_valid(int numa_id OVS_UNUSED)
54 {
55     return false;
56 }
57
58 static inline bool
59 ovs_numa_core_id_is_valid(int core_id OVS_UNUSED)
60 {
61     return false;
62 }
63
64 static inline void
65 ovs_numa_set_cpu_mask(const char *cmask OVS_UNUSED)
66 {
67     /* Nothing */
68 }
69
70 static inline int
71 ovs_numa_get_n_numas(void)
72 {
73     return OVS_NUMA_UNSPEC;
74 }
75
76 static inline int
77 ovs_numa_get_n_cores(void)
78 {
79     return OVS_CORE_UNSPEC;
80 }
81
82 static inline int
83 ovs_numa_get_numa_id(int core_id OVS_UNUSED)
84 {
85     return OVS_NUMA_UNSPEC;
86 }
87
88 static inline int
89 ovs_numa_get_n_cores_on_numa(int numa_id OVS_UNUSED)
90 {
91     return OVS_CORE_UNSPEC;
92 }
93
94 static inline int
95 ovs_numa_get_n_unpinned_cores_on_numa(int numa_id OVS_UNUSED)
96 {
97     return OVS_CORE_UNSPEC;
98 }
99
100 static inline bool
101 ovs_numa_try_pin_core_specific(int core_id OVS_UNUSED)
102 {
103     return false;
104 }
105
106 static inline int
107 ovs_numa_get_unpinned_core_any(void)
108 {
109     return OVS_CORE_UNSPEC;
110 }
111
112 static inline int
113 ovs_numa_get_unpinned_core_on_numa(int numa_id OVS_UNUSED)
114 {
115     return OVS_CORE_UNSPEC;
116 }
117
118 static inline void
119 ovs_numa_unpin_core(int core_id OVS_UNUSED)
120 {
121     /* Nothing */
122 }
123
124 #endif /* __linux__ */
125 #endif /* ovs-thead.h */