2011-12-10 01:24:07 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
|
|
|
/*
|
2013-01-04 03:11:13 +04:00
|
|
|
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
|
2011-12-10 01:24:07 +04:00
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2011 UT-Battelle, LLC. All rights reserved.
|
2013-07-04 12:34:37 +04:00
|
|
|
* Copyright (c) 2013 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2011-12-10 01:24:07 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if !defined(MCA_BTL_UGNI_FRAG_H)
|
|
|
|
#define MCA_BTL_UGNI_FRAG_H
|
|
|
|
|
|
|
|
#include "btl_ugni.h"
|
|
|
|
#include "btl_ugni_endpoint.h"
|
|
|
|
|
2012-06-29 19:43:29 +04:00
|
|
|
typedef struct mca_btl_ugni_segment_t {
|
|
|
|
mca_btl_base_segment_t base;
|
|
|
|
gni_mem_handle_t memory_handle;
|
|
|
|
uint8_t extra_bytes[3];
|
|
|
|
uint8_t extra_byte_count;
|
|
|
|
} mca_btl_ugni_segment_t;
|
|
|
|
|
2012-02-10 04:47:29 +04:00
|
|
|
typedef struct mca_btl_ugni_send_frag_hdr_t {
|
2012-04-20 01:51:55 +04:00
|
|
|
uint32_t lag;
|
2012-02-10 04:47:29 +04:00
|
|
|
} mca_btl_ugni_send_frag_hdr_t;
|
2011-12-10 01:24:07 +04:00
|
|
|
|
2012-04-20 01:51:55 +04:00
|
|
|
typedef struct mca_btl_ugni_send_ex_frag_hdr_t {
|
|
|
|
mca_btl_ugni_send_frag_hdr_t send;
|
|
|
|
uint8_t pml_header[128];
|
|
|
|
} mca_btl_ugni_send_ex_frag_hdr_t;
|
|
|
|
|
2012-02-10 04:47:29 +04:00
|
|
|
typedef struct mca_btl_ugni_rdma_frag_hdr_t {
|
|
|
|
void *ctx;
|
|
|
|
} mca_btl_ugni_rdma_frag_hdr_t;
|
|
|
|
|
|
|
|
typedef struct mca_btl_ugni_eager_frag_hdr_t {
|
2012-04-20 01:51:55 +04:00
|
|
|
mca_btl_ugni_send_frag_hdr_t send;
|
2012-06-29 19:43:29 +04:00
|
|
|
mca_btl_ugni_segment_t src_seg;
|
2012-02-10 04:47:29 +04:00
|
|
|
void *ctx;
|
|
|
|
} mca_btl_ugni_eager_frag_hdr_t;
|
|
|
|
|
2012-04-20 01:51:55 +04:00
|
|
|
typedef struct mca_btl_ugni_eager_ex_frag_hdr_t {
|
2012-02-10 04:47:29 +04:00
|
|
|
mca_btl_ugni_eager_frag_hdr_t eager;
|
2012-04-20 01:51:55 +04:00
|
|
|
uint8_t pml_header[128];
|
|
|
|
} mca_btl_ugni_eager_ex_frag_hdr_t;
|
|
|
|
|
|
|
|
typedef union mca_btl_ugni_frag_hdr_t {
|
|
|
|
mca_btl_ugni_send_frag_hdr_t send;
|
|
|
|
mca_btl_ugni_send_ex_frag_hdr_t send_ex;
|
|
|
|
mca_btl_ugni_rdma_frag_hdr_t rdma;
|
|
|
|
mca_btl_ugni_eager_frag_hdr_t eager;
|
|
|
|
mca_btl_ugni_eager_ex_frag_hdr_t eager_ex;
|
2012-02-10 04:47:29 +04:00
|
|
|
} mca_btl_ugni_frag_hdr_t;
|
|
|
|
|
2012-05-07 21:23:06 +04:00
|
|
|
enum {
|
2013-01-04 03:11:13 +04:00
|
|
|
MCA_BTL_UGNI_FRAG_BUFFERED = 1, /* frag data is buffered */
|
|
|
|
MCA_BTL_UGNI_FRAG_COMPLETE = 2, /* smsg complete for frag */
|
|
|
|
MCA_BTL_UGNI_FRAG_EAGER = 4, /* eager get frag */
|
|
|
|
MCA_BTL_UGNI_FRAG_IGNORE = 8, /* ignore local smsg completion */
|
|
|
|
MCA_BTL_UGNI_FRAG_SMSG_COMPLETE = 16 /* SMSG has completed for this message */
|
2012-05-07 21:23:06 +04:00
|
|
|
};
|
|
|
|
|
2012-06-01 00:02:41 +04:00
|
|
|
struct mca_btl_ugni_base_frag_t;
|
|
|
|
|
|
|
|
typedef void (*frag_cb_t) (struct mca_btl_ugni_base_frag_t *, int);
|
|
|
|
|
2012-02-10 04:47:29 +04:00
|
|
|
typedef struct mca_btl_ugni_base_frag_t {
|
2012-06-01 00:02:41 +04:00
|
|
|
mca_btl_base_descriptor_t base;
|
2013-01-04 03:11:13 +04:00
|
|
|
uint32_t msg_id;
|
|
|
|
uint16_t hdr_size;
|
|
|
|
uint16_t flags;
|
2012-06-01 00:02:41 +04:00
|
|
|
mca_btl_ugni_frag_hdr_t hdr;
|
2012-06-21 21:09:12 +04:00
|
|
|
mca_btl_ugni_segment_t segments[2];
|
2011-12-10 01:24:07 +04:00
|
|
|
ompi_common_ugni_post_desc_t post_desc;
|
2012-06-01 00:02:41 +04:00
|
|
|
mca_btl_base_endpoint_t *endpoint;
|
|
|
|
mca_btl_ugni_reg_t *registration;
|
|
|
|
ompi_free_list_t *my_list;
|
|
|
|
frag_cb_t cbfunc;
|
2012-02-10 04:47:29 +04:00
|
|
|
} mca_btl_ugni_base_frag_t;
|
2011-12-10 01:24:07 +04:00
|
|
|
|
2012-02-10 04:47:29 +04:00
|
|
|
typedef struct mca_btl_ugni_base_frag_t mca_btl_ugni_smsg_frag_t;
|
2011-12-10 01:24:07 +04:00
|
|
|
typedef struct mca_btl_ugni_base_frag_t mca_btl_ugni_rdma_frag_t;
|
2012-02-10 04:47:29 +04:00
|
|
|
typedef struct mca_btl_ugni_base_frag_t mca_btl_ugni_eager_frag_t;
|
2011-12-10 01:24:07 +04:00
|
|
|
|
2012-02-10 04:47:29 +04:00
|
|
|
#define MCA_BTL_UGNI_DESC_TO_FRAG(desc) \
|
|
|
|
((mca_btl_ugni_base_frag_t *)((uintptr_t) (desc) - offsetof (mca_btl_ugni_base_frag_t, post_desc)))
|
2011-12-10 01:24:07 +04:00
|
|
|
|
2012-02-10 04:47:29 +04:00
|
|
|
OBJ_CLASS_DECLARATION(mca_btl_ugni_smsg_frag_t);
|
2011-12-10 01:24:07 +04:00
|
|
|
OBJ_CLASS_DECLARATION(mca_btl_ugni_rdma_frag_t);
|
2012-02-10 04:47:29 +04:00
|
|
|
OBJ_CLASS_DECLARATION(mca_btl_ugni_eager_frag_t);
|
|
|
|
|
2012-03-16 00:13:32 +04:00
|
|
|
void mca_btl_ugni_frag_init (mca_btl_ugni_base_frag_t *frag, mca_btl_ugni_module_t *ugni_module);
|
|
|
|
|
2012-02-10 04:47:29 +04:00
|
|
|
static inline int mca_btl_ugni_frag_alloc (mca_btl_base_endpoint_t *ep,
|
|
|
|
ompi_free_list_t *list,
|
|
|
|
mca_btl_ugni_base_frag_t **frag)
|
|
|
|
{
|
|
|
|
ompi_free_list_item_t *item = NULL;
|
|
|
|
|
2013-07-09 02:07:52 +04:00
|
|
|
OMPI_FREE_LIST_GET_MT(list, item);
|
2012-02-10 04:47:29 +04:00
|
|
|
*frag = (mca_btl_ugni_base_frag_t *) item;
|
|
|
|
if (OPAL_LIKELY(NULL != item)) {
|
|
|
|
(*frag)->my_list = list;
|
|
|
|
(*frag)->endpoint = ep;
|
2013-07-04 12:34:37 +04:00
|
|
|
return OMPI_SUCCESS;
|
2012-02-10 04:47:29 +04:00
|
|
|
}
|
|
|
|
|
2013-07-04 12:34:37 +04:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
2012-02-10 04:47:29 +04:00
|
|
|
}
|
|
|
|
|
2012-04-20 01:51:55 +04:00
|
|
|
static inline int mca_btl_ugni_frag_return (mca_btl_ugni_base_frag_t *frag)
|
2012-02-10 04:47:29 +04:00
|
|
|
{
|
|
|
|
if (frag->registration) {
|
|
|
|
frag->endpoint->btl->super.btl_mpool->mpool_deregister(frag->endpoint->btl->super.btl_mpool,
|
2013-11-18 08:58:37 +04:00
|
|
|
(mca_mpool_base_registration_t *) frag->registration);
|
2012-02-10 04:47:29 +04:00
|
|
|
frag->registration = NULL;
|
|
|
|
}
|
|
|
|
|
2013-01-04 03:11:13 +04:00
|
|
|
frag->flags = 0;
|
|
|
|
|
2013-07-09 02:07:52 +04:00
|
|
|
OMPI_FREE_LIST_RETURN_MT(frag->my_list, (ompi_free_list_item_t *) frag);
|
2012-04-20 01:51:55 +04:00
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void mca_btl_ugni_frag_complete (mca_btl_ugni_base_frag_t *frag, int rc) {
|
2012-05-07 21:23:06 +04:00
|
|
|
frag->flags |= MCA_BTL_UGNI_FRAG_COMPLETE;
|
2012-04-25 00:18:35 +04:00
|
|
|
|
2012-06-01 00:02:41 +04:00
|
|
|
BTL_VERBOSE(("frag complete. flags = %d", frag->base.des_flags));
|
|
|
|
|
|
|
|
/* call callback if specified */
|
2012-04-25 00:18:35 +04:00
|
|
|
if (frag->base.des_flags & MCA_BTL_DES_SEND_ALWAYS_CALLBACK) {
|
2012-04-20 01:51:55 +04:00
|
|
|
frag->base.des_cbfunc(&frag->endpoint->btl->super, frag->endpoint, &frag->base, rc);
|
|
|
|
}
|
|
|
|
|
2012-04-25 00:18:35 +04:00
|
|
|
if (frag->base.des_flags & MCA_BTL_DES_FLAGS_BTL_OWNERSHIP) {
|
2012-04-20 01:51:55 +04:00
|
|
|
mca_btl_ugni_frag_return (frag);
|
|
|
|
}
|
2012-02-10 04:47:29 +04:00
|
|
|
}
|
2011-12-10 01:24:07 +04:00
|
|
|
|
2012-02-10 04:47:29 +04:00
|
|
|
#define MCA_BTL_UGNI_FRAG_ALLOC_SMSG(ep, frag) \
|
2012-03-16 00:13:32 +04:00
|
|
|
mca_btl_ugni_frag_alloc((ep), &(ep)->btl->smsg_frags, &(frag))
|
2012-02-10 04:47:29 +04:00
|
|
|
#define MCA_BTL_UGNI_FRAG_ALLOC_RDMA(ep, frag) \
|
2012-03-16 00:13:32 +04:00
|
|
|
mca_btl_ugni_frag_alloc((ep), &(ep)->btl->rdma_frags, &(frag))
|
|
|
|
#define MCA_BTL_UGNI_FRAG_ALLOC_RDMA_INT(ep, frag) \
|
|
|
|
mca_btl_ugni_frag_alloc((ep), &(ep)->btl->rdma_int_frags, &(frag))
|
2012-02-10 04:47:29 +04:00
|
|
|
#define MCA_BTL_UGNI_FRAG_ALLOC_EAGER_SEND(ep, frag) \
|
|
|
|
mca_btl_ugni_frag_alloc((ep), &(ep)->btl->eager_frags_send, &(frag))
|
|
|
|
#define MCA_BTL_UGNI_FRAG_ALLOC_EAGER_RECV(ep, frag) \
|
|
|
|
mca_btl_ugni_frag_alloc((ep), &(ep)->btl->eager_frags_recv, &(frag))
|
2011-12-10 01:24:07 +04:00
|
|
|
|
|
|
|
#endif /* MCA_BTL_UGNI_FRAG_H */
|