root/opal/mca/btl/portals4/btl_portals4_frag.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2006 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
  10  *                         University of Stuttgart.  All rights reserved.
  11  * Copyright (c) 2004-2005 The Regents of the University of California.
  12  *                         All rights reserved.
  13  * Copyright (c) 2011-2015 Los Alamos National Security, LLC.
  14  *                         All rights reserved.
  15  * Copyright (c) 2014      Bull SAS.  All rights reserved.
  16  * $COPYRIGHT$
  17  *
  18  * Additional copyrights may follow
  19  *
  20  * $HEADER$
  21  */
  22 
  23 #ifndef OPAL_BTL_PORTALS4_FRAG_H
  24 #define OPAL_BTL_PORTALS4_FRAG_H
  25 
  26 #include "opal/mca/btl/btl.h"
  27 
  28 BEGIN_C_DECLS
  29 
  30 struct mca_btl_portals4_segment_t {
  31   mca_btl_base_segment_t base;
  32   ptl_match_bits_t key;
  33 };
  34 typedef struct mca_btl_portals4_segment_t mca_btl_portals4_segment_t;
  35 
  36 /**
  37  * Portals send fragment derived type
  38  */
  39 struct mca_btl_portals4_frag_t {
  40     mca_btl_base_descriptor_t base;
  41     mca_btl_portals4_segment_t segments[1];
  42     /* needed for retransmit case */
  43    struct mca_btl_base_endpoint_t *endpoint;
  44     /* needed for retransmit case */
  45     mca_btl_base_header_t hdr;
  46     /* handle to use for communication */
  47     ptl_handle_me_t me_h;
  48     /* size of the allocated memory region -- not the amount of data
  49        we need to send */
  50     void *addr;
  51     size_t size;
  52     /* match bits for retransmit case */
  53     ptl_match_bits_t match_bits;
  54     /* length for retransmit case */
  55     ptl_size_t length;
  56     /* length for retransmit case */
  57     ptl_process_t peer_proc;
  58 
  59     /* the callback and context to complete an RDMA operation */
  60     struct {
  61         mca_btl_base_rdma_completion_fn_t func;
  62         void *context;
  63         void *data;
  64         mca_btl_base_registration_handle_t *local_handle;
  65     } rdma_cb;
  66 
  67     enum { BTL_PORTALS4_FRAG_TYPE_EAGER,
  68            BTL_PORTALS4_FRAG_TYPE_MAX,
  69            BTL_PORTALS4_FRAG_TYPE_USER } type;
  70     unsigned char  data[16];
  71 };
  72 typedef struct mca_btl_portals4_frag_t mca_btl_portals4_frag_t;
  73 OBJ_CLASS_DECLARATION(mca_btl_portals4_frag_t);
  74 
  75 typedef struct mca_btl_portals4_frag_t mca_btl_portals4_frag_eager_t;
  76 OBJ_CLASS_DECLARATION(mca_btl_portals4_frag_eager_t);
  77 
  78 typedef struct mca_btl_portals4_frag_t mca_btl_portals4_frag_max_t;
  79 OBJ_CLASS_DECLARATION(mca_btl_portals4_frag_max_t);
  80 
  81 typedef struct mca_btl_portals4_frag_t mca_btl_portals4_frag_user_t;
  82 OBJ_CLASS_DECLARATION(mca_btl_portals4_frag_user_t);
  83 
  84 /*
  85  * Macros to allocate/return descriptors from module specific
  86  * free list(s).
  87  */
  88 #define OPAL_BTL_PORTALS4_FRAG_ALLOC_EAGER(btl_macro, frag)                                \
  89 {                                                                                          \
  90     frag = (mca_btl_portals4_frag_t *)                                                     \
  91         opal_free_list_get (&((mca_btl_portals4_module_t*)btl_macro)->portals_frag_eager); \
  92     if (NULL == frag) {                                                                    \
  93         OPAL_BTL_PORTALS4_FRAG_ALLOC_MAX(btl_macro, frag);                                 \
  94     }                                                                                      \
  95 }
  96 
  97 
  98 #define OPAL_BTL_PORTALS4_FRAG_RETURN_EAGER(btl_macro, frag)                            \
  99 {                                                                                       \
 100     assert(BTL_PORTALS4_FRAG_TYPE_EAGER == frag->type);                                 \
 101     opal_free_list_return (&((mca_btl_portals4_module_t*)btl_macro)->portals_frag_eager, \
 102         (opal_free_list_item_t*)(frag));                                                \
 103 }
 104 
 105 
 106 #define OPAL_BTL_PORTALS4_FRAG_ALLOC_MAX(btl_macro, frag)                                           \
 107 {                                                                                                   \
 108     frag = (mca_btl_portals4_frag_t*)                                                               \
 109         opal_free_list_get (&((mca_btl_portals4_module_t*)btl_macro)->portals_frag_max);            \
 110 }
 111 
 112 
 113 #define OPAL_BTL_PORTALS4_FRAG_RETURN_MAX(btl_macro, frag)                            \
 114 {                                                                                     \
 115     assert(BTL_PORTALS4_FRAG_TYPE_MAX == frag->type);                                 \
 116     opal_free_list_return (&((mca_btl_portals4_module_t*)btl_macro)->portals_frag_max, \
 117         (opal_free_list_item_t*)(frag));                                              \
 118 }
 119 
 120 
 121 #define OPAL_BTL_PORTALS4_FRAG_ALLOC_USER(btl_macro, frag)                                      \
 122 {                                                                                               \
 123     frag = (mca_btl_portals4_frag_t*)                                                           \
 124         opal_free_list_get (&((mca_btl_portals4_module_t*)btl_macro)->portals_frag_user);       \
 125     frag->base.des_cbfunc = NULL;                                                               \
 126 }
 127 
 128 
 129 #define OPAL_BTL_PORTALS4_FRAG_RETURN_USER(btl_macro, frag)                            \
 130 {                                                                                      \
 131     assert(BTL_PORTALS4_FRAG_TYPE_USER == frag->type);                                 \
 132     opal_free_list_return (&((mca_btl_portals4_module_t*)btl_macro)->portals_frag_user, \
 133         (opal_free_list_item_t*)(frag));                                               \
 134 }
 135 
 136 
 137 END_C_DECLS
 138 #endif

/* [<][>][^][v][top][bottom][index][help] */