OpenMPI  0.1.1
btl_ugni_frag.h
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2011-2012 Los Alamos National Security, LLC. All rights
4  * reserved.
5  * Copyright (c) 2011 UT-Battelle, LLC. All rights reserved.
6  * $COPYRIGHT$
7  *
8  * Additional copyrights may follow
9  *
10  * $HEADER$
11  */
12 
13 #if !defined(MCA_BTL_UGNI_FRAG_H)
14 #define MCA_BTL_UGNI_FRAG_H
15 
16 #include "btl_ugni.h"
17 #include "btl_ugni_endpoint.h"
18 
20  size_t len;
21  mca_btl_base_tag_t tag;
23 
25  mca_btl_base_segment_t src_seg;
26  mca_btl_base_segment_t dst_seg;
27  void *ctx;
29 
31  size_t len;
32  mca_btl_base_tag_t tag;
33  mca_btl_base_segment_t src_seg;
34  void *ctx;
36 
37 typedef union mca_btl_ugni_frag_hdr_t {
42 
43 typedef struct mca_btl_ugni_base_frag_t {
45  mca_btl_base_segment_t segments[2];
48  mca_btl_base_endpoint_t *endpoint;
49  mca_btl_ugni_reg_t *registration;
50  ompi_free_list_t *my_list;
51  uint32_t msg_id;
53 
57 
58 #define MCA_BTL_UGNI_DESC_TO_FRAG(desc) \
59  ((mca_btl_ugni_base_frag_t *)((uintptr_t) (desc) - offsetof (mca_btl_ugni_base_frag_t, post_desc)))
60 
64 
65 void mca_btl_ugni_frag_init (mca_btl_ugni_base_frag_t *frag, mca_btl_ugni_module_t *ugni_module);
66 
67 static inline int mca_btl_ugni_frag_alloc (mca_btl_base_endpoint_t *ep,
68  ompi_free_list_t *list,
70 {
71  ompi_free_list_item_t *item = NULL;
72  int rc;
73 
74  OMPI_FREE_LIST_GET(list, item, rc);
75  *frag = (mca_btl_ugni_base_frag_t *) item;
76  if (OPAL_LIKELY(NULL != item)) {
77  (*frag)->my_list = list;
78  (*frag)->endpoint = ep;
79  }
80 
81  return rc;
82 }
83 
84 static inline void mca_btl_ugni_frag_return (mca_btl_ugni_base_frag_t *frag)
85 {
86  if (frag->registration) {
87  frag->endpoint->btl->super.btl_mpool->mpool_deregister(frag->endpoint->btl->super.btl_mpool,
88  &frag->registration->base);
89  frag->registration = NULL;
90  }
91 
92  OMPI_FREE_LIST_RETURN(frag->my_list, (ompi_free_list_item_t *) frag);
93 }
94 
95 #define MCA_BTL_UGNI_FRAG_ALLOC_SMSG(ep, frag) \
96  mca_btl_ugni_frag_alloc((ep), &(ep)->btl->smsg_frags, &(frag))
97 #define MCA_BTL_UGNI_FRAG_ALLOC_RDMA(ep, frag) \
98  mca_btl_ugni_frag_alloc((ep), &(ep)->btl->rdma_frags, &(frag))
99 #define MCA_BTL_UGNI_FRAG_ALLOC_RDMA_INT(ep, frag) \
100  mca_btl_ugni_frag_alloc((ep), &(ep)->btl->rdma_int_frags, &(frag))
101 #define MCA_BTL_UGNI_FRAG_ALLOC_EAGER_SEND(ep, frag) \
102  mca_btl_ugni_frag_alloc((ep), &(ep)->btl->eager_frags_send, &(frag))
103 #define MCA_BTL_UGNI_FRAG_ALLOC_EAGER_RECV(ep, frag) \
104  mca_btl_ugni_frag_alloc((ep), &(ep)->btl->eager_frags_recv, &(frag))
105 
106 #endif /* MCA_BTL_UGNI_FRAG_H */
A descriptor that holds the parameters to a send/put/get operation along w/ a callback routine that i...
Definition: btl.h:275
Definition: btl_ugni_frag.h:43
Definition: btl_ugni.h:51
Definition: btl_ugni_frag.h:24
Definition: ompi_free_list.h:39
mca_mpool_base_module_deregister_fn_t mpool_deregister
deregister memory
Definition: mpool.h:181
Definition: btl_ugni_frag.h:19
State of ELAN endpoint connection.
Definition: btl_elan_endpoint.h:33
Definition: ompi_free_list.h:62
Definition: btl_ugni_frag.h:30
mca_mpool_base_module_t * btl_mpool
the mpool associated with this btl (optional)
Definition: btl.h:818
Definition: btl_ugni.h:241
Definition: common_ugni.h:81
Definition: btl_ugni_frag.h:37
Describes a region/segment of memory that is addressable by an BTL.
Definition: btl.h:236
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236