idxd: zero out batch element descriptors before each use

Although there are no use cases right now where a batch can have
mixed op types, there may be in the future and rather than have
one blow up because ops have different reserved fields and its
not valid to submit an op with a non-zero reserved field, go
ahead and zero these out like we do with descriptors in the non
batch case.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Change-Id: I6d1bb416dc84aa1f76407c76aedf0768dd003218
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11325
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
paul luse 2022-01-27 13:26:30 -07:00 committed by Jim Harris
parent 7aa1650d28
commit 0ae7f4d816

View File

@ -394,6 +394,7 @@ _idxd_prep_batch_cmd(struct spdk_idxd_io_channel *chan, spdk_idxd_req_cb cb_fn,
{ {
struct idxd_hw_desc *desc; struct idxd_hw_desc *desc;
struct idxd_ops *op; struct idxd_ops *op;
uint64_t comp_addr;
if (_is_batch_valid(batch, chan) == false) { if (_is_batch_valid(batch, chan) == false) {
SPDK_ERRLOG("Attempt to add to an invalid batch.\n"); SPDK_ERRLOG("Attempt to add to an invalid batch.\n");
@ -413,6 +414,10 @@ _idxd_prep_batch_cmd(struct spdk_idxd_io_channel *chan, spdk_idxd_req_cb cb_fn,
batch->index++; batch->index++;
comp_addr = desc->completion_addr;
memset(desc, 0, sizeof(*desc));
desc->completion_addr = comp_addr;
desc->flags = IDXD_FLAG_COMPLETION_ADDR_VALID | IDXD_FLAG_REQUEST_COMPLETION; desc->flags = IDXD_FLAG_COMPLETION_ADDR_VALID | IDXD_FLAG_REQUEST_COMPLETION;
op->cb_arg = cb_arg; op->cb_arg = cb_arg;
op->cb_fn = cb_fn; op->cb_fn = cb_fn;