Esempio n. 1
0
int
usdf_cq_create_cq(struct usdf_cq *cq)
{
	struct usd_cq_init_attr attr;

	memset(&attr, 0, sizeof(attr));
	attr.num_entries = cq->cq_attr.size,
	attr.comp_fd = -1;
	return usd_create_cq(cq->cq_domain->dom_dev, &attr, &cq->c.hard.cq_cq);
}
Esempio n. 2
0
int
usdf_cq_open(struct fid_domain *domain, struct fi_cq_attr *attr,
	    struct fid_cq **cq_o, void *context)
{
	struct usdf_cq *cq;
	int ret;

	if (attr->wait_obj != FI_WAIT_NONE) {
		return -FI_ENOSYS;
	}

	cq = calloc(1, sizeof(*cq));
	if (cq == NULL) {
		return -FI_ENOMEM;
	}

	cq->cq_domain = container_of(domain, struct usdf_domain, dom_fid);

	ret = usd_create_cq(cq->cq_domain->dom_dev, attr->size, USD_CQ_NO_GROUP,
				-1, &cq->cq_cq);
	if (ret != 0) {
		goto fail;
	}

	cq->cq_fid.fid.fclass = FI_CLASS_CQ;
	cq->cq_fid.fid.context = context;
	cq->cq_fid.fid.ops = &usdf_cq_fi_ops;

	switch (attr->format) {
	case FI_CQ_FORMAT_CONTEXT:
		cq->cq_fid.ops = &usdf_cq_context_ops;
		break;
	case FI_CQ_FORMAT_MSG:
		cq->cq_fid.ops = &usdf_cq_msg_ops;
		break;
	case FI_CQ_FORMAT_DATA:
		cq->cq_fid.ops = &usdf_cq_data_ops;
		break;
	default:
		ret = -FI_ENOSYS;
		goto fail;
	}

	*cq_o = &cq->cq_fid;
	return 0;

fail:
	if (cq != NULL) {
		if (cq->cq_cq != NULL) {
			usd_destroy_cq(cq->cq_cq);
		}
		free(cq);
	}
	return ret;
}
Esempio n. 3
0
File: usdf_cq.c Progetto: ORNL/ompi
int
usdf_cq_create_cq(struct usdf_cq *cq)
{
	return usd_create_cq(cq->cq_domain->dom_dev, cq->cq_attr.size, -1,
			&cq->c.hard.cq_cq);
}