本文整理汇总了C++中ibv_dereg_mr函数的典型用法代码示例。如果您正苦于以下问题:C++ ibv_dereg_mr函数的具体用法?C++ ibv_dereg_mr怎么用?C++ ibv_dereg_mr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ibv_dereg_mr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: close
void close()
{
util::spinlock::scoped_lock lk(mtx_);
if(buffer_mr_)
{
ibv_dereg_mr(buffer_mr_);
buffer_mr_ = 0;
}
if(server_msg_mr_)
{
ibv_dereg_mr(server_msg_mr_);
server_msg_mr_ = 0;
}
if(client_msg_mr_)
{
ibv_dereg_mr(client_msg_mr_);
client_msg_mr_ = 0;
}
if(id_)
{
rdma_disconnect(id_);
id_ = 0;
}
size_ = 0;
}
示例2: rdma_trans_destroy
static void
rdma_trans_destroy(void *a)
{
Rdmatrans *rdma;
struct ibv_qp_attr attr;
rdma = a;
if (rdma->connected)
rdma_disconnect(rdma->cm_id);
if (rdma->qp) {
attr.qp_state = IBV_QPS_ERR;
ibv_modify_qp(rdma->qp, &attr, IBV_QP_STATE);
ibv_destroy_qp(rdma->qp);
}
if (rdma->cq)
ibv_destroy_cq(rdma->cq);
if (rdma->ch)
ibv_destroy_comp_channel(rdma->ch);
if (rdma->snd_mr)
ibv_dereg_mr(rdma->snd_mr);
if (rdma->snd_buf)
free(rdma->snd_buf);
if (rdma->rcv_mr)
ibv_dereg_mr(rdma->rcv_mr);
if (rdma->rcv_buf)
free(rdma->rcv_buf);
if (rdma->pd)
ibv_dealloc_pd(rdma->pd);
if (rdma->cm_id)
rdma_destroy_id(rdma->cm_id);
}
示例3: destroy_connection
void destroy_connection(rdma_conn_t *conn)
{
rdma_destroy_qp(conn->id);
ibv_dereg_mr(conn->send_mr);
ibv_dereg_mr(conn->recv_mr);
ibv_dereg_mr(conn->data_mr);
ibv_dereg_mr(conn->addr_mr);
if (conn->send_msg) {
free(conn->send_msg);
conn->send_msg = NULL;
}
if (conn->recv_msg) {
free(conn->recv_msg);
conn->recv_msg = NULL;
}
rdma_destroy_id(conn->id);
if (conn) {
free(conn);
conn = NULL;
}
}
示例4: on_disconnect
void on_disconnect(struct rdma_cm_id *id)
{
struct timeval start, end, dt;
gettimeofday(&start, NULL);
struct connection *conn = (struct connection *)id->context;
printf("disconnected.\n");
rdma_destroy_qp(id);
ibv_dereg_mr(conn->send_region_mr);
ibv_dereg_mr(conn->recv_region_mr);
ibv_dereg_mr(conn->send_msg_mr);
ibv_dereg_mr(conn->recv_msg_mr);
free(conn->send_region);
free(conn->recv_region);
free(conn->recv_msg);
free(conn->send_msg);
rdma_destroy_id(id);
free(conn);
gettimeofday(&end, NULL);
timersub(&end, &start, &dt);
long usec = dt.tv_usec + 1000000 * dt.tv_sec;
printf("[Derigester] takes %ld micro_secs.\n", usec);
return; /* exit event loop */
}
示例5: FreeBuff
/* De_register the allocated memory regions before exiting */
void FreeBuff(char *buff1, char *buff2)
{
int ret;
if(s_mr_hndl) {
LOGPRINTF(("Deregistering send buffer"));
ret = ibv_dereg_mr(s_mr_hndl);
if(ret) {
fprintf(stderr, "Error deregistering send mr\n");
} else {
s_mr_hndl = NULL;
}
}
if(r_mr_hndl) {
LOGPRINTF(("Deregistering recv buffer"));
ret = ibv_dereg_mr(r_mr_hndl);
if(ret) {
fprintf(stderr, "Error deregistering recv mr\n");
} else {
r_mr_hndl = NULL;
}
}
if(buff1 != NULL)
free(buff1);
if(buff2 != NULL)
free(buff2);
}
示例6: xfer_rdma_destroy_ctx
void xfer_rdma_destroy_ctx(struct xfer_context *ctx) {
rdma_destroy_qp(ctx->cm_id);
ibv_destroy_cq(ctx->cq);
ibv_destroy_comp_channel(ctx->ch);
ibv_dereg_mr(ctx->send_mr);
ibv_dereg_mr(ctx->recv_mr);
ibv_dealloc_pd(ctx->pd);
free(ctx);
}
示例7: ibv_dereg_mr
InputChannelSender::~InputChannelSender()
{
if (mr_desc_) {
ibv_dereg_mr(mr_desc_);
mr_desc_ = nullptr;
}
if (mr_data_) {
ibv_dereg_mr(mr_data_);
mr_data_ = nullptr;
}
}
示例8: rping_free_buffers
static void rping_free_buffers(struct rping_cb *cb)
{
DEBUG_LOG("rping_free_buffers called on cb %p\n", cb);
ibv_dereg_mr(cb->recv_mr);
ibv_dereg_mr(cb->send_mr);
ibv_dereg_mr(cb->rdma_mr);
free(cb->rdma_buf);
if (!cb->server) {
ibv_dereg_mr(cb->start_mr);
free(cb->start_buf);
}
}
示例9: destroy_context
int BClientContext::destroy_context () {
if (qp) TEST_NZ(ibv_destroy_qp (qp));
if (recv_memory_mr) TEST_NZ (ibv_dereg_mr (recv_memory_mr));
if (lock_result_mr) TEST_NZ (ibv_dereg_mr (lock_result_mr));
if (cq) TEST_NZ (ibv_destroy_cq (cq));
if (pd) TEST_NZ (ibv_dealloc_pd (pd));
if (ib_ctx) TEST_NZ (ibv_close_device (ib_ctx));
if (sockfd >= 0) TEST_NZ (close (sockfd));
return 0;
}
示例10: txq_mp2mr_reg
/**
* Register a Memory Region (MR) <-> Memory Pool (MP) association in
* txq->mp2mr[]. If mp2mr[] is full, remove an entry first.
*
* This function should only be called by txq_mp2mr().
*
* @param txq
* Pointer to TX queue structure.
* @param[in] mp
* Memory Pool for which a Memory Region lkey must be returned.
* @param idx
* Index of the next available entry.
*
* @return
* mr->lkey on success, (uint32_t)-1 on failure.
*/
uint32_t
txq_mp2mr_reg(struct txq *txq, struct rte_mempool *mp, unsigned int idx)
{
struct txq_ctrl *txq_ctrl = container_of(txq, struct txq_ctrl, txq);
struct ibv_mr *mr;
/* Add a new entry, register MR first. */
DEBUG("%p: discovered new memory pool \"%s\" (%p)",
(void *)txq_ctrl, mp->name, (void *)mp);
mr = mlx5_mp2mr(txq_ctrl->priv->pd, mp);
if (unlikely(mr == NULL)) {
DEBUG("%p: unable to configure MR, ibv_reg_mr() failed.",
(void *)txq_ctrl);
return (uint32_t)-1;
}
if (unlikely(idx == RTE_DIM(txq_ctrl->txq.mp2mr))) {
/* Table is full, remove oldest entry. */
DEBUG("%p: MR <-> MP table full, dropping oldest entry.",
(void *)txq_ctrl);
--idx;
claim_zero(ibv_dereg_mr(txq_ctrl->txq.mp2mr[0].mr));
memmove(&txq_ctrl->txq.mp2mr[0], &txq_ctrl->txq.mp2mr[1],
(sizeof(txq_ctrl->txq.mp2mr) -
sizeof(txq_ctrl->txq.mp2mr[0])));
}
/* Store the new entry. */
txq_ctrl->txq.mp2mr[idx].mp = mp;
txq_ctrl->txq.mp2mr[idx].mr = mr;
txq_ctrl->txq.mp2mr[idx].lkey = htonl(mr->lkey);
DEBUG("%p: new MR lkey for MP \"%s\" (%p): 0x%08" PRIu32,
(void *)txq_ctrl, mp->name, (void *)mp,
txq_ctrl->txq.mp2mr[idx].lkey);
return txq_ctrl->txq.mp2mr[idx].lkey;
}
示例11: xfer_rdma_unregister_buffer
int xfer_rdma_unregister_buffer(struct xfer_rdma_buf_handle_t *handle) {
ibv_dereg_mr(handle->local_mr);
if (handle->remote_mr)
free(handle->remote_mr);
return 0;
}
示例12: on_disconnect
static void on_disconnect(struct rdma_cm_id *id)
{
struct conn_context *ctx = (struct conn_context *)id->context;
close(ctx->fd);
ibv_dereg_mr(ctx->buffer_mr);
ibv_dereg_mr(ctx->msg_mr);
free(ctx->buffer);
free(ctx->msg);
printf("finished transferring %s\n", ctx->file_name);
free(ctx);
}
示例13: ibv_reg_mr
/**
* Sends a buffer's memory region so that it can be mapped to it's remote end.
*/
void RDMAChannel::SendMR(ibv_mr* mr, int id) {
// Map the memory region itself so that it can be sent
ibv_mr* init = ibv_reg_mr(adapter_.pd_, mr, sizeof(ibv_mr),
IBV_ACCESS_LOCAL_WRITE);
struct ibv_sge list;
list.addr = (uint64_t) mr;
list.length = sizeof(ibv_mr);
list.lkey = init->lkey;
struct ibv_send_wr wr;
caffe_memset(sizeof(wr), 0, &wr);
wr.wr_id = (uint64_t) init;
wr.sg_list = &list;
wr.num_sge = 1;
wr.opcode = IBV_WR_SEND_WITH_IMM;
wr.send_flags = IBV_SEND_SIGNALED;
wr.imm_data = id;
struct ibv_send_wr *bad_wr;
CHECK(!ibv_post_send(qp_, &wr, &bad_wr));
for (;;) {
ibv_wc wc;
int ne = ibv_poll_cq(write_cq_, 1, &wc);
CHECK_GE(ne, 0);
if (ne && wc.wr_id == (uint64_t) init) {
break;
}
}
CHECK(!ibv_dereg_mr(init));
}
示例14: mca_oob_ud_req_destruct
static void mca_oob_ud_req_destruct (mca_oob_ud_req_t *req)
{
int i;
if (req->req_peer) {
OBJ_RELEASE(req->req_peer);
}
if (req->req_wr.send) {
free (req->req_wr.send);
}
if (req->req_grh_mr) {
(void) ibv_dereg_mr (req->req_grh_mr);
}
if (req->req_grh) {
free (req->req_grh);
}
if (req->req_sge) {
free (req->req_sge);
}
MCA_OOB_UD_REQ_DEREG_MR(req);
}
示例15: destroy_node
static void destroy_node(struct cmatest_node *node)
{
if (!node->cma_id)
return;
if (node->cma_id->qp)
rdma_destroy_qp(node->cma_id);
if (node->cq[SEND_CQ_INDEX])
ibv_destroy_cq(node->cq[SEND_CQ_INDEX]);
if (node->cq[RECV_CQ_INDEX])
ibv_destroy_cq(node->cq[RECV_CQ_INDEX]);
if (node->mem) {
ibv_dereg_mr(node->mr);
free(node->mem);
}
if (node->pd)
ibv_dealloc_pd(node->pd);
/* Destroy the RDMA ID after all device resources */
rdma_destroy_id(node->cma_id);
}