image image image image image

On This Page

Resource domain is a verb object that may be associated with QP and CQ objects upon creation to enhance data-path performance.

Resource Domain Attributes

Thread model - defines the threading module for the objects (QP/CQ) associated with this resource domain.


Access to the associated objects are thread safe. Such objects may be accessed by any thread without concern for thread safety issues.


Access to the associated objects are not thread safe. Access to such objects must be coordinated by the calling threads.


Access to the associated objects are from only one thread over the lifetime of the object. In addition, different objects associated with the same resource domain must be called by the same thread.

Message model - defines whether associated objects connection is optimized for low latency or high bandwidth.


Forces the provider to optimize for low latency


Suggests the provider to optimize for low latency.


Suggests the provider to optimize for high bandwidth.


Uses the provider's default message model.

To create a resource domain, use: 

static inline struct ibv_exp_res_domain *ibv_exp_create_res_domain( 
struct ibv_context *context, struct ibv_exp_res_domain_init_attr *attr)

destroy a resource domain, use: 

static inline int ibv_exp_destroy_res_domain( struct ibv_context *context, 
struct ibv_exp_res_domain *res_dom, struct ibv_exp_destroy_res_domain_attr *attr)

Use the res_domain field and relevant comp_mask in the ibv_exp_cq_init_attr and ibv_exp_qp_init_attr structs to pass resource domain to the CQ and QP upon their creation.

Example - creating a CQ and QP that may be called from one thread only: 

struct ibv_exp_res_domain_init_attr res_domain_attr;
struct ibv_exp_res_domain *res_domain;
struct ibv_exp_cq_init_attr cq_attr;
struct ibv_exp_qp_init_attr qp_attr;

res_domain_attr.comp_mask = IBV_EXP_RES_DOMAIN_THREAD_MODEL |
res_domain_attr.thread_model = IBV_EXP_THREAD_SINGLE;
res_domain_attr.msg_model = IBV_EXP_MSG_HIGH_BW;

res_domain = ibv_exp_create_res_domain(ctx->context, &res_domain_attr);
if (!_domain) {
     fprintf(stderr, "Can't create resource domain\n");
cq_attr.res_domain = res_domain;
cq_attr.comp_mask |= IBV_EXP_CQ_INIT_ATTR_RES_DOMAIN;
cq = ibv_exp_create_cq(context, num_ entries, NULL, NULL, 0, &cq_attr);
qp_attr.res_domain = res_domain;
qp_attr.comp_mask |= IBV_EXP_QP_INIT_ATTR_RES_DOMAIN;
qp = ibv_exp_create_qp(context, &qp_attr);