Commit 0765bba9 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

ioat: add return code to ioat_process_events()



This lets us signal an error if the channel is halted in
ioat_process_channel_events().

Change-Id: Iffaf4fd1e27d1254f9d95a37d732ae4a5f3a0465
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 4662e22a
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -90,12 +90,14 @@ void ioat_unregister_thread(void);
int64_t ioat_submit_copy(void *cb_arg, ioat_callback_t cb_fn,
			 void *dst, const void *src, uint64_t nbytes);

/*
/**
 * Check for completed requests on the current thread.
 *
 * Before submitting any requests on a thread, the thread must be registered
 * using the \ref ioat_register_thread() function.
 *
 * \returns 0 on success or negative if something went wrong.
 */
void ioat_process_events(void);
int ioat_process_events(void);

#endif
+8 −8
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ static int ioat_reset_hw(struct ioat_channel *ioat)
	return 0;
}

static void
static int
ioat_process_channel_events(struct ioat_channel *ioat)
{
	struct ioat_descriptor *desc;
@@ -347,7 +347,7 @@ ioat_process_channel_events(struct ioat_channel *ioat)
	uint32_t tail;

	if (ioat->head == ioat->tail) {
		return;
		return 0;
	}

	status = *ioat->comp_update;
@@ -355,12 +355,11 @@ ioat_process_channel_events(struct ioat_channel *ioat)

	if (is_ioat_halted(status)) {
		ioat_printf(ioat, "%s: Channel halted (%x)\n", __func__, ioat->regs->chanerr);
		/* TODO: report error */
		return;
		return -1;
	}

	if (completed_descriptor == ioat->last_seen) {
		return;
		return 0;
	}

	do {
@@ -376,6 +375,7 @@ ioat_process_channel_events(struct ioat_channel *ioat)
	} while (hw_desc_phys_addr != completed_descriptor);

	ioat->last_seen = hw_desc_phys_addr;
	return 0;
}

static int
@@ -663,11 +663,11 @@ ioat_submit_copy(void *cb_arg, ioat_callback_t cb_fn,
	return nbytes;
}

void ioat_process_events(void)
int ioat_process_events(void)
{
	if (!ioat_thread_channel) {
		return;
		return -1;
	}

	ioat_process_channel_events(ioat_thread_channel);
	return ioat_process_channel_events(ioat_thread_channel);
}