2006-03-26 12:30:50 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2006 Voltaire All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MCA_BTL_OPENIB_EAGER_RDMA_BUF_H
|
|
|
|
#define MCA_BTL_OPENIB_EAGER_RDMA_BUF_H
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
#include "btl_openib.h"
|
|
|
|
#include "btl_openib_endpoint.h"
|
|
|
|
#include "ompi/mca/mpool/openib/mpool_openib.h"
|
|
|
|
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct mca_btl_openib_eager_rdma_local_t {
|
|
|
|
ompi_ptr_t base; /**< buffer for RDMAing eager messages */
|
|
|
|
mca_mpool_openib_registration_t *reg;
|
|
|
|
uint16_t head; /**< RDMA buffer to poll */
|
|
|
|
uint16_t tail; /**< Needed for credit managment */
|
|
|
|
int32_t credits; /**< number of RDMA credits */
|
2006-06-28 15:25:09 +04:00
|
|
|
#if OMPI_ENABLE_DEBUG
|
2006-03-26 12:30:50 +04:00
|
|
|
uint32_t seq;
|
|
|
|
#endif
|
|
|
|
opal_mutex_t lock; /**< guard access to RDMA buffer */
|
|
|
|
};
|
|
|
|
typedef struct mca_btl_openib_eager_rdma_local_t mca_btl_openib_eager_rdma_local_t;
|
|
|
|
|
|
|
|
struct mca_btl_openib_eager_rdma_remote_t {
|
|
|
|
ompi_ptr_t base; /**< address of remote buffer */
|
2006-05-25 15:05:12 +04:00
|
|
|
uint32_t rkey; /**< RKey for accessing remote buffer */
|
2006-03-26 12:30:50 +04:00
|
|
|
uint16_t head; /**< RDMA buffer to post to */
|
|
|
|
int32_t tokens; /**< number of rdam tokens */
|
2006-06-28 15:25:09 +04:00
|
|
|
#if OMPI_ENABLE_DEBUG
|
2006-03-26 12:30:50 +04:00
|
|
|
uint32_t seq;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
typedef struct mca_btl_openib_eager_rdma_remote_t mca_btl_openib_eager_rdma_remote_t;
|
|
|
|
|
2006-03-30 19:26:21 +04:00
|
|
|
#define MCA_BTL_OPENIB_RDMA_FRAG(F) \
|
|
|
|
((F)->type == MCA_BTL_OPENIB_FRAG_EAGER_RDMA)
|
2006-03-26 12:30:50 +04:00
|
|
|
|
|
|
|
#define EAGER_RDMA_BUFFER_REMOTE (0)
|
|
|
|
#define EAGER_RDMA_BUFFER_LOCAL (0xff)
|
|
|
|
|
|
|
|
#ifdef WORDS_BIGENDIAN
|
|
|
|
#define MCA_BTL_OPENIB_RDMA_FRAG_GET_SIZE(F) ((F)->u.size >> 8)
|
|
|
|
#define MCA_BTL_OPENIB_RDMA_FRAG_SET_SIZE(F, S) \
|
|
|
|
((F)->u.size = (S) << 8)
|
|
|
|
#else
|
|
|
|
#define MCA_BTL_OPENIB_RDMA_FRAG_GET_SIZE(F) ((F)->u.size & 0x00ffffff)
|
|
|
|
#define MCA_BTL_OPENIB_RDMA_FRAG_SET_SIZE(F, S) \
|
|
|
|
((F)->u.size = (S) & 0x00ffffff)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define MCA_BTL_OPENIB_RDMA_FRAG_LOCAL(F) \
|
|
|
|
(((volatile uint8_t*)(F)->ftr->u.buf)[3] != EAGER_RDMA_BUFFER_REMOTE)
|
|
|
|
|
|
|
|
#define MCA_BTL_OPENIB_RDMA_FRAG_REMOTE(F) \
|
|
|
|
(!MCA_BTL_OPENIB_RDMA_FRAG_LOCAL(F))
|
|
|
|
|
|
|
|
#define MCA_BTL_OPENIB_RDMA_MAKE_REMOTE(F) do { \
|
|
|
|
((volatile uint8_t*)(F)->u.buf)[3] = EAGER_RDMA_BUFFER_REMOTE; \
|
|
|
|
}while (0)
|
|
|
|
|
|
|
|
#define MCA_BTL_OPENIB_RDMA_MAKE_LOCAL(F) do { \
|
|
|
|
((volatile uint8_t*)(F)->u.buf)[3] = EAGER_RDMA_BUFFER_LOCAL; \
|
|
|
|
}while (0)
|
|
|
|
|
|
|
|
#define MCA_BTL_OPENIB_GET_LOCAL_RDMA_FRAG(E, I) \
|
2006-04-02 15:32:25 +04:00
|
|
|
(mca_btl_openib_frag_t*) \
|
|
|
|
((char*)(E)->eager_rdma_local.base.pval + \
|
2006-03-26 12:30:50 +04:00
|
|
|
(I) * (E)->endpoint_btl->eager_rdma_frag_size)
|
|
|
|
|
2006-06-28 16:00:47 +04:00
|
|
|
#define MCA_BTL_OPENIB_RDMA_NEXT_INDEX(I) do { \
|
|
|
|
(I) = ((I) + 1); \
|
|
|
|
if((I) == \
|
|
|
|
mca_btl_openib_component.eager_rdma_num) \
|
|
|
|
(I) = 0; \
|
2006-03-26 12:30:50 +04:00
|
|
|
} while (0)
|
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|