Add Zcompress16 and Zdecompress16 to IAA test
Li Zhang
cover Add Zcompress16 and Zdecompress16 to IAA test
Add software algorithms of Zcompress16 and Zdecompress16, add operation Zcompress16 and Zdecompress16 test code, modify Makefile, test script and configuration file.
Li Zhang (11):
accel-config/test: Move macro ADDR_ALIGNMENT to common file accel-config/test: Modify max_transfer_size in config file accel-config/test: Add algorithm to generate random data for
Zcompress16
accel-config/test: Add algorithm to do Zcompress16 accel-config/test: Add element output to struct task accel-config/test: Add test code of operation Zcompress16 accel-config/test: Modify script for executing Zcompress16 test accel-config/test: Add algorithm to do Zdecompress16 accel-config/test: Add element input to struct task accel-config/test: Add test code of operation Zdecompress16 accel-config/test: Modify script for executing Zdecompress16 test
test/Makefile.am | 2 +- test/accel_test.c | 2 + test/accel_test.h | 3 + test/algorithms/iaa_zcompress.c | 121 +++++++++++++++ test/algorithms/iaa_zcompress.h | 12 ++ test/configs/2g2q_user_2.conf | 4 +- test/dsa.h | 2 - test/iaa.c | 252 +++++++++++++++++++++++++++++++- test/iaa.h | 6 + test/iaa_prep.c | 24 ++- test/iaa_test.c | 79 ++++++++++ test/iaa_user_test_runner.sh | 14 ++ 12 files changed, 513 insertions(+), 8 deletions(-) create mode 100644 test/algorithms/iaa_zcompress.c create mode 100644 test/algorithms/iaa_zcompress.h
Signature · 1 line
2.25.1
Li Zhang
PATCH 1/11 accel-config/test: Move macro ADDR_ALIGNMENT to common file
Move macro ADDR_ALIGNMENT from dsa.h to accel_test.h for aligned memory allocation.
--- test/accel_test.h | 1 + test/dsa.h | 2 -- test/iaa.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-)
test/accel_test.h +1 -0
@@ -9,6 +9,7 @@#define SHARED 1#define DEDICATED 0 +#define ADDR_ALIGNMENT 32#define MAX_PATH_LENGTH 1024#define ACCTEST_DEVICE_ID_NO_INPUT -1
test/dsa.h +0 -2
@@ -33,8 +33,6 @@#define DIF_INVERT_CRC_SEED ((unsigned long)(1 << 2))#define DIF_INVERT_CRC_RESULT ((unsigned long)(1 << 3)) -#define ADDR_ALIGNMENT 32 -#define MIN_DELTA_RECORD_SIZE 80/* dump all sub descriptors for a batch task */
test/iaa.c +1 -1
@@ -25,7 +25,7 @@ static int init_crc64(struct task *tsk, int tflags, int opcode, unsigned long sr tsk->test_flags = tflags; tsk->xfer_size = src1_xfer_size; - tsk->src1 =malloc (src1_xfer_size); + tsk->src1 =aligned_alloc (ADDR_ALIGNMENT , src1_xfer_size);if (!tsk->src1)return -ENOMEM ;memset_pattern (tsk->src1, tsk->pattern, src1_xfer_size);
Signature · 1 line
2.25.1
Li Zhang
PATCH 2/11 accel-config/test: Modify max_transfer_size in config file
In reply to Li ZhangIn config file, modify max_transfer_size from 2097152 to 4194304, because when the input data of Zcompress doesn't has any 0 field and the input size is close to 2097152, it may cause destination size overflow.
--- test/configs/2g2q_user_2.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
test/configs/2g2q_user_2.conf +2 -2
@@ -19,7 +19,7 @@ "group_id":1, "priority":10, "block_on_fault":0, - "max_transfer_size":2097152, + "max_transfer_size":4194304, "type":"user", "name":"wq1.1", "driver_name":"user",
@@ -46,7 +46,7 @@ "group_id":2, "priority":10, "block_on_fault":0, - "max_transfer_size":2097152, + "max_transfer_size":4194304, "type":"user", "name":"wq1.4", "driver_name":"user",
Signature · 1 line
2.25.1
Li Zhang
PATCH 3/11 accel-config/test: Add algorithm to generate random data for Zcompress16
In reply to Li ZhangAdd new file iaa_zcompress.c and iaa_zcompress.h with an algorithm to generate random input data for operation Zcompress16, add new files into Makefile for compiling.
--- test/Makefile.am | 2 +- test/algorithms/iaa_zcompress.c | 37 +++++++++++++++++++++++++++++++++ test/algorithms/iaa_zcompress.h | 10 +++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 test/algorithms/iaa_zcompress.c create mode 100644 test/algorithms/iaa_zcompress.h
test/Makefile.am +1 -1
@@ -38,5 +38,5 @@ libaccfg_LDADD = $(LIBACCFG_LIB) $(UUID_LIBS) dsa_test_SOURCES = dsa_test.c dsa.c dsa_prep.c accel_test.c dsa_test_LDADD = $(LIBACCFG_LIB) $(UUID_LIBS) -iaa_test_SOURCES = iaa_test.c iaa.c iaa_prep.c accel_test.c algorithms/iaa_crc64.c algorithms/iaa_crc64.h +iaa_test_SOURCES = iaa_test.c iaa.c iaa_prep.c accel_test.c algorithms/iaa_crc64.c algorithms/iaa_zcompress.c iaa_test_LDADD = $(LIBACCFG_LIB) $(UUID_LIBS)
test/algorithms/iaa_zcompress.c new file +37 -0
@@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright(c) 2019 Intel Corporation. All rights reserved. */ +#include <stdio.h> +#include <stdint.h> +#include <stdlib.h> +#include <time.h> +#include "algorithms/iaa_zcompress.h" + +static int iaa_zcompress_get_random_value (void ) +{ +static int extra_seed; + +srand (time (NULL ) + (extra_seed++)); +return rand (); +} + +static uint16_t iaa_zcompress16_get_word_pattern (uint64_t pattern) +{ +uint16_t word_pattern =0 ; +int position = (iaa_zcompress_get_random_value () %4 ); + + word_pattern = (uint16_t )((pattern & (0xFFFF << (16 * position))) >> (16 * position)); +return word_pattern; +} + +void iaa_zcompress16_randomize_input (void *dst,uint64_t pattern,int len) +{ +int i; +int num_words = len /2 ; + +for (i =0 ; i < num_words; i++) { +if (iaa_zcompress_get_random_value () %2 ) + ((uint16_t *)dst)[i] =iaa_zcompress16_get_word_pattern (pattern); +else + ((uint16_t *)dst)[i] =0 ; + } +}
test/algorithms/iaa_zcompress.h new file +10 -0
@@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright(c) 2019 Intel Corporation. All rights reserved. */ +#ifndef _IAA_ZCOMPRESS_H_ +#define _IAA_ZCOMPRESS_H_ + +#include <stdint.h> + +void iaa_zcompress16_randomize_input (void *dst,uint64_t pattern,int len); + +#endif
Signature · 1 line
2.25.1
Li Zhang
PATCH 4/11 accel-config/test: Add algorithm to do Zcompress16
In reply to Li ZhangAdd an algorithm to implement Zcompress16, it is used to generate a reference data for comparing with the result from IAA hardware.
--- test/algorithms/iaa_zcompress.c | 50 +++++++++++++++++++++++++++++++++ test/algorithms/iaa_zcompress.h | 1 + 2 files changed, 51 insertions(+)
test/algorithms/iaa_zcompress.c +50 -0
@@ -6,6 +6,8 @@#include <time.h> #include "algorithms/iaa_zcompress.h" +#define IAA_ZCOMPRESS_BLOCK_SIZE (128) +static int iaa_zcompress_get_random_value (void ) {static int extra_seed;
@@ -35,3 +37,51 @@ void iaa_zcompress16_randomize_input(void *dst, uint64_t pattern, int len) ((uint16_t *)dst)[i] =0 ; } } + +int iaa_do_zcompress16 (void *dst,void *src,int src_len) +{ +int i, j, dst_len =0 ; +uint16_t *tags; +int num_blocks = src_len /IAA_ZCOMPRESS_BLOCK_SIZE ; +int remainder_bytes = src_len %IAA_ZCOMPRESS_BLOCK_SIZE ; +uint16_t *src_ptr = (uint16_t *)src; +uint16_t *dst_ptr = (uint16_t *)dst; + +for (i =0 ; i < num_blocks; i++) { + tags = dst_ptr; + dst_ptr +=4 ; + dst_len +=8 ; +for (j =0 ; j < (IAA_ZCOMPRESS_BLOCK_SIZE /2 ); j++) { +if (*src_ptr !=0 ) { + tags[j /16 ] |= ((uint16_t )1 << (j %16 )); + *dst_ptr++ = *src_ptr; + dst_len +=2 ; + } + + src_ptr++; + } + } + +if (remainder_bytes) { + tags = dst_ptr; + tags[0 ] =0xFFFF ; + tags[1 ] =0xFFFF ; + tags[2 ] =0xFFFF ; + tags[3 ] =0xFFFF ; + dst_ptr +=4 ; + dst_len +=8 ; + +for (i =0 ; i < (remainder_bytes /2 ); i++) { +if (*src_ptr ==0 ) { + tags[i /16 ] &= ~((uint16_t )1 << (i %16 )); + }else { + *dst_ptr++ = *src_ptr; + dst_len +=2 ; + } + + src_ptr++; + } + } + +return dst_len; +}
test/algorithms/iaa_zcompress.h +1 -0
@@ -6,5 +6,6 @@#include <stdint.h> void iaa_zcompress16_randomize_input (void *dst,uint64_t pattern,int len); +int iaa_do_zcompress16 (void *dst,void *src,int src_len);#endif
Signature · 1 line
2.25.1
Li Zhang
PATCH 5/11 accel-config/test: Add element output to struct task
In reply to Li ZhangAdd a new pointer output to struct task for Zcompress16, and free the memory area pointed by output.
--- test/accel_test.c | 1 + test/accel_test.h | 1 + 2 files changed, 2 insertions(+)
test/accel_test.c +1 -0
@@ -464,6 +464,7 @@ void __clean_task(struct task *tsk)free (tsk->src2);free (tsk->dst1);free (tsk->dst2); +free (tsk->output); }void free_batch_task (struct batch_task *btsk)
test/accel_test.h +1 -0
@@ -53,6 +53,7 @@ struct task {void *dst1;void *dst2;void *delta1; +void *output;uint64_t pattern;uint64_t pattern2;uint64_t xfer_size;
Signature · 1 line
2.25.1
Li Zhang
PATCH 6/11 accel-config/test: Add test code of operation Zcompress16
In reply to Li ZhangAdd test code of operation Zcompress16
--- test/iaa.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++ test/iaa.h | 3 ++ test/iaa_prep.c | 13 ++++- test/iaa_test.c | 63 +++++++++++++++++++++++++ 4 files changed, 201 insertions(+), 1 deletion(-)
test/iaa.c +123 -0
@@ -17,6 +17,7 @@#include "accel_test.h" #include "iaa.h" #include "algorithms/iaa_crc64.h" +#include "algorithms/iaa_zcompress.h" static int init_crc64 (struct task *tsk,int tflags,int opcode,unsigned long src1_xfer_size) {
@@ -34,6 +35,33 @@ static int init_crc64(struct task *tsk, int tflags, int opcode, unsigned long srreturn ACCTEST_STATUS_OK ; } +static int init_zcompress16 (struct task *tsk,int tflags,int opcode,unsigned long src1_xfer_size) +{ + tsk->pattern =0x98765432abcdef01 ; + tsk->opcode = opcode; + tsk->test_flags = tflags; + tsk->xfer_size = src1_xfer_size; + + tsk->src1 =aligned_alloc (ADDR_ALIGNMENT , src1_xfer_size); +if (!tsk->src1) +return -ENOMEM ; +iaa_zcompress16_randomize_input (tsk->src1, tsk->pattern, src1_xfer_size); + + tsk->dst1 =aligned_alloc (ADDR_ALIGNMENT , src1_xfer_size *2 ); +if (!tsk->dst1) +return -ENOMEM ; +memset_pattern (tsk->dst1,0 , src1_xfer_size *2 ); + + tsk->output =aligned_alloc (ADDR_ALIGNMENT , src1_xfer_size *2 ); +if (!tsk->output) +return -ENOMEM ; +memset_pattern (tsk->output,0 , src1_xfer_size *2 ); + + tsk->iaa_max_dst_size = src1_xfer_size *2 ; + +return ACCTEST_STATUS_OK ; +} +/* this function is re-used by batch task */ int init_task (struct task *tsk,int tflags,int opcode,unsigned long src1_xfer_size) {
@@ -46,6 +74,9 @@ int init_task(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_case IAX_OPCODE_CRC64 :/* intentionally empty */ rc =init_crc64 (tsk, tflags, opcode, src1_xfer_size);break ; +case IAX_OPCODE_ZCOMPRESS16 : + rc =init_zcompress16 (tsk, tflags, opcode, src1_xfer_size); +break ; }if (rc !=ACCTEST_STATUS_OK ) {
@@ -150,6 +181,53 @@ int iaa_crc64_multi_task_nodes(struct acctest_context *ctx)return ret; } +static int iaa_wait_zcompress16 (struct acctest_context *ctx,struct task *tsk) +{ +struct completion_record *comp = tsk->comp; +int rc; + + rc =acctest_wait_on_desc_timeout (comp, ctx, ms_timeout); +if (rc <0 ) { +err ("zcompress16 desc timeout\n" ); +return ACCTEST_STATUS_TIMEOUT ; + } + +return ACCTEST_STATUS_OK ; +} + +int iaa_zcompress16_multi_task_nodes (struct acctest_context *ctx) +{ +struct task_node *tsk_node = ctx->multi_task_node; +int ret =ACCTEST_STATUS_OK ; + +while (tsk_node) { + tsk_node->tsk->dflags |= (IDXD_OP_FLAG_CRAV |IDXD_OP_FLAG_RCR ); +if ((tsk_node->tsk->test_flags &TEST_FLAGS_BOF ) && ctx->bof) + tsk_node->tsk->dflags |=IDXD_OP_FLAG_BOF ; + +iaa_prep_zcompress16 (tsk_node->tsk); + tsk_node = tsk_node->next; + } + +info ("Submitted all zcompress16 jobs\n" ); + tsk_node = ctx->multi_task_node; +while (tsk_node) { +acctest_desc_submit (ctx, tsk_node->tsk->desc); + tsk_node = tsk_node->next; + } + + tsk_node = ctx->multi_task_node; +while (tsk_node) { + ret =iaa_wait_zcompress16 (ctx, tsk_node->tsk); +if (ret !=ACCTEST_STATUS_OK ) +info ("Desc: %p failed with ret: %d\n" , + tsk_node->tsk->desc, tsk_node->tsk->comp->status); + tsk_node = tsk_node->next; + } + +return ret; +} +/* mismatch_expected: expect mismatched buffer with success status 0x1 */ int iaa_task_result_verify (struct task *tsk,int mismatch_expected) {
@@ -163,6 +241,10 @@ int iaa_task_result_verify(struct task *tsk, int mismatch_expected)switch (tsk->opcode) {case IAX_OPCODE_CRC64 : ret =task_result_verify_crc64 (tsk, mismatch_expected); +break ; +case IAX_OPCODE_ZCOMPRESS16 : + ret =task_result_verify_zcompress16 (tsk, mismatch_expected); +break ; }if (ret ==ACCTEST_STATUS_OK )
@@ -227,3 +309,44 @@ int task_result_verify_crc64(struct task *tsk, int mismatch_expected)return -ENXIO ; } + +int task_result_verify_zcompress16 (struct task *tsk,int mismatch_expected) +{ +int i; +int rc; +int expected_len; + +if (mismatch_expected) +warn ("invalid arg mismatch_expected for %d\n" , tsk->opcode); + + expected_len =iaa_do_zcompress16 (tsk->output, tsk->src1, tsk->xfer_size); + rc =memcmp (tsk->dst1, tsk->output, expected_len); + +if (!mismatch_expected) { +if (expected_len - tsk->comp->iax_output_size) { +err ("zcompress16 mismatch, exp len %d, act len %d\n" , + expected_len, tsk->comp->iax_output_size); + +return -ENXIO ; + } +if (rc) { +err ("zcompress16 mismatch, memcmp rc %d\n" , rc); +for (i =0 ; i < (expected_len /2 ); i++) { +printf ("Exp[%d]=0x%04X, Act[%d]=0x%4X\n" , + i, ((uint16_t *)tsk->output)[i], + i, ((uint16_t *)tsk->dst1)[i]); + } + +return -ENXIO ; + } +return ACCTEST_STATUS_OK ; + } + +/* mismatch_expected */ +if (rc) { +info ("expected mismatch\n" ); +return ACCTEST_STATUS_OK ; + } + +return -ENXIO ; +}
test/iaa.h +3 -0
@@ -11,11 +11,14 @@ int init_task(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_int iaa_noop_multi_task_nodes (struct acctest_context *ctx);int iaa_crc64_multi_task_nodes (struct acctest_context *ctx); +int iaa_zcompress16_multi_task_nodes (struct acctest_context *ctx);void iaa_prep_noop (struct task *tsk);void iaa_prep_crc64 (struct task *tsk); +void iaa_prep_zcompress16 (struct task *tsk);int iaa_task_result_verify (struct task *tsk,int mismatch_expected);int iaa_task_result_verify_task_nodes (struct acctest_context *ctx,int mismatch_expected);int task_result_verify_crc64 (struct task *tsk,int mismatch_expected); +int task_result_verify_zcompress16 (struct task *tsk,int mismatch_expected);#endif
test/iaa_prep.c +12 -1
@@ -22,7 +22,7 @@ void iaa_prep_noop(struct task *tsk)void iaa_prep_crc64 (struct task *tsk) { -info ("preparing descriptor for memcpy\n" ); +info ("preparing descriptor for crc64\n" );acctest_prep_desc_common (tsk->desc, tsk->opcode,0 , (uint64_t )(tsk->src1), tsk->xfer_size, tsk->dflags);
@@ -31,3 +31,14 @@ void iaa_prep_crc64(struct task *tsk) tsk->desc->iax_crc64_poly = tsk->iaa_crc64_poly; tsk->comp->status =0 ; } + +void iaa_prep_zcompress16 (struct task *tsk) +{ +info ("preparing descriptor for zcompress16\n" ); + +acctest_prep_desc_common (tsk->desc, tsk->opcode, (uint64_t )(tsk->dst1), + (uint64_t )(tsk->src1), tsk->xfer_size, tsk->dflags); + tsk->desc->completion_addr = (uint64_t )(tsk->comp); + tsk->desc->iax_max_dst_size = tsk->iaa_max_dst_size; + tsk->comp->status =0 ; +}
test/iaa_test.c +63 -0
75 lines not on this page · raw message
Signature · 1 line
2.25.1
Li Zhang
PATCH 7/11 accel-config/test: Modify script for executing Zcompress16 test
In reply to Li ZhangModify test script for passing parameters and executing operation Zcompress16 test.
--- test/iaa_user_test_runner.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
test/iaa_user_test_runner.sh +14 -0
@@ -113,6 +113,20 @@ for opcode in "0x44"; do test_op $opcode $flag $extra_flag done +unset SIZE_1 + +flag="0x1" +echo "Testing with 'block on fault' flag ON" +for opcode in "0x4d"; do + test_op $opcode $flag +done + +flag="0x0" +echo "Testing with 'block on fault' flag OFF" +for opcode in "0x4d"; do + test_op $opcode $flag +done + disable_wqs stop_iaa _cleanup
Signature · 1 line
2.25.1
Li Zhang
PATCH 8/11 accel-config/test: Add algorithm to do Zdecompress16
In reply to Li ZhangAdd an algorithm to implement Zdecompress16, it is used to generate a reference data for comparing with the result from IAA hardware.
--- test/algorithms/iaa_zcompress.c | 34 +++++++++++++++++++++++++++++++++ test/algorithms/iaa_zcompress.h | 1 + 2 files changed, 35 insertions(+)
test/algorithms/iaa_zcompress.c +34 -0
@@ -85,3 +85,37 @@ int iaa_do_zcompress16(void *dst, void *src, int src_len)return dst_len; } + +int iaa_do_zdecompress16 (void *dst,void *src,int src_len) +{ +int i, j, dst_len =0 ; +uint64_t tags; +int remainder_len = src_len; +uint16_t *src_ptr = (uint16_t *)src; +uint16_t *dst_ptr = (uint16_t *)dst; + +for (i =0 ; i < (src_len /2 ); i++) { + tags = (((uint64_t )src_ptr[3 ]) <<48 ) | (((uint64_t )src_ptr[2 ]) <<32 ) | + (((uint64_t )src_ptr[1 ]) <<16 ) | ((uint64_t )src_ptr[0 ]); + src_ptr +=4 ; + remainder_len -=8 ; + +for (j =0 ; j <64 ; j++) { +if (tags & ((uint64_t )1 << j)) { +if (remainder_len <=0 ) +break ; + *dst_ptr++ = *src_ptr++; + remainder_len -=2 ; + }else { + *dst_ptr++ =0 ; + } + + dst_len +=2 ; + } + +if (remainder_len <=0 ) +break ; + } + +return dst_len; +}
test/algorithms/iaa_zcompress.h +1 -0
@@ -7,5 +7,6 @@void iaa_zcompress16_randomize_input (void *dst,uint64_t pattern,int len);int iaa_do_zcompress16 (void *dst,void *src,int src_len); +int iaa_do_zdecompress16 (void *dst,void *src,int src_len);#endif
Signature · 1 line
2.25.1
Li Zhang
PATCH 9/11 accel-config/test: Add element input to struct task
In reply to Li ZhangAdd a new pointer input to struct task for Zdecompress16, and free the memory area pointed by output.
--- test/accel_test.c | 1 + test/accel_test.h | 1 + 2 files changed, 2 insertions(+)
test/accel_test.c +1 -0
@@ -464,6 +464,7 @@ void __clean_task(struct task *tsk)free (tsk->src2);free (tsk->dst1);free (tsk->dst2); +free (tsk->input);free (tsk->output); }
test/accel_test.h +1 -0
@@ -53,6 +53,7 @@ struct task {void *dst1;void *dst2;void *delta1; +void *input;void *output;uint64_t pattern;uint64_t pattern2;
Signature · 1 line
2.25.1
Li Zhang
PATCH 10/11 accel-config/test: Add test code of operation Zdecompress16
In reply to Li ZhangAdd test code of operation Zdecompress16
--- test/iaa.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++- test/iaa.h | 3 ++ test/iaa_prep.c | 11 +++++ test/iaa_test.c | 16 ++++++ 4 files changed, 156 insertions(+), 1 deletion(-)
test/iaa.c +126 -1
@@ -62,7 +62,38 @@ static int init_zcompress16(struct task *tsk, int tflags, int opcode, unsigned lreturn ACCTEST_STATUS_OK ; } -/* this function is re-used by batch task */ +static int init_zdecompress16 (struct task *tsk,int tflags,int opcode,unsigned long input_size) +{ + tsk->pattern =0x98765432abcdef01 ; + tsk->opcode = opcode; + tsk->test_flags = tflags; + + tsk->input =aligned_alloc (ADDR_ALIGNMENT , input_size); +if (!tsk->input) +return -ENOMEM ; +iaa_zcompress16_randomize_input (tsk->input, tsk->pattern, input_size); + + tsk->src1 =aligned_alloc (ADDR_ALIGNMENT , input_size *2 ); +if (!tsk->src1) +return -ENOMEM ; +memset_pattern (tsk->src1,0 , input_size *2 ); + tsk->xfer_size =iaa_do_zcompress16 (tsk->src1, tsk->input, input_size); + + tsk->dst1 =aligned_alloc (ADDR_ALIGNMENT , input_size); +if (!tsk->dst1) +return -ENOMEM ; +memset_pattern (tsk->dst1,0 , input_size); + + tsk->output =aligned_alloc (ADDR_ALIGNMENT , input_size); +if (!tsk->output) +return -ENOMEM ; +memset_pattern (tsk->output,0 , input_size); + + tsk->iaa_max_dst_size = input_size; + +return ACCTEST_STATUS_OK ; +} +int init_task (struct task *tsk,int tflags,int opcode,unsigned long src1_xfer_size) {int rc =0 ;
@@ -77,6 +108,9 @@ int init_task(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_case IAX_OPCODE_ZCOMPRESS16 : rc =init_zcompress16 (tsk, tflags, opcode, src1_xfer_size);break ; +case IAX_OPCODE_ZDECOMPRESS16 : + rc =init_zdecompress16 (tsk, tflags, opcode, src1_xfer_size); +break ; }if (rc !=ACCTEST_STATUS_OK ) {
@@ -228,6 +262,53 @@ int iaa_zcompress16_multi_task_nodes(struct acctest_context *ctx)return ret; } +static int iaa_wait_zdecompress16 (struct acctest_context *ctx,struct task *tsk) +{ +struct completion_record *comp = tsk->comp; +int rc; + + rc =acctest_wait_on_desc_timeout (comp, ctx, ms_timeout); +if (rc <0 ) { +err ("zdecompress16 desc timeout\n" ); +return ACCTEST_STATUS_TIMEOUT ; + } + +return ACCTEST_STATUS_OK ; +} + +int iaa_zdecompress16_multi_task_nodes (struct acctest_context *ctx) +{ +struct task_node *tsk_node = ctx->multi_task_node; +int ret =ACCTEST_STATUS_OK ; + +while (tsk_node) { + tsk_node->tsk->dflags |= (IDXD_OP_FLAG_CRAV |IDXD_OP_FLAG_RCR ); +if ((tsk_node->tsk->test_flags &TEST_FLAGS_BOF ) && ctx->bof) + tsk_node->tsk->dflags |=IDXD_OP_FLAG_BOF ; + +iaa_prep_zdecompress16 (tsk_node->tsk); + tsk_node = tsk_node->next; + } + +info ("Submitted all zdecompress16 jobs\n" ); + tsk_node = ctx->multi_task_node; +while (tsk_node) { +acctest_desc_submit (ctx, tsk_node->tsk->desc); + tsk_node = tsk_node->next; + } + + tsk_node = ctx->multi_task_node; +while (tsk_node) { + ret =iaa_wait_zdecompress16 (ctx, tsk_node->tsk); +if (ret !=ACCTEST_STATUS_OK ) +info ("Desc: %p failed with ret: %d\n" , + tsk_node->tsk->desc, tsk_node->tsk->comp->status); + tsk_node = tsk_node->next; + } + +return ret; +} +/* mismatch_expected: expect mismatched buffer with success status 0x1 */ int iaa_task_result_verify (struct task *tsk,int mismatch_expected) {
@@ -245,6 +326,9 @@ int iaa_task_result_verify(struct task *tsk, int mismatch_expected)case IAX_OPCODE_ZCOMPRESS16 : ret =task_result_verify_zcompress16 (tsk, mismatch_expected);break ; +case IAX_OPCODE_ZDECOMPRESS16 : + ret =task_result_verify_zdecompress16 (tsk, mismatch_expected); +break ; }if (ret ==ACCTEST_STATUS_OK )
@@ -350,3 +434,44 @@ int task_result_verify_zcompress16(struct task *tsk, int mismatch_expected)return -ENXIO ; } + +int task_result_verify_zdecompress16 (struct task *tsk,int mismatch_expected) +{ +int i; +int rc; +int expected_len; + +if (mismatch_expected) +warn ("invalid arg mismatch_expected for %d\n" , tsk->opcode); + + expected_len =iaa_do_zdecompress16 (tsk->output, tsk->src1, tsk->xfer_size); + rc =memcmp (tsk->dst1, tsk->output, expected_len); + +if (!mismatch_expected) { +if (expected_len - tsk->comp->iax_output_size) { +err ("zdecompress16 mismatch, exp len %d, act len %d\n" , + expected_len, tsk->comp->iax_output_size); + +return -ENXIO ; + } +if (rc) { +err ("zdecompress16 mismatch, memcmp rc %d\n" , rc); +for (i =0 ; i < (expected_len /2 ); i++) { +printf ("Exp[%d]=0x%04X, Act[%d]=0x%4X\n" , + i, ((uint16_t *)tsk->output)[i], + i, ((uint16_t *)tsk->dst1)[i]); + } + +return -ENXIO ; + } +return ACCTEST_STATUS_OK ; + } + +/* mismatch_expected */ +if (rc) { +info ("expected mismatch\n" ); +return ACCTEST_STATUS_OK ; + } + +return -ENXIO ; +}
test/iaa.h +3 -0
@@ -12,13 +12,16 @@ int init_task(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_int iaa_noop_multi_task_nodes (struct acctest_context *ctx);int iaa_crc64_multi_task_nodes (struct acctest_context *ctx);int iaa_zcompress16_multi_task_nodes (struct acctest_context *ctx); +int iaa_zdecompress16_multi_task_nodes (struct acctest_context *ctx);void iaa_prep_noop (struct task *tsk);void iaa_prep_crc64 (struct task *tsk);void iaa_prep_zcompress16 (struct task *tsk); +void iaa_prep_zdecompress16 (struct task *tsk);int iaa_task_result_verify (struct task *tsk,int mismatch_expected);int iaa_task_result_verify_task_nodes (struct acctest_context *ctx,int mismatch_expected);int task_result_verify_crc64 (struct task *tsk,int mismatch_expected);int task_result_verify_zcompress16 (struct task *tsk,int mismatch_expected); +int task_result_verify_zdecompress16 (struct task *tsk,int mismatch_expected);#endif
test/iaa_prep.c +11 -0
@@ -42,3 +42,14 @@ void iaa_prep_zcompress16(struct task *tsk) tsk->desc->iax_max_dst_size = tsk->iaa_max_dst_size; tsk->comp->status =0 ; } + +void iaa_prep_zdecompress16 (struct task *tsk) +{ +info ("preparing descriptor for zdecompress16\n" ); + +acctest_prep_desc_common (tsk->desc, tsk->opcode, (uint64_t )(tsk->dst1), + (uint64_t )(tsk->src1), tsk->xfer_size, tsk->dflags); + tsk->desc->completion_addr = (uint64_t )(tsk->comp); + tsk->desc->iax_max_dst_size = tsk->iaa_max_dst_size; + tsk->comp->status =0 ; +}
test/iaa_test.c +16 -0
@@ -174,6 +174,16 @@ static int test_zcompress(struct acctest_context *ctx, size_t buf_size,if (rc !=ACCTEST_STATUS_OK )return rc; +/* Verification of all the nodes*/ + rc =iaa_task_result_verify_task_nodes (ctx,0 ); +if (rc !=ACCTEST_STATUS_OK ) +return rc; +break ; +case IAX_OPCODE_ZDECOMPRESS16 : + rc =iaa_zdecompress16_multi_task_nodes (ctx); +if (rc !=ACCTEST_STATUS_OK ) +return rc; +/* Verification of all the nodes*/ rc =iaa_task_result_verify_task_nodes (ctx,0 );if (rc !=ACCTEST_STATUS_OK )
@@ -282,6 +292,12 @@ int main(int argc, char *argv[]) goto error;break ; +case IAX_OPCODE_ZDECOMPRESS16 : + rc =test_zcompress (iaa, buf_size, tflags, opcode, num_desc); +if (rc !=ACCTEST_STATUS_OK ) + goto error; +break ; +default : rc = -EINVAL ;break ;
Signature · 1 line
2.25.1
Li Zhang
PATCH 11/11 accel-config/test: Modify script for executing Zdecompress16 test
In reply to Li ZhangModify test script for passing parameters and executing operation Zdecompress16 test.
--- test/iaa_user_test_runner.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
test/iaa_user_test_runner.sh +2 -2
@@ -117,13 +117,13 @@ unset SIZE_1 flag="0x1" echo "Testing with 'block on fault' flag ON" -for opcode in "0x4d"; do +for opcode in "0x4d" "0x49"; do test_op $opcode $flag done flag="0x0" echo "Testing with 'block on fault' flag OFF" -for opcode in "0x4d"; do +for opcode in "0x4d" "0x49"; do test_op $opcode $flag done
Signature · 1 line
2.25.1
Dave Jiang
Reviewed-by on the v1 seriesQuoted 31 lines · Li Zhang
Add software algorithms of Zcompress16 and Zdecompress16, add operation Zcompress16 and Zdecompress16 test code, modify
Makefile, test script and configuration file.Li Zhang (11):
accel-config/test: Move macroADDR_ALIGNMENTto common file accel-config/test: Modifymax_transfer_sizein config file accel-config/test: Add algorithm to generate random data for
Zcompress16
accel-config/test: Add algorithm to do Zcompress16 accel-config/test: Add element output to struct task accel-config/test: Add test code of operation Zcompress16 accel-config/test: Modify script for executing Zcompress16 test accel-config/test: Add algorithm to do Zdecompress16 accel-config/test: Add element input to struct task accel-config/test: Add test code of operation Zdecompress16 accel-config/test: Modify script for executing Zdecompress16 testtest/Makefile.am | 2 +- test/accel_test.c | 2 + test/accel_test.h | 3 + test/algorithms/iaa_zcompress.c | 121 +++++++++++++++ test/algorithms/iaa_zcompress.h | 12 ++ test/configs/2g2q_user_2.conf | 4 +- test/dsa.h | 2 - test/iaa.c | 252 +++++++++++++++++++++++++++++++- test/iaa.h | 6 + test/iaa_prep.c | 24 ++- test/iaa_test.c | 79 ++++++++++ test/iaa_user_test_runner.sh | 14 ++ 12 files changed, 513 insertions(+), 8 deletions(-)
Quoted 2 lines
create mode 100644
test/algorithms/iaa_zcompress.ccreate mode 100644test/algorithms/iaa_zcompress.h