idxd: update low level lib and poller to indicate busy/idle

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I0acb74bd679e924977fb058a29ee947734e7aa83
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6287
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
paul luse 2021-02-05 10:32:39 -05:00 committed by Tomasz Zawadzki
parent 78ce3152b5
commit 9a70b6375d
3 changed files with 19 additions and 16 deletions

View File

@ -391,8 +391,9 @@ int spdk_idxd_submit_crc32c(struct spdk_idxd_io_channel *chan, uint32_t *dst, vo
* Check for completed requests on an IDXD channel.
*
* \param chan IDXD channel to check for completions.
* \return number of operations completed.
*/
void spdk_idxd_process_events(struct spdk_idxd_io_channel *chan);
int spdk_idxd_process_events(struct spdk_idxd_io_channel *chan);
/**
* Returns an IDXD channel for a given IDXD device.

View File

@ -1391,17 +1391,19 @@ _dump_error_reg(struct spdk_idxd_io_channel *chan)
#define IDXD_COMPLETION(x) ((x) > (0) ? (1) : (0))
#define IDXD_FAILURE(x) ((x) > (1) ? (1) : (0))
#define IDXD_SW_ERROR(x) ((x) &= (0x1) ? (1) : (0))
void
int
spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
{
struct idxd_comp *comp_ctx, *tmp;
uint64_t sw_error_0;
int status = 0;
int rc = 0;
TAILQ_FOREACH_SAFE(comp_ctx, &chan->comp_ctx_oustanding, link, tmp) {
if (IDXD_COMPLETION(comp_ctx->hw.status)) {
TAILQ_REMOVE(&chan->comp_ctx_oustanding, comp_ctx, link);
rc++;
if (spdk_unlikely(IDXD_FAILURE(comp_ctx->hw.status))) {
sw_error_0 = _idxd_read_8(chan->idxd, IDXD_SWERR_OFFSET);
@ -1445,6 +1447,7 @@ spdk_idxd_process_events(struct spdk_idxd_io_channel *chan)
}
}
}
return rc;
}
SPDK_LOG_REGISTER_COMPONENT(idxd)

View File

@ -194,24 +194,23 @@ idxd_poll(void *arg)
{
struct idxd_io_channel *chan = arg;
struct spdk_accel_task *task = NULL;
int count;
spdk_idxd_process_events(chan->chan);
count = spdk_idxd_process_events(chan->chan);
/* Check if there are any pending ops to process if the channel is active */
if (chan->state != IDXD_CHANNEL_ACTIVE) {
return -1;
if (chan->state == IDXD_CHANNEL_ACTIVE) {
/* Submit queued tasks */
if (!TAILQ_EMPTY(&chan->queued_tasks)) {
task = TAILQ_FIRST(&chan->queued_tasks);
TAILQ_INIT(&chan->queued_tasks);
idxd_submit_tasks(task->accel_ch->engine_ch, task);
}
}
/* Submit queued tasks */
if (!TAILQ_EMPTY(&chan->queued_tasks)) {
task = TAILQ_FIRST(&chan->queued_tasks);
TAILQ_INIT(&chan->queued_tasks);
idxd_submit_tasks(task->accel_ch->engine_ch, task);
}
return -1;
return count > 0 ? SPDK_POLLER_BUSY : SPDK_POLLER_IDLE;
}
static size_t
@ -323,7 +322,7 @@ idxd_create_cb(void *io_device, void *ctx_buf)
}
chan->dev = dev;
chan->poller = spdk_poller_register(idxd_poll, chan, 0);
chan->poller = SPDK_POLLER_REGISTER(idxd_poll, chan, 0);
TAILQ_INIT(&chan->queued_tasks);
/*