2012-02-10 04:47:29 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2011-2012 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2011 UT-Battelle, LLC. All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if !defined(MCA_BTL_UGNI_SMSG_H)
|
|
|
|
#define MCA_BTL_UGNI_SMSG_H
|
|
|
|
|
|
|
|
#include "btl_ugni.h"
|
|
|
|
#include "btl_ugni_endpoint.h"
|
2012-04-20 01:51:55 +04:00
|
|
|
#include "btl_ugni_frag.h"
|
|
|
|
#include "btl_ugni_rdma.h"
|
2012-02-10 04:47:29 +04:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
MCA_BTL_UGNI_TAG_SEND,
|
|
|
|
MCA_BTL_UGNI_TAG_DISCONNECT,
|
|
|
|
MCA_BTL_UGNI_TAG_GET_INIT,
|
2012-03-16 00:13:32 +04:00
|
|
|
MCA_BTL_UGNI_TAG_RDMA_COMPLETE
|
2012-02-10 04:47:29 +04:00
|
|
|
} mca_btl_ugni_smsg_tag_t;
|
|
|
|
|
2012-06-01 00:02:41 +04:00
|
|
|
typedef struct mca_btl_ugni_smsg_mbox_t {
|
|
|
|
ompi_free_list_item_t super;
|
|
|
|
gni_smsg_attr_t smsg_attrib;
|
|
|
|
} mca_btl_ugni_smsg_mbox_t;
|
|
|
|
|
|
|
|
OBJ_CLASS_DECLARATION(mca_btl_ugni_smsg_mbox_t);
|
|
|
|
|
|
|
|
int mca_btl_ugni_smsg_init (mca_btl_ugni_module_t *ugni_module);
|
2012-04-20 01:51:55 +04:00
|
|
|
int mca_btl_ugni_smsg_process (mca_btl_base_endpoint_t *ep);
|
|
|
|
int mca_btl_ugni_progress_remote_smsg (mca_btl_ugni_module_t *btl);
|
|
|
|
|
2012-05-07 21:23:06 +04:00
|
|
|
static inline int mca_btl_ugni_progress_local_smsg (mca_btl_ugni_module_t *ugni_module)
|
2012-04-20 01:51:55 +04:00
|
|
|
{
|
2012-05-07 21:23:06 +04:00
|
|
|
mca_btl_ugni_base_frag_t *frag;
|
2012-04-20 01:51:55 +04:00
|
|
|
gni_cq_entry_t event_data;
|
2012-06-01 00:02:41 +04:00
|
|
|
gni_return_t grc;
|
2012-04-20 01:51:55 +04:00
|
|
|
|
2012-06-01 00:02:41 +04:00
|
|
|
grc = GNI_CqGetEvent (ugni_module->smsg_local_cq, &event_data);
|
|
|
|
if (GNI_RC_NOT_DONE == grc) {
|
2012-04-20 01:51:55 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2012-06-01 00:02:41 +04:00
|
|
|
if (OPAL_UNLIKELY((GNI_RC_SUCCESS != grc && !event_data) || GNI_CQ_OVERRUN(event_data))) {
|
2012-04-20 01:51:55 +04:00
|
|
|
/* TODO -- need to handle overrun -- how do we do this without an event?
|
|
|
|
will the event eventually come back? Ask Cray */
|
|
|
|
BTL_ERROR(("post error! cq overrun = %d", (int)GNI_CQ_OVERRUN(event_data)));
|
|
|
|
assert (0);
|
2012-06-01 00:02:41 +04:00
|
|
|
return ompi_common_rc_ugni_to_ompi (grc);
|
2012-04-20 01:51:55 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
assert (GNI_CQ_GET_TYPE(event_data) == GNI_CQ_EVENT_TYPE_SMSG);
|
|
|
|
|
2012-05-07 21:23:06 +04:00
|
|
|
frag = (mca_btl_ugni_base_frag_t *) opal_pointer_array_get_item (&ugni_module->pending_smsg_frags_bb,
|
2012-06-01 00:02:41 +04:00
|
|
|
GNI_CQ_GET_MSG_ID(event_data));
|
2012-05-07 21:23:06 +04:00
|
|
|
if (OPAL_UNLIKELY(NULL == frag)) {
|
2012-06-01 00:02:41 +04:00
|
|
|
assert (0);
|
2012-05-07 21:23:06 +04:00
|
|
|
return OMPI_ERROR;
|
2012-04-20 01:51:55 +04:00
|
|
|
}
|
|
|
|
|
2012-06-01 00:02:41 +04:00
|
|
|
if (!(frag->flags & MCA_BTL_UGNI_FRAG_IGNORE)) {
|
|
|
|
mca_btl_ugni_frag_complete (frag, OMPI_SUCCESS);
|
|
|
|
}
|
2012-05-07 21:23:06 +04:00
|
|
|
|
2012-04-20 01:51:55 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2012-02-10 04:47:29 +04:00
|
|
|
static inline int ompi_mca_btl_ugni_smsg_send (mca_btl_ugni_base_frag_t *frag,
|
|
|
|
void *hdr, size_t hdr_len,
|
|
|
|
void *payload, size_t payload_len,
|
|
|
|
mca_btl_ugni_smsg_tag_t tag) {
|
2012-03-16 00:13:32 +04:00
|
|
|
gni_return_t grc;
|
|
|
|
|
2012-06-01 00:02:41 +04:00
|
|
|
grc = GNI_SmsgSendWTag (frag->endpoint->smsg_ep_handle, hdr, hdr_len,
|
|
|
|
payload, payload_len, frag->msg_id, tag);
|
2012-04-24 01:11:57 +04:00
|
|
|
|
|
|
|
(void) mca_btl_ugni_progress_local_smsg ((mca_btl_ugni_module_t *) frag->endpoint->btl);
|
|
|
|
|
2012-05-07 21:23:06 +04:00
|
|
|
if (OPAL_LIKELY(GNI_RC_SUCCESS == grc)) {
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2012-02-10 04:47:29 +04:00
|
|
|
|
2012-05-07 21:23:06 +04:00
|
|
|
if (OPAL_LIKELY(GNI_RC_NOT_DONE == grc)) {
|
|
|
|
BTL_VERBOSE(("out of credits"));
|
2012-04-20 01:51:55 +04:00
|
|
|
|
2012-05-07 21:23:06 +04:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2012-02-10 04:47:29 +04:00
|
|
|
}
|
|
|
|
|
2012-05-07 21:23:06 +04:00
|
|
|
BTL_ERROR(("GNI_SmsgSendWTag failed with rc = %d. handle = %lu, hdr_len = %d, payload_len = %d",
|
|
|
|
grc, (uintptr_t) frag->endpoint->smsg_ep_handle, (int) hdr_len, (int) payload_len));
|
|
|
|
|
|
|
|
return OMPI_ERROR;
|
2012-02-10 04:47:29 +04:00
|
|
|
}
|
|
|
|
|
2012-06-01 00:02:41 +04:00
|
|
|
static inline int mca_btl_ugni_send_frag (struct mca_btl_base_endpoint_t *btl_peer,
|
|
|
|
mca_btl_ugni_base_frag_t *frag) {
|
|
|
|
if (OPAL_LIKELY(!(frag->flags & MCA_BTL_UGNI_FRAG_EAGER))) {
|
|
|
|
return ompi_mca_btl_ugni_smsg_send (frag, &frag->hdr.send, frag->hdr_size,
|
2012-06-21 21:09:12 +04:00
|
|
|
frag->segments[1].base.seg_addr.pval,
|
|
|
|
frag->segments[1].base.seg_len,
|
2012-06-01 00:02:41 +04:00
|
|
|
MCA_BTL_UGNI_TAG_SEND);
|
|
|
|
}
|
|
|
|
|
2012-06-29 19:43:29 +04:00
|
|
|
frag->hdr.eager.src_seg = frag->segments[1];
|
2012-06-01 00:02:41 +04:00
|
|
|
frag->hdr.eager.ctx = (void *) frag;
|
|
|
|
|
|
|
|
return ompi_mca_btl_ugni_smsg_send (frag, &frag->hdr.eager, frag->hdr_size,
|
|
|
|
NULL, 0, MCA_BTL_UGNI_TAG_GET_INIT);
|
|
|
|
}
|
|
|
|
|
2012-02-10 04:47:29 +04:00
|
|
|
#endif /* MCA_BTL_UGNI_SMSG_H */
|