]>
git.proxmox.com Git - mirror_ovs.git/blob - lib/ovs-numa.h
2 * Copyright (c) 2014 Nicira, Inc.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
24 #include "openvswitch/hmap.h"
26 #define OVS_CORE_UNSPEC INT_MAX
27 #define OVS_NUMA_UNSPEC INT_MAX
29 /* Dump of a list of 'struct ovs_numa_info'. */
30 struct ovs_numa_dump
{
35 /* A numa_id - core_id pair. */
36 struct ovs_numa_info_core
{
37 struct hmap_node hmap_node
;
43 struct ovs_numa_info_numa
{
44 struct hmap_node hmap_node
;
49 void ovs_numa_init(void);
50 void ovs_numa_set_dummy(const char *config
);
51 bool ovs_numa_numa_id_is_valid(int numa_id
);
52 bool ovs_numa_core_id_is_valid(unsigned core_id
);
53 int ovs_numa_get_n_numas(void);
54 int ovs_numa_get_n_cores(void);
55 int ovs_numa_get_numa_id(unsigned core_id
);
56 int ovs_numa_get_n_cores_on_numa(int numa_id
);
57 struct ovs_numa_dump
*ovs_numa_dump_cores_on_numa(int numa_id
);
58 struct ovs_numa_dump
*ovs_numa_dump_cores_with_cmask(const char *cmask
);
59 struct ovs_numa_dump
*ovs_numa_dump_n_cores_per_numa(int n
);
60 bool ovs_numa_dump_contains_core(const struct ovs_numa_dump
*,
61 int numa_id
, unsigned core_id
);
62 size_t ovs_numa_dump_count(const struct ovs_numa_dump
*);
63 struct ovs_numa_dump
* ovs_numa_thread_getaffinity_dump(void);
64 int ovs_numa_thread_setaffinity_dump(const struct ovs_numa_dump
*);
65 void ovs_numa_dump_destroy(struct ovs_numa_dump
*);
66 int ovs_numa_thread_setaffinity_core(unsigned core_id
);
68 #define FOR_EACH_CORE_ON_DUMP(ITER, DUMP) \
69 HMAP_FOR_EACH((ITER), hmap_node, &(DUMP)->cores)
71 #define FOR_EACH_NUMA_ON_DUMP(ITER, DUMP) \
72 HMAP_FOR_EACH((ITER), hmap_node, &(DUMP)->numas)
74 #endif /* ovs-numa.h */