root/opal/mca/btl/vader/btl_vader_send.c

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

DEFINITIONS

This source file includes following definitions.
  1. mca_btl_vader_send

   1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
   2 /*
   3  * Copyright (c) 2004-2011 The Trustees of Indiana University and Indiana
   4  *                         University Research and Technology
   5  *                         Corporation.  All rights reserved.
   6  * Copyright (c) 2004-2009 The University of Tennessee and The University
   7  *                         of Tennessee Research Foundation.  All rights
   8  *                         reserved.
   9  * Copyright (c) 2004-2007 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) 2006-2007 Voltaire. All rights reserved.
  14  * Copyright (c) 2009      Cisco Systems, Inc.  All rights reserved.
  15  * Copyright (c) 2010-2014 Los Alamos National Security, LLC. All rights
  16  *                         reserved.
  17  * $COPYRIGHT$
  18  *
  19  * Additional copyrights may follow
  20  *
  21  * $HEADER$
  22  */
  23 
  24 #include "opal_config.h"
  25 
  26 #include "btl_vader.h"
  27 #include "btl_vader_frag.h"
  28 #include "btl_vader_fifo.h"
  29 #include "btl_vader_fbox.h"
  30 
  31 /**
  32  * Initiate a send to the peer.
  33  *
  34  * @param btl (IN)      BTL module
  35  * @param peer (IN)     BTL peer addressing
  36  */
  37 int mca_btl_vader_send (struct mca_btl_base_module_t *btl,
  38                         struct mca_btl_base_endpoint_t *endpoint,
  39                         struct mca_btl_base_descriptor_t *descriptor,
  40                         mca_btl_base_tag_t tag)
  41 {
  42     mca_btl_vader_frag_t *frag = (mca_btl_vader_frag_t *) descriptor;
  43     const size_t total_size = frag->segments[0].seg_len;
  44 
  45     /* in order to work around a long standing ob1 bug (see #3845) we have to always
  46      * make the callback. once this is fixed in ob1 we can restore the code below. */
  47     frag->base.des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
  48 
  49     /* header (+ optional inline data) */
  50     frag->hdr->len = total_size;
  51     /* type of message, pt-2-pt, one-sided, etc */
  52     frag->hdr->tag = tag;
  53 
  54     /* post the relative address of the descriptor into the peer's fifo */
  55     if (opal_list_get_size (&endpoint->pending_frags) || !vader_fifo_write_ep (frag->hdr, endpoint)) {
  56         frag->base.des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
  57         OPAL_THREAD_LOCK(&endpoint->pending_frags_lock);
  58         opal_list_append (&endpoint->pending_frags, (opal_list_item_t *) frag);
  59         if (!endpoint->waiting) {
  60             OPAL_THREAD_LOCK(&mca_btl_vader_component.lock);
  61             opal_list_append (&mca_btl_vader_component.pending_endpoints, &endpoint->super);
  62             OPAL_THREAD_UNLOCK(&mca_btl_vader_component.lock);
  63             endpoint->waiting = true;
  64         }
  65         OPAL_THREAD_UNLOCK(&endpoint->pending_frags_lock);
  66         return OPAL_SUCCESS;
  67     }
  68 
  69     return OPAL_SUCCESS;
  70 
  71 #if 0
  72     if ((frag->hdr->flags & MCA_BTL_VADER_FLAG_SINGLE_COPY) ||
  73         !(frag->base.des_flags & MCA_BTL_DES_FLAGS_BTL_OWNERSHIP)) {
  74         frag->base.des_flags |= MCA_BTL_DES_SEND_ALWAYS_CALLBACK;
  75 
  76         return OPAL_SUCCESS;
  77     }
  78 
  79     /* data is gone (from the pml's perspective). frag callback/release will
  80        happen later */
  81     return 1;
  82 #endif
  83 }

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