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

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. mca_btl_portals4_activate_block

   1 /*
   2  * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2005 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2014      Bull SAS.  All rights reserved.
  13  * $COPYRIGHT$
  14  *
  15  * Additional copyrights may follow
  16  *
  17  * $HEADER$
  18  */
  19 
  20 #ifndef OPAL_BTL_PORTALS4_RECV_H
  21 #define OPAL_BTL_PORTALS4_RECV_H
  22 
  23 #include "btl_portals4_frag.h"
  24 
  25 struct mca_btl_portals4_recv_block_t {
  26     opal_list_item_t base;
  27 
  28     mca_btl_portals4_module_t *btl;
  29 
  30     void *start;
  31     size_t length;
  32     ptl_handle_me_t me_h;
  33 
  34     volatile bool full;
  35     volatile int32_t pending;
  36 };
  37 typedef struct mca_btl_portals4_recv_block_t mca_btl_portals4_recv_block_t;
  38 OBJ_CLASS_DECLARATION(mca_btl_portals4_recv_block_t);
  39 
  40 
  41 int mca_btl_portals4_recv_enable(mca_btl_portals4_module_t *btl);
  42 
  43 int mca_btl_portals4_recv_disable(mca_btl_portals4_module_t *btl);
  44 
  45 /**
  46  * Free a block of memory.
  47  *
  48  */
  49 int mca_btl_portals4_recv_block_free(mca_btl_portals4_recv_block_t *block);
  50 
  51 /**
  52  * Create a block of memory for receiving send messages.  Must call
  53  * activate_block on the returned block of memory before it will be
  54  * active with the Portals library
  55  *
  56  * Module lock must be held before calling this function
  57  */
  58 mca_btl_portals4_recv_block_t*
  59 mca_btl_portals4_recv_block_init(mca_btl_portals4_module_t *btl);
  60 
  61 /**
  62  * activate a block.  Blocks that are full (have gone inactive) can be
  63  * re-activated with this call.  There is no need to hold the lock
  64  * before calling this function
  65  */
  66 static inline int
  67 mca_btl_portals4_activate_block(mca_btl_portals4_recv_block_t *block)
  68 {
  69     int ret;
  70     ptl_me_t me;
  71     ptl_process_t remote_proc;
  72     ptl_match_bits_t match_bits, ignore_bits;
  73     mca_btl_portals4_module_t *btl = block->btl;
  74 
  75     if (NULL == block->start) return OPAL_ERROR;
  76 
  77     ignore_bits = BTL_PORTALS4_CONTEXT_MASK | BTL_PORTALS4_SOURCE_MASK | BTL_PORTALS4_TAG_MASK;
  78     match_bits = BTL_PORTALS4_SHORT_MSG;
  79 
  80     me.start = block->start;
  81     me.length = block->length;
  82     me.ct_handle = PTL_CT_NONE;
  83     me.min_free = btl->super.btl_eager_limit;
  84     me.uid = PTL_UID_ANY;
  85     me.options =
  86         PTL_ME_OP_PUT |
  87         PTL_ME_MANAGE_LOCAL |
  88         PTL_ME_EVENT_LINK_DISABLE  |
  89         PTL_ME_MAY_ALIGN;
  90 
  91     if (mca_btl_portals4_component.use_logical) {
  92         remote_proc.rank = PTL_RANK_ANY;
  93     } else {
  94         remote_proc.phys.nid = PTL_NID_ANY;
  95         remote_proc.phys.pid = PTL_PID_ANY;
  96     }
  97 
  98     me.match_id = remote_proc;
  99     me.match_bits = match_bits;
 100     me.ignore_bits = ignore_bits;
 101 
 102     block->pending = 0;
 103     block->full = false;
 104     opal_atomic_mb();
 105 
 106     ret = PtlMEAppend(btl->portals_ni_h,
 107                       btl->recv_idx,
 108                       &me,
 109                       PTL_PRIORITY_LIST,
 110                       block,
 111                       &block->me_h);
 112     if (OPAL_UNLIKELY(PTL_OK != ret)) {
 113         opal_output_verbose(1, opal_btl_base_framework.framework_output,
 114                             "%s:%d: PtlMEAppend failed on NI %d: %d",
 115                             __FILE__, __LINE__, btl->interface_num, ret);
 116         return OPAL_ERROR;
 117     }
 118     OPAL_OUTPUT_VERBOSE((90, opal_btl_base_framework.framework_output, "PtlMEAppend (recv) block=%p me_h=%d start=%p len=%x NI=%d\n",
 119         (void *)block, block->me_h, block->start, (unsigned int) block->length, btl->interface_num));
 120 
 121     return OPAL_SUCCESS;
 122 }
 123 
 124 #endif /* OPAL_BTL_PORTALS4_RECV_H */

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