Пример #1
0
/*
 * rpmem_fip_signal_all -- (internal) signal all lanes about completion with
 * error code
 */
static void
rpmem_fip_signal_all(struct rpmem_fip *fip, int ret)
{
	switch (fip->persist_method) {
	case RPMEM_PM_APM:
		for (unsigned i = 0; i < fip->nlanes; i++)
			rpmem_fip_lane_sigret(&fip->lanes.apm[i].lane,
					FI_WRITE | FI_READ, ret);
		break;
	case RPMEM_PM_GPSPM:
		for (unsigned i = 0; i < fip->nlanes; i++)
			rpmem_fip_lane_sigret(&fip->lanes.gpspm[i].lane,
					FI_WRITE | FI_SEND | FI_RECV, ret);
		break;
	default:
		RPMEM_ASSERT(0);
	}

	rpmem_fip_lane_sigret(&fip->rd_lane.lane, FI_READ, ret);
}
Пример #2
0
/*
 * rpmem_fip_process_gpspm -- (internal) process completion queue entry for
 * GPSPM
 */
static int
rpmem_fip_process_gpspm(struct rpmem_fip *fip, void *context, uint64_t flags)
{
	if (flags & FI_RECV) {
		/* RECV completion */
		struct rpmem_fip_msg *resp = context;
		struct rpmem_msg_persist_resp *msg_resp =
			rpmem_fip_msg_get_pres(resp);
		VALGRIND_DO_MAKE_MEM_DEFINED(msg_resp, sizeof(*msg_resp));

		if (unlikely(msg_resp->lane >= fip->nlanes)) {
			RPMEM_LOG(ERR, "lane number received (%lu) is greater "
					"than maximum lane number (%u)",
					msg_resp->lane, fip->nlanes - 1);
			return -1;
		}

		struct rpmem_fip_lane *lanep =
			&fip->lanes.gpspm[msg_resp->lane].lane;

		/* post RECV buffer immediately */
		int ret = rpmem_fip_gpspm_post_resp(fip, resp);
		if (unlikely(ret))
			RPMEM_FI_ERR((int)ret, "MSG send");

		rpmem_fip_lane_sigret(lanep, flags, ret);

		return ret;
	}

	struct rpmem_fip_lane *lanep = context;

	/* SEND completion */
	rpmem_fip_lane_signal(lanep, flags);

	return 0;
}