1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36#define DEBUG_SUBSYSTEM S_LNET
37
38#include "../../include/linux/libcfs/libcfs.h"
39
40
41struct cfs_cpt_table *cfs_cpt_table __read_mostly = NULL;
42EXPORT_SYMBOL(cfs_cpt_table);
43
44#ifndef HAVE_LIBCFS_CPT
45
46#define CFS_CPU_VERSION_MAGIC 0xbabecafe
47
48struct cfs_cpt_table *
49cfs_cpt_table_alloc(unsigned int ncpt)
50{
51 struct cfs_cpt_table *cptab;
52
53 if (ncpt != 1) {
54 CERROR("Can't support cpu partition number %d\n", ncpt);
55 return NULL;
56 }
57
58 LIBCFS_ALLOC(cptab, sizeof(*cptab));
59 if (cptab != NULL) {
60 cptab->ctb_version = CFS_CPU_VERSION_MAGIC;
61 cptab->ctb_nparts = ncpt;
62 }
63
64 return cptab;
65}
66EXPORT_SYMBOL(cfs_cpt_table_alloc);
67
68void
69cfs_cpt_table_free(struct cfs_cpt_table *cptab)
70{
71 LASSERT(cptab->ctb_version == CFS_CPU_VERSION_MAGIC);
72
73 LIBCFS_FREE(cptab, sizeof(*cptab));
74}
75EXPORT_SYMBOL(cfs_cpt_table_free);
76
77#ifdef CONFIG_SMP
78int
79cfs_cpt_table_print(struct cfs_cpt_table *cptab, char *buf, int len)
80{
81 int rc = 0;
82
83 rc = snprintf(buf, len, "%d\t: %d\n", 0, 0);
84 len -= rc;
85 if (len <= 0)
86 return -EFBIG;
87
88 return rc;
89}
90EXPORT_SYMBOL(cfs_cpt_table_print);
91#endif
92
93int
94cfs_cpt_number(struct cfs_cpt_table *cptab)
95{
96 return 1;
97}
98EXPORT_SYMBOL(cfs_cpt_number);
99
100int
101cfs_cpt_weight(struct cfs_cpt_table *cptab, int cpt)
102{
103 return 1;
104}
105EXPORT_SYMBOL(cfs_cpt_weight);
106
107int
108cfs_cpt_online(struct cfs_cpt_table *cptab, int cpt)
109{
110 return 1;
111}
112EXPORT_SYMBOL(cfs_cpt_online);
113
114int
115cfs_cpt_set_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
116{
117 return 1;
118}
119EXPORT_SYMBOL(cfs_cpt_set_cpu);
120
121void
122cfs_cpt_unset_cpu(struct cfs_cpt_table *cptab, int cpt, int cpu)
123{
124}
125EXPORT_SYMBOL(cfs_cpt_unset_cpu);
126
127int
128cfs_cpt_set_cpumask(struct cfs_cpt_table *cptab, int cpt, cpumask_t *mask)
129{
130 return 1;
131}
132EXPORT_SYMBOL(cfs_cpt_set_cpumask);
133
134void
135cfs_cpt_unset_cpumask(struct cfs_cpt_table *cptab, int cpt, cpumask_t *mask)
136{
137}
138EXPORT_SYMBOL(cfs_cpt_unset_cpumask);
139
140int
141cfs_cpt_set_node(struct cfs_cpt_table *cptab, int cpt, int node)
142{
143 return 1;
144}
145EXPORT_SYMBOL(cfs_cpt_set_node);
146
147void
148cfs_cpt_unset_node(struct cfs_cpt_table *cptab, int cpt, int node)
149{
150}
151EXPORT_SYMBOL(cfs_cpt_unset_node);
152
153int
154cfs_cpt_set_nodemask(struct cfs_cpt_table *cptab, int cpt, nodemask_t *mask)
155{
156 return 1;
157}
158EXPORT_SYMBOL(cfs_cpt_set_nodemask);
159
160void
161cfs_cpt_unset_nodemask(struct cfs_cpt_table *cptab, int cpt, nodemask_t *mask)
162{
163}
164EXPORT_SYMBOL(cfs_cpt_unset_nodemask);
165
166void
167cfs_cpt_clear(struct cfs_cpt_table *cptab, int cpt)
168{
169}
170EXPORT_SYMBOL(cfs_cpt_clear);
171
172int
173cfs_cpt_spread_node(struct cfs_cpt_table *cptab, int cpt)
174{
175 return 0;
176}
177EXPORT_SYMBOL(cfs_cpt_spread_node);
178
179int
180cfs_cpu_ht_nsiblings(int cpu)
181{
182 return 1;
183}
184EXPORT_SYMBOL(cfs_cpu_ht_nsiblings);
185
186int
187cfs_cpt_current(struct cfs_cpt_table *cptab, int remap)
188{
189 return 0;
190}
191EXPORT_SYMBOL(cfs_cpt_current);
192
193int
194cfs_cpt_of_cpu(struct cfs_cpt_table *cptab, int cpu)
195{
196 return 0;
197}
198EXPORT_SYMBOL(cfs_cpt_of_cpu);
199
200int
201cfs_cpt_bind(struct cfs_cpt_table *cptab, int cpt)
202{
203 return 0;
204}
205EXPORT_SYMBOL(cfs_cpt_bind);
206
207void
208cfs_cpu_fini(void)
209{
210 if (cfs_cpt_table != NULL) {
211 cfs_cpt_table_free(cfs_cpt_table);
212 cfs_cpt_table = NULL;
213 }
214}
215
216int
217cfs_cpu_init(void)
218{
219 cfs_cpt_table = cfs_cpt_table_alloc(1);
220
221 return cfs_cpt_table != NULL ? 0 : -1;
222}
223
224#endif
225