This source file includes following definitions.
- mca_btl_ofi_frag_alloc
- mca_btl_ofi_frag_return
- mca_btl_ofi_frag_complete
1
2
3
4
5
6
7
8
9
10
11
12 #if !defined(MCA_BTL_OFI_FRAG_H)
13 #define MCA_BTL_OFI_FRAG_H
14
15 #include "btl_ofi.h"
16 #include "btl_ofi_endpoint.h"
17
18
19 #define MCA_BTL_OFI_HDR_SIZE sizeof(mca_btl_ofi_header_t)
20 #define MCA_BTL_OFI_FRAG_SIZE 4096
21 #define MCA_BTL_OFI_RECV_SIZE MCA_BTL_OFI_FRAG_SIZE + MCA_BTL_OFI_HDR_SIZE
22
23 #define MCA_BTL_OFI_NUM_SEND_INC(module) \
24 OPAL_ATOMIC_ADD_FETCH64(&(module)->outstanding_send, 1); \
25 if (module->outstanding_send > mca_btl_ofi_component.progress_threshold) { \
26 mca_btl_ofi_component.super.btl_progress(); \
27 }
28
29 #define MCA_BTL_OFI_NUM_SEND_DEC(module) \
30 OPAL_ATOMIC_ADD_FETCH64(&(module)->outstanding_send, -1);
31
32 mca_btl_base_descriptor_t *mca_btl_ofi_alloc(
33 mca_btl_base_module_t *btl,
34 mca_btl_base_endpoint_t *endpoint,
35 uint8_t order, size_t size, uint32_t flags);
36
37 int mca_btl_ofi_free (mca_btl_base_module_t *btl, mca_btl_base_descriptor_t *des);
38
39 int mca_btl_ofi_send (mca_btl_base_module_t *btl,
40 mca_btl_base_endpoint_t *endpoint,
41 mca_btl_base_descriptor_t *descriptor,
42 mca_btl_base_tag_t tag);
43
44 int mca_btl_ofi_recv_frag (mca_btl_ofi_module_t *ofi_btl,
45 mca_btl_base_endpoint_t *endpoint,
46 mca_btl_ofi_context_t *context,
47 mca_btl_ofi_base_frag_t *frag);
48
49 struct mca_btl_base_descriptor_t *mca_btl_ofi_prepare_src (
50 mca_btl_base_module_t *btl,
51 mca_btl_base_endpoint_t *endpoint,
52 opal_convertor_t *convertor,
53 uint8_t order, size_t reserve,
54 size_t *size, uint32_t flags);
55
56 mca_btl_ofi_frag_completion_t *mca_btl_ofi_frag_completion_alloc
57 (mca_btl_base_module_t *btl,
58 mca_btl_ofi_context_t *context,
59 mca_btl_ofi_base_frag_t *frag,
60 int type);
61
62 static inline mca_btl_ofi_base_frag_t *mca_btl_ofi_frag_alloc (mca_btl_ofi_module_t *ofi_btl, opal_free_list_t *fl,
63 mca_btl_base_endpoint_t *endpoint)
64 {
65 mca_btl_ofi_base_frag_t *frag = (mca_btl_ofi_base_frag_t *) opal_free_list_get (fl);
66
67 if (OPAL_LIKELY(NULL != frag)) {
68 frag->free_list = fl;
69 frag->endpoint = endpoint;
70 frag->btl = ofi_btl;
71 }
72
73 return frag;
74 }
75
76 static inline void mca_btl_ofi_frag_return (mca_btl_ofi_base_frag_t *frag)
77 {
78 opal_free_list_return (frag->free_list, &frag->base.super);
79 }
80
81 static inline void mca_btl_ofi_frag_complete (mca_btl_ofi_base_frag_t *frag, int rc) {
82 mca_btl_ofi_module_t *ofi_btl = frag->btl;
83
84
85 if (frag->base.des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) {
86 frag->base.des_cbfunc(&ofi_btl->super, frag->endpoint, &frag->base, rc);
87 }
88
89
90 if (OPAL_LIKELY(frag->base.des_flags & MCA_BTL_DES_FLAGS_BTL_OWNERSHIP)) {
91 mca_btl_ofi_frag_return (frag);
92 }
93 }
94
95 #endif