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 <benjamin.walker@intel.com> Change-Id: I915edb4f212c0751396554655ffe95ae3bb20cd6 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11538 Community-CI: Mellanox Build Bot Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
b2bdbbac56
commit
85580d47e1
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user