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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _RSMAPI_H
#define _RSMAPI_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#include <poll.h>
#include <sys/param.h>
#include <sys/rsm/rsm_common.h>
#include <sys/rsm/rsmapi_common.h>
typedef enum {
RSM_MAP_NONE = 0x0,
RSM_MAP_FIXED = 0x1,
RSM_MAP_RESERVED = 0x2
}rsm_attribute_t;
/*
* Topology data structures - The primary structure is struct rsm_topology_t
*
* The key interconnect data required for segment operations includes the
* cluster nodeids and the controllers (name, hardware address); with
* the fundamental constraint that the controller specified for a segment
* import must have a physical connection with the contorller used in the
* export of the segment. To facilitate applications in the establishment
* of proper and efficient export and import policies, a delineation of the
* interconnect topology is provided by these data structures.
*
*/
#define RSM_CONNECTION_ACTIVE 3
typedef struct rsm_topology_hdr {
rsm_node_id_t local_nodeid;
uint_t local_cntlr_count;
} rsm_topology_hdr_t;
typedef struct rsm_connections_hdr {
char cntlr_name[MAXNAMELEN]; /* <cntlr_type><unit> */
rsm_addr_t local_hwaddr;
int remote_cntlr_count;
} rsm_connections_hdr_t;
/*
* The remote cntrlname element should be used for matching with the
* cntrlname of an exported segment.
*
* An application must not attempt to use a connection unless the
* the connection_state element of struct rsm_remote_cntlr_t is equal to
* RSM_CONNECTION_ACTIVE
*/
typedef struct rsm_remote_cntlr {
rsm_node_id_t remote_nodeid;
char remote_cntlrname[MAXNAMELEN];
rsm_addr_t remote_hwaddr;
uint_t connection_state;
} rsm_remote_cntlr_t;
/*
* The actual size of the remote_cntlr array is equal to the remote_cntlr_count
* of the rsm_connections_hdr_t struct.
*/
typedef struct rsm_connection {
rsm_connections_hdr_t hdr;
rsm_remote_cntlr_t remote_cntlr[1];
} rsm_connections_t;
/*
* A pointer to an instance of this structure type is returned by a call
* to rsm_get_interconnect_topology(). The actual size of the connections
* array is equal to the local_cntlr_count of the rsm_topology_hdr_t struct.
*/
typedef struct rsm_topology {
rsm_topology_hdr_t topology_hdr;
rsm_connections_t *connections[1];
} rsm_topology_t;
/*
* function templates:
*/
int rsm_get_controller(char *name, rsmapi_controller_handle_t *controller);
int rsm_get_controller_attr(rsmapi_controller_handle_t chdl,
rsmapi_controller_attr_t *attr);
int rsm_release_controller(rsmapi_controller_handle_t controller);
/*
* Export side memory segment operations
*/
int rsm_memseg_export_create(rsmapi_controller_handle_t controller,
rsm_memseg_export_handle_t *memseg,
void *vaddr, size_t size, uint_t flags);
int rsm_memseg_export_destroy(rsm_memseg_export_handle_t memseg);
int rsm_memseg_export_rebind(rsm_memseg_export_handle_t memseg,
void *vaddr, offset_t off, size_t size);
int rsm_memseg_export_publish(rsm_memseg_export_handle_t memseg,
rsm_memseg_id_t *segment_id,
rsmapi_access_entry_t access_list[],
uint_t access_list_length);
int rsm_memseg_export_unpublish(rsm_memseg_export_handle_t memseg);
int rsm_memseg_export_republish(rsm_memseg_export_handle_t memseg,
rsmapi_access_entry_t access_list[],
uint_t access_list_length);
/*
* import side memory segment operations:
*/
int rsm_memseg_import_connect(rsmapi_controller_handle_t controller,
rsm_node_id_t node_id,
rsm_memseg_id_t segment_id,
rsm_permission_t perm,
rsm_memseg_import_handle_t *im_memseg);
int rsm_memseg_import_disconnect(rsm_memseg_import_handle_t im_memseg);
/*
* import side memory segment operations (read access functions):
*/
int rsm_memseg_import_get8(rsm_memseg_import_handle_t im_memseg,
off_t offset,
uint8_t *datap,
ulong_t rep_cnt);
int rsm_memseg_import_get16(rsm_memseg_import_handle_t im_memseg,
off_t offset,
uint16_t *datap,
ulong_t rep_cnt);
int rsm_memseg_import_get32(rsm_memseg_import_handle_t im_memseg,
off_t offset,
uint32_t *datap,
ulong_t rep_cnt);
int rsm_memseg_import_get64(rsm_memseg_import_handle_t im_memseg,
off_t offset,
uint64_t *datap,
ulong_t rep_cnt);
int rsm_memseg_import_get(rsm_memseg_import_handle_t im_memseg,
off_t offset,
void *dst_addr,
size_t length);
int rsm_memseg_import_getv(rsm_scat_gath_t *);
/*
* import side memory segment operations (write access functions):
*/
int rsm_memseg_import_put8(rsm_memseg_import_handle_t im_memseg,
off_t offset,
uint8_t *datap,
ulong_t rep_cnt);
int rsm_memseg_import_put16(rsm_memseg_import_handle_t im_memseg,
off_t offset,
uint16_t *datap,
ulong_t rep_cnt);
int rsm_memseg_import_put32(rsm_memseg_import_handle_t im_memseg,
off_t offset,
uint32_t *datap,
ulong_t rep_cnt);
int rsm_memseg_import_put64(rsm_memseg_import_handle_t im_memseg,
off_t offset,
uint64_t *datap,
ulong_t rep_cnt);
int rsm_memseg_import_put(rsm_memseg_import_handle_t im_memseg,
off_t offset,
void *src_addr,
size_t length);
int rsm_memseg_import_putv(rsm_scat_gath_t *);
/*
* import side memory segment operations (mapping):
*/
int rsm_memseg_import_map(rsm_memseg_import_handle_t im_memseg,
void **address,
rsm_attribute_t attr,
rsm_permission_t perm,
off_t offset, size_t length);
int rsm_memseg_import_unmap(rsm_memseg_import_handle_t im_memseg);
/*
* import side memory segment operations (barriers):
*/
int rsm_memseg_import_init_barrier(rsm_memseg_import_handle_t im_memseg,
rsm_barrier_type_t type,
rsmapi_barrier_t *barrier);
int rsm_memseg_import_open_barrier(rsmapi_barrier_t *barrier);
int rsm_memseg_import_close_barrier(rsmapi_barrier_t *barrier);
int rsm_memseg_import_order_barrier(rsmapi_barrier_t *barrier);
int rsm_memseg_import_destroy_barrier(rsmapi_barrier_t *barrier);
int rsm_memseg_import_get_mode(rsm_memseg_import_handle_t im_memseg,
rsm_barrier_mode_t *mode);
int rsm_memseg_import_set_mode(rsm_memseg_import_handle_t im_memseg,
rsm_barrier_mode_t mode);
int rsm_intr_signal_post(void * im_memseg, uint_t flags);
int rsm_intr_signal_wait(void * im_memseg, int timeout);
int rsm_memseg_get_pollfd(void *, struct pollfd *);
int rsm_memseg_release_pollfd(void *);
int rsm_get_interconnect_topology(rsm_topology_t **);
void rsm_free_interconnect_topology(rsm_topology_t *);
int rsm_create_localmemory_handle(rsmapi_controller_handle_t,
rsm_localmemory_handle_t *,
caddr_t, size_t);
int rsm_free_localmemory_handle(rsmapi_controller_handle_t,
rsm_localmemory_handle_t);
int rsm_get_segmentid_range(const char *, rsm_memseg_id_t *, uint32_t *);
int rsm_intr_signal_wait_pollfd(struct pollfd [], nfds_t, int, int *);
#ifdef __cplusplus
}
#endif
#endif /* _RSMAPI_H */
|