From 0ae7f4d816b66b257046c3af5d972fb8bb092845 Mon Sep 17 00:00:00 2001 From: paul luse Date: Thu, 27 Jan 2022 13:26:30 -0700 Subject: [PATCH] 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 Change-Id: I6d1bb416dc84aa1f76407c76aedf0768dd003218 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11325 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/idxd/idxd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/idxd/idxd.c b/lib/idxd/idxd.c index 53e8b127a..2cdff9777 100644 --- a/lib/idxd/idxd.c +++ b/lib/idxd/idxd.c @@ -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_ops *op; + uint64_t comp_addr; if (_is_batch_valid(batch, chan) == false) { 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++; + 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; op->cb_arg = cb_arg; op->cb_fn = cb_fn;