This source file includes following definitions.
- mca_btl_ugni_progress_local_smsg
- opal_mca_btl_ugni_smsg_send
- mca_btl_ugni_send_frag
1
2
3
4
5
6
7
8
9
10
11
12
13 #if !defined(MCA_BTL_UGNI_SMSG_H)
14 #define MCA_BTL_UGNI_SMSG_H
15
16 #include "btl_ugni.h"
17 #include "btl_ugni_endpoint.h"
18 #include "btl_ugni_frag.h"
19 #include "btl_ugni_rdma.h"
20
21 typedef enum {
22 MCA_BTL_UGNI_TAG_SEND,
23 MCA_BTL_UGNI_TAG_DISCONNECT,
24 MCA_BTL_UGNI_TAG_GET_INIT,
25 MCA_BTL_UGNI_TAG_RDMA_COMPLETE
26 } mca_btl_ugni_smsg_tag_t;
27
28 typedef struct mca_btl_ugni_smsg_mbox_t {
29 opal_free_list_item_t super;
30 mca_btl_ugni_endpoint_attr_t attr;
31 } mca_btl_ugni_smsg_mbox_t;
32
33 OBJ_CLASS_DECLARATION(mca_btl_ugni_smsg_mbox_t);
34
35 int mca_btl_ugni_smsg_init (mca_btl_ugni_module_t *ugni_module);
36 int mca_btl_ugni_smsg_process (mca_btl_base_endpoint_t *ep);
37 int mca_btl_ugni_progress_remote_smsg (mca_btl_ugni_module_t *btl);
38
39 static inline int mca_btl_ugni_progress_local_smsg (mca_btl_ugni_module_t *ugni_module, mca_btl_ugni_device_t *device)
40 {
41 mca_btl_ugni_base_frag_t *frag;
42 gni_cq_entry_t event_data;
43 gni_return_t grc;
44
45 grc = mca_btl_ugni_cq_get_event (device, &device->dev_smsg_local_cq, &event_data);
46 if (GNI_RC_NOT_DONE == grc) {
47 return OPAL_SUCCESS;
48 }
49
50 if (OPAL_UNLIKELY((GNI_RC_SUCCESS != grc && !event_data) || GNI_CQ_OVERRUN(event_data))) {
51
52
53 return mca_btl_ugni_event_fatal_error (grc, event_data);
54 }
55
56 assert (GNI_CQ_GET_TYPE(event_data) == GNI_CQ_EVENT_TYPE_SMSG);
57
58 frag = (mca_btl_ugni_base_frag_t *) opal_pointer_array_get_item (&ugni_module->pending_smsg_frags_bb,
59 GNI_CQ_GET_MSG_ID(event_data));
60 if (OPAL_UNLIKELY(NULL == frag)) {
61 assert (0);
62 return OPAL_ERROR;
63 }
64
65 frag->flags |= MCA_BTL_UGNI_FRAG_SMSG_COMPLETE;
66
67 if (!(frag->flags & MCA_BTL_UGNI_FRAG_IGNORE)) {
68 mca_btl_ugni_frag_complete (frag, OPAL_SUCCESS);
69 }
70
71 return 1;
72 }
73
74 static inline int opal_mca_btl_ugni_smsg_send (mca_btl_ugni_base_frag_t *frag,
75 void *hdr, size_t hdr_len,
76 void *payload, size_t payload_len,
77 mca_btl_ugni_smsg_tag_t tag)
78 {
79 mca_btl_base_endpoint_t *endpoint = frag->endpoint;
80 mca_btl_ugni_module_t *ugni_module = mca_btl_ugni_ep_btl (endpoint);
81 gni_return_t grc;
82
83 grc = mca_btl_ugni_endpoint_smsg_send_wtag (endpoint, hdr, hdr_len, payload, payload_len,
84 frag->msg_id, tag);
85 if (OPAL_LIKELY(GNI_RC_SUCCESS == grc)) {
86 if (mca_btl_ugni_component.progress_thread_enabled) {
87 if (frag->base.des_flags & MCA_BTL_DES_FLAGS_SIGNAL) {
88
89 (void) mca_btl_ugni_post_cqwrite (endpoint, &ugni_module->devices[0].dev_rdma_local_cq,
90 endpoint->rmt_irq_mem_hndl, 0xdead, NULL, NULL, NULL);
91 }
92 }
93
94 (void) mca_btl_ugni_progress_local_smsg (ugni_module, endpoint->smsg_ep_handle.device);
95 return OPAL_SUCCESS;
96 }
97
98 if (OPAL_LIKELY(GNI_RC_NOT_DONE == grc)) {
99 BTL_VERBOSE(("out of credits"));
100
101 return OPAL_ERR_OUT_OF_RESOURCE;
102 }
103
104 BTL_ERROR(("GNI_SmsgSendWTag failed with rc = %d. handle = %lu, hdr_len = %d, payload_len = %d",
105 grc, (uintptr_t) frag->endpoint->smsg_ep_handle.gni_handle, (int) hdr_len,
106 (int) payload_len));
107
108 return OPAL_ERROR;
109 }
110
111 static inline int mca_btl_ugni_send_frag (struct mca_btl_base_endpoint_t *btl_peer,
112 mca_btl_ugni_base_frag_t *frag) {
113 if (OPAL_LIKELY(!(frag->flags & MCA_BTL_UGNI_FRAG_EAGER))) {
114 return opal_mca_btl_ugni_smsg_send (frag, &frag->hdr.send, frag->hdr_size,
115 frag->segments[1].seg_addr.pval,
116 frag->segments[1].seg_len,
117 MCA_BTL_UGNI_TAG_SEND);
118 }
119
120 frag->hdr.eager.size = frag->segments[1].seg_len;
121 frag->hdr.eager.address = frag->segments[1].seg_addr.lval;
122 frag->hdr.eager.ctx = (void *) frag;
123
124 return opal_mca_btl_ugni_smsg_send (frag, &frag->hdr.eager, frag->hdr_size,
125 NULL, 0, MCA_BTL_UGNI_TAG_GET_INIT);
126 }
127
128 #endif