]> git.proxmox.com Git - ceph.git/blob - ceph/src/seastar/dpdk/lib/librte_eal/common/eal_thread.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / seastar / dpdk / lib / librte_eal / common / eal_thread.h
1 /*-
2 * BSD LICENSE
3 *
4 * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
16 * distribution.
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef EAL_THREAD_H
35 #define EAL_THREAD_H
36
37 #include <rte_lcore.h>
38
39 /**
40 * basic loop of thread, called for each thread by eal_init().
41 *
42 * @param arg
43 * opaque pointer
44 */
45 __attribute__((noreturn)) void *eal_thread_loop(void *arg);
46
47 /**
48 * Init per-lcore info for master thread
49 *
50 * @param lcore_id
51 * identifier of master lcore
52 */
53 void eal_thread_init_master(unsigned lcore_id);
54
55 /**
56 * Get the NUMA socket id from cpu id.
57 * This function is private to EAL.
58 *
59 * @param cpu_id
60 * The logical process id.
61 * @return
62 * socket_id or SOCKET_ID_ANY
63 */
64 unsigned eal_cpu_socket_id(unsigned cpu_id);
65
66 /**
67 * Get the NUMA socket id from cpuset.
68 * This function is private to EAL.
69 *
70 * @param cpusetp
71 * The point to a valid cpu set.
72 * @return
73 * socket_id or SOCKET_ID_ANY
74 */
75 int eal_cpuset_socket_id(rte_cpuset_t *cpusetp);
76
77 /**
78 * Default buffer size to use with eal_thread_dump_affinity()
79 */
80 #define RTE_CPU_AFFINITY_STR_LEN 256
81
82 /**
83 * Dump the current pthread cpuset.
84 * This function is private to EAL.
85 *
86 * Note:
87 * If the dump size is greater than the size of given buffer,
88 * the string will be truncated and with '\0' at the end.
89 *
90 * @param str
91 * The string buffer the cpuset will dump to.
92 * @param size
93 * The string buffer size.
94 * @return
95 * 0 for success, -1 if truncation happens.
96 */
97 int
98 eal_thread_dump_affinity(char *str, unsigned size);
99
100 #endif /* EAL_THREAD_H */