From 85580d47e18b0ff02dd7ba51876495bb7bfe899a Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Mon, 7 Feb 2022 11:21:00 -0700 Subject: [PATCH] idxd: Remove _idxd_batch_is_valid The only place a batch can be created is by assigning it to the channel now, so this isn't a mistake that can be made and the checks can all be removed. Signed-off-by: Ben Walker Change-Id: I915edb4f212c0751396554655ffe95ae3bb20cd6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11538 Community-CI: Mellanox Build Bot Community-CI: Broadcom CI Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Reviewed-by: Paul Luse Tested-by: SPDK CI Jenkins --- lib/idxd/idxd.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/lib/idxd/idxd.c b/lib/idxd/idxd.c index 459849824..46376ed4a 100644 --- a/lib/idxd/idxd.c +++ b/lib/idxd/idxd.c @@ -343,12 +343,6 @@ _idxd_prep_command(struct spdk_idxd_io_channel *chan, spdk_idxd_req_cb cb_fn, vo return 0; } -static bool -_is_batch_valid(struct idxd_batch *batch, struct spdk_idxd_io_channel *chan) -{ - return batch->chan == chan; -} - static int _idxd_prep_batch_cmd(struct spdk_idxd_io_channel *chan, spdk_idxd_req_cb cb_fn, void *cb_arg, int flags, @@ -360,14 +354,8 @@ _idxd_prep_batch_cmd(struct spdk_idxd_io_channel *chan, spdk_idxd_req_cb cb_fn, struct idxd_batch *batch; batch = chan->batch; + assert(batch != NULL); - - if (_is_batch_valid(batch, chan) == false) { - SPDK_ERRLOG("Attempt to add to an invalid batch.\n"); - return -EINVAL; - } - - assert(batch != NULL); /* suppress scan-build warning. */ if (batch->index == DESC_PER_BATCH) { return -EBUSY; } @@ -436,11 +424,6 @@ idxd_batch_cancel(struct spdk_idxd_io_channel *chan, int status) batch = chan->batch; assert(batch != NULL); - if (_is_batch_valid(batch, chan) == false) { - SPDK_ERRLOG("Attempt to cancel an invalid batch.\n"); - return -EINVAL; - } - if (batch->index == UINT8_MAX) { SPDK_ERRLOG("Cannot cancel batch, already submitted to HW.\n"); return -EINVAL; @@ -474,11 +457,6 @@ idxd_batch_submit(struct spdk_idxd_io_channel *chan, batch = chan->batch; assert(batch != NULL); - if (_is_batch_valid(batch, chan) == false) { - SPDK_ERRLOG("Attempt to submit an invalid batch.\n"); - return -EINVAL; - } - if (batch->index == 0) { return idxd_batch_cancel(chan, 0); }