root/opal/mca/btl/uct/btl_uct_endpoint.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. mca_btl_uct_endpoint_test_am
  2. mca_btl_uct_endpoint_check
  3. mca_btl_uct_endpoint_check_rdma
  4. mca_btl_uct_endpoint_check_am

   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) 2017-2018 Los Alamos National Security, LLC. All rights
  14  *                         reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 
  22 #ifndef MCA_BTL_UCT_ENDPOINT_H
  23 #define MCA_BTL_UCT_ENDPOINT_H
  24 
  25 #include "opal/class/opal_list.h"
  26 #include "opal/mca/event/event.h"
  27 #include "btl_uct.h"
  28 
  29 BEGIN_C_DECLS
  30 
  31 mca_btl_base_endpoint_t *mca_btl_uct_endpoint_create (opal_proc_t *proc);
  32 int mca_btl_uct_endpoint_connect (mca_btl_uct_module_t *module, mca_btl_uct_endpoint_t *endpoint, int ep_index, void *ep_addr, int tl_index);
  33 
  34 static inline int mca_btl_uct_endpoint_test_am (mca_btl_uct_module_t *module, mca_btl_uct_endpoint_t *endpoint,
  35                                                 mca_btl_uct_device_context_t *context, uct_ep_h *ep_handle)
  36 {
  37     int tl_index = module->am_tl->tl_index;
  38     int ep_index = context->context_id;
  39 
  40     if (OPAL_LIKELY(MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY & endpoint->uct_eps[ep_index][tl_index].flags)) {
  41         *ep_handle = endpoint->uct_eps[ep_index][tl_index].uct_ep;
  42         return OPAL_SUCCESS;
  43     }
  44 
  45     return OPAL_ERR_NOT_AVAILABLE;
  46 }
  47 
  48 /**
  49  * @brief Check if the endpoint is connected and start the connection if not
  50  *
  51  * @param[in] module      UCT BTL module
  52  * @param[in] endpoint    UCT BTL endpoint
  53  * @param[in] context     UCT BTL device context
  54  * @param[out] ep_handle  UCT endpoint handle
  55  * @param[in] tl_index    UCT TL index (0 or 1)
  56  *
  57  * @returns OPAL_SUCCESS if the endpoint is connected and ready to us
  58  * @returns OPAL_ERR_RESOURCE_BUSY if the connection is underway
  59  * @returns OPAL_ERROR otherwise
  60  */
  61 static inline int mca_btl_uct_endpoint_check (mca_btl_uct_module_t *module, mca_btl_uct_endpoint_t *endpoint,
  62                                               mca_btl_uct_device_context_t *context, uct_ep_h *ep_handle,
  63                                               const int tl_index)
  64 {
  65     int ep_index = context->context_id;
  66     int rc;
  67 
  68     if (OPAL_LIKELY(MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY & endpoint->uct_eps[ep_index][tl_index].flags)) {
  69         *ep_handle = endpoint->uct_eps[ep_index][tl_index].uct_ep;
  70         return OPAL_SUCCESS;
  71     }
  72 
  73     rc = mca_btl_uct_endpoint_connect (module, endpoint, ep_index, NULL, tl_index);
  74     *ep_handle = endpoint->uct_eps[ep_index][tl_index].uct_ep;
  75     BTL_VERBOSE(("mca_btl_uct_endpoint_connect returned %d. context id = %d, flags = 0x%x", rc, ep_index,
  76                  MCA_BTL_UCT_ENDPOINT_FLAG_CONN_READY & endpoint->uct_eps[ep_index][tl_index].flags));
  77     return rc;
  78 }
  79 
  80 static inline int mca_btl_uct_endpoint_check_rdma (mca_btl_uct_module_t *module, mca_btl_uct_endpoint_t *endpoint,
  81                                                    mca_btl_uct_device_context_t *context, uct_ep_h *ep_handle)
  82 {
  83     assert (NULL != module->rdma_tl);
  84     return mca_btl_uct_endpoint_check (module, endpoint, context, ep_handle, module->rdma_tl->tl_index);
  85 }
  86 
  87 static inline int mca_btl_uct_endpoint_check_am (mca_btl_uct_module_t *module, mca_btl_uct_endpoint_t *endpoint,
  88                                                  mca_btl_uct_device_context_t *context, uct_ep_h *ep_handle)
  89 {
  90     assert (NULL != module->am_tl);
  91     return mca_btl_uct_endpoint_check (module, endpoint, context, ep_handle, module->am_tl->tl_index);
  92 }
  93 
  94 END_C_DECLS
  95 #endif

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