]> git.proxmox.com Git - ovs.git/blame - lib/ovs-numa.h
datapath-windows: Avoid BSOD when switch context is NULL
[ovs.git] / lib / ovs-numa.h
CommitLineData
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
30void ovs_numa_init(void);
012c0a04
AW
31bool ovs_numa_numa_id_is_valid(int numa_id);
32bool ovs_numa_core_id_is_valid(int core_id);
33int ovs_numa_get_n_numas(void);
8db2f898 34void ovs_numa_set_cpu_mask(const char *cmask);
7c5a3bbf 35int ovs_numa_get_n_cores(void);
6b1105fb 36int ovs_numa_get_numa_id(int core_id);
012c0a04
AW
37int ovs_numa_get_n_cores_on_numa(int numa_id);
38int ovs_numa_get_n_unpinned_cores_on_numa(int numa_id);
7c5a3bbf
AW
39bool ovs_numa_try_pin_core_specific(int core_id);
40int ovs_numa_get_unpinned_core_any(void);
012c0a04 41int ovs_numa_get_unpinned_core_on_numa(int numa_id);
7c5a3bbf
AW
42void ovs_numa_unpin_core(int core_id);
43
44#else
45
46static inline void
47ovs_numa_init(void)
48{
49 /* Nothing */
50}
51
52static inline bool
012c0a04 53ovs_numa_numa_id_is_valid(int numa_id OVS_UNUSED)
7c5a3bbf
AW
54{
55 return false;
56}
57
58static inline bool
012c0a04 59ovs_numa_core_id_is_valid(int core_id OVS_UNUSED)
7c5a3bbf
AW
60{
61 return false;
62}
63
8db2f898
AW
64static inline void
65ovs_numa_set_cpu_mask(const char *cmask OVS_UNUSED)
66{
67 /* Nothing */
68}
69
7c5a3bbf 70static inline int
012c0a04 71ovs_numa_get_n_numas(void)
7c5a3bbf 72{
012c0a04 73 return OVS_NUMA_UNSPEC;
7c5a3bbf
AW
74}
75
76static inline int
77ovs_numa_get_n_cores(void)
78{
79 return OVS_CORE_UNSPEC;
80}
81
6b1105fb
AW
82static inline int
83ovs_numa_get_numa_id(int core_id OVS_UNUSED)
84{
85 return OVS_NUMA_UNSPEC;
86}
87
7c5a3bbf 88static inline int
012c0a04 89ovs_numa_get_n_cores_on_numa(int numa_id OVS_UNUSED)
7c5a3bbf
AW
90{
91 return OVS_CORE_UNSPEC;
92}
93
94static inline int
012c0a04 95ovs_numa_get_n_unpinned_cores_on_numa(int numa_id OVS_UNUSED)
7c5a3bbf
AW
96{
97 return OVS_CORE_UNSPEC;
98}
99
100static inline bool
101ovs_numa_try_pin_core_specific(int core_id OVS_UNUSED)
102{
103 return false;
104}
105
106static inline int
107ovs_numa_get_unpinned_core_any(void)
108{
109 return OVS_CORE_UNSPEC;
110}
111
112static inline int
012c0a04 113ovs_numa_get_unpinned_core_on_numa(int numa_id OVS_UNUSED)
7c5a3bbf
AW
114{
115 return OVS_CORE_UNSPEC;
116}
117
118static inline void
119ovs_numa_unpin_core(int core_id OVS_UNUSED)
120{
121 /* Nothing */
122}
123
124#endif /* __linux__ */
125#endif /* ovs-thead.h */