2011-11-02 15:07:57 +00:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2011-10-20 21:39:44 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2013-07-11 20:54:12 +00:00
|
|
|
* Copyright (c) 2004-2009 The University of Tennessee and The University
|
2011-10-20 21:39:44 +00:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
|
|
|
|
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
|
2013-03-27 22:10:02 +00:00
|
|
|
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
|
2011-10-20 21:39:44 +00:00
|
|
|
* reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MCA_BTL_VADER_SEND_FRAG_H
|
|
|
|
#define MCA_BTL_VADER_SEND_FRAG_H
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
2014-01-06 19:51:44 +00:00
|
|
|
enum {
|
|
|
|
MCA_BTL_VADER_FLAG_INLINE = 0,
|
|
|
|
MCA_BTL_VADER_FLAG_SINGLE_COPY = 1,
|
|
|
|
MCA_BTL_VADER_FLAG_COMPLETE = 2,
|
|
|
|
};
|
2013-07-11 20:54:12 +00:00
|
|
|
|
|
|
|
struct mca_btl_vader_frag_t;
|
2014-01-06 19:51:44 +00:00
|
|
|
struct mca_btl_vader_fbox_t;
|
2011-10-25 18:38:42 +00:00
|
|
|
|
2011-10-20 21:39:44 +00:00
|
|
|
struct mca_btl_vader_hdr_t {
|
2012-03-15 20:12:59 +00:00
|
|
|
volatile intptr_t next; /* next item in fifo. many peers may touch this */
|
2013-07-11 20:54:12 +00:00
|
|
|
struct mca_btl_vader_frag_t *frag;
|
2011-10-25 19:21:45 +00:00
|
|
|
mca_btl_base_tag_t tag; /* tag associated with this fragment (used to lookup callback) */
|
2013-07-11 20:54:12 +00:00
|
|
|
uint8_t flags; /* vader send flags */
|
2014-04-24 17:36:03 +00:00
|
|
|
uint16_t seqn;
|
2014-01-06 19:51:44 +00:00
|
|
|
int32_t len; /* length of data following this header */
|
2012-12-13 23:18:53 +00:00
|
|
|
struct iovec sc_iov; /* io vector containing pointer to single-copy data */
|
2011-10-20 21:39:44 +00:00
|
|
|
};
|
|
|
|
typedef struct mca_btl_vader_hdr_t mca_btl_vader_hdr_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* shared memory send fragment derived type.
|
|
|
|
*/
|
|
|
|
struct mca_btl_vader_frag_t {
|
|
|
|
mca_btl_base_descriptor_t base;
|
2012-12-13 23:18:53 +00:00
|
|
|
mca_btl_base_segment_t segments[2];
|
2011-10-20 21:39:44 +00:00
|
|
|
struct mca_btl_base_endpoint_t *endpoint;
|
2014-01-06 19:51:44 +00:00
|
|
|
struct mca_btl_vader_fbox_t *fbox;
|
2012-02-22 18:32:40 +00:00
|
|
|
mca_btl_vader_hdr_t *hdr; /* in the shared memory region */
|
2011-10-20 21:39:44 +00:00
|
|
|
ompi_free_list_t *my_list;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct mca_btl_vader_frag_t mca_btl_vader_frag_t;
|
|
|
|
|
2014-01-06 19:51:44 +00:00
|
|
|
static inline int mca_btl_vader_frag_alloc (mca_btl_vader_frag_t **frag, ompi_free_list_t *list,
|
|
|
|
struct mca_btl_base_endpoint_t *endpoint) {
|
2012-03-15 20:12:46 +00:00
|
|
|
ompi_free_list_item_t *item;
|
2011-10-20 21:39:44 +00:00
|
|
|
|
2013-07-12 17:55:33 +00:00
|
|
|
OMPI_FREE_LIST_GET_MT(list, item);
|
2012-03-15 20:12:46 +00:00
|
|
|
*frag = (mca_btl_vader_frag_t *) item;
|
|
|
|
if (OPAL_LIKELY(NULL != item)) {
|
2013-03-27 22:10:02 +00:00
|
|
|
if (NULL == (*frag)->hdr) {
|
2013-07-12 17:55:33 +00:00
|
|
|
OMPI_FREE_LIST_RETURN_MT(list, (ompi_free_list_item_t *)*frag);
|
2013-03-27 22:10:02 +00:00
|
|
|
*frag = NULL;
|
|
|
|
return OMPI_ERR_TEMP_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
2014-01-06 19:51:44 +00:00
|
|
|
(*frag)->endpoint = endpoint;
|
2012-03-15 20:12:46 +00:00
|
|
|
}
|
2011-10-20 21:39:44 +00:00
|
|
|
|
2013-07-12 17:55:33 +00:00
|
|
|
return OMPI_SUCCESS;
|
2012-03-15 20:12:46 +00:00
|
|
|
}
|
2011-10-20 21:39:44 +00:00
|
|
|
|
2014-01-06 19:51:44 +00:00
|
|
|
static inline void mca_btl_vader_frag_return (mca_btl_vader_frag_t *frag)
|
|
|
|
{
|
|
|
|
frag->hdr->flags = 0;
|
|
|
|
frag->segments[0].seg_addr.pval = (char *)(frag->hdr + 1);
|
2014-07-10 16:31:15 +00:00
|
|
|
frag->base.des_local_count = 1;
|
2014-01-06 19:51:44 +00:00
|
|
|
frag->fbox = NULL;
|
|
|
|
|
|
|
|
OMPI_FREE_LIST_RETURN_MT(frag->my_list, (ompi_free_list_item_t *)frag);
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_CLASS_DECLARATION(mca_btl_vader_frag_t);
|
|
|
|
|
|
|
|
#define MCA_BTL_VADER_FRAG_ALLOC_EAGER(frag, endpoint) \
|
|
|
|
mca_btl_vader_frag_alloc (&(frag), &mca_btl_vader_component.vader_frags_eager, endpoint)
|
|
|
|
|
|
|
|
#if !OMPI_BTL_VADER_HAVE_XPMEM
|
|
|
|
#define MCA_BTL_VADER_FRAG_ALLOC_MAX(frag, endpoint) \
|
|
|
|
mca_btl_vader_frag_alloc (&(frag), &mca_btl_vader_component.vader_frags_max_send, endpoint)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define MCA_BTL_VADER_FRAG_ALLOC_USER(frag, endpoint) \
|
|
|
|
mca_btl_vader_frag_alloc (&(frag), &mca_btl_vader_component.vader_frags_user, endpoint)
|
2013-03-27 22:10:02 +00:00
|
|
|
|
|
|
|
#define MCA_BTL_VADER_FRAG_RETURN(frag) mca_btl_vader_frag_return(frag)
|
|
|
|
|
2012-03-15 20:12:46 +00:00
|
|
|
|
|
|
|
static inline void mca_btl_vader_frag_complete (mca_btl_vader_frag_t *frag) {
|
|
|
|
if (OPAL_UNLIKELY(MCA_BTL_DES_SEND_ALWAYS_CALLBACK & frag->base.des_flags)) {
|
|
|
|
/* completion callback */
|
|
|
|
frag->base.des_cbfunc(&mca_btl_vader.super, frag->endpoint,
|
|
|
|
&frag->base, OMPI_SUCCESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (OPAL_LIKELY(frag->base.des_flags & MCA_BTL_DES_FLAGS_BTL_OWNERSHIP)) {
|
|
|
|
MCA_BTL_VADER_FRAG_RETURN(frag);
|
|
|
|
}
|
|
|
|
}
|
2011-10-20 21:39:44 +00:00
|
|
|
|
2013-03-27 22:10:02 +00:00
|
|
|
void mca_btl_vader_frag_init (ompi_free_list_item_t *item, void *ctx);
|
|
|
|
|
2011-10-20 21:39:44 +00:00
|
|
|
#endif /* MCA_BTL_VADER_SEND_FRAG_H */
|