1 /*
2 * Copyright (c) 2018 Intel Corporation. All rights reserved.
3 *
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * BSD license below:
9 *
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
12 * conditions are met:
13 *
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
16 * disclaimer.
17 *
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 * SOFTWARE.
31 */
32
33 #include "ofi_hook.h"
34
35
36 static ssize_t
hook_atomic_write(struct fid_ep * ep,const void * buf,size_t count,void * desc,fi_addr_t dest_addr,uint64_t addr,uint64_t key,enum fi_datatype datatype,enum fi_op op,void * context)37 hook_atomic_write(struct fid_ep *ep,
38 const void *buf, size_t count, void *desc,
39 fi_addr_t dest_addr, uint64_t addr, uint64_t key,
40 enum fi_datatype datatype, enum fi_op op, void *context)
41 {
42 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
43
44 return fi_atomic(myep->hep, buf, count, desc, dest_addr,
45 addr, key, datatype, op, context);
46 }
47
48 static ssize_t
hook_atomic_writev(struct fid_ep * ep,const struct fi_ioc * iov,void ** desc,size_t count,fi_addr_t dest_addr,uint64_t addr,uint64_t key,enum fi_datatype datatype,enum fi_op op,void * context)49 hook_atomic_writev(struct fid_ep *ep,
50 const struct fi_ioc *iov, void **desc, size_t count,
51 fi_addr_t dest_addr, uint64_t addr, uint64_t key,
52 enum fi_datatype datatype, enum fi_op op, void *context)
53 {
54 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
55
56 return fi_atomicv(myep->hep, iov, desc, count, dest_addr,
57 addr, key, datatype, op, context);
58 }
59
60 static ssize_t
hook_atomic_writemsg(struct fid_ep * ep,const struct fi_msg_atomic * msg,uint64_t flags)61 hook_atomic_writemsg(struct fid_ep *ep,
62 const struct fi_msg_atomic *msg, uint64_t flags)
63 {
64 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
65
66 return fi_atomicmsg(myep->hep, msg, flags);
67 }
68
69 static ssize_t
hook_atomic_inject(struct fid_ep * ep,const void * buf,size_t count,fi_addr_t dest_addr,uint64_t addr,uint64_t key,enum fi_datatype datatype,enum fi_op op)70 hook_atomic_inject(struct fid_ep *ep, const void *buf, size_t count,
71 fi_addr_t dest_addr, uint64_t addr, uint64_t key,
72 enum fi_datatype datatype, enum fi_op op)
73 {
74 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
75
76 return fi_inject_atomic(myep->hep, buf, count, dest_addr,
77 addr, key, datatype, op);
78 }
79
80 static ssize_t
hook_atomic_readwrite(struct fid_ep * ep,const void * buf,size_t count,void * desc,void * result,void * result_desc,fi_addr_t dest_addr,uint64_t addr,uint64_t key,enum fi_datatype datatype,enum fi_op op,void * context)81 hook_atomic_readwrite(struct fid_ep *ep,
82 const void *buf, size_t count, void *desc,
83 void *result, void *result_desc,
84 fi_addr_t dest_addr, uint64_t addr, uint64_t key,
85 enum fi_datatype datatype, enum fi_op op, void *context)
86 {
87 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
88
89 return fi_fetch_atomic(myep->hep, buf, count, desc,
90 result, result_desc, dest_addr,
91 addr, key, datatype, op, context);
92 }
93
94 static ssize_t
hook_atomic_readwritev(struct fid_ep * ep,const struct fi_ioc * iov,void ** desc,size_t count,struct fi_ioc * resultv,void ** result_desc,size_t result_count,fi_addr_t dest_addr,uint64_t addr,uint64_t key,enum fi_datatype datatype,enum fi_op op,void * context)95 hook_atomic_readwritev(struct fid_ep *ep,
96 const struct fi_ioc *iov, void **desc, size_t count,
97 struct fi_ioc *resultv, void **result_desc,
98 size_t result_count, fi_addr_t dest_addr,
99 uint64_t addr, uint64_t key, enum fi_datatype datatype,
100 enum fi_op op, void *context)
101 {
102 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
103
104 return fi_fetch_atomicv(myep->hep, iov, desc, count,
105 resultv, result_desc, result_count,
106 dest_addr, addr, key, datatype, op, context);
107 }
108
109 static ssize_t
hook_atomic_readwritemsg(struct fid_ep * ep,const struct fi_msg_atomic * msg,struct fi_ioc * resultv,void ** result_desc,size_t result_count,uint64_t flags)110 hook_atomic_readwritemsg(struct fid_ep *ep, const struct fi_msg_atomic *msg,
111 struct fi_ioc *resultv, void **result_desc,
112 size_t result_count, uint64_t flags)
113 {
114 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
115
116 return fi_fetch_atomicmsg(myep->hep, msg, resultv, result_desc,
117 result_count, flags);
118 }
119
120 static ssize_t
hook_atomic_compwrite(struct fid_ep * ep,const void * buf,size_t count,void * desc,const void * compare,void * compare_desc,void * result,void * result_desc,fi_addr_t dest_addr,uint64_t addr,uint64_t key,enum fi_datatype datatype,enum fi_op op,void * context)121 hook_atomic_compwrite(struct fid_ep *ep,
122 const void *buf, size_t count, void *desc,
123 const void *compare, void *compare_desc,
124 void *result, void *result_desc,
125 fi_addr_t dest_addr, uint64_t addr, uint64_t key,
126 enum fi_datatype datatype, enum fi_op op, void *context)
127 {
128 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
129
130 return fi_compare_atomic(myep->hep, buf, count, desc,
131 compare, compare_desc, result, result_desc,
132 dest_addr, addr, key, datatype, op, context);
133 }
134
135 static ssize_t
hook_atomic_compwritev(struct fid_ep * ep,const struct fi_ioc * iov,void ** desc,size_t count,const struct fi_ioc * comparev,void ** compare_desc,size_t compare_count,struct fi_ioc * resultv,void ** result_desc,size_t result_count,fi_addr_t dest_addr,uint64_t addr,uint64_t key,enum fi_datatype datatype,enum fi_op op,void * context)136 hook_atomic_compwritev(struct fid_ep *ep,
137 const struct fi_ioc *iov, void **desc, size_t count,
138 const struct fi_ioc *comparev, void **compare_desc,
139 size_t compare_count, struct fi_ioc *resultv,
140 void **result_desc, size_t result_count,
141 fi_addr_t dest_addr, uint64_t addr, uint64_t key,
142 enum fi_datatype datatype, enum fi_op op, void *context)
143 {
144 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
145
146 return fi_compare_atomicv(myep->hep, iov, desc, count,
147 comparev, compare_desc, compare_count,
148 resultv, result_desc, result_count, dest_addr,
149 addr, key, datatype, op, context);
150 }
151 static ssize_t
hook_atomic_compwritemsg(struct fid_ep * ep,const struct fi_msg_atomic * msg,const struct fi_ioc * comparev,void ** compare_desc,size_t compare_count,struct fi_ioc * resultv,void ** result_desc,size_t result_count,uint64_t flags)152 hook_atomic_compwritemsg(struct fid_ep *ep,
153 const struct fi_msg_atomic *msg,
154 const struct fi_ioc *comparev, void **compare_desc,
155 size_t compare_count, struct fi_ioc *resultv,
156 void **result_desc, size_t result_count,
157 uint64_t flags)
158 {
159 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
160
161 return fi_compare_atomicmsg(myep->hep, msg,
162 comparev, compare_desc, compare_count,
163 resultv, result_desc, result_count, flags);
164 }
165
166 static int
hook_atomic_writevalid(struct fid_ep * ep,enum fi_datatype datatype,enum fi_op op,size_t * count)167 hook_atomic_writevalid(struct fid_ep *ep, enum fi_datatype datatype,
168 enum fi_op op, size_t *count)
169 {
170 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
171
172 return fi_atomicvalid(myep->hep, datatype, op, count);
173 }
174
175 static int
hook_atomic_readwritevalid(struct fid_ep * ep,enum fi_datatype datatype,enum fi_op op,size_t * count)176 hook_atomic_readwritevalid(struct fid_ep *ep, enum fi_datatype datatype,
177 enum fi_op op, size_t *count)
178 {
179 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
180
181 return fi_fetch_atomicvalid(myep->hep, datatype, op, count);
182 }
183
184 static int
hook_atomic_compwritevalid(struct fid_ep * ep,enum fi_datatype datatype,enum fi_op op,size_t * count)185 hook_atomic_compwritevalid(struct fid_ep *ep, enum fi_datatype datatype,
186 enum fi_op op, size_t *count)
187 {
188 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
189
190 return fi_compare_atomicvalid(myep->hep, datatype, op, count);
191 }
192
193 struct fi_ops_atomic hook_atomic_ops = {
194 .size = sizeof(struct fi_ops_atomic),
195 .write = hook_atomic_write,
196 .writev = hook_atomic_writev,
197 .writemsg = hook_atomic_writemsg,
198 .inject = hook_atomic_inject,
199 .readwrite = hook_atomic_readwrite,
200 .readwritev = hook_atomic_readwritev,
201 .readwritemsg = hook_atomic_readwritemsg,
202 .compwrite = hook_atomic_compwrite,
203 .compwritev = hook_atomic_compwritev,
204 .compwritemsg = hook_atomic_compwritemsg,
205 .writevalid = hook_atomic_writevalid,
206 .readwritevalid = hook_atomic_readwritevalid,
207 .compwritevalid = hook_atomic_compwritevalid,
208 };
209
210
211 static ssize_t
hook_msg_recv(struct fid_ep * ep,void * buf,size_t len,void * desc,fi_addr_t src_addr,void * context)212 hook_msg_recv(struct fid_ep *ep, void *buf, size_t len, void *desc,
213 fi_addr_t src_addr, void *context)
214 {
215 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
216
217 return fi_recv(myep->hep, buf, len, desc, src_addr, context);
218 }
219
220 static ssize_t
hook_msg_recvv(struct fid_ep * ep,const struct iovec * iov,void ** desc,size_t count,fi_addr_t src_addr,void * context)221 hook_msg_recvv(struct fid_ep *ep, const struct iovec *iov, void **desc,
222 size_t count, fi_addr_t src_addr, void *context)
223 {
224 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
225
226 return fi_recvv(myep->hep, iov, desc, count, src_addr, context);
227 }
228
229 static ssize_t
hook_msg_recvmsg(struct fid_ep * ep,const struct fi_msg * msg,uint64_t flags)230 hook_msg_recvmsg(struct fid_ep *ep, const struct fi_msg *msg, uint64_t flags)
231 {
232 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
233
234 return fi_recvmsg(myep->hep, msg, flags);
235 }
236
237 static ssize_t
hook_msg_send(struct fid_ep * ep,const void * buf,size_t len,void * desc,fi_addr_t dest_addr,void * context)238 hook_msg_send(struct fid_ep *ep, const void *buf, size_t len, void *desc,
239 fi_addr_t dest_addr, void *context)
240 {
241 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
242
243 return fi_send(myep->hep, buf, len, desc, dest_addr, context);
244 }
245
246 static ssize_t
hook_msg_sendv(struct fid_ep * ep,const struct iovec * iov,void ** desc,size_t count,fi_addr_t dest_addr,void * context)247 hook_msg_sendv(struct fid_ep *ep, const struct iovec *iov, void **desc,
248 size_t count, fi_addr_t dest_addr, void *context)
249 {
250 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
251
252 return fi_sendv(myep->hep, iov, desc, count, dest_addr, context);
253 }
254
255 static ssize_t
hook_msg_sendmsg(struct fid_ep * ep,const struct fi_msg * msg,uint64_t flags)256 hook_msg_sendmsg(struct fid_ep *ep, const struct fi_msg *msg,
257 uint64_t flags)
258 {
259 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
260
261 return fi_sendmsg(myep->hep, msg, flags);
262 }
263
264 static ssize_t
hook_msg_inject(struct fid_ep * ep,const void * buf,size_t len,fi_addr_t dest_addr)265 hook_msg_inject(struct fid_ep *ep, const void *buf, size_t len,
266 fi_addr_t dest_addr)
267 {
268 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
269
270 return fi_inject(myep->hep, buf, len, dest_addr);
271 }
272
273 static ssize_t
hook_msg_senddata(struct fid_ep * ep,const void * buf,size_t len,void * desc,uint64_t data,fi_addr_t dest_addr,void * context)274 hook_msg_senddata(struct fid_ep *ep, const void *buf, size_t len, void *desc,
275 uint64_t data, fi_addr_t dest_addr, void *context)
276 {
277 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
278
279 return fi_senddata(myep->hep, buf, len, desc, data, dest_addr, context);
280 }
281
282 static ssize_t
hook_msg_injectdata(struct fid_ep * ep,const void * buf,size_t len,uint64_t data,fi_addr_t dest_addr)283 hook_msg_injectdata(struct fid_ep *ep, const void *buf, size_t len,
284 uint64_t data, fi_addr_t dest_addr)
285 {
286 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
287
288 return fi_injectdata(myep->hep, buf, len, data, dest_addr);
289 }
290
291 struct fi_ops_msg hook_msg_ops = {
292 .size = sizeof(struct fi_ops_msg),
293 .recv = hook_msg_recv,
294 .recvv = hook_msg_recvv,
295 .recvmsg = hook_msg_recvmsg,
296 .send = hook_msg_send,
297 .sendv = hook_msg_sendv,
298 .sendmsg = hook_msg_sendmsg,
299 .inject = hook_msg_inject,
300 .senddata = hook_msg_senddata,
301 .injectdata = hook_msg_injectdata,
302 };
303
304
305 static ssize_t
hook_rma_read(struct fid_ep * ep,void * buf,size_t len,void * desc,fi_addr_t src_addr,uint64_t addr,uint64_t key,void * context)306 hook_rma_read(struct fid_ep *ep, void *buf, size_t len, void *desc,
307 fi_addr_t src_addr, uint64_t addr, uint64_t key, void *context)
308 {
309 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
310
311 return fi_read(myep->hep, buf, len, desc, src_addr, addr, key, context);
312 }
313
314 static ssize_t
hook_rma_readv(struct fid_ep * ep,const struct iovec * iov,void ** desc,size_t count,fi_addr_t src_addr,uint64_t addr,uint64_t key,void * context)315 hook_rma_readv(struct fid_ep *ep, const struct iovec *iov, void **desc,
316 size_t count, fi_addr_t src_addr, uint64_t addr, uint64_t key,
317 void *context)
318 {
319 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
320
321 return fi_readv(myep->hep, iov, desc, count, src_addr,
322 addr, key, context);
323 }
324
325 static ssize_t
hook_rma_readmsg(struct fid_ep * ep,const struct fi_msg_rma * msg,uint64_t flags)326 hook_rma_readmsg(struct fid_ep *ep, const struct fi_msg_rma *msg,
327 uint64_t flags)
328 {
329 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
330
331 return fi_readmsg(myep->hep, msg, flags);
332 }
333
334 static ssize_t
hook_rma_write(struct fid_ep * ep,const void * buf,size_t len,void * desc,fi_addr_t dest_addr,uint64_t addr,uint64_t key,void * context)335 hook_rma_write(struct fid_ep *ep, const void *buf, size_t len, void *desc,
336 fi_addr_t dest_addr, uint64_t addr, uint64_t key, void *context)
337 {
338 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
339
340 return fi_write(myep->hep, buf, len, desc, dest_addr,
341 addr, key, context);
342 }
343
344 static ssize_t
hook_rma_writev(struct fid_ep * ep,const struct iovec * iov,void ** desc,size_t count,fi_addr_t dest_addr,uint64_t addr,uint64_t key,void * context)345 hook_rma_writev(struct fid_ep *ep, const struct iovec *iov, void **desc,
346 size_t count, fi_addr_t dest_addr, uint64_t addr, uint64_t key,
347 void *context)
348 {
349 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
350
351 return fi_writev(myep->hep, iov, desc, count, dest_addr,
352 addr, key, context);
353 }
354
355 static ssize_t
hook_rma_writemsg(struct fid_ep * ep,const struct fi_msg_rma * msg,uint64_t flags)356 hook_rma_writemsg(struct fid_ep *ep, const struct fi_msg_rma *msg,
357 uint64_t flags)
358 {
359 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
360
361 return fi_writemsg(myep->hep, msg, flags);
362 }
363
364 static ssize_t
hook_rma_inject(struct fid_ep * ep,const void * buf,size_t len,fi_addr_t dest_addr,uint64_t addr,uint64_t key)365 hook_rma_inject(struct fid_ep *ep, const void *buf, size_t len,
366 fi_addr_t dest_addr, uint64_t addr, uint64_t key)
367 {
368 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
369
370 return fi_inject_write(myep->hep, buf, len, dest_addr, addr, key);
371 }
372
373 static ssize_t
hook_rma_writedata(struct fid_ep * ep,const void * buf,size_t len,void * desc,uint64_t data,fi_addr_t dest_addr,uint64_t addr,uint64_t key,void * context)374 hook_rma_writedata(struct fid_ep *ep, const void *buf, size_t len, void *desc,
375 uint64_t data, fi_addr_t dest_addr, uint64_t addr,
376 uint64_t key, void *context)
377 {
378 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
379
380 return fi_writedata(myep->hep, buf, len, desc, data,
381 dest_addr, addr, key, context);
382 }
383
384 static ssize_t
hook_rma_injectdata(struct fid_ep * ep,const void * buf,size_t len,uint64_t data,fi_addr_t dest_addr,uint64_t addr,uint64_t key)385 hook_rma_injectdata(struct fid_ep *ep, const void *buf, size_t len,
386 uint64_t data, fi_addr_t dest_addr, uint64_t addr,
387 uint64_t key)
388 {
389 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
390
391 return fi_inject_writedata(myep->hep, buf, len, data, dest_addr,
392 addr, key);
393 }
394
395 struct fi_ops_rma hook_rma_ops = {
396 .size = sizeof(struct fi_ops_rma),
397 .read = hook_rma_read,
398 .readv = hook_rma_readv,
399 .readmsg = hook_rma_readmsg,
400 .write = hook_rma_write,
401 .writev = hook_rma_writev,
402 .writemsg = hook_rma_writemsg,
403 .inject = hook_rma_inject,
404 .writedata = hook_rma_writedata,
405 .injectdata = hook_rma_injectdata,
406 };
407
408
409 static ssize_t
hook_tagged_recv(struct fid_ep * ep,void * buf,size_t len,void * desc,fi_addr_t src_addr,uint64_t tag,uint64_t ignore,void * context)410 hook_tagged_recv(struct fid_ep *ep, void *buf, size_t len, void *desc,
411 fi_addr_t src_addr, uint64_t tag, uint64_t ignore,
412 void *context)
413 {
414 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
415
416 return fi_trecv(myep->hep, buf, len, desc, src_addr,
417 tag, ignore, context);
418 }
419
420 static ssize_t
hook_tagged_recvv(struct fid_ep * ep,const struct iovec * iov,void ** desc,size_t count,fi_addr_t src_addr,uint64_t tag,uint64_t ignore,void * context)421 hook_tagged_recvv(struct fid_ep *ep, const struct iovec *iov, void **desc,
422 size_t count, fi_addr_t src_addr, uint64_t tag,
423 uint64_t ignore, void *context)
424 {
425 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
426
427 return fi_trecvv(myep->hep, iov, desc, count, src_addr,
428 tag, ignore, context);
429 }
430
431 static ssize_t
hook_tagged_recvmsg(struct fid_ep * ep,const struct fi_msg_tagged * msg,uint64_t flags)432 hook_tagged_recvmsg(struct fid_ep *ep, const struct fi_msg_tagged *msg,
433 uint64_t flags)
434 {
435 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
436
437 return fi_trecvmsg(myep->hep, msg, flags);
438 }
439
440 static ssize_t
hook_tagged_send(struct fid_ep * ep,const void * buf,size_t len,void * desc,fi_addr_t dest_addr,uint64_t tag,void * context)441 hook_tagged_send(struct fid_ep *ep, const void *buf, size_t len, void *desc,
442 fi_addr_t dest_addr, uint64_t tag, void *context)
443 {
444 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
445
446 return fi_tsend(myep->hep, buf, len, desc, dest_addr, tag, context);
447 }
448
449 static ssize_t
hook_tagged_sendv(struct fid_ep * ep,const struct iovec * iov,void ** desc,size_t count,fi_addr_t dest_addr,uint64_t tag,void * context)450 hook_tagged_sendv(struct fid_ep *ep, const struct iovec *iov, void **desc,
451 size_t count, fi_addr_t dest_addr, uint64_t tag,
452 void *context)
453 {
454 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
455
456 return fi_tsendv(myep->hep, iov, desc, count, dest_addr, tag, context);
457 }
458
459 static ssize_t
hook_tagged_sendmsg(struct fid_ep * ep,const struct fi_msg_tagged * msg,uint64_t flags)460 hook_tagged_sendmsg(struct fid_ep *ep, const struct fi_msg_tagged *msg,
461 uint64_t flags)
462 {
463 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
464
465 return fi_tsendmsg(myep->hep, msg, flags);
466 }
467
468 static ssize_t
hook_tagged_inject(struct fid_ep * ep,const void * buf,size_t len,fi_addr_t dest_addr,uint64_t tag)469 hook_tagged_inject(struct fid_ep *ep, const void *buf, size_t len,
470 fi_addr_t dest_addr, uint64_t tag)
471 {
472 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
473
474 return fi_tinject(myep->hep, buf, len, dest_addr, tag);
475 }
476
477 static ssize_t
hook_tagged_senddata(struct fid_ep * ep,const void * buf,size_t len,void * desc,uint64_t data,fi_addr_t dest_addr,uint64_t tag,void * context)478 hook_tagged_senddata(struct fid_ep *ep, const void *buf, size_t len, void *desc,
479 uint64_t data, fi_addr_t dest_addr, uint64_t tag,
480 void *context)
481 {
482 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
483
484 return fi_tsenddata(myep->hep, buf, len, desc, data,
485 dest_addr, tag, context);
486 }
487
488 static ssize_t
hook_tagged_injectdata(struct fid_ep * ep,const void * buf,size_t len,uint64_t data,fi_addr_t dest_addr,uint64_t tag)489 hook_tagged_injectdata(struct fid_ep *ep, const void *buf, size_t len,
490 uint64_t data, fi_addr_t dest_addr, uint64_t tag)
491 {
492 struct hook_ep *myep = container_of(ep, struct hook_ep, ep);
493
494 return fi_tinjectdata(myep->hep, buf, len, data, dest_addr, tag);
495 }
496
497 struct fi_ops_tagged hook_tagged_ops = {
498 .size = sizeof(struct fi_ops_tagged),
499 .recv = hook_tagged_recv,
500 .recvv = hook_tagged_recvv,
501 .recvmsg = hook_tagged_recvmsg,
502 .send = hook_tagged_send,
503 .sendv = hook_tagged_sendv,
504 .sendmsg = hook_tagged_sendmsg,
505 .inject = hook_tagged_inject,
506 .senddata = hook_tagged_senddata,
507 .injectdata = hook_tagged_injectdata,
508 };
509