Ejemplo n.º 1
0
/*
 * ssize_t fi_send(struct fid_ep *ep, void *buf, size_t len,
 *		void *desc, fi_addr_t dest_addr, void *context);
 *
 * ssize_t fi_recv(struct fid_ep *ep, void * buf, size_t len,
 *		void *desc, fi_addr_t src_addr, void *context);
 */
void api_send_recv(int len)
{
	ssize_t sz;
	uint64_t caps = fi[0]->caps;

	rdm_api_init_data(source, len, 0xab);
	rdm_api_init_data(target, len, 0);

	sz = fi_send(ep[0], source, len, loc_mr[0], gni_addr[1], target);
	if (MSG_SEND_ALLOWED(caps)) {
		cr_assert(sz == 0, "fi_send failed caps:0x%lx err:%ld",
			  caps, sz);
	} else {
		cr_assert(sz < 0, "fi_send should fail caps:0x%lx err:%ld",
			  caps, sz);
	}

	sz = fi_recv(ep[1], target, len, rem_mr[1], gni_addr[0], source);
	if (MSG_RECV_ALLOWED(caps)) {
		cr_assert(sz == 0, "fi_recv failed caps:0x%lx err:%ld",
			  caps, sz);
	} else {
		cr_assert(sz < 0, "fi_recv should fail caps:0x%lx err:%ld",
			  caps, sz);
	}
}
Ejemplo n.º 2
0
void api_cntr_bind(uint64_t flags)
{
	int ret, i;

	for (i = 0; i < NUMEPS; i++) {
		if (RMA_WRITE_ALLOWED(flags)) {
			ret = fi_ep_bind(ep[i], &write_cntr[i]->fid, FI_WRITE);
			cr_assert(!ret, "fi_ep_bind");
		}

		if (RMA_READ_ALLOWED(flags)) {
			ret = fi_ep_bind(ep[i], &read_cntr[i]->fid, FI_READ);
			cr_assert(!ret, "fi_ep_bind");
		}

		if (MSG_SEND_ALLOWED(flags)) {
			ret = fi_ep_bind(ep[i], &send_cntr[i]->fid, FI_SEND);
			cr_assert(!ret, "fi_ep_bind");
		}

		if (MSG_RECV_ALLOWED(flags)) {
			ret = fi_ep_bind(ep[i], &recv_cntr[i]->fid, FI_RECV);
			cr_assert(!ret, "fi_ep_bind");
		}

		ret = fi_enable(ep[i]);
		cr_assert(!ret, "fi_enable");
	}
}
Ejemplo n.º 3
0
void api_cq_send_allowed(ssize_t sz, uint64_t flags, char *fn)
{
	if (MSG_SEND_ALLOWED(flags)) {
		cr_assert(sz == 0, "%s failed flags:0x%lx sz:%ld",
			  fn, flags, sz);
	} else {
		cr_assert(sz < 0, "%s should fail flags:0x%lx sz:%ld",
			  fn, flags, sz);
	}
}