1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #ifndef MCA_BTL_TCP_H
24 #define MCA_BTL_TCP_H
25
26 #include "ompi_config.h"
27 #ifdef HAVE_SYS_TYPES_H
28 #include <sys/types.h>
29 #endif
30 #ifdef HAVE_SYS_SOCKET_H
31 #include <sys/socket.h>
32 #endif
33 #ifdef HAVE_NETINET_IN_H
34 #include <netinet/in.h>
35 #endif
36
37
38 #include "opal/mca/event/event.h"
39 #include "ompi/class/ompi_free_list.h"
40 #include "ompi/mca/btl/btl.h"
41 #include "ompi/mca/btl/base/base.h"
42 #include "ompi/mca/mpool/mpool.h"
43 #include "ompi/mca/btl/btl.h"
44 #include "opal/class/opal_hash_table.h"
45
46 #define MCA_BTL_TCP_STATISTICS 0
47 BEGIN_C_DECLS
48
49
50
51
52
53
54 struct mca_btl_tcp2_component_t {
55 mca_btl_base_component_2_0_0_t super;
56 uint32_t tcp_addr_count;
57 uint32_t tcp_num_btls;
58 uint32_t tcp_num_links;
59 struct mca_btl_tcp2_module_t **tcp_btls;
60 struct mca_btl_tcp2_proc_t* tcp_local;
61 int tcp_free_list_num;
62 int tcp_free_list_max;
63 int tcp_free_list_inc;
64 int tcp_endpoint_cache;
65 opal_hash_table_t tcp_procs;
66 opal_list_t tcp_events;
67 opal_mutex_t tcp_lock;
68
69 opal_event_t tcp_recv_event;
70 int tcp_listen_sd;
71 unsigned short tcp_listen_port;
72 int32_t tcp_port_min;
73 int32_t tcp_port_range;
74 #if OPAL_ENABLE_IPV6
75 opal_event_t tcp6_recv_event;
76 int tcp6_listen_sd;
77 unsigned short tcp6_listen_port;
78 int32_t tcp6_port_min;
79 int32_t tcp6_port_range;
80 #endif
81
82
83 char* tcp_if_include;
84 char* tcp_if_exclude;
85 int tcp_sndbuf;
86 int tcp_rcvbuf;
87 int tcp_disable_family;
88
89
90 ompi_free_list_t tcp_frag_eager;
91 ompi_free_list_t tcp_frag_max;
92 ompi_free_list_t tcp_frag_user;
93
94
95 int tcp_use_nodelay;
96 };
97 typedef struct mca_btl_tcp2_component_t mca_btl_tcp2_component_t;
98
99 OMPI_MODULE_DECLSPEC extern mca_btl_tcp2_component_t mca_btl_tcp2_component;
100
101
102
103
104 struct mca_btl_tcp2_module_t {
105 mca_btl_base_module_t super;
106 uint16_t tcp_ifkindex;
107 #if 0
108 int tcp_ifindex;
109 #endif
110 struct sockaddr_storage tcp_ifaddr;
111 uint32_t tcp_ifmask;
112 opal_list_t tcp_endpoints;
113 #if MCA_BTL_TCP_STATISTICS
114 size_t tcp_bytes_sent;
115 size_t tcp_bytes_recv;
116 size_t tcp_send_handler;
117 #endif
118 };
119 typedef struct mca_btl_tcp2_module_t mca_btl_tcp2_module_t;
120 extern mca_btl_tcp2_module_t mca_btl_tcp2_module;
121
122 #define CLOSE_THE_SOCKET(socket) close(socket)
123
124
125
126
127 extern int mca_btl_tcp2_component_open(void);
128
129
130
131
132 extern int mca_btl_tcp2_component_close(void);
133
134
135
136
137
138
139
140
141 extern mca_btl_base_module_t** mca_btl_tcp2_component_init(
142 int *num_btl_modules,
143 bool allow_multi_user_threads,
144 bool have_hidden_threads
145 );
146
147
148
149
150 int mca_btl_tcp2_component_control(
151 int param,
152 void* value,
153 size_t size
154 );
155
156
157
158
159
160 extern int mca_btl_tcp2_component_progress(void);
161
162
163
164
165
166
167
168
169
170
171 extern int mca_btl_tcp2_finalize(
172 struct mca_btl_base_module_t* btl
173 );
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188 extern int mca_btl_tcp2_add_procs(
189 struct mca_btl_base_module_t* btl,
190 size_t nprocs,
191 struct ompi_proc_t **procs,
192 struct mca_btl_base_endpoint_t** peers,
193 opal_bitmap_t* reachable
194 );
195
196
197
198
199
200
201
202
203
204
205
206
207 extern int mca_btl_tcp2_del_procs(
208 struct mca_btl_base_module_t* btl,
209 size_t nprocs,
210 struct ompi_proc_t **procs,
211 struct mca_btl_base_endpoint_t** peers
212 );
213
214
215
216
217
218
219
220
221
222
223
224 extern int mca_btl_tcp2_send(
225 struct mca_btl_base_module_t* btl,
226 struct mca_btl_base_endpoint_t* btl_peer,
227 struct mca_btl_base_descriptor_t* descriptor,
228 mca_btl_base_tag_t tag
229 );
230
231
232
233
234
235
236
237
238
239
240 extern int mca_btl_tcp2_put(
241 struct mca_btl_base_module_t* btl,
242 struct mca_btl_base_endpoint_t* btl_peer,
243 struct mca_btl_base_descriptor_t* decriptor
244 );
245
246
247
248
249
250
251
252
253
254
255 extern int mca_btl_tcp2_get(
256 struct mca_btl_base_module_t* btl,
257 struct mca_btl_base_endpoint_t* btl_peer,
258 struct mca_btl_base_descriptor_t* decriptor
259 );
260
261
262
263
264
265
266
267
268
269
270 extern mca_btl_base_descriptor_t* mca_btl_tcp2_alloc(
271 struct mca_btl_base_module_t* btl,
272 struct mca_btl_base_endpoint_t* endpoint,
273 uint8_t order,
274 size_t size,
275 uint32_t flags);
276
277
278
279
280
281
282
283
284
285 extern int mca_btl_tcp2_free(
286 struct mca_btl_base_module_t* btl,
287 mca_btl_base_descriptor_t* des);
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304 mca_btl_base_descriptor_t* mca_btl_tcp2_prepare_src(
305 struct mca_btl_base_module_t* btl,
306 struct mca_btl_base_endpoint_t* peer,
307 struct mca_mpool_base_registration_t*,
308 struct opal_convertor_t* convertor,
309 uint8_t order,
310 size_t reserve,
311 size_t* size,
312 uint32_t flags
313 );
314
315 extern mca_btl_base_descriptor_t* mca_btl_tcp2_prepare_dst(
316 struct mca_btl_base_module_t* btl,
317 struct mca_btl_base_endpoint_t* peer,
318 struct mca_mpool_base_registration_t*,
319 struct opal_convertor_t* convertor,
320 uint8_t order,
321 size_t reserve,
322 size_t* size,
323 uint32_t flags);
324
325
326
327
328
329
330
331 int mca_btl_tcp2_ft_event(int state);
332
333 END_C_DECLS
334 #endif