static int route_handler(struct cmatest_node *node) { struct rdma_conn_param conn_param; int ret; ret = init_node(node); if (ret) goto err; ret = post_recvs(node); if (ret) goto err; memset(&conn_param, 0, sizeof conn_param); conn_param.responder_resources = 1; conn_param.initiator_depth = 1; conn_param.retry_count = 5; conn_param.private_data = test.rai->ai_connect; conn_param.private_data_len = test.rai->ai_connect_len; ret = rdma_connect(node->cma_id, &conn_param); if (ret) { perror("cmatose: failure connecting"); goto err; } return 0; err: connect_error(); return ret; }
static int create_messages(struct cma_node *node) { int ret; if (!hints->ep_attr->max_msg_size) hints->tx_attr->size = 0; if (!hints->tx_attr->size) return 0; node->mem = malloc(hints->ep_attr->max_msg_size); if (!node->mem) { printf("failed message allocation\n"); return -1; } if (info->mode & FI_LOCAL_MR) { ret = fi_mr_reg(node->domain, node->mem, hints->ep_attr->max_msg_size, FI_SEND | FI_RECV, 0, 0, 0, &node->mr, NULL); if (ret) { FT_PRINTERR("fi_reg_mr", ret); goto err; } node->mrdesc = fi_mr_desc(node->mr); } ret = post_recvs(node); return ret; err: free(node->mem); return -1; }
static int addr_handler(struct cmatest_node *node) { int ret; ret = verify_test_params(node); if (ret) goto err; ret = init_node(node); if (ret) goto err; if (!is_sender) { ret = post_recvs(node); if (ret) goto err; } ret = rdma_join_multicast(node->cma_id, test.dst_addr, node); if (ret) { perror("mckey: failure joining"); goto err; } return 0; err: connect_error(); return ret; }
static int route_handler(struct cmatest_node *node) { struct rdma_conn_param conn_param; int ret; ret = verify_test_params(node); if (ret) goto err; ret = init_node(node); if (ret) goto err; ret = post_recvs(node); if (ret) goto err; memset(&conn_param, 0, sizeof conn_param); ret = rdma_connect(node->cma_id, &conn_param); if (ret) { perror("udaddy: failure connecting"); goto err; } return 0; err: connect_error(); return ret; }
static int poll_recv_cqs(void) { struct ibv_wc wc[POLL_BATCH]; int done, i, ret, poll_ret; long total_counter = 0; struct timespec ts0; ts0.tv_sec = -1; ts0.tv_nsec = -1; if(is_sender) { printf(" called poll_rec_cqs() with sender side \n"); return -1; } if (print_base == -1) print_base = message_buffer * message_batch; for (i = 0; i < connections; i++) { if (!test.nodes[i].connected) continue; do { for (done = 0; done < message_buffer * message_batch; done += poll_ret) { poll_ret = ibv_poll_cq(test.nodes[i].cq, POLL_BATCH, wc); total_counter += poll_ret; if (poll_ret < 0) { printf("rxe_send_mc: failed polling CQ: %d\n", poll_ret); return poll_ret; } else if (poll_ret > 0) { if(ts0.tv_sec == -1 && ts0.tv_nsec == -1) { clock_gettime(CLOCK_REALTIME, &ts0); } ret = recv_check_psn(wc,poll_ret,total_counter); if ( ret < 0) { return ret; } ret = post_recvs(&test.nodes[i],poll_ret); if (ret < 0) { printf("rxe_send_mc: failed post receives after polling CQ: %d\n", ret); return ret; } if (done != 0 && done % print_base == 0) { print_line(&ts0, done, print_base); } } } printf ("Have sent the last message %u of %lu \n", done, total_counter); fprintf (pFile,"Have sent the last message %u of %lu \n", done, total_counter); } while (message_batch >= 1000 && if_continue()); } return 0; }
static int connect_handler(struct rdma_cm_id *cma_id) { struct cmatest_node *node; struct rdma_conn_param conn_param; int ret; if (test.conn_index == connections) { ret = -ENOMEM; goto err1; } node = &test.nodes[test.conn_index++]; node->cma_id = cma_id; cma_id->context = node; ret = verify_test_params(node); if (ret) goto err2; ret = init_node(node); if (ret) goto err2; ret = post_recvs(node); if (ret) goto err2; memset(&conn_param, 0, sizeof conn_param); conn_param.qp_num = node->cma_id->qp->qp_num; ret = rdma_accept(node->cma_id, &conn_param); if (ret) { perror("udaddy: failure accepting"); goto err2; } node->connected = 1; test.connects_left--; return 0; err2: node->cma_id = NULL; connect_error(); err1: printf("udaddy: failing connection request\n"); rdma_reject(cma_id, NULL, 0); return ret; }
static int connect_handler(struct rdma_cm_id *cma_id) { struct cmatest_node *node; int ret; if (test.conn_index == connections) { ret = -ENOMEM; goto err1; } node = &test.nodes[test.conn_index++]; node->cma_id = cma_id; cma_id->context = node; ret = init_node(node); if (ret) goto err2; ret = post_recvs(node); if (ret) goto err2; ret = rdma_accept(node->cma_id, NULL); if (ret) { perror("cmatose: failure accepting"); goto err2; } return 0; err2: node->cma_id = NULL; connect_error(); err1: printf("cmatose: failing connection request\n"); rdma_reject(cma_id, NULL, 0); return ret; }