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 #ifndef MCA_PML_OB1_RDMAFRAG_H
26 #define MCA_PML_OB1_RDMAFRAG_H
27
28 #include "pml_ob1_hdr.h"
29
30 BEGIN_C_DECLS
31
32 typedef enum {
33 MCA_PML_OB1_RDMA_PUT,
34 MCA_PML_OB1_RDMA_GET
35 } mca_pml_ob1_rdma_state_t;
36
37 struct mca_pml_ob1_rdma_frag_t;
38
39 typedef void (*mca_pml_ob1_rdma_frag_callback_t)(struct mca_pml_ob1_rdma_frag_t *frag, int64_t rdma_length);
40
41
42
43
44 struct mca_pml_ob1_rdma_frag_t {
45 opal_free_list_item_t super;
46 mca_bml_base_btl_t *rdma_bml;
47 mca_pml_ob1_hdr_t rdma_hdr;
48 mca_pml_ob1_rdma_state_t rdma_state;
49 size_t rdma_length;
50 opal_atomic_size_t rdma_bytes_remaining;
51 void *rdma_req;
52 uint32_t retries;
53 mca_pml_ob1_rdma_frag_callback_t cbfunc;
54
55 uint64_t rdma_offset;
56 void *local_address;
57 mca_btl_base_registration_handle_t *local_handle;
58
59 uint64_t remote_address;
60 uint8_t remote_handle[MCA_BTL_REG_HANDLE_MAX_SIZE];
61 };
62 typedef struct mca_pml_ob1_rdma_frag_t mca_pml_ob1_rdma_frag_t;
63
64 OBJ_CLASS_DECLARATION(mca_pml_ob1_rdma_frag_t);
65
66
67 #define MCA_PML_OB1_RDMA_FRAG_ALLOC(frag) \
68 do { \
69 frag = (mca_pml_ob1_rdma_frag_t *) \
70 opal_free_list_wait (&mca_pml_ob1.rdma_frags); \
71 } while(0)
72
73 #define MCA_PML_OB1_RDMA_FRAG_RETURN(frag) \
74 do { \
75 if (frag->local_handle) { \
76 mca_bml_base_deregister_mem (frag->rdma_bml, frag->local_handle); \
77 frag->local_handle = NULL; \
78 } \
79 opal_free_list_return (&mca_pml_ob1.rdma_frags, \
80 (opal_free_list_item_t*)frag); \
81 } while (0)
82
83 END_C_DECLS
84
85 #endif
86