本文整理汇总了C++中ibv_alloc_pd函数的典型用法代码示例。如果您正苦于以下问题:C++ ibv_alloc_pd函数的具体用法?C++ ibv_alloc_pd怎么用?C++ ibv_alloc_pd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ibv_alloc_pd函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: l
ibv_pd *connection_handler::get_pd(ibv_context *context, boost::system::error_code & ec)
{
hpx::lcos::local::spinlock::scoped_lock l(pd_map_mtx_);
typedef pd_map_type::iterator iterator;
iterator it = pd_map_.find(context);
if(it == pd_map_.end())
{
ibv_pd *pd = ibv_alloc_pd(context);
if(pd == 0)
{
int verrno = errno;
boost::system::error_code err(verrno, boost::system::system_category());
HPX_IBVERBS_THROWS_IF(
ec
, err
);
return 0;
}
memory_pool_.register_chunk(pd);
pd_map_.insert(std::make_pair(context, pd));
mr_map_.insert(std::make_pair(pd, mr_cache_type()));
return pd;
}
return it->second;
}
开发者ID:nchaimov,项目名称:hpx,代码行数:27,代码来源:connection_handler_ibverbs.cpp
示例2: make_pd
static PdPtr make_pd(CtxPtr ctx) {
auto ptr = ibv_alloc_pd(ctx.get());
if(!ptr) {
throw std::runtime_error("cannot allocate pd");
}
return PdPtr(ptr, ibv_dealloc_pd);
}
开发者ID:lunastorm,项目名称:cpp_ib,代码行数:7,代码来源:verbs.hpp
示例3: init_node
static int init_node(struct cmatest_node *node)
{
struct ibv_qp_init_attr init_qp_attr;
int cqe, ret;
int i;
struct ibv_cq **cqs[] = {&node->cq[SEND_CQ_INDEX],
&node->cq[RECV_CQ_INDEX]};
node->pd = ibv_alloc_pd(node->cma_id->verbs);
if (!node->pd) {
ret = -ENOMEM;
printf("cmatose: unable to allocate PD\n");
goto out;
}
cqe = message_count ? message_count : 1;
for (i = 0; i < sizeof(cqs)/sizeof(cqs[0]); i++) {
if (set_ts) {
struct ibv_exp_cq_init_attr cq_init_attr;
memset(&cq_init_attr, 0, sizeof(cq_init_attr));
cq_init_attr.flags = IBV_EXP_CQ_TIMESTAMP;
cq_init_attr.comp_mask = IBV_EXP_CQ_INIT_ATTR_FLAGS;
*cqs[i] = (struct ibv_cq *)ibv_exp_create_cq(
node->cma_id->verbs, cqe, node,
NULL, 0, &cq_init_attr);
} else {
*cqs[i] = ibv_create_cq(node->cma_id->verbs, cqe, node,
0, 0);
}
}
if (!node->cq[SEND_CQ_INDEX] || !node->cq[RECV_CQ_INDEX]) {
ret = -ENOMEM;
printf("cmatose: unable to create CQ\n");
goto out;
}
memset(&init_qp_attr, 0, sizeof init_qp_attr);
init_qp_attr.cap.max_send_wr = cqe;
init_qp_attr.cap.max_recv_wr = cqe;
init_qp_attr.cap.max_send_sge = 1;
init_qp_attr.cap.max_recv_sge = 1;
init_qp_attr.qp_context = node;
init_qp_attr.sq_sig_all = 1;
init_qp_attr.qp_type = IBV_QPT_RC;
init_qp_attr.send_cq = node->cq[SEND_CQ_INDEX];
init_qp_attr.recv_cq = node->cq[RECV_CQ_INDEX];
ret = rdma_create_qp(node->cma_id, node->pd, &init_qp_attr);
if (ret) {
perror("cmatose: unable to create QP");
goto out;
}
ret = create_message(node);
if (ret) {
printf("cmatose: failed to create messages: %d\n", ret);
goto out;
}
out:
return ret;
}
开发者ID:Cai900205,项目名称:test,代码行数:60,代码来源:cmatose.c
示例4: mDomain
ProtectionDomain::ProtectionDomain(ibv_context* context)
: mDomain(ibv_alloc_pd(context)) {
if (mDomain == nullptr) {
throw std::system_error(errno, std::generic_category());
}
LOG_TRACE("Allocated protection domain");
}
开发者ID:Stone1973,项目名称:crossbow,代码行数:7,代码来源:DeviceContext.cpp
示例5: build_verbs
static void build_verbs(IbvConnection *conn, struct ibv_context *verbs)
{
conn->ibvctx = verbs;
TEST_Z(conn->pd = ibv_alloc_pd(conn->ibvctx));
TEST_Z(conn->comp_channel = ibv_create_comp_channel(conn->ibvctx));
TEST_Z(conn->cq = ibv_create_cq(conn->ibvctx, 10, NULL, conn->comp_channel, 0)); /* cqe=10 is arbitrary */
TEST_NZ(ibv_req_notify_cq(conn->cq, 0));
TEST_NZ(pthread_create(&conn->cq_poller_thread, NULL, poll_cq, conn));
}
开发者ID:Daweek,项目名称:Original_DSCUDA,代码行数:10,代码来源:ibv_rdma.cpp
示例6: rdma_backend_create_pd
int rdma_backend_create_pd(RdmaBackendDev *backend_dev, RdmaBackendPD *pd)
{
pd->ibpd = ibv_alloc_pd(backend_dev->context);
if (!pd->ibpd) {
rdma_error_report("ibv_alloc_pd fail, errno=%d", errno);
return -EIO;
}
return 0;
}
开发者ID:OSLL,项目名称:qemu-xtensa,代码行数:11,代码来源:rdma_backend.c
示例7: opal_common_verbs_qp_test
int opal_common_verbs_qp_test(struct ibv_context *device_context, int flags)
{
int rc = OPAL_SUCCESS;
struct ibv_pd *pd = NULL;
struct ibv_cq *cq = NULL;
/* Bozo check */
if (NULL == device_context ||
(0 == (flags & (OPAL_COMMON_VERBS_FLAGS_RC | OPAL_COMMON_VERBS_FLAGS_UD)))) {
return OPAL_ERR_BAD_PARAM;
}
/* Try to make both the PD and CQ */
pd = ibv_alloc_pd(device_context);
if (NULL == pd) {
return OPAL_ERR_OUT_OF_RESOURCE;
}
cq = ibv_create_cq(device_context, 2, NULL, NULL, 0);
if (NULL == cq) {
rc = OPAL_ERR_OUT_OF_RESOURCE;
goto out;
}
/* Now try to make the QP(s) of the desired type(s) */
if (flags & OPAL_COMMON_VERBS_FLAGS_RC &&
!make_qp(pd, cq, IBV_QPT_RC)) {
rc = OPAL_ERR_NOT_SUPPORTED;
goto out;
}
if (flags & OPAL_COMMON_VERBS_FLAGS_NOT_RC &&
make_qp(pd, cq, IBV_QPT_RC)) {
rc = OPAL_ERR_TYPE_MISMATCH;
goto out;
}
if (flags & OPAL_COMMON_VERBS_FLAGS_UD &&
!make_qp(pd, cq, IBV_QPT_UD)) {
rc = OPAL_ERR_NOT_SUPPORTED;
goto out;
}
out:
/* Free the PD and/or CQ */
if (NULL != pd) {
ibv_dealloc_pd(pd);
}
if (NULL != cq) {
ibv_destroy_cq(cq);
}
return rc;
}
开发者ID:Greatrandom,项目名称:ompi,代码行数:52,代码来源:common_verbs_qp_type.c
示例8: fi_ibv_domain
static int
fi_ibv_domain(struct fid_fabric *fabric, struct fi_info *info,
struct fid_domain **domain, void *context)
{
struct fi_ibv_domain *_domain;
struct fi_info *fi;
int ret;
fi = fi_ibv_get_verbs_info(info->domain_attr->name);
if (!fi)
return -FI_EINVAL;
ret = fi_ibv_check_domain_attr(info->domain_attr, fi);
if (ret)
return ret;
_domain = calloc(1, sizeof *_domain);
if (!_domain)
return -FI_ENOMEM;
_domain->info = fi_dupinfo(info);
if (!_domain->info)
goto err1;
_domain->rdm = FI_IBV_EP_TYPE_IS_RDM(info);
ret = fi_ibv_open_device_by_name(_domain, info->domain_attr->name);
if (ret)
goto err2;
_domain->pd = ibv_alloc_pd(_domain->verbs);
if (!_domain->pd) {
ret = -errno;
goto err2;
}
_domain->domain_fid.fid.fclass = FI_CLASS_DOMAIN;
_domain->domain_fid.fid.context = context;
_domain->domain_fid.fid.ops = &fi_ibv_fid_ops;
_domain->domain_fid.ops = _domain->rdm ? &fi_ibv_rdm_domain_ops :
&fi_ibv_domain_ops;
_domain->domain_fid.mr = &fi_ibv_domain_mr_ops;
_domain->fab = container_of(fabric, struct fi_ibv_fabric, fabric_fid);
*domain = &_domain->domain_fid;
return 0;
err2:
fi_freeinfo(_domain->info);
err1:
free(_domain);
return ret;
}
开发者ID:sanidhya,项目名称:libfabric,代码行数:51,代码来源:verbs_domain.c
示例9: rping_setup_qp
static int rping_setup_qp(struct rping_cb *cb, struct rdma_cm_id *cm_id)
{
int ret;
cb->pd = ibv_alloc_pd(cm_id->verbs);
if (!cb->pd) {
fprintf(stderr, "ibv_alloc_pd failed\n");
return errno;
}
DEBUG_LOG("created pd %p\n", cb->pd);
cb->channel = ibv_create_comp_channel(cm_id->verbs);
if (!cb->channel) {
fprintf(stderr, "ibv_create_comp_channel failed\n");
ret = errno;
goto err1;
}
DEBUG_LOG("created channel %p\n", cb->channel);
cb->cq = ibv_create_cq(cm_id->verbs, RPING_SQ_DEPTH * 2, cb,
cb->channel, 0);
if (!cb->cq) {
fprintf(stderr, "ibv_create_cq failed\n");
ret = errno;
goto err2;
}
DEBUG_LOG("created cq %p\n", cb->cq);
ret = ibv_req_notify_cq(cb->cq, 0);
if (ret) {
fprintf(stderr, "ibv_create_cq failed\n");
ret = errno;
goto err3;
}
ret = rping_create_qp(cb);
if (ret) {
perror("rdma_create_qp");
goto err3;
}
DEBUG_LOG("created qp %p\n", cb->qp);
return 0;
err3:
ibv_destroy_cq(cb->cq);
err2:
ibv_destroy_comp_channel(cb->channel);
err1:
ibv_dealloc_pd(cb->pd);
return ret;
}
开发者ID:hkimura,项目名称:pib,代码行数:51,代码来源:rping.c
示例10: ibv_alloc_pd
static
struct ibv_pd *psofed_open_pd(struct ibv_context *ctx)
{
/* allocate a protection domain to be associated with QP */
struct ibv_pd *pd;
pd = ibv_alloc_pd(ctx);
if (!pd) {
psofed_err_errno("ibv_alloc_pd() failed", errno);
}
return pd;
}
开发者ID:RWTH-OS,项目名称:pscom,代码行数:14,代码来源:psofed.c
示例11: fi_ibv_get_qp_cap
static inline int fi_ibv_get_qp_cap(struct ibv_context *ctx,
struct fi_info *info)
{
struct ibv_pd *pd;
struct ibv_cq *cq;
struct ibv_qp *qp;
struct ibv_qp_init_attr init_attr;
int ret = 0;
pd = ibv_alloc_pd(ctx);
if (!pd) {
VERBS_INFO_ERRNO(FI_LOG_FABRIC, "ibv_alloc_pd", errno);
return -errno;
}
cq = ibv_create_cq(ctx, 1, NULL, NULL, 0);
if (!cq) {
VERBS_INFO_ERRNO(FI_LOG_FABRIC, "ibv_create_cq", errno);
ret = -errno;
goto err1;
}
memset(&init_attr, 0, sizeof init_attr);
init_attr.send_cq = cq;
init_attr.recv_cq = cq;
init_attr.cap.max_send_wr = verbs_default_tx_size;
init_attr.cap.max_recv_wr = verbs_default_rx_size;
init_attr.cap.max_send_sge = verbs_default_tx_iov_limit;
init_attr.cap.max_recv_sge = verbs_default_rx_iov_limit;
init_attr.cap.max_inline_data = verbs_default_inline_size;
init_attr.qp_type = IBV_QPT_RC;
qp = ibv_create_qp(pd, &init_attr);
if (!qp) {
VERBS_INFO_ERRNO(FI_LOG_FABRIC, "ibv_create_qp", errno);
ret = -errno;
goto err2;
}
info->tx_attr->inject_size = init_attr.cap.max_inline_data;
ibv_destroy_qp(qp);
err2:
ibv_destroy_cq(cq);
err1:
ibv_dealloc_pd(pd);
return ret;
}
开发者ID:p91paul,项目名称:libfabric,代码行数:50,代码来源:verbs_info.c
示例12: uct_ib_mlx5_check_dc
static ucs_status_t uct_ib_mlx5_check_dc(uct_ib_device_t *dev)
{
ucs_status_t status = UCS_OK;
struct ibv_context *ctx = dev->ibv_context;
struct ibv_qp_init_attr_ex qp_attr = {};
struct mlx5dv_qp_init_attr dv_attr = {};
struct ibv_pd *pd;
struct ibv_cq *cq;
struct ibv_qp *qp;
pd = ibv_alloc_pd(ctx);
if (pd == NULL) {
ucs_error("ibv_alloc_pd() failed: %m");
return UCS_ERR_IO_ERROR;
}
cq = ibv_create_cq(ctx, 1, NULL, NULL, 0);
if (cq == NULL) {
ucs_error("ibv_create_cq() failed: %m");
status = UCS_ERR_IO_ERROR;
goto err_cq;
}
qp_attr.send_cq = cq;
qp_attr.recv_cq = cq;
qp_attr.cap.max_send_wr = 1;
qp_attr.cap.max_send_sge = 1;
qp_attr.qp_type = IBV_QPT_DRIVER;
qp_attr.comp_mask = IBV_QP_INIT_ATTR_PD;
qp_attr.pd = pd;
dv_attr.comp_mask = MLX5DV_QP_INIT_ATTR_MASK_DC;
dv_attr.dc_init_attr.dc_type = MLX5DV_DCTYPE_DCI;
/* create DCI qp successful means DC is supported */
qp = mlx5dv_create_qp(ctx, &qp_attr, &dv_attr);
if (qp) {
ibv_destroy_qp(qp);
dev->flags |= UCT_IB_DEVICE_FLAG_DC;
}
ibv_destroy_cq(cq);
err_cq:
ibv_dealloc_pd(pd);
return status;
}
开发者ID:shamisp,项目名称:ucx,代码行数:46,代码来源:ib_mlx5_dv.c
示例13: init_context
/// Initialize the InfiniBand verbs context.
void init_context(struct ibv_context* context)
{
context_ = context;
L_(debug) << "create verbs objects";
pd_ = ibv_alloc_pd(context);
if (!pd_)
throw InfinibandException("ibv_alloc_pd failed");
cq_ = ibv_create_cq(context, num_cqe_, nullptr, nullptr, 0);
if (!cq_)
throw InfinibandException("ibv_create_cq failed");
if (ibv_req_notify_cq(cq_, 0))
throw InfinibandException("ibv_req_notify_cq failed");
}
开发者ID:Jiray,项目名称:flesnet,代码行数:18,代码来源:IBConnectionGroup.hpp
示例14: init_node
static int init_node(struct cmatest_node *node)
{
struct ibv_qp_init_attr init_qp_attr;
int cqe, ret;
node->pd = ibv_alloc_pd(node->cma_id->verbs);
if (!node->pd) {
ret = -ENOMEM;
printf("cmatose: unable to allocate PD\n");
goto out;
}
cqe = message_count ? message_count : 1;
node->cq[SEND_CQ_INDEX] = ibv_create_cq(node->cma_id->verbs, cqe, node, NULL, 0);
node->cq[RECV_CQ_INDEX] = ibv_create_cq(node->cma_id->verbs, cqe, node, NULL, 0);
if (!node->cq[SEND_CQ_INDEX] || !node->cq[RECV_CQ_INDEX]) {
ret = -ENOMEM;
printf("cmatose: unable to create CQ\n");
goto out;
}
memset(&init_qp_attr, 0, sizeof init_qp_attr);
init_qp_attr.cap.max_send_wr = cqe;
init_qp_attr.cap.max_recv_wr = cqe;
init_qp_attr.cap.max_send_sge = 1;
init_qp_attr.cap.max_recv_sge = 1;
init_qp_attr.qp_context = node;
init_qp_attr.sq_sig_all = 1;
init_qp_attr.qp_type = IBV_QPT_RC;
init_qp_attr.send_cq = node->cq[SEND_CQ_INDEX];
init_qp_attr.recv_cq = node->cq[RECV_CQ_INDEX];
ret = rdma_create_qp(node->cma_id, node->pd, &init_qp_attr);
if (ret) {
perror("cmatose: unable to create QP");
goto out;
}
ret = create_message(node);
if (ret) {
printf("cmatose: failed to create messages: %d\n", ret);
goto out;
}
out:
return ret;
}
开发者ID:jgunthorpe,项目名称:rdma-plumbing,代码行数:45,代码来源:cmatose.c
示例15: build_context
void build_context(struct ibv_context *verbs)
{
if (s_ctx) {
if (s_ctx->ctx != verbs) {
die("cannot handle events in more than one context.");
}
return;
}
s_ctx = (rdma_ctx_t *)malloc(sizeof(rdma_ctx_t));
s_ctx->ctx = verbs;
TEST_Z(s_ctx->pd = ibv_alloc_pd(s_ctx->ctx));
TEST_Z(s_ctx->comp_channel = ibv_create_comp_channel(s_ctx->ctx));
TEST_Z(s_ctx->cq = ibv_create_cq(s_ctx->ctx, 10, NULL, s_ctx->comp_channel, 0)); /* cqe=10 is arbitrary */
TEST_NZ(ibv_req_notify_cq(s_ctx->cq, 0));
}
开发者ID:hxmhuang,项目名称:CFIO2,代码行数:18,代码来源:rdma_client.c
示例16: init_node
static int init_node(struct cmatest_node *node)
{
struct ibv_qp_init_attr init_qp_attr;
int cqe, ret;
node->pd = ibv_alloc_pd(node->cma_id->verbs);
if (!node->pd) {
ret = -ENOMEM;
printf("rxe_send_mc: unable to allocate PD\n");
goto out;
}
cqe = message_buffer ? message_buffer * 2 : 2;
node->cq = ibv_create_cq(node->cma_id->verbs, cqe, node, 0, 0);
if (!node->cq) {
ret = -ENOMEM;
printf("rxe_send_mc: unable to create CQ\n");
goto out;
}
memset(&init_qp_attr, 0, sizeof init_qp_attr);
init_qp_attr.cap.max_send_wr = message_buffer ? message_buffer : 1;
init_qp_attr.cap.max_recv_wr = message_buffer ? message_buffer : 1;
init_qp_attr.cap.max_send_sge = 1;
init_qp_attr.cap.max_recv_sge = 1;
init_qp_attr.qp_context = node;
init_qp_attr.sq_sig_all = 1; //singal all
init_qp_attr.qp_type = IBV_QPT_UD;
init_qp_attr.send_cq = node->cq;
init_qp_attr.recv_cq = node->cq;
ret = rdma_create_qp(node->cma_id, node->pd, &init_qp_attr);
if (ret) {
perror("rxe_send_mc: unable to create QP");
goto out;
}
ret = create_message(node);
if (ret) {
printf("rxe_send_mc: failed to create messages: %d\n", ret);
goto out;
}
out:
return ret;
}
开发者ID:vtrocelab,项目名称:rxe_send_mc,代码行数:44,代码来源:rxe_send_mc.c
示例17: build_context
static void build_context(struct ibv_context *verbs)
{
if (s_ctx) {
if (s_ctx->ctx != verbs)
die("cannot handle events in more than one context.");
return;
}
s_ctx = (struct context *)malloc(sizeof(struct context));
s_ctx->ctx = verbs;
TEST_Z(s_ctx->pd = ibv_alloc_pd(s_ctx->ctx));
TEST_Z(s_ctx->comp_channel = ibv_create_comp_channel(s_ctx->ctx));
TEST_Z(s_ctx->cq = ibv_create_cq(s_ctx->ctx, 10, NULL, s_ctx->comp_channel, 0)); /* cqe=10 is arbitrary */
TEST_NZ(ibv_req_notify_cq(s_ctx->cq, 0));
// TEST_NZ(pthread_create(&s_ctx->cq_poller_thread, NULL, poll_cq, NULL));
}
开发者ID:kento,项目名称:ibrdma,代码行数:20,代码来源:rdma-client.c
示例18: fprintf
struct ibv_pd_1_0 *__ibv_alloc_pd_1_0(struct ibv_context_1_0 *context)
{ fprintf(stderr, "%s:%s:%d \n", __func__, __FILE__, __LINE__);
struct ibv_pd *real_pd;
struct ibv_pd_1_0 *pd;
pd = malloc(sizeof *pd);
if (!pd)
return NULL;
real_pd = ibv_alloc_pd(context->real_context);
if (!real_pd) {
free(pd);
return NULL;
}
pd->context = context;
pd->real_pd = real_pd;
return pd;
}
开发者ID:kento,项目名称:libpibverbs,代码行数:20,代码来源:compat-1_0.c
示例19: log_
void Connector::build_context(struct ibv_context* verb_)
{
if (s_ctx_ && s_ctx_->ctx_ != verb_) {
log_(ERROR, "cannot handle events in more than one context.")
exit(EXIT_FAILURE);
}
s_ctx_ = (struct context*)malloc(sizeof(struct context) );
s_ctx_->ctx_ = verb_;
TEST_Z(s_ctx_->pd_ = ibv_alloc_pd(s_ctx_->ctx_) );
TEST_Z(s_ctx_->comp_channel_ = ibv_create_comp_channel(s_ctx_->ctx_) );
TEST_Z(s_ctx_->cq_ = ibv_create_cq(s_ctx_->ctx_, MAX_QP__CQ_LENGTH, NULL, s_ctx_->comp_channel_, 0) );
TEST_NZ(ibv_req_notify_cq(s_ctx_->cq_, 0) )
// TODO
// TEST_NZ(pthread_create(pthread_v.back(), NULL, &Connector::bst_poll_cq, (void*)(this) ) )
pthread_v.push_back(new pthread_t() );
wrap_Connector* wrap_ = new wrap_Connector(this, s_ctx_);
TEST_NZ(pthread_create(pthread_v.back(), NULL, call_poll_cq_w_wrap, wrap_) )
}
开发者ID:mfatihaktas,项目名称:dataspaces_wa,代码行数:21,代码来源:ib_conn.cpp
示例20: open_hca
int open_hca(void)
{
struct ibv_device **dev_list=NULL;
struct ibv_context *cxt = NULL;
int rc;
int num_hcas;
dev_list = ibv_get_device_list(&num_hcas);
// Assume that the first device has an ACTIVE port
// if it does not we do not handle this situation for now
hca.ib_dev = dev_list[0];
hca.context = ibv_open_device(hca.ib_dev);
if(!hca.context) {
fprintf(stderr,"Couldn't get context %s\n",
ibv_get_device_name(hca.ib_dev));
return 1;
}
hca.pd = ibv_alloc_pd(hca.context);
assert(hca.pd != NULL);
if(!hca.pd) {
fprintf(stderr,"Couldn't get pd %s\n",
ibv_get_device_name(hca.ib_dev));
return 1;
}
return 0;
}
开发者ID:bcernohous,项目名称:ga,代码行数:36,代码来源:openib.c
注:本文中的ibv_alloc_pd函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论