From 0765bba91f86709bce52656f4936578105802578 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 17 Dec 2015 10:56:00 -0700 Subject: [PATCH] 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 --- include/spdk/ioat.h | 6 ++++-- lib/ioat/ioat.c | 16 ++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/spdk/ioat.h b/include/spdk/ioat.h index a40dfb62e..b3c8a334e 100644 --- a/include/spdk/ioat.h +++ b/include/spdk/ioat.h @@ -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 diff --git a/lib/ioat/ioat.c b/lib/ioat/ioat.c index d00e2b604..e5d028876 100644 --- a/lib/ioat/ioat.c +++ b/lib/ioat/ioat.c @@ -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); }