This source file includes following definitions.
- opal_btl_usnic_get_first_endpoint_needing_ack
- opal_btl_usnic_get_next_endpoint_needing_ack
- opal_btl_usnic_remove_from_endpoints_needing_ack
- opal_btl_usnic_add_to_endpoints_needing_ack
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 #ifndef OPAL_BTL_USNIC_MODULE_H
28 #define OPAL_BTL_USNIC_MODULE_H
29
30 #include <rdma/fabric.h>
31 #include <rdma/fi_cm.h>
32 #include <rdma/fi_eq.h>
33 #include <rdma/fi_endpoint.h>
34 #include <rdma/fi_errno.h>
35 #include <rdma/fi_ext_usnic.h>
36
37 #include "opal/class/opal_pointer_array.h"
38
39 #include "btl_usnic_endpoint.h"
40 #include "btl_usnic_stats.h"
41 #include "btl_usnic_util.h"
42
43
44
45
46
47
48
49 #define USNIC_DFLT_EAGER_LIMIT_1DEVICE (150 * 1024)
50 #define USNIC_DFLT_EAGER_LIMIT_NDEVICES (25 * 1024)
51 #define USNIC_DFLT_RNDV_EAGER_LIMIT 500
52 #define USNIC_DFLT_PACK_LAZY_THRESHOLD (16 * 1024)
53
54 BEGIN_C_DECLS
55
56
57
58
59 struct opal_btl_usnic_send_segment_t;
60 struct opal_btl_usnic_recv_segment_t;
61
62
63
64
65 typedef struct opal_btl_usnic_channel_t {
66 int chan_index;
67
68 struct fid_cq *cq;
69
70 int chan_max_msg_size;
71 int chan_rd_num;
72 int chan_sd_num;
73
74 int credits;
75 uint32_t rx_post_cnt;
76
77
78 unsigned fastsend_wqe_thresh;
79
80
81 struct opal_btl_usnic_recv_segment_t *chan_deferred_recv;
82
83
84 struct fi_info *info;
85 struct fid_ep *ep;
86
87 struct opal_btl_usnic_recv_segment_t *repost_recv_head;
88
89
90 opal_free_list_t recv_segs;
91
92 bool chan_error;
93
94
95 uint32_t num_channel_sends;
96 } opal_btl_usnic_channel_t;
97
98
99
100
101 typedef struct opal_btl_usnic_module_t {
102 mca_btl_base_module_t super;
103
104
105
106 uint32_t libfabric_api;
107 struct fid_fabric *fabric;
108 struct fid_domain *domain;
109 char *linux_device_name;
110 struct fi_info *fabric_info;
111 struct fi_usnic_ops_fabric *usnic_fabric_ops;
112 struct fi_usnic_ops_av *usnic_av_ops;
113 struct fi_usnic_info usnic_info;
114 struct fid_eq *dom_eq;
115 struct fid_eq *av_eq;
116 struct fid_av *av;
117
118 size_t av_eq_size;
119
120 mca_btl_base_module_error_cb_fn_t pml_error_callback;
121
122
123 struct event device_async_event;
124 bool device_async_event_active;
125 int numa_distance;
126
127
128 struct opal_btl_usnic_modex_t local_modex;
129 char if_ipv4_addr_str[IPV4STRADDRLEN];
130
131
132
133
134 int sd_num;
135 int rd_num;
136 int cq_num;
137 int av_eq_num;
138 int prio_sd_num;
139 int prio_rd_num;
140 int prio_cq_num;
141
142
143
144
145
146
147
148 size_t max_tiny_msg_size;
149 size_t max_frag_payload;
150 size_t max_chunk_payload;
151 size_t max_tiny_payload;
152
153
154 opal_hash_table_t senders;
155
156
157
158
159
160
161
162
163 opal_list_t all_endpoints;
164 opal_mutex_t all_endpoints_lock;
165 bool all_endpoints_constructed;
166
167
168
169 opal_pointer_array_t all_procs;
170
171
172 opal_free_list_t small_send_frags;
173 opal_free_list_t large_send_frags;
174 opal_free_list_t put_dest_frags;
175 opal_free_list_t chunk_segs;
176
177
178 int first_pool;
179 int last_pool;
180 opal_free_list_t *module_recv_buffers;
181
182
183
184 opal_list_t endpoints_with_sends;
185
186
187
188 opal_list_t pending_resend_segs;
189
190
191 opal_free_list_t ack_segs;
192
193
194
195 opal_list_t endpoints_that_need_acks;
196
197
198 opal_btl_usnic_channel_t mod_channels[USNIC_NUM_CHANNELS];
199
200
201
202 uint32_t num_short_packets;
203
204
205 opal_btl_usnic_module_stats_t stats;
206
207
208 mca_rcache_base_module_t *rcache;
209 } opal_btl_usnic_module_t;
210
211 struct opal_btl_usnic_frag_t;
212 extern opal_btl_usnic_module_t opal_btl_usnic_module_template;
213
214
215
216
217
218
219 static inline opal_btl_usnic_endpoint_t *
220 opal_btl_usnic_get_first_endpoint_needing_ack(
221 opal_btl_usnic_module_t *module)
222 {
223 opal_list_item_t *item;
224 opal_btl_usnic_endpoint_t *endpoint;
225
226 item = opal_list_get_first(&module->endpoints_that_need_acks);
227 if (item != opal_list_get_end(&module->endpoints_that_need_acks)) {
228 endpoint = container_of(item, mca_btl_base_endpoint_t, endpoint_ack_li);
229 return endpoint;
230 } else {
231 return NULL;
232 }
233 }
234
235
236 static inline opal_btl_usnic_endpoint_t *
237 opal_btl_usnic_get_next_endpoint_needing_ack(
238 opal_btl_usnic_endpoint_t *endpoint)
239 {
240 opal_list_item_t *item;
241 opal_btl_usnic_module_t *module;
242
243 module = endpoint->endpoint_module;
244
245 item = opal_list_get_next(&(endpoint->endpoint_ack_li));
246 if (item != opal_list_get_end(&module->endpoints_that_need_acks)) {
247 endpoint = container_of(item, mca_btl_base_endpoint_t, endpoint_ack_li);
248 return endpoint;
249 } else {
250 return NULL;
251 }
252 }
253
254 static inline void
255 opal_btl_usnic_remove_from_endpoints_needing_ack(
256 opal_btl_usnic_endpoint_t *endpoint)
257 {
258 opal_list_remove_item(
259 &(endpoint->endpoint_module->endpoints_that_need_acks),
260 &endpoint->endpoint_ack_li);
261 endpoint->endpoint_ack_needed = false;
262 endpoint->endpoint_acktime = 0;
263 #if MSGDEBUG1
264 opal_output(0, "clear ack_needed on %p\n", (void*)endpoint);
265 #endif
266 }
267
268 static inline void
269 opal_btl_usnic_add_to_endpoints_needing_ack(
270 opal_btl_usnic_endpoint_t *endpoint)
271 {
272 opal_list_append(&(endpoint->endpoint_module->endpoints_that_need_acks),
273 &endpoint->endpoint_ack_li);
274 endpoint->endpoint_ack_needed = true;
275 #if MSGDEBUG1
276 opal_output(0, "set ack_needed on %p\n", (void*)endpoint);
277 #endif
278 }
279
280
281
282
283 int opal_btl_usnic_module_init(opal_btl_usnic_module_t* module);
284
285
286
287
288
289 void opal_btl_usnic_module_progress_sends(opal_btl_usnic_module_t *module);
290
291
292 void opal_btl_usnic_print_stats(
293 opal_btl_usnic_module_t *module,
294 const char *prefix,
295 bool reset_stats);
296
297 END_C_DECLS
298 #endif