]>
Commit | Line | Data |
---|---|---|
7c5a3bbf AW |
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 | |
012c0a04 | 26 | #define OVS_NUMA_UNSPEC INT_MAX |
7c5a3bbf AW |
27 | |
28 | #ifdef __linux__ | |
29 | ||
30 | void ovs_numa_init(void); | |
012c0a04 AW |
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); | |
8db2f898 | 34 | void ovs_numa_set_cpu_mask(const char *cmask); |
7c5a3bbf | 35 | int ovs_numa_get_n_cores(void); |
6b1105fb | 36 | int ovs_numa_get_numa_id(int core_id); |
012c0a04 AW |
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); | |
7c5a3bbf AW |
39 | bool ovs_numa_try_pin_core_specific(int core_id); |
40 | int ovs_numa_get_unpinned_core_any(void); | |
012c0a04 | 41 | int ovs_numa_get_unpinned_core_on_numa(int numa_id); |
7c5a3bbf AW |
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 | |
012c0a04 | 53 | ovs_numa_numa_id_is_valid(int numa_id OVS_UNUSED) |
7c5a3bbf AW |
54 | { |
55 | return false; | |
56 | } | |
57 | ||
58 | static inline bool | |
012c0a04 | 59 | ovs_numa_core_id_is_valid(int core_id OVS_UNUSED) |
7c5a3bbf AW |
60 | { |
61 | return false; | |
62 | } | |
63 | ||
8db2f898 AW |
64 | static inline void |
65 | ovs_numa_set_cpu_mask(const char *cmask OVS_UNUSED) | |
66 | { | |
67 | /* Nothing */ | |
68 | } | |
69 | ||
7c5a3bbf | 70 | static inline int |
012c0a04 | 71 | ovs_numa_get_n_numas(void) |
7c5a3bbf | 72 | { |
012c0a04 | 73 | return OVS_NUMA_UNSPEC; |
7c5a3bbf AW |
74 | } |
75 | ||
76 | static inline int | |
77 | ovs_numa_get_n_cores(void) | |
78 | { | |
79 | return OVS_CORE_UNSPEC; | |
80 | } | |
81 | ||
6b1105fb AW |
82 | static inline int |
83 | ovs_numa_get_numa_id(int core_id OVS_UNUSED) | |
84 | { | |
85 | return OVS_NUMA_UNSPEC; | |
86 | } | |
87 | ||
7c5a3bbf | 88 | static inline int |
012c0a04 | 89 | ovs_numa_get_n_cores_on_numa(int numa_id OVS_UNUSED) |
7c5a3bbf AW |
90 | { |
91 | return OVS_CORE_UNSPEC; | |
92 | } | |
93 | ||
94 | static inline int | |
012c0a04 | 95 | ovs_numa_get_n_unpinned_cores_on_numa(int numa_id OVS_UNUSED) |
7c5a3bbf AW |
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 | |
012c0a04 | 113 | ovs_numa_get_unpinned_core_on_numa(int numa_id OVS_UNUSED) |
7c5a3bbf AW |
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 */ |