2005-07-01 01:28:35 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University.
|
|
|
|
* All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
|
|
|
|
* All rights reserved.
|
|
|
|
* 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"
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include "include/types.h"
|
|
|
|
#include "mca/pml/base/pml_base_sendreq.h"
|
|
|
|
#include "mca/ns/base/base.h"
|
|
|
|
#include "mca/oob/base/base.h"
|
|
|
|
#include "mca/rml/rml.h"
|
|
|
|
#include "mca/errmgr/errmgr.h"
|
|
|
|
#include "dps/dps.h"
|
|
|
|
#include "btl_openib.h"
|
|
|
|
#include "btl_openib_endpoint.h"
|
|
|
|
#include "btl_openib_proc.h"
|
|
|
|
#include "btl_openib_frag.h"
|
|
|
|
#include "class/ompi_free_list.h"
|
2005-07-15 19:13:19 +04:00
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
extern int errno;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
static void mca_btl_openib_endpoint_construct(mca_btl_base_endpoint_t* endpoint);
|
|
|
|
static void mca_btl_openib_endpoint_destruct(mca_btl_base_endpoint_t* endpoint);
|
|
|
|
|
|
|
|
int mca_btl_openib_endpoint_create_qp(
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl,
|
|
|
|
struct ibv_pd* pd,
|
|
|
|
struct ibv_cq* cq,
|
|
|
|
struct ibv_qp_attr* qp_attr,
|
|
|
|
struct ibv_qp** qp
|
|
|
|
);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
int mca_btl_openib_endpoint_qp_init_query(
|
|
|
|
mca_btl_openib_module_t* openib_btl,
|
|
|
|
struct ibv_qp* qp,
|
|
|
|
struct ibv_qp_attr* attr,
|
|
|
|
uint32_t lcl_psn,
|
|
|
|
uint32_t rem_qp_num,
|
|
|
|
uint32_t rem_psn,
|
|
|
|
uint16_t rem_lid,
|
|
|
|
uint32_t port_num
|
|
|
|
);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* post a send to the work queue
|
|
|
|
*/
|
2005-07-12 17:38:54 +04:00
|
|
|
static inline int mca_btl_openib_endpoint_post_send(mca_btl_openib_module_t* openib_btl,
|
|
|
|
mca_btl_openib_endpoint_t * endpoint,
|
|
|
|
mca_btl_openib_frag_t * frag)
|
2005-07-01 01:28:35 +04:00
|
|
|
{
|
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
struct ibv_qp* ib_qp;
|
2005-07-13 04:17:08 +04:00
|
|
|
struct ibv_send_wr* bad_wr;
|
|
|
|
frag->sg_entry.addr = (uintptr_t) frag->hdr;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
if(frag->base.des_flags && MCA_BTL_DES_FLAGS_PRIORITY && frag->size <= openib_btl->super.btl_eager_limit){
|
|
|
|
ib_qp = endpoint->lcl_qp_high;
|
2005-07-01 01:28:35 +04:00
|
|
|
} else {
|
2005-07-12 17:38:54 +04:00
|
|
|
ib_qp = endpoint->lcl_qp_low;
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
frag->wr_desc.sr_desc.opcode = IBV_WR_SEND;
|
2005-07-20 01:04:22 +04:00
|
|
|
|
|
|
|
frag->sg_entry.length =
|
|
|
|
frag->segment.seg_len +
|
|
|
|
((unsigned char*) frag->segment.seg_addr.pval - (unsigned char*) frag->hdr);
|
2005-07-12 17:38:54 +04:00
|
|
|
|
2005-07-20 01:04:22 +04:00
|
|
|
|
|
|
|
if(frag->sg_entry.length <= openib_btl->ib_inline_max) {
|
2005-07-20 19:17:18 +04:00
|
|
|
frag->wr_desc.sr_desc.send_flags |= IBV_SEND_INLINE;
|
2005-07-20 01:04:22 +04:00
|
|
|
}
|
2005-07-12 17:38:54 +04:00
|
|
|
|
2005-07-20 01:04:22 +04:00
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
if(ibv_post_send(ib_qp,
|
2005-07-20 19:17:18 +04:00
|
|
|
&frag->wr_desc.sr_desc,
|
2005-07-12 17:38:54 +04:00
|
|
|
&bad_wr)) {
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_ERROR("error posting send request errno says %s", strerror(errno));
|
2005-07-01 01:28:35 +04:00
|
|
|
return OMPI_ERROR;
|
2005-07-12 17:38:54 +04:00
|
|
|
}
|
2005-07-20 19:17:18 +04:00
|
|
|
MCA_BTL_OPENIB_ENDPOINT_POST_RR_HIGH(endpoint, 1);
|
|
|
|
MCA_BTL_OPENIB_ENDPOINT_POST_RR_LOW(endpoint, 1);
|
|
|
|
|
2005-07-20 01:04:22 +04:00
|
|
|
return OMPI_SUCCESS;
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(mca_btl_openib_endpoint_t,
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t, mca_btl_openib_endpoint_construct,
|
2005-07-01 01:28:35 +04:00
|
|
|
mca_btl_openib_endpoint_destruct);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize state of the endpoint instance.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_btl_openib_endpoint_construct(mca_btl_base_endpoint_t* endpoint)
|
|
|
|
{
|
|
|
|
endpoint->endpoint_btl = 0;
|
|
|
|
endpoint->endpoint_proc = 0;
|
|
|
|
endpoint->endpoint_tstamp = 0.0;
|
|
|
|
endpoint->endpoint_state = MCA_BTL_IB_CLOSED;
|
|
|
|
endpoint->endpoint_retries = 0;
|
2005-07-04 02:45:48 +04:00
|
|
|
OBJ_CONSTRUCT(&endpoint->endpoint_send_lock, opal_mutex_t);
|
|
|
|
OBJ_CONSTRUCT(&endpoint->endpoint_recv_lock, opal_mutex_t);
|
2005-07-03 20:22:16 +04:00
|
|
|
OBJ_CONSTRUCT(&endpoint->pending_send_frags, opal_list_t);
|
2005-07-20 01:04:22 +04:00
|
|
|
endpoint->lcl_qp_attr_high = (struct ibv_qp_attr *) malloc(sizeof(struct ibv_qp_attr));
|
|
|
|
endpoint->lcl_qp_attr_low = (struct ibv_qp_attr *) malloc(sizeof(struct ibv_qp_attr));
|
|
|
|
memset(endpoint->lcl_qp_attr_high, 0, sizeof(struct ibv_qp_attr));
|
|
|
|
memset(endpoint->lcl_qp_attr_low, 0, sizeof(struct ibv_qp_attr));
|
|
|
|
endpoint->rr_posted_high = 0;
|
|
|
|
endpoint->rr_posted_low = 0;
|
|
|
|
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Destroy a endpoint
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_btl_openib_endpoint_destruct(mca_btl_base_endpoint_t* endpoint)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Send connection information to remote endpoint using OOB
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_btl_openib_endpoint_send_cb(
|
|
|
|
int status,
|
|
|
|
orte_process_name_t* endpoint,
|
|
|
|
orte_buffer_t* buffer,
|
|
|
|
orte_rml_tag_t tag,
|
|
|
|
void* cbdata)
|
|
|
|
{
|
|
|
|
OBJ_RELEASE(buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int mca_btl_openib_endpoint_send_connect_req(mca_btl_base_endpoint_t* endpoint)
|
|
|
|
{
|
|
|
|
orte_buffer_t* buffer = OBJ_NEW(orte_buffer_t);
|
|
|
|
int rc;
|
|
|
|
if(NULL == buffer) {
|
|
|
|
ORTE_ERROR_LOG(ORTE_ERR_OUT_OF_RESOURCE);
|
|
|
|
return ORTE_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* pack the info in the send buffer */
|
|
|
|
|
2005-07-13 04:17:08 +04:00
|
|
|
rc = orte_dps.pack(buffer, &endpoint->lcl_qp_high->qp_num, 1, ORTE_UINT32);
|
2005-07-01 01:28:35 +04:00
|
|
|
if(rc != ORTE_SUCCESS) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-07-13 04:17:08 +04:00
|
|
|
rc = orte_dps.pack(buffer, &endpoint->lcl_qp_low->qp_num, 1, ORTE_UINT32);
|
2005-07-01 01:28:35 +04:00
|
|
|
if(rc != ORTE_SUCCESS) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2005-07-12 17:38:54 +04:00
|
|
|
|
|
|
|
rc = orte_dps.pack(buffer, &endpoint->lcl_psn_high, 1, ORTE_UINT32);
|
|
|
|
if(rc != ORTE_SUCCESS) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = orte_dps.pack(buffer, &endpoint->lcl_psn_low, 1, ORTE_UINT32);
|
2005-07-01 01:28:35 +04:00
|
|
|
if(rc != ORTE_SUCCESS) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-07-13 04:17:08 +04:00
|
|
|
rc = orte_dps.pack(buffer, &endpoint->endpoint_btl->ib_port_attr->lid, 1, ORTE_UINT16);
|
2005-07-12 17:38:54 +04:00
|
|
|
if(rc != ORTE_SUCCESS) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
/* send to endpoint */
|
|
|
|
rc = orte_rml.send_buffer_nb(&endpoint->endpoint_proc->proc_guid, buffer, ORTE_RML_TAG_DYNAMIC-1, 0,
|
|
|
|
mca_btl_openib_endpoint_send_cb, NULL);
|
|
|
|
|
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_DEBUG_OUT("Sending High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
|
2005-07-20 01:04:22 +04:00
|
|
|
endpoint->lcl_qp_high->qp_num,
|
|
|
|
endpoint->lcl_qp_low->qp_num,
|
|
|
|
endpoint->endpoint_btl->ib_port_attr->lid);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
if(rc < 0) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Send connect ACK to remote endpoint
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int mca_btl_openib_endpoint_send_connect_ack(mca_btl_base_endpoint_t* endpoint)
|
|
|
|
{
|
|
|
|
orte_buffer_t* buffer = OBJ_NEW(orte_buffer_t);
|
|
|
|
int rc;
|
|
|
|
uint32_t zero = 0;
|
|
|
|
|
|
|
|
/* pack the info in the send buffer */
|
|
|
|
if(ORTE_SUCCESS != (rc = orte_dps.pack(buffer, &zero, 1, ORTE_UINT32))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
if(ORTE_SUCCESS != (rc = orte_dps.pack(buffer, &zero, 1, ORTE_UINT32))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
if(ORTE_SUCCESS != (rc = orte_dps.pack(buffer, &zero, 1, ORTE_UINT32))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2005-07-12 17:38:54 +04:00
|
|
|
if(ORTE_SUCCESS != (rc = orte_dps.pack(buffer, &zero, 1, ORTE_UINT32))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
if(ORTE_SUCCESS != (rc = orte_dps.pack(buffer, &zero, 1, ORTE_UINT16))) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
/* send to endpoint */
|
|
|
|
rc = orte_rml.send_buffer_nb(&endpoint->endpoint_proc->proc_guid, buffer, ORTE_RML_TAG_DYNAMIC-1, 0,
|
|
|
|
mca_btl_openib_endpoint_send_cb, NULL);
|
|
|
|
if(rc < 0) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set remote connection info
|
2005-07-20 19:17:18 +04:00
|
|
|
* (from OOB connection)
|
2005-07-01 01:28:35 +04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
static int mca_btl_openib_endpoint_set_remote_info(mca_btl_base_endpoint_t* endpoint, orte_buffer_t* buffer)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
size_t cnt = 1;
|
|
|
|
rc = orte_dps.unpack(buffer, &endpoint->rem_qp_num_high, &cnt, ORTE_UINT32);
|
|
|
|
if(ORTE_SUCCESS != rc) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
rc = orte_dps.unpack(buffer, &endpoint->rem_qp_num_low, &cnt, ORTE_UINT32);
|
|
|
|
if(ORTE_SUCCESS != rc) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2005-07-12 17:38:54 +04:00
|
|
|
rc = orte_dps.unpack(buffer, &endpoint->rem_psn_high, &cnt, ORTE_UINT32);
|
|
|
|
if(ORTE_SUCCESS != rc) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
rc = orte_dps.unpack(buffer, &endpoint->rem_psn_low, &cnt, ORTE_UINT32);
|
|
|
|
if(ORTE_SUCCESS != rc) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
rc = orte_dps.unpack(buffer, &endpoint->rem_lid, &cnt, ORTE_UINT16);
|
2005-07-01 01:28:35 +04:00
|
|
|
if(ORTE_SUCCESS != rc) {
|
|
|
|
ORTE_ERROR_LOG(rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_DEBUG_OUT("Received High Priority QP num = %d, Low Priority QP num %d, LID = %d",
|
2005-07-01 01:28:35 +04:00
|
|
|
endpoint->rem_qp_num_high,
|
|
|
|
endpoint->rem_qp_num_low,
|
|
|
|
endpoint->rem_lid);
|
|
|
|
|
|
|
|
return ORTE_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Start to connect to the endpoint. We send our Queue Pair
|
|
|
|
* information over the TCP OOB communication mechanism.
|
|
|
|
|
|
|
|
* On completion of our send, a send completion handler
|
|
|
|
* is called.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int mca_btl_openib_endpoint_start_connect(mca_btl_base_endpoint_t* endpoint)
|
|
|
|
{
|
|
|
|
int rc;
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl = (mca_btl_openib_module_t*) endpoint->endpoint_btl;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* Create the High Priority Queue Pair */
|
2005-07-12 17:38:54 +04:00
|
|
|
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_create_qp(openib_btl,
|
|
|
|
openib_btl->ib_pd,
|
|
|
|
openib_btl->ib_cq_high,
|
|
|
|
endpoint->lcl_qp_attr_high,
|
|
|
|
&endpoint->lcl_qp_high))) {
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
|
2005-07-01 01:28:35 +04:00
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2005-07-20 01:04:22 +04:00
|
|
|
srand48(getpid() * time(NULL));
|
2005-07-12 17:38:54 +04:00
|
|
|
endpoint->lcl_psn_high = lrand48() & 0xffffff;
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
/* Create the Low Priority Queue Pair */
|
2005-07-12 17:38:54 +04:00
|
|
|
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_create_qp(openib_btl,
|
|
|
|
openib_btl->ib_pd,
|
|
|
|
openib_btl->ib_cq_low,
|
|
|
|
endpoint->lcl_qp_attr_low,
|
|
|
|
&endpoint->lcl_qp_low))) {
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
|
2005-07-01 01:28:35 +04:00
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
|
|
|
|
return rc;
|
|
|
|
}
|
2005-07-12 17:38:54 +04:00
|
|
|
endpoint->lcl_psn_low = lrand48() & 0xffffff;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_DEBUG_OUT("Initialized High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
|
2005-07-12 17:38:54 +04:00
|
|
|
endpoint->lcl_qp_high->qp_num,
|
2005-07-20 01:04:22 +04:00
|
|
|
endpoint->lcl_qp_low->qp_num,
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl->ib_port_attr->lid);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
/* Send connection info over to remote endpoint */
|
|
|
|
endpoint->endpoint_state = MCA_BTL_IB_CONNECTING;
|
|
|
|
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_send_connect_req(endpoint))) {
|
2005-07-04 03:31:27 +04:00
|
|
|
opal_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
|
2005-07-01 01:28:35 +04:00
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reply to a `start - connect' message
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static int mca_btl_openib_endpoint_reply_start_connect(mca_btl_openib_endpoint_t *endpoint, orte_buffer_t* buffer)
|
|
|
|
{
|
|
|
|
int rc;
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl = (mca_btl_openib_module_t*) endpoint->endpoint_btl;
|
|
|
|
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
/* Create the High Priority Queue Pair */
|
2005-07-12 17:38:54 +04:00
|
|
|
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_create_qp(openib_btl,
|
|
|
|
openib_btl->ib_pd,
|
2005-07-13 04:17:08 +04:00
|
|
|
openib_btl->ib_cq_high,
|
2005-07-12 17:38:54 +04:00
|
|
|
endpoint->lcl_qp_attr_high,
|
|
|
|
&endpoint->lcl_qp_high))) {
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_ERROR("error creating queue pair, error code %d", rc);
|
2005-07-01 01:28:35 +04:00
|
|
|
return rc;
|
|
|
|
}
|
2005-07-20 01:04:22 +04:00
|
|
|
srand48(getpid() * time(NULL));
|
2005-07-12 17:38:54 +04:00
|
|
|
endpoint->lcl_psn_high = lrand48() & 0xffffff;
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
/* Create the Low Priority Queue Pair */
|
2005-07-12 17:38:54 +04:00
|
|
|
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_create_qp(openib_btl,
|
|
|
|
openib_btl->ib_pd,
|
2005-07-13 04:17:08 +04:00
|
|
|
openib_btl->ib_cq_low,
|
2005-07-12 17:38:54 +04:00
|
|
|
endpoint->lcl_qp_attr_low,
|
|
|
|
&endpoint->lcl_qp_low))) {
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_ERROR("error createing queue pair, error code %d", rc);
|
2005-07-01 01:28:35 +04:00
|
|
|
return rc;
|
|
|
|
}
|
2005-07-12 17:38:54 +04:00
|
|
|
endpoint->lcl_psn_low = lrand48() & 0xffffff;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_DEBUG_OUT("Initialized High Priority QP num = %d, Low Priority QP num = %d, LID = %d",
|
2005-07-12 17:38:54 +04:00
|
|
|
endpoint->lcl_qp_high->qp_num,
|
2005-07-20 01:04:22 +04:00
|
|
|
endpoint->lcl_qp_low->qp_num,
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl->ib_port_attr->lid);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* Set the remote side info */
|
|
|
|
mca_btl_openib_endpoint_set_remote_info(endpoint, buffer);
|
2005-07-12 17:38:54 +04:00
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
/* Connect to endpoint */
|
|
|
|
|
|
|
|
rc = mca_btl_openib_endpoint_connect(endpoint);
|
|
|
|
if(rc != OMPI_SUCCESS) {
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_ERROR("error in endpoint connect error code is %d", rc);
|
2005-07-01 01:28:35 +04:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Send connection info over to remote endpoint */
|
|
|
|
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_send_connect_req(endpoint))) {
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_ERROR("error in endpoint send connect request error code is %d", rc);
|
2005-07-01 01:28:35 +04:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_btl_openib_endpoint_connected(mca_btl_openib_endpoint_t *endpoint)
|
|
|
|
{
|
|
|
|
endpoint->endpoint_state = MCA_BTL_IB_CONNECTED;
|
2005-07-20 01:04:22 +04:00
|
|
|
endpoint->endpoint_btl->poll_cq = true;
|
2005-07-01 01:28:35 +04:00
|
|
|
mca_btl_openib_progress_send_frags(endpoint);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Non blocking OOB recv callback.
|
|
|
|
* Read incoming QP and other info, and if this endpoint
|
|
|
|
* is trying to connect, reply with our QP info,
|
|
|
|
* otherwise try to modify QP's and establish
|
|
|
|
* reliable connection
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void mca_btl_openib_endpoint_recv(
|
|
|
|
int status,
|
|
|
|
orte_process_name_t* endpoint,
|
|
|
|
orte_buffer_t* buffer,
|
|
|
|
orte_rml_tag_t tag,
|
|
|
|
void* cbdata)
|
|
|
|
{
|
|
|
|
mca_btl_openib_proc_t *ib_proc;
|
|
|
|
mca_btl_openib_endpoint_t *ib_endpoint;
|
|
|
|
int endpoint_state;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
for(ib_proc = (mca_btl_openib_proc_t*)
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_get_first(&mca_btl_openib_component.ib_procs);
|
2005-07-01 01:28:35 +04:00
|
|
|
ib_proc != (mca_btl_openib_proc_t*)
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_get_end(&mca_btl_openib_component.ib_procs);
|
|
|
|
ib_proc = (mca_btl_openib_proc_t*)opal_list_get_next(ib_proc)) {
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
if(ib_proc->proc_guid.vpid == endpoint->vpid) {
|
|
|
|
|
|
|
|
/* Try to get the endpoint instance of this proc */
|
|
|
|
|
|
|
|
/* Limitation: Right now, we have only 1 endpoint
|
|
|
|
* for every process. Need several changes, some
|
|
|
|
* in PML/BTL interface to set this right */
|
|
|
|
ib_endpoint = ib_proc->proc_endpoints[0];
|
|
|
|
|
|
|
|
endpoint_state = ib_endpoint->endpoint_state;
|
|
|
|
|
|
|
|
/* Update status */
|
|
|
|
switch(endpoint_state) {
|
2005-07-12 17:38:54 +04:00
|
|
|
case MCA_BTL_IB_CLOSED :
|
|
|
|
/* We had this connection closed before.
|
|
|
|
* The endpoint is trying to connect. Move the
|
|
|
|
* status of this connection to CONNECTING,
|
|
|
|
* and then reply with our QP information */
|
|
|
|
|
|
|
|
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_reply_start_connect(ib_endpoint, buffer))) {
|
|
|
|
opal_output(0, "[%lu,%lu,%lu] %s:%d errcode %d\n",
|
|
|
|
ORTE_NAME_ARGS(orte_process_info.my_name), __FILE__,__LINE__,rc);
|
2005-07-01 01:28:35 +04:00
|
|
|
break;
|
2005-07-12 17:38:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup state as connected */
|
|
|
|
ib_endpoint->endpoint_state = MCA_BTL_IB_CONNECT_ACK;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MCA_BTL_IB_CONNECTING :
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_endpoint_set_remote_info(ib_endpoint, buffer);
|
|
|
|
if(OMPI_SUCCESS != (rc = mca_btl_openib_endpoint_connect(ib_endpoint))) {
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_ERROR("endpoint connect error: %d", rc);
|
2005-07-01 01:28:35 +04:00
|
|
|
break;
|
2005-07-12 17:38:54 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup state as connected */
|
|
|
|
mca_btl_openib_endpoint_connected(ib_endpoint);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
/* Send him an ack */
|
|
|
|
mca_btl_openib_endpoint_send_connect_ack(ib_endpoint);
|
|
|
|
break;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
case MCA_BTL_IB_CONNECT_ACK:
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_endpoint_connected(ib_endpoint);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MCA_BTL_IB_CONNECTED :
|
2005-07-20 01:04:22 +04:00
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
break;
|
|
|
|
default :
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_ERROR("Invalid endpoint state %d", endpoint_state);
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Okay, now that we are done receiving,
|
|
|
|
* re-post the buffer */
|
|
|
|
mca_btl_openib_post_recv();
|
|
|
|
}
|
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
/*
|
|
|
|
* Post the OOB recv (for receiving the peers information)
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
void mca_btl_openib_post_recv()
|
|
|
|
{
|
2005-07-13 04:17:08 +04:00
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
orte_rml.recv_buffer_nb(
|
|
|
|
ORTE_RML_NAME_ANY,
|
|
|
|
ORTE_RML_TAG_DYNAMIC-1,
|
|
|
|
0,
|
|
|
|
mca_btl_openib_endpoint_recv,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Attempt to send a fragment using a given endpoint. If the endpoint is not
|
|
|
|
* connected, queue the fragment and start the connection as required.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_openib_endpoint_send(
|
|
|
|
mca_btl_base_endpoint_t* endpoint,
|
|
|
|
mca_btl_openib_frag_t* frag
|
|
|
|
)
|
|
|
|
{
|
|
|
|
int rc;
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_module_t *openib_btl;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_LOCK(&endpoint->endpoint_send_lock);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
switch(endpoint->endpoint_state) {
|
|
|
|
case MCA_BTL_IB_CONNECTING:
|
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_DEBUG_OUT("Queing because state is connecting");
|
2005-07-13 04:17:08 +04:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(&endpoint->pending_send_frags,
|
|
|
|
(opal_list_item_t *)frag);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
rc = OMPI_SUCCESS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MCA_BTL_IB_CONNECT_ACK:
|
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_DEBUG_OUT("Queuing because waiting for ack");
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(&endpoint->pending_send_frags,
|
|
|
|
(opal_list_item_t *)frag);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
rc = OMPI_SUCCESS;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MCA_BTL_IB_CLOSED:
|
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_DEBUG_OUT("Connection to endpoint closed ... connecting ...");
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_append(&endpoint->pending_send_frags,
|
|
|
|
(opal_list_item_t *)frag);
|
2005-07-01 01:28:35 +04:00
|
|
|
rc = mca_btl_openib_endpoint_start_connect(endpoint);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MCA_BTL_IB_FAILED:
|
|
|
|
|
|
|
|
rc = OMPI_ERR_UNREACH;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MCA_BTL_IB_CONNECTED:
|
|
|
|
{
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl = endpoint->endpoint_btl;
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_DEBUG_OUT("Send to : %d, len : %lu, frag : %llu",
|
|
|
|
endpoint->endpoint_proc->proc_guid.vpid,
|
|
|
|
frag->sg_entry.length,
|
|
|
|
(unsigned long long) frag);
|
2005-07-12 17:38:54 +04:00
|
|
|
rc = mca_btl_openib_endpoint_post_send(openib_btl, endpoint, frag);
|
2005-07-01 01:28:35 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
rc = OMPI_ERR_UNREACH;
|
|
|
|
}
|
|
|
|
|
2005-07-04 02:45:48 +04:00
|
|
|
OPAL_THREAD_UNLOCK(&endpoint->endpoint_send_lock);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
2005-07-20 19:17:18 +04:00
|
|
|
/*
|
|
|
|
* Progress send frags, any frags that have been queued up before the connection
|
|
|
|
* was established need to be progressed.
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
void mca_btl_openib_progress_send_frags(mca_btl_openib_endpoint_t* endpoint)
|
|
|
|
{
|
2005-07-03 20:22:16 +04:00
|
|
|
opal_list_item_t *frag_item;
|
2005-07-01 01:28:35 +04:00
|
|
|
mca_btl_openib_frag_t *frag;
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl;
|
2005-07-01 01:28:35 +04:00
|
|
|
/*Check if endpoint is connected */
|
|
|
|
if(endpoint->endpoint_state != MCA_BTL_IB_CONNECTED) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* While there are frags in the list,
|
|
|
|
* process them */
|
|
|
|
|
2005-07-03 20:22:16 +04:00
|
|
|
while(!opal_list_is_empty(&(endpoint->pending_send_frags))) {
|
|
|
|
frag_item = opal_list_remove_first(&(endpoint->pending_send_frags));
|
2005-07-01 01:28:35 +04:00
|
|
|
frag = (mca_btl_openib_frag_t *) frag_item;
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl = endpoint->endpoint_btl;
|
2005-07-01 01:28:35 +04:00
|
|
|
/* We need to post this one */
|
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
if(OMPI_SUCCESS != mca_btl_openib_endpoint_post_send(openib_btl, endpoint, frag))
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_ERROR("Error posting send");
|
2005-07-01 01:28:35 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Complete connection to endpoint.
|
|
|
|
*/
|
|
|
|
|
|
|
|
int mca_btl_openib_endpoint_connect(
|
|
|
|
mca_btl_openib_endpoint_t *endpoint)
|
|
|
|
{
|
|
|
|
int rc;
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl = (mca_btl_openib_module_t*) endpoint->endpoint_btl;
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
/* Connection establishment RC */
|
2005-07-12 17:38:54 +04:00
|
|
|
rc = mca_btl_openib_endpoint_qp_init_query(
|
|
|
|
openib_btl,
|
|
|
|
endpoint->lcl_qp_high,
|
|
|
|
endpoint->lcl_qp_attr_high,
|
|
|
|
endpoint->lcl_psn_high,
|
|
|
|
endpoint->rem_qp_num_high,
|
|
|
|
endpoint->rem_psn_high,
|
|
|
|
endpoint->rem_lid,
|
|
|
|
openib_btl->port_num
|
|
|
|
);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(rc != OMPI_SUCCESS) {
|
|
|
|
return rc;
|
|
|
|
}
|
2005-07-12 17:38:54 +04:00
|
|
|
rc = mca_btl_openib_endpoint_qp_init_query(
|
|
|
|
openib_btl,
|
|
|
|
endpoint->lcl_qp_low,
|
|
|
|
endpoint->lcl_qp_attr_low,
|
|
|
|
endpoint->lcl_psn_low,
|
|
|
|
endpoint->rem_qp_num_low,
|
|
|
|
endpoint->rem_psn_low,
|
|
|
|
endpoint->rem_lid,
|
|
|
|
openib_btl->port_num
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(rc != OMPI_SUCCESS) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
MCA_BTL_OPENIB_ENDPOINT_POST_RR_HIGH(endpoint, 0);
|
|
|
|
MCA_BTL_OPENIB_ENDPOINT_POST_RR_LOW(endpoint, 0);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
/*
|
|
|
|
* Create the queue pair note that this is just the initial
|
|
|
|
* queue pair creation and we need to get the remote queue pair
|
|
|
|
* info from the peer before the qp is usable,
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
int mca_btl_openib_endpoint_create_qp(
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl,
|
|
|
|
struct ibv_pd* pd,
|
|
|
|
struct ibv_cq* cq,
|
|
|
|
struct ibv_qp_attr* qp_attr,
|
|
|
|
struct ibv_qp** qp
|
|
|
|
)
|
2005-07-01 01:28:35 +04:00
|
|
|
{
|
2005-07-12 17:38:54 +04:00
|
|
|
{
|
2005-07-20 01:04:22 +04:00
|
|
|
struct ibv_qp* my_qp;
|
2005-07-13 04:17:08 +04:00
|
|
|
struct ibv_qp_init_attr qp_init_attr;
|
2005-07-20 01:04:22 +04:00
|
|
|
|
|
|
|
memset(&qp_init_attr, 0, sizeof(struct ibv_qp_init_attr));
|
|
|
|
|
2005-07-13 04:17:08 +04:00
|
|
|
qp_init_attr.send_cq = cq;
|
|
|
|
qp_init_attr.recv_cq = cq;
|
2005-07-20 01:04:22 +04:00
|
|
|
qp_init_attr.cap.max_send_wr = mca_btl_openib_component.ib_wq_size;
|
2005-07-15 19:13:19 +04:00
|
|
|
qp_init_attr.cap.max_recv_wr = mca_btl_openib_component.ib_wq_size;
|
2005-07-20 01:04:22 +04:00
|
|
|
qp_init_attr.cap.max_send_sge = mca_btl_openib_component.ib_sg_list_size;
|
2005-07-15 19:13:19 +04:00
|
|
|
qp_init_attr.cap.max_recv_sge = mca_btl_openib_component.ib_sg_list_size;
|
2005-07-13 04:17:08 +04:00
|
|
|
qp_init_attr.qp_type = IBV_QPT_RC;
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-20 01:04:22 +04:00
|
|
|
my_qp = ibv_create_qp(pd, &qp_init_attr);
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-20 01:04:22 +04:00
|
|
|
if(NULL == my_qp) {
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_ERROR("error creating qp errno says %s", strerror(errno));
|
2005-07-12 17:38:54 +04:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
2005-07-20 01:04:22 +04:00
|
|
|
(*qp) = my_qp;
|
2005-07-12 17:38:54 +04:00
|
|
|
openib_btl->ib_inline_max = qp_init_attr.cap.max_inline_data;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
|
|
|
}
|
2005-07-12 17:38:54 +04:00
|
|
|
|
|
|
|
{
|
|
|
|
qp_attr->qp_state = IBV_QPS_INIT;
|
2005-07-15 19:13:19 +04:00
|
|
|
qp_attr->pkey_index = mca_btl_openib_component.ib_pkey_ix;
|
2005-07-13 04:17:08 +04:00
|
|
|
qp_attr->port_num = openib_btl->port_num;
|
2005-07-20 01:04:22 +04:00
|
|
|
qp_attr->qp_access_flags = IBV_ACCESS_REMOTE_WRITE;
|
2005-07-12 17:38:54 +04:00
|
|
|
|
|
|
|
if(ibv_modify_qp((*qp), qp_attr,
|
|
|
|
IBV_QP_STATE |
|
|
|
|
IBV_QP_PKEY_INDEX |
|
|
|
|
IBV_QP_PORT |
|
|
|
|
IBV_QP_ACCESS_FLAGS )) {
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_ERROR("error modifying qp to INIT errno says %s", strerror(errno));
|
2005-07-12 17:38:54 +04:00
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-07-01 01:28:35 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2005-07-20 19:17:18 +04:00
|
|
|
/*
|
|
|
|
* The queue pair has been created and we have received the remote
|
|
|
|
* queue pair information from the peer so we init this queue pair
|
|
|
|
* and are ready to roll.
|
|
|
|
*/
|
2005-07-01 01:28:35 +04:00
|
|
|
int mca_btl_openib_endpoint_qp_init_query(
|
2005-07-12 17:38:54 +04:00
|
|
|
mca_btl_openib_module_t* openib_btl,
|
|
|
|
struct ibv_qp* qp,
|
|
|
|
struct ibv_qp_attr* attr,
|
|
|
|
uint32_t lcl_psn,
|
|
|
|
uint32_t rem_qp_num,
|
|
|
|
uint32_t rem_psn,
|
|
|
|
uint16_t rem_lid,
|
|
|
|
uint32_t port_num
|
2005-07-01 01:28:35 +04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
{
|
2005-07-12 17:38:54 +04:00
|
|
|
attr->qp_state = IBV_QPS_RTR;
|
2005-07-15 19:13:19 +04:00
|
|
|
attr->path_mtu = mca_btl_openib_component.ib_mtu;
|
2005-07-12 17:38:54 +04:00
|
|
|
attr->dest_qp_num = rem_qp_num;
|
|
|
|
attr->rq_psn = rem_psn;
|
2005-07-15 19:13:19 +04:00
|
|
|
attr->max_dest_rd_atomic = mca_btl_openib_component.ib_max_rdma_dst_ops;
|
|
|
|
attr->min_rnr_timer = mca_btl_openib_component.ib_min_rnr_timer;
|
2005-07-12 17:38:54 +04:00
|
|
|
attr->ah_attr.is_global = 0;
|
|
|
|
attr->ah_attr.dlid = rem_lid;
|
2005-07-15 19:13:19 +04:00
|
|
|
attr->ah_attr.sl = mca_btl_openib_component.ib_service_level;
|
|
|
|
attr->ah_attr.src_path_bits = mca_btl_openib_component.ib_src_path_bits;
|
2005-07-12 17:38:54 +04:00
|
|
|
attr->ah_attr.port_num = port_num;
|
2005-07-01 01:28:35 +04:00
|
|
|
|
2005-07-12 17:38:54 +04:00
|
|
|
if(ibv_modify_qp(qp, attr,
|
|
|
|
IBV_QP_STATE |
|
|
|
|
IBV_QP_AV |
|
|
|
|
IBV_QP_PATH_MTU |
|
|
|
|
IBV_QP_DEST_QPN |
|
|
|
|
IBV_QP_RQ_PSN |
|
|
|
|
IBV_QP_MAX_DEST_RD_ATOMIC |
|
|
|
|
IBV_QP_MIN_RNR_TIMER)) {
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_ERROR("error modifing QP to RTR errno says %s", strerror(errno));
|
2005-07-01 01:28:35 +04:00
|
|
|
return OMPI_ERROR;
|
2005-07-12 17:38:54 +04:00
|
|
|
}
|
|
|
|
attr->qp_state = IBV_QPS_RTS;
|
2005-07-15 19:13:19 +04:00
|
|
|
attr->timeout = mca_btl_openib_component.ib_timeout;
|
|
|
|
attr->retry_cnt = mca_btl_openib_component.ib_retry_count;
|
|
|
|
attr->rnr_retry = mca_btl_openib_component.ib_rnr_retry;
|
2005-07-13 04:17:08 +04:00
|
|
|
attr->sq_psn = lcl_psn;
|
2005-07-15 19:13:19 +04:00
|
|
|
attr->max_rd_atomic = mca_btl_openib_component.ib_max_rdma_dst_ops;
|
2005-07-12 17:38:54 +04:00
|
|
|
if (ibv_modify_qp(qp, attr,
|
|
|
|
IBV_QP_STATE |
|
|
|
|
IBV_QP_TIMEOUT |
|
|
|
|
IBV_QP_RETRY_CNT |
|
|
|
|
IBV_QP_RNR_RETRY |
|
|
|
|
IBV_QP_SQ_PSN |
|
|
|
|
IBV_QP_MAX_QP_RD_ATOMIC)) {
|
2005-07-20 19:17:18 +04:00
|
|
|
BTL_ERROR("error modifying QP to RTS errno says %s", strerror(errno));
|
2005-07-13 04:17:08 +04:00
|
|
|
return OMPI_ERROR;
|
2005-07-12 17:38:54 +04:00
|
|
|
}
|
2005-07-01 01:28:35 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|