2005-06-30 06:09:50 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-06-30 06:09:50 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
2005-09-22 20:41:34 +04:00
|
|
|
#include <unistd.h>
|
2005-08-13 01:42:07 +04:00
|
|
|
#include "ompi/include/constants.h"
|
2005-07-04 03:09:55 +04:00
|
|
|
#include "opal/event/event.h"
|
2005-11-08 19:50:07 +03:00
|
|
|
#include "opal/include/sys/timer.h"
|
2005-07-04 05:36:20 +04:00
|
|
|
#include "opal/util/if.h"
|
2005-07-04 04:13:44 +04:00
|
|
|
#include "opal/util/argv.h"
|
2005-07-04 03:31:27 +04:00
|
|
|
#include "opal/util/output.h"
|
2005-06-30 06:09:50 +04:00
|
|
|
#include "mca/pml/pml.h"
|
2005-06-30 06:12:23 +04:00
|
|
|
#include "mca/btl/btl.h"
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
#include "mca/base/mca_base_param.h"
|
|
|
|
#include "mca/errmgr/errmgr.h"
|
|
|
|
#include "mca/mpool/base/base.h"
|
2005-06-30 09:50:55 +04:00
|
|
|
#include "btl_mvapi.h"
|
|
|
|
#include "btl_mvapi_frag.h"
|
|
|
|
#include "btl_mvapi_endpoint.h"
|
2005-06-30 06:12:23 +04:00
|
|
|
#include "mca/btl/base/base.h"
|
2005-06-30 06:09:50 +04:00
|
|
|
#include <vapi.h>
|
|
|
|
#include <vapi_common.h>
|
|
|
|
#include "datatype/convertor.h"
|
2005-07-01 01:28:35 +04:00
|
|
|
#include "mca/mpool/mvapi/mpool_mvapi.h"
|
2005-08-31 23:43:22 +04:00
|
|
|
#include "btl_mvapi_endpoint.h"
|
2005-09-13 06:00:28 +04:00
|
|
|
#include "mca/pml/base/pml_base_module_exchange.h"
|
2005-09-24 04:24:49 +04:00
|
|
|
#include <malloc.h>
|
2005-06-30 06:09:50 +04:00
|
|
|
|
2005-11-08 19:50:07 +03:00
|
|
|
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_component_t mca_btl_mvapi_component = {
|
2005-06-30 06:09:50 +04:00
|
|
|
{
|
|
|
|
/* First, the mca_base_component_t struct containing meta information
|
|
|
|
about the component itself */
|
|
|
|
|
|
|
|
{
|
|
|
|
/* Indicate that we are a pml v1.0.0 component (which also implies a
|
|
|
|
specific MCA version) */
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
MCA_BTL_BASE_VERSION_1_0_0,
|
2005-06-30 06:09:50 +04:00
|
|
|
|
2005-07-12 23:02:39 +04:00
|
|
|
"mvapi", /* MCA component name */
|
Major simplifications to component versioning:
- After long discussions and ruminations on how we run components in
LAM/MPI, made the decision that, by default, all components included
in Open MPI will use the version number of their parent project
(i.e., OMPI or ORTE). They are certaint free to use a different
number, but this simplification makes the common cases easy:
- components are only released when the parent project is released
- it is easy (trivial?) to distinguish which version component goes
with with version of the parent project
- removed all autogen/configure code for templating the version .h
file in components
- made all ORTE components use ORTE_*_VERSION for version numbers
- made all OMPI components use OMPI_*_VERSION for version numbers
- removed all VERSION files from components
- configure now displays OPAL, ORTE, and OMPI version numbers
- ditto for ompi_info
- right now, faking it -- OPAL and ORTE and OMPI will always have the
same version number (i.e., they all come from the same top-level
VERSION file). But this paves the way for the Great Configure
Reorganization, where, among other things, each project will have
its own version number.
So all in all, we went from a boatload of version numbers to
[effectively] three. That's pretty good. :-)
This commit was SVN r6344.
2005-07-05 00:12:36 +04:00
|
|
|
OMPI_MAJOR_VERSION, /* MCA component major version */
|
|
|
|
OMPI_MINOR_VERSION, /* MCA component minor version */
|
|
|
|
OMPI_RELEASE_VERSION, /* MCA component release version */
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_component_open, /* component open */
|
|
|
|
mca_btl_mvapi_component_close /* component close */
|
2005-06-30 06:09:50 +04:00
|
|
|
},
|
|
|
|
|
|
|
|
/* Next the MCA v1.0.0 component meta data */
|
|
|
|
|
|
|
|
{
|
|
|
|
/* Whether the component is checkpointable or not */
|
|
|
|
|
|
|
|
false
|
|
|
|
},
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_component_init,
|
|
|
|
mca_btl_mvapi_component_progress,
|
2005-06-30 06:09:50 +04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* utility routines for parameter registration
|
|
|
|
*/
|
|
|
|
|
2005-10-20 06:55:21 +04:00
|
|
|
static inline void mca_btl_mvapi_param_register_string(
|
|
|
|
const char* param_name,
|
|
|
|
const char* param_desc,
|
|
|
|
const char* default_value,
|
|
|
|
char** out_value)
|
2005-06-30 06:09:50 +04:00
|
|
|
{
|
2005-10-20 06:55:21 +04:00
|
|
|
mca_base_param_reg_string(&mca_btl_mvapi_component.super.btl_version,
|
|
|
|
param_name,
|
|
|
|
param_desc,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
default_value,
|
|
|
|
out_value);
|
2005-06-30 06:09:50 +04:00
|
|
|
}
|
|
|
|
|
2005-10-20 06:55:21 +04:00
|
|
|
static inline void mca_btl_mvapi_param_register_int(
|
|
|
|
const char* param_name,
|
|
|
|
const char* param_desc,
|
|
|
|
int default_value,
|
|
|
|
int* out_value)
|
2005-06-30 06:09:50 +04:00
|
|
|
{
|
2005-10-20 06:55:21 +04:00
|
|
|
mca_base_param_reg_int(&mca_btl_mvapi_component.super.btl_version,
|
|
|
|
param_name,
|
|
|
|
param_desc,
|
|
|
|
false,
|
|
|
|
false,
|
|
|
|
default_value,
|
|
|
|
out_value);
|
2005-06-30 06:09:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Called by MCA framework to open the component, registers
|
|
|
|
* component parameters.
|
|
|
|
*/
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
int mca_btl_mvapi_component_open(void)
|
2005-06-30 06:09:50 +04:00
|
|
|
{
|
|
|
|
|
|
|
|
int param, value;
|
|
|
|
|
|
|
|
/* initialize state */
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_component.ib_num_btls=0;
|
|
|
|
mca_btl_mvapi_component.mvapi_btls=NULL;
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
/* initialize objects */
|
2005-07-03 20:22:16 +04:00
|
|
|
OBJ_CONSTRUCT(&mca_btl_mvapi_component.ib_procs, opal_list_t);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
/* register IB component parameters */
|
2005-10-20 06:55:21 +04:00
|
|
|
mca_btl_mvapi_param_register_int ("free_list_num", "intial size of free lists",
|
|
|
|
8, &mca_btl_mvapi_component.ib_free_list_num);
|
|
|
|
mca_btl_mvapi_param_register_int ("free_list_max", "maximum size of free lists",
|
2005-11-08 19:50:07 +03:00
|
|
|
-1, &mca_btl_mvapi_component.ib_free_list_max);
|
2005-10-20 06:55:21 +04:00
|
|
|
mca_btl_mvapi_param_register_int ("free_list_inc", "increment size of free lists",
|
|
|
|
32, &mca_btl_mvapi_component.ib_free_list_inc);
|
|
|
|
mca_btl_mvapi_param_register_string("mpool", "name of the memory pool to be used",
|
|
|
|
"mvapi", &mca_btl_mvapi_component.ib_mpool_name);
|
|
|
|
mca_btl_mvapi_param_register_int("reg_mru_len", "length of the registration cache most recently used list",
|
|
|
|
16, (int*) &mca_btl_mvapi_component.reg_mru_len);
|
|
|
|
mca_btl_mvapi_param_register_int("use_srq", "if 1 use the IB shared receive queue to post receive descriptors",
|
|
|
|
0, (int*) &mca_btl_mvapi_component.use_srq);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_cq_size", "size of the IB completion queue",
|
|
|
|
10000, (int*) &mca_btl_mvapi_component.ib_cq_size);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_wq_size", "size of the IB work queue",
|
|
|
|
10000, (int*) &mca_btl_mvapi_component.ib_wq_size);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_sg_list_size", "size of IB segment list",
|
|
|
|
1, (int*) &mca_btl_mvapi_component.ib_sg_list_size);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_pkey_ix", "IB pkey index",
|
|
|
|
0, (int*) &mca_btl_mvapi_component.ib_pkey_ix);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_psn", "IB Packet sequence starting number",
|
|
|
|
0, (int*) &mca_btl_mvapi_component.ib_psn);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_qp_ous_rd_atom", "IB outstanding atomic reads",
|
|
|
|
4, (int*) &mca_btl_mvapi_component.ib_qp_ous_rd_atom);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_mtu", "IB MTU",
|
|
|
|
MTU1024, (int*) &mca_btl_mvapi_component.ib_mtu);
|
|
|
|
|
|
|
|
mca_btl_mvapi_param_register_int("ib_min_rnr_timer", "IB min rnr timer",
|
|
|
|
5, (int*) &mca_btl_mvapi_component.ib_min_rnr_timer);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_timeout", "IB transmit timeout",
|
|
|
|
10, (int*) &mca_btl_mvapi_component.ib_timeout);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_retry_count", "IB transmit retry count",
|
|
|
|
7, (int*) &mca_btl_mvapi_component.ib_retry_count);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_rnr_retry", "IB rnr retry",
|
2005-10-31 20:18:39 +03:00
|
|
|
7, (int*) &mca_btl_mvapi_component.ib_rnr_retry);
|
2005-10-20 06:55:21 +04:00
|
|
|
mca_btl_mvapi_param_register_int("ib_max_rdma_dst_ops", "IB max rdma destination operations",
|
|
|
|
16, (int*) &mca_btl_mvapi_component.ib_max_rdma_dst_ops);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_service_level", "IB service level",
|
|
|
|
0, (int*) &mca_btl_mvapi_component.ib_service_level);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_static_rate", "IB static rate",
|
|
|
|
0, (int*) &mca_btl_mvapi_component.ib_static_rate);
|
|
|
|
mca_btl_mvapi_param_register_int("ib_src_path_bits", "IB source path bits",
|
|
|
|
0, (int*) &mca_btl_mvapi_component.ib_src_path_bits);
|
|
|
|
|
2005-11-08 19:50:07 +03:00
|
|
|
mca_btl_mvapi_param_register_int("rd_num", "number of receive descriptors to post to a QP",
|
|
|
|
16, (int*) &mca_btl_mvapi_component.rd_num);
|
|
|
|
mca_btl_mvapi_param_register_int("rd_low", "low water mark before reposting occurs",
|
|
|
|
12, (int*) &mca_btl_mvapi_component.rd_low);
|
|
|
|
mca_btl_mvapi_param_register_int("rd_win", "window size at which generate explicity credit message",
|
|
|
|
8, (int*) &mca_btl_mvapi_component.rd_win);
|
|
|
|
mca_btl_mvapi_component.rd_rsv = ((mca_btl_mvapi_component.rd_num<<1)-1) / mca_btl_mvapi_component.rd_win;
|
2005-09-02 08:06:51 +04:00
|
|
|
|
2005-10-20 06:55:21 +04:00
|
|
|
mca_btl_mvapi_param_register_int("rd_per_peer", "receive descriptors posted per peer, SRQ mode only",
|
2005-11-08 19:50:07 +03:00
|
|
|
16, (int*) &mca_btl_mvapi_component.rd_per_peer);
|
2005-10-20 06:55:21 +04:00
|
|
|
mca_btl_mvapi_param_register_int ("exclusivity", "BTL exclusivity",
|
|
|
|
MCA_BTL_EXCLUSIVITY_DEFAULT, (int*) &mca_btl_mvapi_module.super.btl_exclusivity);
|
|
|
|
mca_btl_mvapi_param_register_int ("eager_limit", "eager send limit",
|
|
|
|
(32*1024),(int*) &mca_btl_mvapi_module.super.btl_eager_limit);
|
|
|
|
mca_btl_mvapi_module.super.btl_eager_limit -= sizeof(mca_btl_mvapi_header_t);
|
|
|
|
mca_btl_mvapi_param_register_int ("min_send_size", "minimum send size",
|
|
|
|
(32*1024),(int*) &mca_btl_mvapi_module.super.btl_min_send_size);
|
|
|
|
mca_btl_mvapi_module.super.btl_min_send_size -= sizeof(mca_btl_mvapi_header_t);
|
|
|
|
mca_btl_mvapi_param_register_int ("max_send_size", "maximum send size",
|
|
|
|
(64*1024), (int*) &mca_btl_mvapi_module.super.btl_max_send_size);
|
|
|
|
mca_btl_mvapi_module.super.btl_max_send_size -= sizeof(mca_btl_mvapi_header_t);
|
|
|
|
mca_btl_mvapi_param_register_int("min_rdma_size", "minimum rdma size",
|
|
|
|
1024*1024, (int*) &mca_btl_mvapi_module.super.btl_min_rdma_size);
|
|
|
|
mca_btl_mvapi_param_register_int("max_rdma_size", "maximium rdma size",
|
|
|
|
1024*1024, (int*) &mca_btl_mvapi_module.super.btl_max_rdma_size);
|
|
|
|
mca_btl_mvapi_param_register_int("flags", "BTL flags, SEND=0, PUT=1, GET=2",
|
|
|
|
MCA_BTL_FLAGS_PUT | MCA_BTL_FLAGS_GET, (int*) &mca_btl_mvapi_module.super.btl_flags);
|
|
|
|
mca_btl_mvapi_param_register_int("bandwidth", "Approximate maximum bandwidth of interconnect",
|
|
|
|
800, (int*) &mca_btl_mvapi_module.super.btl_bandwidth);
|
|
|
|
mca_btl_mvapi_param_register_int("max_wr_sq_tokens", "Maximum number of send/rdma work request tokens",
|
|
|
|
16, &mca_btl_mvapi_component.max_wr_sq_tokens);
|
|
|
|
mca_btl_mvapi_param_register_int("max_total_wr_sq_tokens", "Maximum number of send/rdma work request tokens peer btl",
|
|
|
|
32, &mca_btl_mvapi_component.max_total_wr_sq_tokens);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
param = mca_base_param_find("mpi", NULL, "leave_pinned");
|
|
|
|
mca_base_param_lookup_int(param, &value);
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_component.leave_pinned = value;
|
2005-10-18 18:55:11 +04:00
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_component.max_send_size = mca_btl_mvapi_module.super.btl_max_send_size;
|
|
|
|
mca_btl_mvapi_component.eager_limit = mca_btl_mvapi_module.super.btl_eager_limit;
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* component cleanup - sanity checking of queue lengths
|
|
|
|
*/
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
int mca_btl_mvapi_component_close(void)
|
2005-06-30 06:09:50 +04:00
|
|
|
{
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-08-15 23:39:56 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
2005-09-02 07:04:28 +04:00
|
|
|
* Register MVAPI port information. The MCA framework
|
2005-08-15 23:39:56 +04:00
|
|
|
* will make this available to all peers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
mca_btl_mvapi_modex_send(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
size_t i;
|
|
|
|
size_t size;
|
2005-09-30 08:39:44 +04:00
|
|
|
mca_btl_mvapi_port_info_t *ports = NULL;
|
2005-08-15 23:39:56 +04:00
|
|
|
|
2005-09-02 07:04:28 +04:00
|
|
|
size = mca_btl_mvapi_component.ib_num_btls * sizeof (mca_btl_mvapi_port_info_t);
|
2005-09-30 08:39:44 +04:00
|
|
|
if (size != 0) {
|
|
|
|
ports = (mca_btl_mvapi_port_info_t *)malloc (size);
|
|
|
|
if (NULL == ports) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
2005-08-15 23:39:56 +04:00
|
|
|
|
2005-09-30 08:39:44 +04:00
|
|
|
for (i = 0; i < mca_btl_mvapi_component.ib_num_btls; i++) {
|
|
|
|
mca_btl_mvapi_module_t *btl = &mca_btl_mvapi_component.mvapi_btls[i];
|
|
|
|
ports[i] = btl->port_info;
|
|
|
|
}
|
2005-08-15 23:39:56 +04:00
|
|
|
}
|
2005-09-02 07:04:28 +04:00
|
|
|
rc = mca_pml_base_modex_send (&mca_btl_mvapi_component.super.btl_version, ports, size);
|
2005-09-30 08:39:44 +04:00
|
|
|
if (NULL != ports) {
|
|
|
|
free (ports);
|
|
|
|
}
|
2005-08-15 23:39:56 +04:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-11-08 19:50:07 +03:00
|
|
|
/*
|
|
|
|
* Callback function on control message.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_btl_mvapi_control(
|
|
|
|
struct mca_btl_base_module_t* btl,
|
|
|
|
mca_btl_base_tag_t tag,
|
|
|
|
mca_btl_base_descriptor_t* descriptor,
|
|
|
|
void* cbdata)
|
|
|
|
{
|
|
|
|
/* dont return credits used for control messages */
|
|
|
|
mca_btl_mvapi_frag_t* frag = (mca_btl_mvapi_frag_t*)descriptor;
|
|
|
|
mca_btl_mvapi_endpoint_t* endpoint = frag->endpoint;
|
|
|
|
if(frag->size == mca_btl_mvapi_component.eager_limit) {
|
|
|
|
OPAL_THREAD_ADD32(&endpoint->rd_credits_hp, -1);
|
|
|
|
} else {
|
|
|
|
OPAL_THREAD_ADD32(&endpoint->rd_credits_lp, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-15 23:39:56 +04:00
|
|
|
|
2005-06-30 06:09:50 +04:00
|
|
|
/*
|
|
|
|
* IB component initialization:
|
|
|
|
* (1) read interface list from kernel and compare against component parameters
|
2005-06-30 09:50:55 +04:00
|
|
|
* then create a BTL instance for selected interfaces
|
2005-06-30 06:09:50 +04:00
|
|
|
* (2) setup IB listen socket for incoming connection attempts
|
2005-06-30 09:50:55 +04:00
|
|
|
* (3) register BTL parameters with the MCA
|
2005-06-30 06:09:50 +04:00
|
|
|
*/
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_base_module_t** mca_btl_mvapi_component_init(int *num_btl_modules,
|
2005-06-30 06:09:50 +04:00
|
|
|
bool enable_progress_threads,
|
|
|
|
bool enable_mpi_threads)
|
|
|
|
{
|
|
|
|
VAPI_ret_t vapi_ret;
|
|
|
|
VAPI_hca_id_t* hca_ids;
|
|
|
|
VAPI_hca_hndl_t hca_hndl;
|
|
|
|
VAPI_hca_vendor_t hca_vendor;
|
|
|
|
VAPI_hca_cap_t hca_cap;
|
|
|
|
VAPI_hca_port_t hca_port;
|
|
|
|
uint32_t num_hcas;
|
2005-06-30 06:12:23 +04:00
|
|
|
mca_btl_base_module_t** btls;
|
2005-06-30 06:09:50 +04:00
|
|
|
uint32_t i,j, length;
|
|
|
|
struct mca_mpool_base_resources_t hca_pd;
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_t btl_list;
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_module_t * mvapi_btl;
|
2005-06-30 06:12:23 +04:00
|
|
|
mca_btl_base_selected_module_t* ib_selected;
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t* item;
|
2005-09-24 04:24:49 +04:00
|
|
|
|
2005-11-08 19:50:07 +03:00
|
|
|
#if 0
|
2005-09-24 04:24:49 +04:00
|
|
|
/* ugly HACK!! */
|
2005-11-08 19:50:07 +03:00
|
|
|
mallopt(M_TRIM_THRESHOLD, -1);
|
|
|
|
mallopt(M_MMAP_MAX, 0);
|
|
|
|
#endif
|
|
|
|
|
2005-06-30 06:09:50 +04:00
|
|
|
/* initialization */
|
2005-06-30 06:12:23 +04:00
|
|
|
*num_btl_modules = 0;
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
/* Determine the number of hca's available on the host */
|
|
|
|
vapi_ret=EVAPI_list_hcas(0, &num_hcas, NULL);
|
|
|
|
if( VAPI_EAGAIN != vapi_ret || 0 == num_hcas ) {
|
2005-09-30 08:39:44 +04:00
|
|
|
mca_btl_base_error_no_nics("MVAPI", "HCA");
|
|
|
|
mca_btl_mvapi_component.ib_num_btls = 0;
|
|
|
|
mca_btl_mvapi_modex_send();
|
2005-06-30 06:09:50 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate space for the hca's */
|
|
|
|
hca_ids = (VAPI_hca_id_t*) malloc(num_hcas * sizeof(VAPI_hca_id_t));
|
|
|
|
if(NULL == hca_ids) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* obtain a list of the hca's on this host */
|
|
|
|
vapi_ret=EVAPI_list_hcas(num_hcas, &num_hcas, hca_ids);
|
|
|
|
if( VAPI_OK != vapi_ret ) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** We must loop through all the hca id's, get there handles and
|
|
|
|
for each hca we query the number of ports on the hca and set up
|
2005-06-30 06:12:23 +04:00
|
|
|
a distinct btl module for each hca port */
|
2005-06-30 06:09:50 +04:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
OBJ_CONSTRUCT(&btl_list, opal_list_t);
|
2005-07-04 02:45:48 +04:00
|
|
|
OBJ_CONSTRUCT(&mca_btl_mvapi_component.ib_lock, opal_mutex_t);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < num_hcas; i++){
|
|
|
|
vapi_ret = EVAPI_get_hca_hndl(hca_ids[i], &hca_hndl);
|
|
|
|
if(VAPI_OK != vapi_ret) {
|
2005-08-02 17:20:50 +04:00
|
|
|
BTL_ERROR(("error getting hca handle: %s", VAPI_strerror(vapi_ret)));
|
2005-06-30 06:09:50 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
vapi_ret = VAPI_query_hca_cap(hca_hndl, &hca_vendor, &hca_cap);
|
|
|
|
if(VAPI_OK != vapi_ret) {
|
2005-08-02 17:20:50 +04:00
|
|
|
BTL_ERROR(("error getting hca properties %s", VAPI_strerror(vapi_ret)));
|
2005-06-30 06:09:50 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Note ports are 1 based hence j = 1 */
|
|
|
|
for(j = 1; j <= hca_cap.phys_port_num; j++){
|
|
|
|
vapi_ret = VAPI_query_hca_port_prop(hca_hndl, (IB_port_t) j, &hca_port);
|
|
|
|
if(VAPI_OK != vapi_ret) {
|
2005-08-02 17:20:50 +04:00
|
|
|
BTL_ERROR(("error getting hca port properties %s", VAPI_strerror(vapi_ret)));
|
2005-06-30 06:09:50 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( PORT_ACTIVE == hca_port.state ){
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
mvapi_btl = (mca_btl_mvapi_module_t*) malloc(sizeof(mca_btl_mvapi_module_t));
|
|
|
|
memcpy(mvapi_btl, &mca_btl_mvapi_module, sizeof(mca_btl_mvapi_module));
|
2005-06-30 06:09:50 +04:00
|
|
|
|
2005-06-30 06:12:23 +04:00
|
|
|
ib_selected = OBJ_NEW(mca_btl_base_selected_module_t);
|
2005-06-30 09:50:55 +04:00
|
|
|
ib_selected->btl_module = (mca_btl_base_module_t*) mvapi_btl;
|
|
|
|
memcpy(mvapi_btl->hca_id, hca_ids[i], sizeof(VAPI_hca_id_t));
|
|
|
|
mvapi_btl->nic = hca_hndl;
|
|
|
|
mvapi_btl->port_id = (IB_port_t) j;
|
|
|
|
mvapi_btl->port = hca_port;
|
2005-09-02 07:04:28 +04:00
|
|
|
mvapi_btl->port_info.subnet = hca_port.sm_lid;
|
2005-11-08 19:50:07 +03:00
|
|
|
mvapi_btl->ib_reg[MCA_BTL_TAG_BTL].cbfunc = mca_btl_mvapi_control;
|
|
|
|
mvapi_btl->ib_reg[MCA_BTL_TAG_BTL].cbdata = NULL;
|
2005-08-15 23:39:56 +04:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(&btl_list, (opal_list_item_t*) ib_selected);
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_component.ib_num_btls ++;
|
2005-06-30 06:09:50 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2005-08-25 01:59:55 +04:00
|
|
|
if(0 == mca_btl_mvapi_component.ib_num_btls){
|
2005-09-30 08:39:44 +04:00
|
|
|
mca_btl_base_error_no_nics("MVAPI", "HCA");
|
|
|
|
mca_btl_mvapi_modex_send();
|
2005-08-25 01:59:55 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
2005-06-30 06:12:23 +04:00
|
|
|
/* Allocate space for btl modules */
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_component.mvapi_btls = (mca_btl_mvapi_module_t*) malloc(sizeof(mca_btl_mvapi_module_t) *
|
2005-08-25 01:59:55 +04:00
|
|
|
mca_btl_mvapi_component.ib_num_btls);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
if(NULL == mca_btl_mvapi_component.mvapi_btls) {
|
2005-06-30 06:09:50 +04:00
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-06-30 06:12:23 +04:00
|
|
|
btls = (struct mca_btl_base_module_t**)
|
2005-06-30 09:50:55 +04:00
|
|
|
malloc(mca_btl_mvapi_component.ib_num_btls * sizeof(struct mca_btl_mvapi_module_t*));
|
2005-06-30 06:12:23 +04:00
|
|
|
if(NULL == btls) {
|
2005-06-30 06:09:50 +04:00
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
for(i = 0; i < mca_btl_mvapi_component.ib_num_btls; i++){
|
2005-08-15 23:39:56 +04:00
|
|
|
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
item = opal_list_remove_first(&btl_list);
|
2005-06-30 06:12:23 +04:00
|
|
|
ib_selected = (mca_btl_base_selected_module_t*)item;
|
2005-06-30 09:50:55 +04:00
|
|
|
mvapi_btl = (mca_btl_mvapi_module_t*) ib_selected->btl_module;
|
|
|
|
memcpy(&(mca_btl_mvapi_component.mvapi_btls[i]), mvapi_btl , sizeof(mca_btl_mvapi_module_t));
|
2005-06-30 06:09:50 +04:00
|
|
|
free(ib_selected);
|
2005-06-30 09:50:55 +04:00
|
|
|
free(mvapi_btl);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
mvapi_btl = &mca_btl_mvapi_component.mvapi_btls[i];
|
2005-11-08 19:50:07 +03:00
|
|
|
mvapi_btl->rd_num = mca_btl_mvapi_component.rd_num + mca_btl_mvapi_component.rd_rsv;
|
|
|
|
mvapi_btl->rd_low = mca_btl_mvapi_component.rd_low;
|
2005-09-02 08:06:51 +04:00
|
|
|
mvapi_btl->num_peers = 0;
|
2005-11-08 19:50:07 +03:00
|
|
|
mvapi_btl->sd_tokens_hp = mvapi_btl->sd_tokens_lp = mca_btl_mvapi_component.max_wr_sq_tokens;
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
/* Initialize module state */
|
|
|
|
|
2005-10-18 18:55:11 +04:00
|
|
|
OBJ_CONSTRUCT(&mvapi_btl->pending_frags_hp, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mvapi_btl->pending_frags_lp, opal_list_t);
|
|
|
|
|
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
OBJ_CONSTRUCT(&mvapi_btl->ib_lock, opal_mutex_t);
|
2005-06-30 09:50:55 +04:00
|
|
|
OBJ_CONSTRUCT(&mvapi_btl->send_free_eager, ompi_free_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mvapi_btl->send_free_max, ompi_free_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mvapi_btl->send_free_frag, ompi_free_list_t);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
OBJ_CONSTRUCT(&mvapi_btl->recv_free_eager, ompi_free_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mvapi_btl->recv_free_max, ompi_free_list_t);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
OBJ_CONSTRUCT(&mvapi_btl->repost, opal_list_t);
|
|
|
|
OBJ_CONSTRUCT(&mvapi_btl->reg_mru_list, opal_list_t);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
if(mca_btl_mvapi_module_init(mvapi_btl) != OMPI_SUCCESS) {
|
2005-06-30 06:09:50 +04:00
|
|
|
free(hca_ids);
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-08-31 23:43:22 +04:00
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
hca_pd.hca = mvapi_btl->nic;
|
|
|
|
hca_pd.pd_tag = mvapi_btl->ptag;
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
/* initialize the memory pool using the hca */
|
2005-09-13 02:28:23 +04:00
|
|
|
mvapi_btl->super.btl_mpool =
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_mpool_base_module_create(mca_btl_mvapi_component.ib_mpool_name,
|
|
|
|
&mvapi_btl->super,
|
2005-06-30 06:09:50 +04:00
|
|
|
&hca_pd);
|
|
|
|
|
2005-09-13 02:28:23 +04:00
|
|
|
if(NULL == mvapi_btl->super.btl_mpool) {
|
2005-08-02 17:20:50 +04:00
|
|
|
BTL_ERROR(("error creating vapi memory pool! aborting mvapi btl initialization"));
|
2005-06-30 06:09:50 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
/* Initialize pool of send fragments */
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
length = sizeof(mca_btl_mvapi_frag_t) +
|
|
|
|
sizeof(mca_btl_mvapi_header_t) +
|
|
|
|
mvapi_btl->super.btl_eager_limit+
|
|
|
|
2*MCA_BTL_IB_FRAG_ALIGN;
|
2005-06-30 06:09:50 +04:00
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
ompi_free_list_init(&mvapi_btl->send_free_eager,
|
2005-06-30 06:09:50 +04:00
|
|
|
length,
|
2005-06-30 09:50:55 +04:00
|
|
|
OBJ_CLASS(mca_btl_mvapi_send_frag_eager_t),
|
2005-11-08 19:50:07 +03:00
|
|
|
2*mvapi_btl->rd_num,
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_component.ib_free_list_max,
|
|
|
|
mca_btl_mvapi_component.ib_free_list_inc,
|
2005-09-13 02:28:23 +04:00
|
|
|
mvapi_btl->super.btl_mpool);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
ompi_free_list_init(&mvapi_btl->recv_free_eager,
|
2005-06-30 06:09:50 +04:00
|
|
|
length,
|
2005-06-30 09:50:55 +04:00
|
|
|
OBJ_CLASS(mca_btl_mvapi_recv_frag_eager_t),
|
2005-11-08 19:50:07 +03:00
|
|
|
2*mvapi_btl->rd_num,
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_component.ib_free_list_max,
|
|
|
|
mca_btl_mvapi_component.ib_free_list_inc,
|
2005-09-13 02:28:23 +04:00
|
|
|
mvapi_btl->super.btl_mpool);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
length = sizeof(mca_btl_mvapi_frag_t) +
|
|
|
|
sizeof(mca_btl_mvapi_header_t) +
|
|
|
|
mvapi_btl->super.btl_max_send_size+
|
|
|
|
2*MCA_BTL_IB_FRAG_ALIGN;
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
ompi_free_list_init(&mvapi_btl->send_free_max,
|
2005-06-30 06:09:50 +04:00
|
|
|
length,
|
2005-06-30 09:50:55 +04:00
|
|
|
OBJ_CLASS(mca_btl_mvapi_send_frag_max_t),
|
2005-11-08 19:50:07 +03:00
|
|
|
2*mvapi_btl->rd_num,
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_component.ib_free_list_max,
|
|
|
|
mca_btl_mvapi_component.ib_free_list_inc,
|
2005-09-13 02:28:23 +04:00
|
|
|
mvapi_btl->super.btl_mpool);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Initialize pool of receive fragments */
|
2005-06-30 09:50:55 +04:00
|
|
|
ompi_free_list_init (&mvapi_btl->recv_free_max,
|
2005-06-30 06:09:50 +04:00
|
|
|
length,
|
2005-06-30 09:50:55 +04:00
|
|
|
OBJ_CLASS (mca_btl_mvapi_recv_frag_max_t),
|
2005-11-08 19:50:07 +03:00
|
|
|
2*mvapi_btl->rd_num,
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_component.ib_free_list_max,
|
2005-09-13 02:28:23 +04:00
|
|
|
mca_btl_mvapi_component.ib_free_list_inc,
|
|
|
|
mvapi_btl->super.btl_mpool);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
length = sizeof(mca_btl_mvapi_frag_t) +
|
|
|
|
sizeof(mca_btl_mvapi_header_t)+
|
|
|
|
2*MCA_BTL_IB_FRAG_ALIGN;
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
ompi_free_list_init(&mvapi_btl->send_free_frag,
|
2005-06-30 06:09:50 +04:00
|
|
|
length,
|
2005-06-30 09:50:55 +04:00
|
|
|
OBJ_CLASS(mca_btl_mvapi_send_frag_frag_t),
|
|
|
|
mca_btl_mvapi_component.ib_free_list_num,
|
|
|
|
mca_btl_mvapi_component.ib_free_list_max,
|
|
|
|
mca_btl_mvapi_component.ib_free_list_inc,
|
2005-09-13 02:28:23 +04:00
|
|
|
mvapi_btl->super.btl_mpool);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* Initialize the rr_desc_post array for posting of rr*/
|
2005-11-08 19:50:07 +03:00
|
|
|
mvapi_btl->rr_desc_post = (VAPI_rr_desc_t*) malloc((mvapi_btl->rd_num * sizeof(VAPI_rr_desc_t)));
|
2005-06-30 09:50:55 +04:00
|
|
|
btls[i] = &mvapi_btl->super;
|
2005-09-01 00:28:42 +04:00
|
|
|
|
2005-06-30 06:09:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Post OOB receive to support dynamic connection setup */
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_post_recv();
|
2005-09-02 07:04:28 +04:00
|
|
|
|
2005-08-15 23:39:56 +04:00
|
|
|
mca_btl_mvapi_modex_send();
|
2005-06-30 09:50:55 +04:00
|
|
|
*num_btl_modules = mca_btl_mvapi_component.ib_num_btls;
|
2005-06-30 06:09:50 +04:00
|
|
|
free(hca_ids);
|
2005-06-30 06:12:23 +04:00
|
|
|
return btls;
|
2005-06-30 06:09:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* IB component progress.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2005-06-30 09:50:55 +04:00
|
|
|
int mca_btl_mvapi_component_progress()
|
2005-06-30 06:09:50 +04:00
|
|
|
{
|
|
|
|
uint32_t i;
|
|
|
|
int count = 0;
|
2005-11-08 19:50:07 +03:00
|
|
|
int32_t credits;
|
|
|
|
|
2005-07-20 01:04:22 +04:00
|
|
|
mca_btl_mvapi_frag_t* frag;
|
|
|
|
mca_btl_mvapi_endpoint_t* endpoint;
|
2005-06-30 06:09:50 +04:00
|
|
|
/* Poll for completions */
|
2005-06-30 09:50:55 +04:00
|
|
|
for(i = 0; i < mca_btl_mvapi_component.ib_num_btls; i++) {
|
2005-06-30 06:09:50 +04:00
|
|
|
VAPI_ret_t ret;
|
|
|
|
VAPI_wc_desc_t comp;
|
2005-06-30 09:50:55 +04:00
|
|
|
mca_btl_mvapi_module_t* mvapi_btl = &mca_btl_mvapi_component.mvapi_btls[i];
|
2005-06-30 06:09:50 +04:00
|
|
|
|
2005-07-20 01:04:22 +04:00
|
|
|
|
|
|
|
/* we have two completion queues, one for "high" priority and one for "low".
|
|
|
|
* we will check the high priority and process them until there are none left.
|
|
|
|
* note that low priority messages are only processed one per progress call.
|
|
|
|
*/
|
2005-11-08 19:50:07 +03:00
|
|
|
ret = VAPI_poll_cq(mvapi_btl->nic, mvapi_btl->cq_hndl_hp, &comp);
|
2005-06-30 06:09:50 +04:00
|
|
|
if(VAPI_OK == ret) {
|
|
|
|
if(comp.status != VAPI_SUCCESS) {
|
2005-08-02 17:20:50 +04:00
|
|
|
BTL_ERROR(("Got error : %s, Vendor code : %d Frag : %p",
|
2005-07-20 21:43:31 +04:00
|
|
|
VAPI_wc_status_sym(comp.status),
|
2005-08-02 17:20:50 +04:00
|
|
|
comp.vendor_err_syndrome, comp.id));
|
2005-06-30 06:09:50 +04:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
2005-07-20 01:04:22 +04:00
|
|
|
/* Handle work completions */
|
2005-06-30 06:09:50 +04:00
|
|
|
switch(comp.opcode) {
|
|
|
|
case VAPI_CQE_RQ_RDMA_WITH_IMM:
|
2005-08-02 17:20:50 +04:00
|
|
|
BTL_ERROR(("Got an RDMA with Immediate data!, not supported!"));
|
2005-07-20 21:43:31 +04:00
|
|
|
return OMPI_ERROR;
|
2005-08-31 23:43:22 +04:00
|
|
|
|
|
|
|
case VAPI_CQE_SQ_SEND_DATA :
|
2005-11-08 19:50:07 +03:00
|
|
|
|
|
|
|
/* Process a completed send */
|
2005-10-07 21:38:34 +04:00
|
|
|
frag = (mca_btl_mvapi_frag_t*) (unsigned long) comp.id;
|
2005-11-08 19:50:07 +03:00
|
|
|
endpoint = (mca_btl_mvapi_endpoint_t*) frag->endpoint;
|
|
|
|
|
2005-06-30 06:09:50 +04:00
|
|
|
frag->rc = OMPI_SUCCESS;
|
2005-11-08 19:50:07 +03:00
|
|
|
frag->base.des_cbfunc(&mvapi_btl->super, endpoint, &frag->base, frag->rc);
|
2005-06-30 06:09:50 +04:00
|
|
|
count++;
|
2005-09-02 20:27:01 +04:00
|
|
|
|
2005-11-08 19:50:07 +03:00
|
|
|
/* check and see if we need to progress pending sends */
|
2005-10-18 18:55:11 +04:00
|
|
|
if( mca_btl_mvapi_component.use_srq &&
|
2005-11-08 19:50:07 +03:00
|
|
|
OPAL_THREAD_ADD32(&mvapi_btl->sd_tokens_hp, 1) > 0
|
2005-10-18 18:55:11 +04:00
|
|
|
&& !opal_list_is_empty(&mvapi_btl->pending_frags_hp)) {
|
|
|
|
opal_list_item_t *frag_item;
|
|
|
|
frag_item = opal_list_remove_first(&mvapi_btl->pending_frags_hp);
|
|
|
|
frag = (mca_btl_mvapi_frag_t *) frag_item;
|
2005-11-08 19:50:07 +03:00
|
|
|
if(OMPI_SUCCESS != mca_btl_mvapi_endpoint_send(endpoint, frag)) {
|
2005-10-18 18:55:11 +04:00
|
|
|
BTL_ERROR(("error in posting pending send\n"));
|
|
|
|
}
|
|
|
|
}
|
2005-06-30 06:09:50 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case VAPI_CQE_RQ_SEND_DATA:
|
|
|
|
|
2005-11-08 19:50:07 +03:00
|
|
|
/* process a RECV */
|
2005-10-07 21:38:34 +04:00
|
|
|
frag = (mca_btl_mvapi_frag_t*) (unsigned long) comp.id;
|
2005-07-20 21:43:31 +04:00
|
|
|
endpoint = (mca_btl_mvapi_endpoint_t*) frag->endpoint;
|
2005-11-08 19:50:07 +03:00
|
|
|
credits = frag->hdr->credits;
|
|
|
|
|
|
|
|
/* repost receive descriptors */
|
|
|
|
if(mca_btl_mvapi_component.use_srq) {
|
|
|
|
OPAL_THREAD_ADD32(&mvapi_btl->srd_posted_hp, -1);
|
|
|
|
MCA_BTL_MVAPI_POST_SRR_HIGH(mvapi_btl, 0);
|
|
|
|
} else {
|
|
|
|
OPAL_THREAD_ADD32(&endpoint->rd_posted_hp, -1);
|
|
|
|
MCA_BTL_MVAPI_ENDPOINT_POST_RR_HIGH(endpoint, 0);
|
|
|
|
}
|
2005-07-20 01:04:22 +04:00
|
|
|
|
2005-11-08 19:50:07 +03:00
|
|
|
/* advance the segment address past the header and subtract from the length..*/
|
2005-06-30 06:09:50 +04:00
|
|
|
frag->rc=OMPI_SUCCESS;
|
|
|
|
frag->segment.seg_len = comp.byte_len-((unsigned char*) frag->segment.seg_addr.pval - (unsigned char*) frag->hdr);
|
2005-11-08 19:50:07 +03:00
|
|
|
/* call registered callback */
|
2005-06-30 09:50:55 +04:00
|
|
|
mvapi_btl->ib_reg[frag->hdr->tag].cbfunc(&mvapi_btl->super, frag->hdr->tag, &frag->base, mvapi_btl->ib_reg[frag->hdr->tag].cbdata);
|
2005-07-03 20:22:16 +04:00
|
|
|
OMPI_FREE_LIST_RETURN(&(mvapi_btl->recv_free_eager), (opal_list_item_t*) frag);
|
2005-06-30 06:09:50 +04:00
|
|
|
|
2005-11-08 19:50:07 +03:00
|
|
|
/* check to see if we need to progress any pending desciptors */
|
|
|
|
if( !mca_btl_mvapi_component.use_srq &&
|
|
|
|
OPAL_THREAD_ADD32(&endpoint->sd_tokens_hp, credits) > 0
|
|
|
|
&& !opal_list_is_empty(&(endpoint->pending_frags_hp))) {
|
|
|
|
|
|
|
|
do {
|
|
|
|
opal_list_item_t *frag_item;
|
|
|
|
OPAL_THREAD_LOCK(&endpoint->endpoint_lock);
|
|
|
|
frag_item = opal_list_remove_first(&(endpoint->pending_frags_hp));
|
|
|
|
OPAL_THREAD_UNLOCK(&endpoint->endpoint_lock);
|
|
|
|
if(NULL == (frag = (mca_btl_mvapi_frag_t *) frag_item))
|
|
|
|
break;
|
|
|
|
if(OMPI_SUCCESS != mca_btl_mvapi_endpoint_send(frag->endpoint, frag)) {
|
|
|
|
BTL_ERROR(("error in posting pending send\n"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while(endpoint->sd_tokens_hp > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check to see if we need to return credits */
|
|
|
|
if( !mca_btl_mvapi_component.use_srq &&
|
|
|
|
endpoint->rd_credits_hp >= mca_btl_mvapi_component.rd_win) {
|
|
|
|
mca_btl_mvapi_endpoint_send_credits(endpoint, endpoint->lcl_qp_hndl_hp, endpoint->rem_info.rem_qp_num_hp, &endpoint->rd_credits_hp);
|
2005-07-26 01:15:41 +04:00
|
|
|
}
|
2005-06-30 06:09:50 +04:00
|
|
|
count++;
|
|
|
|
break;
|
|
|
|
|
2005-11-08 19:50:07 +03:00
|
|
|
case VAPI_CQE_SQ_RDMA_READ:
|
|
|
|
case VAPI_CQE_SQ_RDMA_WRITE:
|
2005-06-30 06:09:50 +04:00
|
|
|
default:
|
2005-08-02 17:20:50 +04:00
|
|
|
BTL_ERROR(("Unhandled work completion opcode is %d", comp.opcode));
|
2005-06-30 06:09:50 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2005-08-18 02:52:56 +04:00
|
|
|
|
2005-11-08 19:50:07 +03:00
|
|
|
ret = VAPI_poll_cq(mvapi_btl->nic, mvapi_btl->cq_hndl_lp, &comp);
|
2005-06-30 06:09:50 +04:00
|
|
|
if(VAPI_OK == ret) {
|
|
|
|
if(comp.status != VAPI_SUCCESS) {
|
2005-08-02 17:20:50 +04:00
|
|
|
BTL_ERROR(("Got error : %s, Vendor code : %d Frag : %p",
|
2005-06-30 06:09:50 +04:00
|
|
|
VAPI_wc_status_sym(comp.status),
|
2005-08-02 17:20:50 +04:00
|
|
|
comp.vendor_err_syndrome, comp.id));
|
2005-06-30 06:09:50 +04:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle n/w completions */
|
|
|
|
switch(comp.opcode) {
|
2005-07-20 21:43:31 +04:00
|
|
|
case VAPI_CQE_RQ_RDMA_WITH_IMM:
|
2005-08-02 17:20:50 +04:00
|
|
|
BTL_ERROR(("Got an RDMA with Immediate data!, not supported!"));
|
2005-07-20 21:43:31 +04:00
|
|
|
return OMPI_ERROR;
|
|
|
|
|
2005-06-30 06:09:50 +04:00
|
|
|
case VAPI_CQE_SQ_SEND_DATA :
|
|
|
|
|
2005-11-08 19:50:07 +03:00
|
|
|
/* Process a completed send - receiver must return tokens */
|
2005-10-07 21:38:34 +04:00
|
|
|
frag = (mca_btl_mvapi_frag_t*) (unsigned long) comp.id;
|
2005-06-30 06:09:50 +04:00
|
|
|
frag->rc = OMPI_SUCCESS;
|
2005-06-30 09:50:55 +04:00
|
|
|
frag->base.des_cbfunc(&mvapi_btl->super, frag->endpoint, &frag->base, frag->rc);
|
2005-06-30 06:09:50 +04:00
|
|
|
count++;
|
2005-11-08 19:50:07 +03:00
|
|
|
|
|
|
|
/* if we have tokens, process pending sends */
|
|
|
|
if(mca_btl_mvapi_component.use_srq &&
|
|
|
|
OPAL_THREAD_ADD32(&mvapi_btl->sd_tokens_lp, 1) > 0
|
|
|
|
&& !opal_list_is_empty(&mvapi_btl->pending_frags_lp)) {
|
2005-09-01 06:41:44 +04:00
|
|
|
opal_list_item_t *frag_item;
|
2005-11-08 19:50:07 +03:00
|
|
|
frag_item = opal_list_remove_first(&mvapi_btl->pending_frags_lp);
|
2005-09-01 06:41:44 +04:00
|
|
|
frag = (mca_btl_mvapi_frag_t *) frag_item;
|
2005-11-08 19:50:07 +03:00
|
|
|
MCA_BTL_IB_FRAG_PROGRESS(frag);
|
2005-10-18 18:55:11 +04:00
|
|
|
}
|
2005-11-08 19:50:07 +03:00
|
|
|
break;
|
|
|
|
|
|
|
|
case VAPI_CQE_SQ_RDMA_READ:
|
|
|
|
|
|
|
|
frag = (mca_btl_mvapi_frag_t*) (unsigned long) comp.id;
|
|
|
|
OPAL_THREAD_ADD32(&frag->endpoint->get_tokens, 1);
|
|
|
|
/* fall through */
|
|
|
|
|
|
|
|
case VAPI_CQE_SQ_RDMA_WRITE:
|
|
|
|
|
|
|
|
/* Process a completed write - returns send tokens immediately */
|
|
|
|
frag = (mca_btl_mvapi_frag_t*) (unsigned long) comp.id;
|
|
|
|
endpoint = frag->endpoint;
|
|
|
|
frag->rc = OMPI_SUCCESS;
|
|
|
|
frag->base.des_cbfunc(&mvapi_btl->super, frag->endpoint, &frag->base, frag->rc);
|
|
|
|
count++;
|
|
|
|
|
2005-10-18 18:55:11 +04:00
|
|
|
if(mca_btl_mvapi_component.use_srq &&
|
2005-11-08 19:50:07 +03:00
|
|
|
OPAL_THREAD_ADD32(&mvapi_btl->sd_tokens_lp, 1) > 0
|
2005-10-18 18:55:11 +04:00
|
|
|
&& !opal_list_is_empty(&mvapi_btl->pending_frags_lp)) {
|
|
|
|
opal_list_item_t *frag_item;
|
|
|
|
frag_item = opal_list_remove_first(&mvapi_btl->pending_frags_lp);
|
|
|
|
frag = (mca_btl_mvapi_frag_t *) frag_item;
|
2005-11-08 19:50:07 +03:00
|
|
|
MCA_BTL_IB_FRAG_PROGRESS(frag);
|
|
|
|
}
|
|
|
|
if(!mca_btl_mvapi_component.use_srq &&
|
|
|
|
OPAL_THREAD_ADD32(&endpoint->sd_tokens_lp, 1) > 0 &&
|
|
|
|
!opal_list_is_empty(&(endpoint->pending_frags_lp))) {
|
|
|
|
opal_list_item_t *frag_item;
|
|
|
|
OPAL_THREAD_LOCK(&frag->endpoint->endpoint_lock);
|
|
|
|
frag_item = opal_list_remove_first(&(frag->endpoint->pending_frags_lp));
|
|
|
|
OPAL_THREAD_UNLOCK(&frag->endpoint->endpoint_lock);
|
|
|
|
frag = (mca_btl_mvapi_frag_t *) frag_item;
|
|
|
|
MCA_BTL_IB_FRAG_PROGRESS(frag);
|
2005-09-01 06:41:44 +04:00
|
|
|
}
|
2005-06-30 06:09:50 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
case VAPI_CQE_RQ_SEND_DATA:
|
|
|
|
|
2005-10-07 21:38:34 +04:00
|
|
|
frag = (mca_btl_mvapi_frag_t*) (unsigned long) comp.id;
|
2005-07-20 21:43:31 +04:00
|
|
|
endpoint = (mca_btl_mvapi_endpoint_t*) frag->endpoint;
|
2005-11-08 19:50:07 +03:00
|
|
|
credits = frag->hdr->credits;
|
|
|
|
|
|
|
|
/* post descriptors before processing receive */
|
|
|
|
if(mca_btl_mvapi_component.use_srq) {
|
|
|
|
OPAL_THREAD_ADD32(&mvapi_btl->srd_posted_lp, -1);
|
|
|
|
MCA_BTL_MVAPI_POST_SRR_LOW(mvapi_btl, 0);
|
|
|
|
} else {
|
|
|
|
OPAL_THREAD_ADD32(&endpoint->rd_posted_lp, -1);
|
|
|
|
MCA_BTL_MVAPI_ENDPOINT_POST_RR_LOW(endpoint, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* process received frag */
|
2005-06-30 06:09:50 +04:00
|
|
|
frag->rc=OMPI_SUCCESS;
|
|
|
|
frag->segment.seg_len = comp.byte_len-((unsigned char*) frag->segment.seg_addr.pval - (unsigned char*) frag->hdr);
|
|
|
|
/* advance the segment address past the header and subtract from the length..*/
|
2005-06-30 09:50:55 +04:00
|
|
|
mvapi_btl->ib_reg[frag->hdr->tag].cbfunc(&mvapi_btl->super, frag->hdr->tag, &frag->base, mvapi_btl->ib_reg[frag->hdr->tag].cbdata);
|
2005-07-03 20:22:16 +04:00
|
|
|
OMPI_FREE_LIST_RETURN(&(mvapi_btl->recv_free_max), (opal_list_item_t*) frag);
|
2005-11-08 19:50:07 +03:00
|
|
|
|
|
|
|
/* check to see if we need to progress pending descriptors */
|
|
|
|
if(!mca_btl_mvapi_component.use_srq &&
|
|
|
|
OPAL_THREAD_ADD32(&endpoint->sd_tokens_lp, credits) > 0 &&
|
|
|
|
!opal_list_is_empty(&(endpoint->pending_frags_lp))) {
|
|
|
|
do {
|
|
|
|
opal_list_item_t *frag_item;
|
|
|
|
OPAL_THREAD_LOCK(&endpoint->endpoint_lock);
|
|
|
|
frag_item = opal_list_remove_first(&(endpoint->pending_frags_lp));
|
|
|
|
OPAL_THREAD_UNLOCK(&endpoint->endpoint_lock);
|
|
|
|
if(NULL == (frag = (mca_btl_mvapi_frag_t *) frag_item))
|
|
|
|
break;
|
|
|
|
MCA_BTL_IB_FRAG_PROGRESS(frag);
|
|
|
|
} while(endpoint->sd_tokens_lp > 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check to see if we need to return credits */
|
|
|
|
if( !mca_btl_mvapi_component.use_srq &&
|
|
|
|
endpoint->rd_credits_lp >= mca_btl_mvapi_component.rd_win) {
|
|
|
|
mca_btl_mvapi_endpoint_send_credits(endpoint, endpoint->lcl_qp_hndl_lp, endpoint->rem_info.rem_qp_num_lp, &endpoint->rd_credits_lp);
|
2005-07-26 01:15:41 +04:00
|
|
|
}
|
2005-06-30 06:09:50 +04:00
|
|
|
count++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2005-08-02 17:20:50 +04:00
|
|
|
BTL_ERROR(("Errorneous network completion"));
|
2005-06-30 06:09:50 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return count;
|
|
|
|
}
|