2013-10-23 15:59:14 +00:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
|
|
|
/*
|
2016-03-23 16:30:10 -06:00
|
|
|
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
|
2013-10-23 15:59:14 +00:00
|
|
|
* reserved.
|
2014-05-12 22:05:31 +00:00
|
|
|
* Copyright (c) 2014 Research Organization for Information Science
|
|
|
|
* and Technology (RIST). All rights reserved.
|
2013-10-23 15:59:14 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
#include "opal_config.h"
|
2013-10-23 15:59:14 +00:00
|
|
|
|
|
|
|
#include "btl_scif.h"
|
|
|
|
#include "btl_scif_frag.h"
|
|
|
|
#include "btl_scif_endpoint.h"
|
|
|
|
|
|
|
|
static int
|
|
|
|
mca_btl_scif_free (struct mca_btl_base_module_t *btl,
|
|
|
|
mca_btl_base_descriptor_t *des);
|
|
|
|
|
|
|
|
static int
|
|
|
|
mca_btl_scif_module_finalize (struct mca_btl_base_module_t* btl);
|
|
|
|
|
2015-01-06 10:52:19 -07:00
|
|
|
static mca_btl_base_registration_handle_t *mca_btl_scif_register_mem (struct mca_btl_base_module_t *btl,
|
|
|
|
mca_btl_base_endpoint_t *endpoint,
|
|
|
|
void *base, size_t size, uint32_t flags);
|
|
|
|
static int mca_btl_scif_deregister_mem (struct mca_btl_base_module_t *btl, mca_btl_base_registration_handle_t *handle);
|
2013-10-23 15:59:14 +00:00
|
|
|
|
|
|
|
static struct mca_btl_base_descriptor_t *
|
|
|
|
mca_btl_scif_prepare_src (struct mca_btl_base_module_t *btl,
|
|
|
|
struct mca_btl_base_endpoint_t *endpoint,
|
|
|
|
struct opal_convertor_t *convertor,
|
|
|
|
uint8_t order, size_t reserve, size_t *size,
|
|
|
|
uint32_t flags);
|
|
|
|
|
|
|
|
mca_btl_scif_module_t mca_btl_scif_module = {
|
|
|
|
.super = {
|
|
|
|
.btl_component = &mca_btl_scif_component.super,
|
|
|
|
.btl_add_procs = mca_btl_scif_add_procs,
|
|
|
|
.btl_del_procs = mca_btl_scif_del_procs,
|
|
|
|
.btl_finalize = mca_btl_scif_module_finalize,
|
|
|
|
.btl_alloc = mca_btl_scif_alloc,
|
|
|
|
.btl_free = mca_btl_scif_free,
|
|
|
|
.btl_prepare_src = mca_btl_scif_prepare_src,
|
|
|
|
.btl_send = mca_btl_scif_send,
|
|
|
|
.btl_sendi = mca_btl_scif_sendi,
|
|
|
|
.btl_put = mca_btl_scif_put,
|
|
|
|
.btl_get = mca_btl_scif_get,
|
2015-01-06 10:52:19 -07:00
|
|
|
.btl_register_mem = mca_btl_scif_register_mem,
|
|
|
|
.btl_deregister_mem = mca_btl_scif_deregister_mem,
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
int mca_btl_scif_module_init (void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* create an endpoint to listen for connections */
|
|
|
|
mca_btl_scif_module.scif_fd = scif_open ();
|
|
|
|
if (-1 == mca_btl_scif_module.scif_fd) {
|
|
|
|
BTL_VERBOSE(("scif_open failed. errno = %d", errno));
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_ERROR;
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* bind the endpoint to a port */
|
|
|
|
mca_btl_scif_module.port_id.port = scif_bind (mca_btl_scif_module.scif_fd, 0);
|
|
|
|
if (-1 == mca_btl_scif_module.port_id.port) {
|
|
|
|
BTL_VERBOSE(("scif_bind failed. errno = %d", errno));
|
|
|
|
scif_close (mca_btl_scif_module.scif_fd);
|
|
|
|
mca_btl_scif_module.scif_fd = -1;
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_ERROR;
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* determine this processes node id */
|
|
|
|
rc = scif_get_nodeIDs (NULL, 0, &mca_btl_scif_module.port_id.node);
|
|
|
|
if (-1 == rc) {
|
|
|
|
BTL_VERBOSE(("btl/scif error getting node id of this node"));
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_ERROR;
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Listen for connections */
|
|
|
|
/* TODO - base the maximum backlog off something */
|
|
|
|
rc = scif_listen (mca_btl_scif_module.scif_fd, 64);
|
|
|
|
if (-1 == rc) {
|
|
|
|
BTL_VERBOSE(("scif_listen failed. errno = %d", errno));
|
|
|
|
scif_close (mca_btl_scif_module.scif_fd);
|
|
|
|
mca_btl_scif_module.scif_fd = -1;
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_ERROR;
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BTL_VERBOSE(("btl/scif: listening @ port %u on node %u\n",
|
|
|
|
mca_btl_scif_module.port_id.port, mca_btl_scif_module.port_id.node));
|
|
|
|
|
2015-02-19 13:41:41 -07:00
|
|
|
OBJ_CONSTRUCT(&mca_btl_scif_module.dma_frags, opal_free_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mca_btl_scif_module.eager_frags, opal_free_list_t);
|
2013-10-23 15:59:14 +00:00
|
|
|
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_SUCCESS;
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mca_btl_scif_module_finalize (struct mca_btl_base_module_t *btl)
|
|
|
|
{
|
|
|
|
mca_btl_scif_module_t *scif_module = (mca_btl_scif_module_t *) btl;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
OBJ_DESTRUCT(&mca_btl_scif_module.dma_frags);
|
|
|
|
OBJ_DESTRUCT(&mca_btl_scif_module.eager_frags);
|
|
|
|
|
2014-05-14 16:14:00 +00:00
|
|
|
mca_btl_scif_module.exiting = true;
|
|
|
|
|
2013-10-23 15:59:14 +00:00
|
|
|
/* close all open connections and release endpoints */
|
|
|
|
if (NULL != scif_module->endpoints) {
|
|
|
|
for (i = 0 ; i < scif_module->endpoint_count ; ++i) {
|
|
|
|
mca_btl_scif_ep_release (scif_module->endpoints + i);
|
|
|
|
}
|
|
|
|
|
|
|
|
free (scif_module->endpoints);
|
|
|
|
|
|
|
|
scif_module->endpoint_count = 0;
|
|
|
|
scif_module->endpoints = NULL;
|
|
|
|
}
|
|
|
|
|
2016-03-23 16:30:10 -06:00
|
|
|
if (NULL != scif_module->rcache) {
|
|
|
|
mca_rcache_base_module_destroy (scif_module->rcache);
|
|
|
|
scif_module->rcache = NULL;
|
|
|
|
}
|
|
|
|
|
2013-10-23 15:59:14 +00:00
|
|
|
/* close the listening endpoint */
|
2014-10-31 16:34:02 +09:00
|
|
|
if (mca_btl_scif_module.listening && -1 != mca_btl_scif_module.scif_fd) {
|
2014-05-14 16:14:00 +00:00
|
|
|
/* wake up the scif thread */
|
2014-05-15 09:55:50 +00:00
|
|
|
scif_epd_t tmpfd;
|
|
|
|
tmpfd = scif_open();
|
|
|
|
scif_connect (tmpfd, &mca_btl_scif_module.port_id);
|
2014-05-13 17:29:53 +00:00
|
|
|
pthread_join(mca_btl_scif_module.listen_thread, NULL);
|
2014-05-15 09:55:50 +00:00
|
|
|
scif_close(tmpfd);
|
|
|
|
scif_close (mca_btl_scif_module.scif_fd);
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mca_btl_scif_module.scif_fd = -1;
|
|
|
|
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 00:47:28 +00:00
|
|
|
return OPAL_SUCCESS;
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mca_btl_base_descriptor_t *
|
|
|
|
mca_btl_scif_alloc(struct mca_btl_base_module_t *btl,
|
|
|
|
struct mca_btl_base_endpoint_t *endpoint,
|
|
|
|
uint8_t order, size_t size, uint32_t flags)
|
|
|
|
{
|
|
|
|
mca_btl_scif_base_frag_t *frag = NULL;
|
|
|
|
|
|
|
|
BTL_VERBOSE(("allocating fragment of size: %u", (unsigned int)size));
|
|
|
|
|
|
|
|
if (size <= mca_btl_scif_module.super.btl_eager_limit) {
|
|
|
|
(void) MCA_BTL_SCIF_FRAG_ALLOC_EAGER(endpoint, frag);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (OPAL_UNLIKELY(NULL == frag)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
BTL_VERBOSE(("btl/scif_module allocated frag of size: %u, flags: %x. frag = %p",
|
|
|
|
(unsigned int)size, flags, (void *) frag));
|
|
|
|
|
|
|
|
frag->base.des_flags = flags;
|
|
|
|
frag->base.order = order;
|
2015-01-06 10:52:19 -07:00
|
|
|
frag->base.des_segments = frag->segments;
|
|
|
|
frag->base.des_segment_count = 1;
|
2013-10-23 15:59:14 +00:00
|
|
|
|
2015-01-06 10:52:19 -07:00
|
|
|
frag->segments[0].seg_len = size;
|
2013-10-23 15:59:14 +00:00
|
|
|
|
|
|
|
return &frag->base;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
mca_btl_scif_free (struct mca_btl_base_module_t *btl,
|
|
|
|
mca_btl_base_descriptor_t *des)
|
|
|
|
{
|
|
|
|
return mca_btl_scif_frag_return ((mca_btl_scif_base_frag_t *) des);
|
|
|
|
}
|
|
|
|
|
2015-01-06 10:52:19 -07:00
|
|
|
static mca_btl_base_registration_handle_t *mca_btl_scif_register_mem (struct mca_btl_base_module_t *btl,
|
|
|
|
mca_btl_base_endpoint_t *endpoint,
|
|
|
|
void *base, size_t size, uint32_t flags)
|
2013-10-23 15:59:14 +00:00
|
|
|
{
|
2016-03-23 16:30:10 -06:00
|
|
|
mca_btl_scif_module_t *scif_module = &mca_btl_scif_module;
|
2013-10-23 15:59:14 +00:00
|
|
|
mca_btl_scif_reg_t *scif_reg;
|
2015-09-29 15:28:00 -06:00
|
|
|
int access_flags = flags & MCA_BTL_REG_FLAG_ACCESS_ANY;
|
2013-10-23 15:59:14 +00:00
|
|
|
int rc;
|
|
|
|
|
2015-01-06 10:52:19 -07:00
|
|
|
if (MCA_BTL_ENDPOINT_ANY == endpoint) {
|
|
|
|
/* it probably isn't possible to support registering memory to use with any endpoint so
|
|
|
|
* return NULL */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-10-23 15:59:14 +00:00
|
|
|
if (OPAL_LIKELY(MCA_BTL_SCIF_EP_STATE_CONNECTED != endpoint->state)) {
|
|
|
|
/* the endpoint needs to be connected before the fragment can be
|
|
|
|
* registered. */
|
|
|
|
rc = mca_btl_scif_ep_connect (endpoint);
|
|
|
|
if (OPAL_LIKELY(MCA_BTL_SCIF_EP_STATE_CONNECTED != endpoint->state)) {
|
|
|
|
/* not yet connected */
|
2014-07-10 16:31:15 +00:00
|
|
|
return NULL;
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-23 16:30:10 -06:00
|
|
|
rc = scif_module->rcache->rcache_register (scif_module->rcache, base, size, 0, access_flags,
|
|
|
|
(mca_rcache_base_registration_t **) &scif_reg);
|
2015-01-06 10:52:19 -07:00
|
|
|
if (OPAL_UNLIKELY(OPAL_SUCCESS != rc)) {
|
2014-07-10 16:31:15 +00:00
|
|
|
return NULL;
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* register the memory location with this peer if it isn't already */
|
2015-01-06 10:52:19 -07:00
|
|
|
if ((off_t) -1 == scif_reg->handles[endpoint->id].btl_handle.scif_offset) {
|
|
|
|
size_t seg_size = (size_t)((uintptr_t) scif_reg->base.bound - (uintptr_t) scif_reg->base.base) + 1;
|
|
|
|
|
2016-03-23 16:30:10 -06:00
|
|
|
/* NTH: until we determine a way to pass permissions to the rcache just make all segments
|
2015-01-06 10:52:19 -07:00
|
|
|
* read/write */
|
|
|
|
scif_reg->handles[endpoint->id].btl_handle.scif_offset =
|
|
|
|
scif_register (endpoint->scif_epd, scif_reg->base.base, seg_size, 0, SCIF_PROT_READ |
|
|
|
|
SCIF_PROT_WRITE, 0);
|
2013-10-23 15:59:14 +00:00
|
|
|
BTL_VERBOSE(("registered fragment for scif DMA transaction. offset = %lu",
|
2015-01-06 10:52:19 -07:00
|
|
|
(unsigned long) scif_reg->handles[endpoint->id].btl_handle.scif_offset));
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
2015-01-06 10:52:19 -07:00
|
|
|
return &scif_reg->handles[endpoint->id].btl_handle;
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
2015-01-06 10:52:19 -07:00
|
|
|
static int mca_btl_scif_deregister_mem (struct mca_btl_base_module_t *btl, mca_btl_base_registration_handle_t *handle)
|
2013-10-23 15:59:14 +00:00
|
|
|
{
|
2015-01-06 10:52:19 -07:00
|
|
|
mca_btl_scif_registration_handle_t *scif_handle = (mca_btl_scif_registration_handle_t *) handle;
|
2016-03-23 16:30:10 -06:00
|
|
|
mca_btl_scif_module_t *scif_module = &mca_btl_scif_module;
|
2015-01-06 10:52:19 -07:00
|
|
|
mca_btl_scif_reg_t *scif_reg = scif_handle->reg;
|
2013-10-23 15:59:14 +00:00
|
|
|
|
2016-03-23 16:30:10 -06:00
|
|
|
scif_module->rcache->rcache_deregister (scif_module->rcache, &scif_reg->base);
|
2013-10-23 15:59:14 +00:00
|
|
|
|
2015-01-06 10:52:19 -07:00
|
|
|
return OPAL_SUCCESS;
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct mca_btl_base_descriptor_t *
|
|
|
|
mca_btl_scif_prepare_src_send (struct mca_btl_base_module_t *btl,
|
|
|
|
mca_btl_base_endpoint_t *endpoint,
|
|
|
|
struct opal_convertor_t *convertor,
|
|
|
|
uint8_t order, size_t reserve, size_t *size,
|
|
|
|
uint32_t flags)
|
|
|
|
{
|
|
|
|
mca_btl_scif_base_frag_t *frag = NULL;
|
|
|
|
uint32_t iov_count = 1;
|
|
|
|
struct iovec iov;
|
|
|
|
size_t max_size = *size;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if (OPAL_LIKELY((mca_btl_scif_module.super.btl_flags & MCA_BTL_FLAGS_SEND_INPLACE) &&
|
|
|
|
!opal_convertor_need_buffers (convertor) &&
|
|
|
|
reserve <= 128)) {
|
|
|
|
/* inplace send */
|
|
|
|
void *data_ptr;
|
|
|
|
opal_convertor_get_current_pointer (convertor, &data_ptr);
|
|
|
|
|
|
|
|
(void) MCA_BTL_SCIF_FRAG_ALLOC_DMA(endpoint, frag);
|
|
|
|
if (OPAL_UNLIKELY(NULL == frag)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-01-06 10:52:19 -07:00
|
|
|
frag->segments[0].seg_len = reserve;
|
|
|
|
frag->segments[1].seg_addr.pval = data_ptr;
|
|
|
|
frag->segments[1].seg_len = *size;
|
|
|
|
frag->base.des_segment_count = 2;
|
2014-05-12 22:05:31 +00:00
|
|
|
} else {
|
2013-10-23 15:59:14 +00:00
|
|
|
/* buffered send */
|
|
|
|
(void) MCA_BTL_SCIF_FRAG_ALLOC_EAGER(endpoint, frag);
|
|
|
|
if (OPAL_UNLIKELY(NULL == frag)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*size) {
|
|
|
|
iov.iov_len = *size;
|
2015-01-06 10:52:19 -07:00
|
|
|
iov.iov_base = (IOVBASE_TYPE *) ((uintptr_t) frag->segments[0].seg_addr.pval + reserve);
|
2013-10-23 15:59:14 +00:00
|
|
|
|
|
|
|
rc = opal_convertor_pack (convertor, &iov, &iov_count, &max_size);
|
|
|
|
if (OPAL_UNLIKELY(rc < 0)) {
|
|
|
|
mca_btl_scif_frag_return (frag);
|
|
|
|
return NULL;
|
|
|
|
}
|
2014-05-12 22:05:31 +00:00
|
|
|
*size = max_size;
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
2015-01-06 10:52:19 -07:00
|
|
|
frag->segments[0].seg_len = reserve + *size;
|
|
|
|
frag->base.des_segment_count = 1;
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|
|
|
|
|
2015-01-06 10:52:19 -07:00
|
|
|
frag->base.des_segments = frag->segments;
|
|
|
|
frag->base.order = order;
|
|
|
|
frag->base.des_flags = flags;
|
2013-10-23 15:59:14 +00:00
|
|
|
|
|
|
|
return &frag->base;
|
|
|
|
}
|
|
|
|
|
|
|
|
static mca_btl_base_descriptor_t *mca_btl_scif_prepare_src (struct mca_btl_base_module_t *btl,
|
|
|
|
mca_btl_base_endpoint_t *endpoint,
|
|
|
|
struct opal_convertor_t *convertor,
|
|
|
|
uint8_t order, size_t reserve, size_t *size,
|
|
|
|
uint32_t flags)
|
|
|
|
{
|
2015-01-06 10:52:19 -07:00
|
|
|
return mca_btl_scif_prepare_src_send (btl, endpoint, convertor, order, reserve, size, flags);
|
2013-10-23 15:59:14 +00:00
|
|
|
}
|