]> git.proxmox.com Git - mirror_ovs.git/blame - lib/ovs-numa.h
cccl: Ability to enable compiler optimization.
[mirror_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
26#define OVS_SOCKET_UNSPEC INT_MAX
27
28#ifdef __linux__
29
30void ovs_numa_init(void);
31bool ovs_numa_cpu_socket_id_is_valid(int sid);
32bool ovs_numa_cpu_core_id_is_valid(int cid);
33int ovs_numa_get_n_sockets(void);
34int ovs_numa_get_n_cores(void);
35int ovs_numa_get_n_cores_on_socket(int socket_id);
36int ovs_numa_get_n_unpinned_cores_on_socket(int socket_id);
37bool ovs_numa_try_pin_core_specific(int core_id);
38int ovs_numa_get_unpinned_core_any(void);
39int ovs_numa_get_unpinned_core_on_socket(int socket_id);
40void ovs_numa_unpin_core(int core_id);
41
42#else
43
44static inline void
45ovs_numa_init(void)
46{
47 /* Nothing */
48}
49
50static inline bool
51ovs_numa_cpu_socket_id_is_valid(int sid OVS_UNUSED)
52{
53 return false;
54}
55
56static inline bool
57ovs_numa_cpu_core_id_is_valid(int cid OVS_UNUSED)
58{
59 return false;
60}
61
62static inline int
63ovs_numa_get_n_sockets(void)
64{
65 return OVS_SOCKET_UNSPEC;
66}
67
68static inline int
69ovs_numa_get_n_cores(void)
70{
71 return OVS_CORE_UNSPEC;
72}
73
74static inline int
75ovs_numa_get_n_cores_on_socket(int socket_id OVS_UNUSED)
76{
77 return OVS_CORE_UNSPEC;
78}
79
80static inline int
81ovs_numa_get_n_unpinned_cores_on_socket(int socket_id OVS_UNUSED)
82{
83 return OVS_CORE_UNSPEC;
84}
85
86static inline bool
87ovs_numa_try_pin_core_specific(int core_id OVS_UNUSED)
88{
89 return false;
90}
91
92static inline int
93ovs_numa_get_unpinned_core_any(void)
94{
95 return OVS_CORE_UNSPEC;
96}
97
98static inline int
99ovs_numa_get_unpinned_core_on_socket(int socket_id OVS_UNUSED)
100{
101 return OVS_CORE_UNSPEC;
102}
103
104static inline void
105ovs_numa_unpin_core(int core_id OVS_UNUSED)
106{
107 /* Nothing */
108}
109
110#endif /* __linux__ */
111#endif /* ovs-thead.h */