[Accel-config] [PATCH v1 1/9] accel-config/test: add drain operation support for single submission

Tony Zhu <tony.zhu at intel.com> Fri, 11 Feb 2022 21:16:25 +0800
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
Drain submission is similiar as noop operation, so modify test_noop to
support drain operation. It is not necessary to test drain in batch,
single submission is enough.A Drain descriptor may not be included in
a batch. It is treated as an unsupported operation type. The batch
completion status is 0x5,the drain subtask completion status should be
0x10. In dsa_test for batch, drain is not a support operation.

Signed-off-by: Tony Zhu <tony.zhu(a)intel.com>
---
 test/dsa_test.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/test/dsa_test.c b/test/dsa_test.c
index eccf89c..8407bfc 100644
--- a/test/dsa_test.c
+++ b/test/dsa_test.c
@@ -136,7 +136,7 @@ static int test_batch(struct dsa_context *ctx, size_t buf_size,
 	return rc;
 }
 
-static int test_noop(struct dsa_context *ctx, int tflags, int num_desc)
+static int test_noop_drain(struct dsa_context *ctx, int tflags, uint32_t opcode, int num_desc)
 {
 	struct task_node *tsk_node;
 	int rc = DSA_STATUS_OK;
@@ -161,7 +161,7 @@ static int test_noop(struct dsa_context *ctx, int tflags, int num_desc)
 		/* allocate memory to src and dest buffers and fill in the desc for all the nodes*/
 		tsk_node = ctx->multi_task_node;
 		while (tsk_node) {
-			tsk_node->tsk->opcode = DSA_OPCODE_NOOP;
+			tsk_node->tsk->opcode = opcode;
 			tsk_node->tsk->test_flags = tflags;
 			tsk_node = tsk_node->next;
 		}
@@ -404,7 +404,8 @@ int main(int argc, char *argv[])
 
 	switch (opcode) {
 	case DSA_OPCODE_NOOP:
-		rc = test_noop(dsa, tflags, num_desc);
+	case DSA_OPCODE_DRAIN:
+		rc = test_noop_drain(dsa, tflags, opcode,  num_desc);
 		if (rc != DSA_STATUS_OK)
 			goto error;
 		break;
-- 
2.27.0