本文整理汇总了C++中rdma_destroy_id函数的典型用法代码示例。如果您正苦于以下问题:C++ rdma_destroy_id函数的具体用法?C++ rdma_destroy_id怎么用?C++ rdma_destroy_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rdma_destroy_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: rpcrdma_ep_connect
/*
* Connect unconnected endpoint.
*/
int
rpcrdma_ep_connect(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia)
{
struct rdma_cm_id *id, *old;
int rc = 0;
int retry_count = 0;
if (ep->rep_connected != 0) {
struct rpcrdma_xprt *xprt;
retry:
dprintk("RPC: %s: reconnecting...\n", __func__);
rpcrdma_ep_disconnect(ep, ia);
rpcrdma_flush_cqs(ep);
xprt = container_of(ia, struct rpcrdma_xprt, rx_ia);
ia->ri_ops->ro_reset(xprt);
id = rpcrdma_create_id(xprt, ia,
(struct sockaddr *)&xprt->rx_data.addr);
if (IS_ERR(id)) {
rc = -EHOSTUNREACH;
goto out;
}
/* TEMP TEMP TEMP - fail if new device:
* Deregister/remarshal *all* requests!
* Close and recreate adapter, pd, etc!
* Re-determine all attributes still sane!
* More stuff I haven't thought of!
* Rrrgh!
*/
if (ia->ri_id->device != id->device) {
printk("RPC: %s: can't reconnect on "
"different device!\n", __func__);
rdma_destroy_id(id);
rc = -ENETUNREACH;
goto out;
}
/* END TEMP */
rc = rdma_create_qp(id, ia->ri_pd, &ep->rep_attr);
if (rc) {
dprintk("RPC: %s: rdma_create_qp failed %i\n",
__func__, rc);
rdma_destroy_id(id);
rc = -ENETUNREACH;
goto out;
}
write_lock(&ia->ri_qplock);
old = ia->ri_id;
ia->ri_id = id;
write_unlock(&ia->ri_qplock);
rdma_destroy_qp(old);
rdma_destroy_id(old);
} else {
开发者ID:hw-claudio,项目名称:linux,代码行数:59,代码来源:verbs.c
示例2: fio_rdmaio_close_file
static int fio_rdmaio_close_file(struct thread_data *td, struct fio_file *f)
{
struct rdmaio_data *rd = td->io_ops->data;
struct ibv_send_wr *bad_wr;
/* unregister rdma buffer */
/*
* Client sends notification to the server side
*/
/* refer to: http://linux.die.net/man/7/rdma_cm */
if ((rd->is_client == 1) && ((rd->rdma_protocol == FIO_RDMA_MEM_WRITE)
|| (rd->rdma_protocol ==
FIO_RDMA_MEM_READ))) {
if (ibv_post_send(rd->qp, &rd->sq_wr, &bad_wr) != 0) {
log_err("fio: ibv_post_send fail");
return 1;
}
dprint(FD_IO, "fio: close information sent success\n");
rdma_poll_wait(td, IBV_WC_SEND);
}
if (rd->is_client == 1)
rdma_disconnect(rd->cm_id);
else {
rdma_disconnect(rd->child_cm_id);
#if 0
rdma_disconnect(rd->cm_id);
#endif
}
#if 0
if (get_next_channel_event(td, rd->cm_channel, RDMA_CM_EVENT_DISCONNECTED) != 0) {
log_err("fio: wait for RDMA_CM_EVENT_DISCONNECTED\n");
return 1;
}
#endif
ibv_destroy_cq(rd->cq);
ibv_destroy_qp(rd->qp);
if (rd->is_client == 1)
rdma_destroy_id(rd->cm_id);
else {
rdma_destroy_id(rd->child_cm_id);
rdma_destroy_id(rd->cm_id);
}
ibv_destroy_comp_channel(rd->channel);
ibv_dealloc_pd(rd->pd);
return 0;
}
开发者ID:DebashisGanguly,项目名称:FIOBenchmark,代码行数:54,代码来源:rdma.c
示例3: connect_client
static int
connect_client (struct rdma_cm_id *client)
{
if (!client)
return -1;
if ( -1 == kiro_attach_qp (client)) {
g_critical ("Could not create a QP for the new connection");
rdma_destroy_id (client);
return -1;
}
struct kiro_connection_context *ctx = (struct kiro_connection_context *)g_try_malloc0 (sizeof (struct kiro_connection_context));
if (!ctx) {
g_critical ("Failed to create connection context");
rdma_destroy_id (client);
return -1;
}
ctx->cf_mr_recv = kiro_create_rdma_memory (client->pd, sizeof (struct kiro_ctrl_msg), IBV_ACCESS_LOCAL_WRITE);
ctx->cf_mr_send = kiro_create_rdma_memory (client->pd, sizeof (struct kiro_ctrl_msg), IBV_ACCESS_LOCAL_WRITE);
if (!ctx->cf_mr_recv || !ctx->cf_mr_send) {
g_critical ("Failed to register control message memory");
goto error;
}
ctx->cf_mr_recv->size = ctx->cf_mr_send->size = sizeof (struct kiro_ctrl_msg);
client->context = ctx;
if (rdma_post_recv (client, client, ctx->cf_mr_recv->mem, ctx->cf_mr_recv->size, ctx->cf_mr_recv->mr)) {
g_critical ("Posting preemtive receive for connection failed: %s", strerror (errno));
goto error;
}
if (rdma_accept (client, NULL)) {
g_warning ("Failed to establish connection to the client: %s", strerror (errno));
goto error;
}
g_debug ("Client connection setup successfull");
return 0;
error:
rdma_reject (client, NULL, 0);
kiro_destroy_connection_context (&ctx);
rdma_destroy_id (client);
return -1;
}
开发者ID:IMCG,项目名称:kiro,代码行数:49,代码来源:kiro-server.c
示例4: xfer_rdma_finalize
int xfer_rdma_finalize(struct xfer_data *data)
{
struct rdma_cm_event *event;
int rc;
if (data->servername) {
rc = rdma_disconnect(data->cm_id);
if (rc) {
perror("rdma_disconnect");
fprintf(stderr, "%d:%s: rdma disconnect error\n", pid,
__func__);
return -1;
}
}
rdma_get_cm_event(data->cm_channel, &event);
if (event->event != RDMA_CM_EVENT_DISCONNECTED)
fprintf(stderr, "%d:%s: unexpected event during disconnect %d\n",
pid, __func__, event->event);
rdma_ack_cm_event(event);
rdma_destroy_id(data->cm_id);
rdma_destroy_event_channel(data->cm_channel);
return 0;
}
开发者ID:disprosium8,项目名称:xfer_test,代码行数:26,代码来源:xfer_rdma.c
示例5: rdma_destroy_id
/// The IBConnectionGroup default destructor.
virtual ~IBConnectionGroup()
{
for (auto& c : conn_)
c = nullptr;
if (listen_id_) {
int err = rdma_destroy_id(listen_id_);
if (err) {
L_(error) << "rdma_destroy_id() failed";
}
listen_id_ = nullptr;
}
if (cq_) {
int err = ibv_destroy_cq(cq_);
if (err) {
L_(error) << "ibv_destroy_cq() failed";
}
cq_ = nullptr;
}
if (pd_) {
int err = ibv_dealloc_pd(pd_);
if (err) {
L_(error) << "ibv_dealloc_pd() failed";
}
pd_ = nullptr;
}
rdma_destroy_event_channel(ec_);
}
开发者ID:Jiray,项目名称:flesnet,代码行数:32,代码来源:IBConnectionGroup.hpp
示例6: 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;
}
}
开发者ID:hxmhuang,项目名称:CFIO2,代码行数:25,代码来源:rdma_client.c
示例7: ibrdma_send
//static int run(int argc, char **argv)
int ibrdma_send(char* host, char* port, void* data, uint64_t size)
{
struct addrinfo *addr;
struct rdma_cm_id *cmid= NULL;
struct rdma_event_channel *ec = NULL;
struct rdma_conn_param cm_params;
TEST_NZ(getaddrinfo(host, port, NULL, &addr));
TEST_Z(ec = rdma_create_event_channel());
TEST_NZ(rdma_create_id(ec, &cmid, NULL, RDMA_PS_TCP));
TEST_NZ(rdma_resolve_addr(cmid, NULL, addr->ai_addr, TIMEOUT_IN_MS));
TEST_NZ(wait_for_event(ec, RDMA_CM_EVENT_ADDR_RESOLVED));
freeaddrinfo(addr);
build_connection(cmid);
TEST_NZ(rdma_resolve_route(cmid, TIMEOUT_IN_MS));
TEST_NZ(wait_for_event(ec, RDMA_CM_EVENT_ROUTE_RESOLVED));
build_params(&cm_params);
TEST_NZ(rdma_connect(cmid, &cm_params));
TEST_NZ(wait_for_event(ec, RDMA_CM_EVENT_ESTABLISHED));
on_connect(cmid->context);
/* Init MSG send to start RDMA*/
init_tfile(data, size);
send_init(cmid->context);
/*----------------------------*/
TEST_NZ(wait_for_event(ec, RDMA_CM_EVENT_DISCONNECTED));
rdma_destroy_id(cmid);
rdma_destroy_event_channel(ec);
return 0;
}
开发者ID:kento,项目名称:ibrdma,代码行数:33,代码来源:rdma-client.c
示例8: ucma_process_conn_req
static int ucma_process_conn_req(struct cma_event *evt,
uint32_t handle)
{
struct cma_id_private *id_priv;
int ret;
id_priv = ucma_alloc_id(evt->id_priv->id.channel,
evt->id_priv->id.context, evt->id_priv->id.ps);
if (!id_priv) {
ucma_destroy_kern_id(evt->id_priv->id.channel->fd, handle);
ret = ERR(ENOMEM);
goto err;
}
evt->event.listen_id = &evt->id_priv->id;
evt->event.id = &id_priv->id;
id_priv->handle = handle;
ret = ucma_query_route(&id_priv->id);
if (ret) {
rdma_destroy_id(&id_priv->id);
goto err;
}
return 0;
err:
ucma_complete_event(evt->id_priv);
return ret;
}
开发者ID:2014-class,项目名称:freerouter,代码行数:29,代码来源:cma.c
示例9: diod_rdma_shutdown
void
diod_rdma_shutdown (diod_rdma_t rdma)
{
if (rdma->listen_id)
rdma_destroy_id(rdma->listen_id);
rdma->listen_id = NULL;
}
开发者ID:8l,项目名称:diod,代码行数:7,代码来源:diod_rdma.c
示例10: main
int main(int argc, char **argv)
{
struct sockaddr_in addr;
struct rdma_cm_event *event = NULL;
struct rdma_cm_id *listener = NULL;
struct rdma_event_channel *ec = NULL;
uint16_t port = 0;
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
TEST_Z(ec = rdma_create_event_channel());
TEST_NZ(rdma_create_id(ec, &listener, NULL, RDMA_PS_TCP));
TEST_NZ(rdma_bind_addr(listener, (struct sockaddr *)&addr));
TEST_NZ(rdma_listen(listener, 10)); /* backlog=10 is arbitrary */
port = ntohs(rdma_get_src_port(listener));
printf("listening on port %d.\n", port);
while (rdma_get_cm_event(ec, &event) == 0) {
struct rdma_cm_event event_copy;
memcpy(&event_copy, event, sizeof(*event));
rdma_ack_cm_event(event);
if (on_event(&event_copy))
break;
}
rdma_destroy_id(listener);
rdma_destroy_event_channel(ec);
return 0;
}
开发者ID:styxyang,项目名称:codelib,代码行数:35,代码来源:ib-conn.c
示例11: iser_free_ib_conn_res
/**
* releases the FMR pool, QP and CMA ID objects, returns 0 on success,
* -1 on failure
*/
static int iser_free_ib_conn_res(struct iser_conn *ib_conn, int can_destroy_id)
{
BUG_ON(ib_conn == NULL);
iser_err("freeing conn %p cma_id %p fmr pool %p qp %p\n",
ib_conn, ib_conn->cma_id,
ib_conn->fmr_pool, ib_conn->qp);
/* qp is created only once both addr & route are resolved */
if (ib_conn->fmr_pool != NULL)
ib_destroy_fmr_pool(ib_conn->fmr_pool);
if (ib_conn->qp != NULL)
rdma_destroy_qp(ib_conn->cma_id);
/* if cma handler context, the caller acts s.t the cma destroy the id */
if (ib_conn->cma_id != NULL && can_destroy_id)
rdma_destroy_id(ib_conn->cma_id);
ib_conn->fmr_pool = NULL;
ib_conn->qp = NULL;
ib_conn->cma_id = NULL;
kfree(ib_conn->page_vec);
return 0;
}
开发者ID:710leo,项目名称:LVS,代码行数:30,代码来源:iser_verbs.c
示例12: fi_ibv_pep_setname
static int fi_ibv_pep_setname(fid_t pep_fid, void *addr, size_t addrlen)
{
struct fi_ibv_pep *pep;
int ret;
pep = container_of(pep_fid, struct fi_ibv_pep, pep_fid);
if (pep->src_addrlen && (addrlen != pep->src_addrlen)) {
FI_INFO(&fi_ibv_prov, FI_LOG_FABRIC, "addrlen expected: %d, got: %d.\n",
pep->src_addrlen, addrlen);
return -FI_EINVAL;
}
/* Re-create id if already bound */
if (pep->bound) {
ret = rdma_destroy_id(pep->id);
if (ret) {
FI_INFO(&fi_ibv_prov, FI_LOG_FABRIC, "Unable to destroy previous rdma_cm_id\n");
return -errno;
}
ret = rdma_create_id(NULL, &pep->id, NULL, RDMA_PS_TCP);
if (ret) {
FI_INFO(&fi_ibv_prov, FI_LOG_FABRIC, "Unable to create rdma_cm_id\n");
return -errno;
}
}
ret = rdma_bind_addr(pep->id, (struct sockaddr *)addr);
if (ret) {
FI_INFO(&fi_ibv_prov, FI_LOG_FABRIC, "Unable to bind addres to rdma_cm_id\n");
return -errno;
}
return 0;
}
开发者ID:hoopoepg,项目名称:libfabric,代码行数:35,代码来源:verbs_cm.c
示例13: 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);
}
开发者ID:doughdemon,项目名称:diod,代码行数:31,代码来源:rdmatrans.c
示例14: isert_kref_free
static void isert_kref_free(struct kref *kref)
{
struct isert_connection *isert_conn = container_of(kref,
struct isert_connection,
kref);
struct isert_device *isert_dev = isert_conn->isert_dev;
struct isert_cq *cq = isert_conn->qp->recv_cq->cq_context;
TRACE_ENTRY();
pr_info("isert_conn_free conn:%p\n", isert_conn);
isert_free_conn_resources(isert_conn);
isert_conn_qp_destroy(isert_conn);
mutex_lock(&dev_list_mutex);
isert_dev->cq_qps[cq->idx]--;
list_del(&isert_conn->portal_node);
isert_deref_device(isert_dev);
if (unlikely(isert_conn->portal->state == ISERT_PORTAL_INACTIVE))
isert_portal_free(isert_conn->portal);
mutex_unlock(&dev_list_mutex);
rdma_destroy_id(isert_conn->cm_id);
isert_conn_kfree(isert_conn);
module_put(THIS_MODULE);
TRACE_EXIT();
}
开发者ID:christopherdion,项目名称:scst,代码行数:32,代码来源:iser_rdma.c
示例15: 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 */
}
开发者ID:xiansl,项目名称:mytests,代码行数:33,代码来源:client1.c
示例16: 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);
}
开发者ID:jgunthorpe,项目名称:rdma-plumbing,代码行数:25,代码来源:cmatose.c
示例17: conn_fini
/**
* Cleanup a conn_t struct.
*
* @param[in] conn
*/
void conn_fini(void *arg)
{
conn_t *conn = arg;
#if WITH_TRANSPORT_IB
if (conn->transport.type == CONN_TYPE_RDMA) {
if (conn->rdma.cm_id) {
if (conn->rdma.cm_id->qp)
rdma_destroy_qp(conn->rdma.cm_id);
rdma_destroy_id(conn->rdma.cm_id);
conn->rdma.cm_id = NULL;
}
}
#endif
#if WITH_TRANSPORT_UDP && WITH_RUDP
if (conn->transport.type == CONN_TYPE_UDP) {
atomic_set(&conn->udp.send_seq_num, 0);
atomic_set(&conn->udp.recv_seq_num, 0);
}
#endif
pthread_mutex_destroy(&conn->mutex);
#if WITH_TRANSPORT_IB || WITH_TRANSPORT_UDP
pthread_cond_destroy(&conn->move_wait);
#endif
}
开发者ID:foool,项目名称:portals4,代码行数:32,代码来源:ptl_conn.c
示例18: 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
示例19: ibrdma_transfer
int ibrdma_transfer(struct transfer_info *tfi, int num_tfi) {
struct addrinfo *addr;
struct rdma_cm_id *cmid= NULL;
struct rdma_event_channel *ec = NULL;
struct rdma_conn_param cm_params;
TEST_NZ(getaddrinfo(host, port, NULL, &addr));
TEST_Z(ec = rdma_create_event_channel());
TEST_NZ(rdma_create_id(ec, &cmid, NULL, RDMA_PS_TCP));
TEST_NZ(rdma_resolve_addr(cmid, NULL, addr->ai_addr, TIMEOUT_IN_MS));
TEST_NZ(wait_for_event(ec, RDMA_CM_EVENT_ADDR_RESOLVED));
freeaddrinfo(addr);
build_connection(cmid);
TEST_NZ(rdma_resolve_route(cmid, TIMEOUT_IN_MS));
TEST_NZ(wait_for_event(ec, RDMA_CM_EVENT_ROUTE_RESOLVED));
build_params(&cm_params);
TEST_NZ(rdma_connect(cmid, &cm_params));
TEST_NZ(wait_for_event(ec, RDMA_CM_EVENT_ESTABLISHED));
on_connect(cmid->context);
TEST_NZ(wait_for_event(ec, RDMA_CM_EVENT_DISCONNECTED));
rdma_destroy_id(&cmid);
rdma_destroy_event_channel(&ec);
return 0;
}
开发者ID:kento,项目名称:ibrdma,代码行数:27,代码来源:rdma-client.c
示例20: RDMA_Active_Finalize
int RDMA_Active_Finalize(struct RDMA_communicator *comm)
{
TEST_NZ(wait_for_event(comm->ec, RDMA_CM_EVENT_DISCONNECTED));
rdma_destroy_id(comm->cm_id);
rdma_destroy_event_channel(comm->ec);
return 0;
}
开发者ID:kento,项目名称:ibrdma,代码行数:7,代码来源:rdma-client.c
注:本文中的rdma_destroy_id函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论