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: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2015-12-17 10:56:00 -07:00
parent 4662e22a99
commit 0765bba91f
2 changed files with 12 additions and 10 deletions

View File

@ -90,12 +90,14 @@ void ioat_unregister_thread(void);
int64_t ioat_submit_copy(void *cb_arg, ioat_callback_t cb_fn, int64_t ioat_submit_copy(void *cb_arg, ioat_callback_t cb_fn,
void *dst, const void *src, uint64_t nbytes); void *dst, const void *src, uint64_t nbytes);
/* /**
* Check for completed requests on the current thread. * Check for completed requests on the current thread.
* *
* Before submitting any requests on a thread, the thread must be registered * Before submitting any requests on a thread, the thread must be registered
* using the \ref ioat_register_thread() function. * 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 #endif

View File

@ -339,7 +339,7 @@ static int ioat_reset_hw(struct ioat_channel *ioat)
return 0; return 0;
} }
static void static int
ioat_process_channel_events(struct ioat_channel *ioat) ioat_process_channel_events(struct ioat_channel *ioat)
{ {
struct ioat_descriptor *desc; struct ioat_descriptor *desc;
@ -347,7 +347,7 @@ ioat_process_channel_events(struct ioat_channel *ioat)
uint32_t tail; uint32_t tail;
if (ioat->head == ioat->tail) { if (ioat->head == ioat->tail) {
return; return 0;
} }
status = *ioat->comp_update; status = *ioat->comp_update;
@ -355,12 +355,11 @@ ioat_process_channel_events(struct ioat_channel *ioat)
if (is_ioat_halted(status)) { if (is_ioat_halted(status)) {
ioat_printf(ioat, "%s: Channel halted (%x)\n", __func__, ioat->regs->chanerr); ioat_printf(ioat, "%s: Channel halted (%x)\n", __func__, ioat->regs->chanerr);
/* TODO: report error */ return -1;
return;
} }
if (completed_descriptor == ioat->last_seen) { if (completed_descriptor == ioat->last_seen) {
return; return 0;
} }
do { do {
@ -376,6 +375,7 @@ ioat_process_channel_events(struct ioat_channel *ioat)
} while (hw_desc_phys_addr != completed_descriptor); } while (hw_desc_phys_addr != completed_descriptor);
ioat->last_seen = hw_desc_phys_addr; ioat->last_seen = hw_desc_phys_addr;
return 0;
} }
static int static int
@ -663,11 +663,11 @@ ioat_submit_copy(void *cb_arg, ioat_callback_t cb_fn,
return nbytes; return nbytes;
} }
void ioat_process_events(void) int ioat_process_events(void)
{ {
if (!ioat_thread_channel) { if (!ioat_thread_channel) {
return; return -1;
} }
ioat_process_channel_events(ioat_thread_channel); return ioat_process_channel_events(ioat_thread_channel);
} }