本文整理汇总了C++中ibv_post_recv函数的典型用法代码示例。如果您正苦于以下问题:C++ ibv_post_recv函数的具体用法?C++ ibv_post_recv怎么用?C++ ibv_post_recv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ibv_post_recv函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: post_receive
void post_receive(boost::system::error_code &ec)
{
util::spinlock::scoped_lock lk(mtx_);
if(!id_)
{
HPX_IBVERBS_THROWS_IF(ec, boost::asio::error::not_connected);
return;
}
struct ibv_recv_wr wr, *bad_wr = NULL;
struct ibv_sge sge;
std::memset(&wr, 0, sizeof(ibv_recv_wr));
HPX_ASSERT(id_);
wr.wr_id = (uintptr_t)id_;
wr.sg_list = &sge;
wr.num_sge = 1;
sge.addr = (uintptr_t)client_msg_;
sge.length = sizeof(message);
sge.lkey = client_msg_mr_->lkey;
int ret = 0;
HPX_ASSERT(id_);
ret = ibv_post_recv(id_->qp, &wr, &bad_wr);
if(ret)
{
int verrno = errno;
boost::system::error_code err(verrno, boost::system::system_category());
HPX_IBVERBS_THROWS_IF(
ec
, err
);
}
}
开发者ID:41i,项目名称:hpx,代码行数:35,代码来源:server.hpp
示例2: infini_post_recv
static void infini_post_recv(struct ibvif *m)
{
struct ibv_sge list;
struct ibv_recv_wr wr;
int i;
struct ibv_recv_wr *bad_wr_recv;
memset(&list, 0, sizeof(struct ibv_sge));
list.addr = (uintptr_t) m->recv_buf;
list.length = m->send_size;
list.lkey = m->recv_mr->lkey;
memset(&wr, 0, sizeof(struct ibv_recv_wr));
wr.wr_id = list.addr;
wr.sg_list = &list;
wr.num_sge = 1;
wr.next = NULL;
for (i = 0; i < m->rx_depth ; ++i) {
bad_wr_recv = NULL;
wr.wr_id = list.addr;
ibv_post_recv(m->qp, &wr, &bad_wr_recv);
if (i+1 < m->rx_depth)
list.addr += m->send_size;
}
}
开发者ID:mohankku,项目名称:aos_project,代码行数:26,代码来源:ibvif.c
示例3: post_recvs
static int post_recvs(struct cmatest_node *node)
{
struct ibv_recv_wr recv_wr, *recv_failure;
struct ibv_sge sge;
int i, ret = 0;
if (!message_count)
return 0;
recv_wr.next = NULL;
recv_wr.sg_list = &sge;
recv_wr.num_sge = 1;
recv_wr.wr_id = (uintptr_t) node;
sge.length = message_size;
sge.lkey = node->mr->lkey;
sge.addr = (uintptr_t) node->mem;
for (i = 0; i < message_count && !ret; i++ ) {
ret = ibv_post_recv(node->cma_id->qp, &recv_wr, &recv_failure);
if (ret) {
printf("failed to post receives: %d\n", ret);
break;
}
}
return ret;
}
开发者ID:jgunthorpe,项目名称:rdma-plumbing,代码行数:27,代码来源:cmatose.c
示例4: __xfer_rdma_post_recv
static int __xfer_rdma_post_recv(struct xfer_context *ctx)
{
struct ibv_sge list;
struct ibv_recv_wr wr, *bad_wr;
int rc;
memset(&wr, 0, sizeof(wr));
list.addr = (uintptr_t) ctx->recv_msg;
list.length = sizeof(struct message);
list.lkey = ctx->recv_mr->lkey;
wr.next = NULL;
wr.wr_id = 0xcafebabe;
wr.sg_list = &list;
wr.num_sge = 1;
rc = ibv_post_recv(ctx->qp, &wr, &bad_wr);
if (rc) {
perror("ibv_post_recv");
fprintf(stderr, "%d:%s: ibv_post_recv failed %d\n", pid,
__func__, rc);
return -1;
}
return 0;
}
开发者ID:disprosium8,项目名称:xfer_test,代码行数:26,代码来源:xfer_rdma.c
示例5: rping_run_server
static int rping_run_server(struct rping_cb *cb)
{
struct ibv_recv_wr *bad_wr;
int ret;
ret = rping_bind_server(cb);
if (ret)
return ret;
sem_wait(&cb->sem);
if (cb->state != CONNECT_REQUEST) {
fprintf(stderr, "wait for CONNECT_REQUEST state %d\n",
cb->state);
return -1;
}
ret = rping_setup_qp(cb, cb->child_cm_id);
if (ret) {
fprintf(stderr, "setup_qp failed: %d\n", ret);
return ret;
}
ret = rping_setup_buffers(cb);
if (ret) {
fprintf(stderr, "rping_setup_buffers failed: %d\n", ret);
goto err1;
}
ret = ibv_post_recv(cb->qp, &cb->rq_wr, &bad_wr);
if (ret) {
fprintf(stderr, "ibv_post_recv failed: %d\n", ret);
goto err2;
}
pthread_create(&cb->cqthread, NULL, cq_thread, cb);
ret = rping_accept(cb);
if (ret) {
fprintf(stderr, "connect error %d\n", ret);
goto err2;
}
ret = rping_test_server(cb);
if (ret) {
fprintf(stderr, "rping server failed: %d\n", ret);
goto err3;
}
ret = 0;
err3:
rdma_disconnect(cb->child_cm_id);
pthread_join(cb->cqthread, NULL);
rdma_destroy_id(cb->child_cm_id);
err2:
rping_free_buffers(cb);
err1:
rping_free_qp(cb);
return ret;
}
开发者ID:digideskio,项目名称:gpunet,代码行数:60,代码来源:rping.c
示例6: post_receive
static int post_receive(struct resources *res)
{
struct ibv_recv_wr rr;
struct ibv_sge sge;
struct ibv_recv_wr *bad_wr;
int rc;
/* prepare the scatter/gather entry */
memset(&sge, 0, sizeof(sge));
sge.addr = (uintptr_t)res->buf;
sge.length = MSG_SIZE;
sge.lkey = res->mr->lkey;
/* prepare the receive work request (RR) */
memset(&rr, 0, sizeof(rr));
rr.next = NULL;
rr.wr_id = 0;
rr.sg_list = &sge;
rr.num_sge = 1;
/* post the Receive Request to the RQ */
rc = ibv_post_recv(res->qp, &rr, &bad_wr);
if (rc) {
fprintf(stderr, "failed to post RR\n");
return 1;
}
fprintf(stdout, "Receive Request was posted\n");
return 0;
}
开发者ID:li-ch,项目名称:rdma-examples,代码行数:33,代码来源:hello_world_rc_send.c
示例7: caffe_memset
void RDMAChannel::recv() {
struct ibv_recv_wr wr;
caffe_memset(sizeof(wr), 0, &wr);
wr.wr_id = (uint64_t) this;
struct ibv_recv_wr* bad_wr;
CHECK(!ibv_post_recv(qp_, &wr, &bad_wr)) << "Failed to post recv";
}
开发者ID:Aravindreddy986,项目名称:CaffeOnSpark,代码行数:8,代码来源:rdma.cpp
示例8: rping_run_client
static int rping_run_client(struct rping_cb *cb)
{
struct ibv_recv_wr *bad_wr;
int ret;
ret = rping_bind_client(cb);
if (ret)
return ret;
ret = rping_setup_qp(cb, cb->cm_id);
if (ret) {
fprintf(stderr, "setup_qp failed: %d\n", ret);
return ret;
}
ret = rping_setup_buffers(cb);
if (ret) {
fprintf(stderr, "rping_setup_buffers failed: %d\n", ret);
goto err1;
}
ret = ibv_post_recv(cb->qp, &cb->rq_wr, &bad_wr);
if (ret) {
fprintf(stderr, "ibv_post_recv failed: %d\n", ret);
goto err2;
}
ret = pthread_create(&cb->cqthread, NULL, cq_thread, cb);
if (ret) {
perror("pthread_create");
goto err2;
}
ret = rping_connect_client(cb);
if (ret) {
fprintf(stderr, "connect error %d\n", ret);
goto err3;
}
ret = rping_test_client(cb);
if (ret) {
fprintf(stderr, "rping client failed: %d\n", ret);
goto err4;
}
ret = 0;
err4:
rdma_disconnect(cb->cm_id);
err3:
pthread_join(cb->cqthread, NULL);
err2:
rping_free_buffers(cb);
err1:
rping_free_qp(cb);
return ret;
}
开发者ID:hkimura,项目名称:pib,代码行数:57,代码来源:rping.c
示例9: post_receive
void post_receive(struct connection *conn)
{
struct ibv_recv_wr wr, *bad_wr = NULL;
memset(&wr, 0, sizeof(wr));
wr.wr_id = (uintptr_t)conn;
wr.next = NULL;
wr.num_sge = 0;
TEST_NZ(ibv_post_recv(conn->qp, &wr, &bad_wr));
}
开发者ID:xiansl,项目名称:mytests,代码行数:10,代码来源:client1.c
示例10: rping_setup_qp
static void *rping_persistent_server_thread(void *arg)
{
struct rping_cb *cb = arg;
struct ibv_recv_wr *bad_wr;
int ret;
ret = rping_setup_qp(cb, cb->child_cm_id);
if (ret) {
fprintf(stderr, "setup_qp failed: %d\n", ret);
goto err0;
}
ret = rping_setup_buffers(cb);
if (ret) {
fprintf(stderr, "rping_setup_buffers failed: %d\n", ret);
goto err1;
}
ret = ibv_post_recv(cb->qp, &cb->rq_wr, &bad_wr);
if (ret) {
fprintf(stderr, "ibv_post_recv failed: %d\n", ret);
goto err2;
}
ret = pthread_create(&cb->cqthread, NULL, cq_thread, cb);
if (ret) {
perror("pthread_create");
goto err2;
}
ret = rping_accept(cb);
if (ret) {
fprintf(stderr, "connect error %d\n", ret);
goto err3;
}
rping_test_server(cb);
rdma_disconnect(cb->child_cm_id);
pthread_join(cb->cqthread, NULL);
rping_free_buffers(cb);
rping_free_qp(cb);
rdma_destroy_id(cb->child_cm_id);
free_cb(cb);
return NULL;
err3:
pthread_cancel(cb->cqthread);
pthread_join(cb->cqthread, NULL);
err2:
rping_free_buffers(cb);
err1:
rping_free_qp(cb);
err0:
free_cb(cb);
return NULL;
}
开发者ID:hkimura,项目名称:pib,代码行数:55,代码来源:rping.c
示例11: ibv_post_recv
void IBConnection::post_recv(struct ibv_recv_wr* wr)
{
struct ibv_recv_wr* bad_recv_wr;
int err = ibv_post_recv(qp(), wr, &bad_recv_wr);
if (err) {
L_(fatal) << "ibv_post_recv failed: " << strerror(err);
throw InfinibandException("ibv_post_recv failed");
}
++total_recv_requests_;
}
开发者ID:cbm-fles,项目名称:flesnet,代码行数:12,代码来源:IBConnection.cpp
示例12: post_receive_data
void post_receive_data() {
/* Post receive for data */
sge_data.addr = (uintptr_t)data;
sge_data.length = BUFFER_SIZE;
sge_data.lkey = mr_data->lkey;
recv_wr.sg_list = &sge_data;
recv_wr.num_sge = 1;
err = ibv_post_recv(cm_id->qp, &recv_wr, &bad_recv_wr);
assert(err == 0);
}
开发者ID:JamisHoo,项目名称:Distributed-Cauchy-Reed-Solomon,代码行数:12,代码来源:encode_client.c
示例13: post_receive
static void post_receive(struct rdma_cm_id *id)
{
struct ibv_recv_wr wr, *bad_wr = NULL;
memset(&wr, 0, sizeof(wr));
wr.wr_id = (uintptr_t)id;
wr.sg_list = NULL;
wr.num_sge = 0;
TEST_NZ(ibv_post_recv(id->qp, &wr, &bad_wr));
}
开发者ID:BenjaminBehringer,项目名称:the-geek-in-the-corner,代码行数:12,代码来源:server.c
示例14: fio_rdmaio_recv
static int fio_rdmaio_recv(struct thread_data *td, struct io_u **io_us,
unsigned int nr)
{
struct rdmaio_data *rd = td->io_ops->data;
struct ibv_recv_wr *bad_wr;
struct rdma_io_u_data *r_io_u_d;
int i;
i = 0;
if (rd->rdma_protocol == FIO_RDMA_CHA_RECV) {
/* post io_u into recv queue */
for (i = 0; i < nr; i++) {
r_io_u_d = io_us[i]->engine_data;
if (ibv_post_recv(rd->qp, &r_io_u_d->rq_wr, &bad_wr) !=
0) {
log_err("fio: ibv_post_recv fail\n");
return 1;
}
}
} else if ((rd->rdma_protocol == FIO_RDMA_MEM_READ)
|| (rd->rdma_protocol == FIO_RDMA_MEM_WRITE)) {
/* re-post the rq_wr */
if (ibv_post_recv(rd->qp, &rd->rq_wr, &bad_wr) != 0) {
log_err("fio: ibv_post_recv fail\n");
return 1;
}
rdma_poll_wait(td, IBV_WC_RECV);
dprint(FD_IO, "fio: recv FINISH message\n");
td->done = 1;
return 0;
}
return i;
}
开发者ID:DebashisGanguly,项目名称:FIOBenchmark,代码行数:36,代码来源:rdma.c
示例15: PrepareToReceive
void PrepareToReceive(ArgStruct *p)
{
int ret; /* Return code */
struct ibv_recv_wr rr; /* Receive request */
struct ibv_recv_wr *bad_wr; /* Handle to any incomplete requests */
struct ibv_sge sg_entry; /* Scatter/Gather list - holds buff addr */
/* We don't need to post a receive if doing RDMA write with local polling */
if( p->prot.commtype == NP_COMM_RDMAWRITE &&
p->prot.comptype == NP_COMP_LOCALPOLL )
return;
/* setup the receive request, specify which list to use and # entries */
rr.num_sge = 1; /* # of entries in this list */
rr.sg_list = &sg_entry; /* the list of entries */
rr.next = NULL; /* the next entry (if more than one */
sg_entry.lkey = r_mr_hndl->lkey; /* link the entries lkey to our remote mr */
sg_entry.length = p->bufflen; /* provide a buffer length */
sg_entry.addr = (uintptr_t)p->r_ptr; /* address/context of sg_entry */
/* technically if we have problems, the return is < 0,
* but this works as well
*/
/* if we get a change in bad_wr value, it is because the Receive request
* couldnt be posted to the command queue for some reason.
* (This may be because the queue is full)
* You should probably do something with the bad_wr if your request
* needs to actuall get posted.
*/
ret = ibv_post_recv(qp_hndl, &rr, &bad_wr);
if(ret) {
fprintf(stderr, "Error posting recv request\n");
CleanUp(p);
exit(-1);
} else {
LOGPRINTF(("Posted recv request"));
}
/* Set receive flag to zero and request event completion
* notification for this receive so the event handler will
* be triggered when the receive completes.
*/
if( p->prot.comptype == NP_COMP_EVENT ) {
receive_complete = 0;
}
}
开发者ID:carriercomm,项目名称:ix,代码行数:48,代码来源:ibv.c
示例16: post_receives
void post_receives(struct connection *conn)
{
struct ibv_recv_wr wr, *bad_wr = NULL;
struct ibv_sge sge;
wr.wr_id = (uintptr_t)conn;
wr.next = NULL;
wr.sg_list = &sge;
wr.num_sge = 1;
sge.addr = (uintptr_t)conn->recv_msg;
sge.length = sizeof(struct message);
sge.lkey = conn->recv_mr->lkey;
TEST_NZ(ibv_post_recv(conn->qp, &wr, &bad_wr));
}
开发者ID:leeymcj,项目名称:RDMA_paging,代码行数:16,代码来源:rdma-common.c
示例17: fio_rdmaio_setup_listen
static int fio_rdmaio_setup_listen(struct thread_data *td, short port)
{
struct rdmaio_data *rd = td->io_ops->data;
struct ibv_recv_wr *bad_wr;
int state = td->runstate;
td_set_runstate(td, TD_SETTING_UP);
rd->addr.sin_family = AF_INET;
rd->addr.sin_addr.s_addr = htonl(INADDR_ANY);
rd->addr.sin_port = htons(port);
/* rdma_listen */
if (rdma_bind_addr(rd->cm_id, (struct sockaddr *)&rd->addr) != 0) {
log_err("fio: rdma_bind_addr fail\n");
return 1;
}
if (rdma_listen(rd->cm_id, 3) != 0) {
log_err("fio: rdma_listen fail\n");
return 1;
}
log_info("fio: waiting for connection\n");
/* wait for CONNECT_REQUEST */
if (get_next_channel_event
(td, rd->cm_channel, RDMA_CM_EVENT_CONNECT_REQUEST) != 0) {
log_err("fio: wait for RDMA_CM_EVENT_CONNECT_REQUEST\n");
return 1;
}
if (fio_rdmaio_setup_qp(td) != 0)
return 1;
if (fio_rdmaio_setup_control_msg_buffers(td) != 0)
return 1;
/* post recv buf */
if (ibv_post_recv(rd->qp, &rd->rq_wr, &bad_wr) != 0) {
log_err("fio: ibv_post_recv fail\n");
return 1;
}
td_set_runstate(td, state);
return 0;
}
开发者ID:DebashisGanguly,项目名称:FIOBenchmark,代码行数:47,代码来源:rdma.c
示例18: post_receives
void post_receives(rdma_conn_t *conn)
{
struct ibv_recv_wr wr, *bad_wr = NULL;
struct ibv_sge sge;
wr.wr_id = (uintptr_t)conn;
wr.next = NULL;
wr.sg_list = &sge;
wr.num_sge = 1;
sge.addr = (uintptr_t)conn->recv_msg;
sge.length = sizeof(rdma_msg_t);
sge.lkey = conn->recv_mr->lkey;
++ request_stack_size;
TEST_NZ(ibv_post_recv(conn->qp, &wr, &bad_wr));
}
开发者ID:hxmhuang,项目名称:CFIO2,代码行数:17,代码来源:rdma_client.c
示例19: mvdev_post_rq_buffers
int mvdev_post_rq_buffers(mv_rpool * rp, mv_qp * qp, int num_bufs)
{
int i = 0, total = 1;
mv_rbuf *v, *first_v, *last_v;
struct ibv_recv_wr *bad_wr;
D_PRINT("Attempting to post %d recv bufs\n", num_bufs);
first_v = last_v = get_mv_rbuf(rp->buffer_size);
switch(qp->type) {
case MVDEV_CH_RC_RQ:
prepare_rc_recv(first_v, rp);
break;
case MVDEV_CH_UD_RQ:
prepare_ud_recv(first_v, rp);
break;
default:
error_abort_all(IBV_RETURN_ERR,"Invalid QP Type: %d\n", qp->type);
}
for(i = 1; i < num_bufs; i++) {
++total;
v = get_mv_rbuf(rp->buffer_size);
switch(qp->type) {
case MVDEV_CH_RC_RQ:
prepare_rc_recv(v, rp);
break;
case MVDEV_CH_UD_RQ:
prepare_ud_recv(v, rp);
break;
}
last_v->desc.rr.next = &v->desc.rr;
last_v = v;
}
if(ibv_post_recv(qp->qp, &first_v->desc.rr, &bad_wr)) {
return 0;
}
D_PRINT("Posted %d recvs\n", i);
return total;
}
开发者ID:grondo,项目名称:mvapich-cce,代码行数:46,代码来源:mv_priv.c
示例20: rdmasniff_post_recv
static void
rdmasniff_post_recv(pcap_t *handle, uint64_t wr_id)
{
struct pcap_rdmasniff *priv = handle->priv;
struct ibv_sge sg_entry;
struct ibv_recv_wr wr, *bad_wr;
sg_entry.length = RDMASNIFF_RECEIVE_SIZE;
sg_entry.addr = (uintptr_t) handle->buffer + RDMASNIFF_RECEIVE_SIZE * wr_id;
sg_entry.lkey = priv->mr->lkey;
wr.wr_id = wr_id;
wr.num_sge = 1;
wr.sg_list = &sg_entry;
wr.next = NULL;
ibv_post_recv(priv->qp, &wr, &bad_wr);
}
开发者ID:alexandretea,项目名称:libpcap,代码行数:18,代码来源:pcap-rdmasniff.c
注:本文中的ibv_post_recv函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论