Add Zcompress32, Zdecompress32, Compress and Decompress test.
Li Zhang
cover Add Zcompress32, Zdecompress32, Compress and Decompress test.
Add software algorithms of Zcompress32, Zdecompress32 and Decompress, add operation Zcompress32, Zdecompress32, Compress and Decompress test code, modify Makefile and test script.
Li Zhang (14):
accel-config/test: Add algorithm to do Zcompress32 accel-config/test: Add test code of operation Zcompress32 accel-config/test: Modify script for executing Zcompress32 test accel-config/test: Add algorithm to do Zdecompress32 accel-config/test: Add test code of operation Zdecompress32 accel-config/test: Modify script for executing Zdecompress32 test accel-config/test: Add function to do Decompress accel-config/test: Add macros for IAA Compress register accel-config/test: Add test code of operation Compress accel-config/test: Modify script for executing Compress test accel-config/test: Add macros for IAA Decompress register accel-config/test: Add element input_size to struct task accel-config/test: Add test code of operation Decompress accel-config/test: Modify script for executing Decompress test
accfg/idxd.h | 10 + test/Makefile.am | 5 +- test/accel_test.h | 1 + test/algorithms/iaa_compress.c | 58 ++++ test/algorithms/iaa_compress.h | 413 +++++++++++++++++++++++ test/algorithms/iaa_zcompress.c | 77 +++++ test/algorithms/iaa_zcompress.h | 2 + test/iaa.c | 569 +++++++++++++++++++++++++++++++- test/iaa.h | 13 + test/iaa_prep.c | 50 +++ test/iaa_test.c | 97 +++++- test/iaa_user_test_runner.sh | 4 +- 12 files changed, 1292 insertions(+), 7 deletions(-) create mode 100644 test/algorithms/iaa_compress.c create mode 100644 test/algorithms/iaa_compress.h
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 1/14 accel-config/test: Add algorithm to do Zcompress32
Add an algorithm to implement Zcompress32, it is used to generate a reference data for comparing with the result from IAA hardware.
--- test/algorithms/iaa_zcompress.c | 45 +++++++++++++++++++++++++++++++++ test/algorithms/iaa_zcompress.h | 1 + 2 files changed, 46 insertions(+)
test/algorithms/iaa_zcompress.c +45 -0
@@ -86,6 +86,51 @@ int iaa_do_zcompress16(void *dst, void *src, int src_len)return dst_len; } +int iaa_do_zcompress32 (void *dst,void *src,int src_len) +{ +int i, j, dst_len =0 ; +uint32_t *tags; +int num_blocks = src_len /IAA_ZCOMPRESS_BLOCK_SIZE ; +int remainder_bytes = src_len %IAA_ZCOMPRESS_BLOCK_SIZE ; +uint32_t *src_ptr = (uint32_t *)src; +uint32_t *dst_ptr = (uint32_t *)dst; + +for (i =0 ; i < num_blocks; i++) { + tags = dst_ptr; + dst_ptr +=1 ; + dst_len +=4 ; +for (j =0 ; j < (IAA_ZCOMPRESS_BLOCK_SIZE /4 ); j++) { +if (*src_ptr !=0 ) { + *tags |= ((uint32_t )1 << j); + *dst_ptr++ = *src_ptr; + dst_len +=4 ; + } + + src_ptr++; + } + } + +if (remainder_bytes) { + tags = dst_ptr; + *tags =0xFFFFFFFF ; + dst_ptr +=1 ; + dst_len +=4 ; + +for (i =0 ; i < (remainder_bytes /4 ); i++) { +if (*src_ptr ==0 ) { + *tags &= ~((uint32_t )1 << i); + }else { + *dst_ptr++ = *src_ptr; + dst_len +=4 ; + } + + src_ptr++; + } + } + +return dst_len; +} +int iaa_do_zdecompress16 (void *dst,void *src,int src_len) {int i, j, dst_len =0 ;
test/algorithms/iaa_zcompress.h +1 -0
@@ -8,5 +8,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); +int iaa_do_zcompress32 (void *dst,void *src,int src_len);#endif
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 2/14 accel-config/test: Add test code of operation Zcompress32
In reply to Li ZhangAdd test code of operation Zcompress32
--- test/iaa.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++- test/iaa.h | 3 ++ test/iaa_prep.c | 11 +++++ test/iaa_test.c | 16 +++++-- 4 files changed, 148 insertions(+), 7 deletions(-)
test/iaa.c +123 -2
@@ -94,6 +94,33 @@ static int init_zdecompress16(struct task *tsk, int tflags, int opcode, unsignedreturn ACCTEST_STATUS_OK ; } +static int init_zcompress32 (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 ; +} +int init_task (struct task *tsk,int tflags,int opcode,unsigned long src1_xfer_size) {int rc =0 ;
@@ -111,6 +138,9 @@ int init_task(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_case IAX_OPCODE_ZDECOMPRESS16 : rc =init_zdecompress16 (tsk, tflags, opcode, src1_xfer_size);break ; +case IAX_OPCODE_ZCOMPRESS32 : + rc =init_zcompress32 (tsk, tflags, opcode, src1_xfer_size); +break ; }if (rc !=ACCTEST_STATUS_OK ) {
@@ -309,6 +339,53 @@ int iaa_zdecompress16_multi_task_nodes(struct acctest_context *ctx)return ret; } +static int iaa_wait_zcompress32 (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 ("zcompress32 desc timeout\n" ); +return ACCTEST_STATUS_TIMEOUT ; + } + +return ACCTEST_STATUS_OK ; +} + +int iaa_zcompress32_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_zcompress32 (tsk_node->tsk); + tsk_node = tsk_node->next; + } + +info ("Submitted all zcompress32 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_zcompress32 (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) {
@@ -329,6 +406,9 @@ int iaa_task_result_verify(struct task *tsk, int mismatch_expected)case IAX_OPCODE_ZDECOMPRESS16 : ret =task_result_verify_zdecompress16 (tsk, mismatch_expected);break ; +case IAX_OPCODE_ZCOMPRESS32 : + ret =task_result_verify_zcompress32 (tsk, mismatch_expected); +break ; }if (ret ==ACCTEST_STATUS_OK )
@@ -416,7 +496,7 @@ int task_result_verify_zcompress16(struct task *tsk, int mismatch_expected)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" , +printf ("Exp[%d]=0x%04X, Act[%d]=0x%04X\n" , i, ((uint16_t *)tsk->output)[i], i, ((uint16_t *)tsk->dst1)[i]); }
@@ -457,7 +537,7 @@ int task_result_verify_zdecompress16(struct task *tsk, int mismatch_expected)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" , +printf ("Exp[%d]=0x%04X, Act[%d]=0x%04X\n" , i, ((uint16_t *)tsk->output)[i], i, ((uint16_t *)tsk->dst1)[i]); }
@@ -475,3 +555,44 @@ int task_result_verify_zdecompress16(struct task *tsk, int mismatch_expected)return -ENXIO ; } + +int task_result_verify_zcompress32 (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_zcompress32 (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 ("zcompress32 mismatch, exp len %d, act len %d\n" , + expected_len, tsk->comp->iax_output_size); + +return -ENXIO ; + } +if (rc) { +err ("zcompress32 mismatch, memcmp rc %d\n" , rc); +for (i =0 ; i < (expected_len /4 ); i++) { +printf ("Exp[%d]=0x%08X, Act[%d]=0x%08X\n" , + i, ((uint32_t *)tsk->output)[i], + i, ((uint32_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
@@ -13,15 +13,18 @@ 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); +int iaa_zcompress32_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); +void iaa_prep_zcompress32 (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); +int task_result_verify_zcompress32 (struct task *tsk,int mismatch_expected);#endif
test/iaa_prep.c +11 -0
@@ -53,3 +53,14 @@ void iaa_prep_zdecompress16(struct task *tsk) tsk->desc->iax_max_dst_size = tsk->iaa_max_dst_size; tsk->comp->status =0 ; } + +void iaa_prep_zcompress32 (struct task *tsk) +{ +info ("preparing descriptor for zcompress32\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 +11 -5
@@ -184,6 +184,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_ZCOMPRESS32 : + rc =iaa_zcompress32_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 )
@@ -287,12 +297,8 @@ int main(int argc, char *argv[])break ;case IAX_OPCODE_ZCOMPRESS16 : - rc =test_zcompress (iaa, buf_size, tflags, opcode, num_desc); -if (rc !=ACCTEST_STATUS_OK ) - goto error; -break ; -case IAX_OPCODE_ZDECOMPRESS16 : +case IAX_OPCODE_ZCOMPRESS32 : rc =test_zcompress (iaa, buf_size, tflags, opcode, num_desc);if (rc !=ACCTEST_STATUS_OK ) goto error;
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 3/14 accel-config/test: Modify script for executing Zcompress32 test
In reply to Li ZhangModify test script for passing parameters and executing operation Zcompress32 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" "0x49"; do +for opcode in "0x4d" "0x49" "0x4c"; do test_op $opcode $flag done flag="0x0" echo "Testing with 'block on fault' flag OFF" -for opcode in "0x4d" "0x49"; do +for opcode in "0x4d" "0x49" "0x4c"; do test_op $opcode $flag done
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 4/14 accel-config/test: Add algorithm to do Zdecompress32
In reply to Li ZhangAdd an algorithm to implement Zdecompress32, it is used to generate a reference data for comparing with the result from IAA hardware.
--- test/algorithms/iaa_zcompress.c | 32 ++++++++++++++++++++++++++++++++ test/algorithms/iaa_zcompress.h | 1 + 2 files changed, 33 insertions(+)
test/algorithms/iaa_zcompress.c +32 -0
@@ -164,3 +164,35 @@ int iaa_do_zdecompress16(void *dst, void *src, int src_len)return dst_len; } + +int iaa_do_zdecompress32 (void *dst,void *src,int src_len) +{ +int i, j, dst_len =0 ; +uint32_t tags; +int remainder_len = src_len; +uint32_t *src_ptr = (uint32_t *)src; +uint32_t *dst_ptr = (uint32_t *)dst; + +for (i =0 ; i < (src_len /4 ); i++) { + tags = *src_ptr++; + remainder_len -=4 ; + +for (j =0 ; j <32 ; j++) { +if (tags & ((uint32_t )1 << j)) { +if (remainder_len <=0 ) +break ; + *dst_ptr++ = *src_ptr++; + remainder_len -=4 ; + }else { + *dst_ptr++ =0 ; + } + + dst_len +=4 ; + } + +if (remainder_len <=0 ) +break ; + } + +return dst_len; +}
test/algorithms/iaa_zcompress.h +1 -0
@@ -9,5 +9,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);int iaa_do_zcompress32 (void *dst,void *src,int src_len); +int iaa_do_zdecompress32 (void *dst,void *src,int src_len);#endif
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 5/14 accel-config/test: Add test code of operation Zdecompress32
In reply to Li ZhangAdd test code of operation Zdecompress32
--- test/iaa.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++++ test/iaa.h | 3 ++ test/iaa_prep.c | 11 +++++ test/iaa_test.c | 11 +++++ 4 files changed, 151 insertions(+)
test/iaa.c +126 -0
@@ -121,6 +121,38 @@ static int init_zcompress32(struct task *tsk, int tflags, int opcode, unsigned lreturn ACCTEST_STATUS_OK ; } +static int init_zdecompress32 (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_zcompress32 (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 ;
@@ -141,6 +173,9 @@ int init_task(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_case IAX_OPCODE_ZCOMPRESS32 : rc =init_zcompress32 (tsk, tflags, opcode, src1_xfer_size);break ; +case IAX_OPCODE_ZDECOMPRESS32 : + rc =init_zdecompress32 (tsk, tflags, opcode, src1_xfer_size); +break ; }if (rc !=ACCTEST_STATUS_OK ) {
@@ -386,6 +421,53 @@ int iaa_zcompress32_multi_task_nodes(struct acctest_context *ctx)return ret; } +static int iaa_wait_zdecompress32 (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 ("zdecompress32 desc timeout\n" ); +return ACCTEST_STATUS_TIMEOUT ; + } + +return ACCTEST_STATUS_OK ; +} + +int iaa_zdecompress32_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_zdecompress32 (tsk_node->tsk); + tsk_node = tsk_node->next; + } + +info ("Submitted all zdecompress32 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_zdecompress32 (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) {
@@ -409,6 +491,9 @@ int iaa_task_result_verify(struct task *tsk, int mismatch_expected)case IAX_OPCODE_ZCOMPRESS32 : ret =task_result_verify_zcompress32 (tsk, mismatch_expected);break ; +case IAX_OPCODE_ZDECOMPRESS32 : + ret =task_result_verify_zdecompress32 (tsk, mismatch_expected); +break ; }if (ret ==ACCTEST_STATUS_OK )
@@ -596,3 +681,44 @@ int task_result_verify_zcompress32(struct task *tsk, int mismatch_expected)return -ENXIO ; } + +int task_result_verify_zdecompress32 (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_zdecompress32 (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 ("zdecompress32 mismatch, exp len %d, act len %d\n" , + expected_len, tsk->comp->iax_output_size); + +return -ENXIO ; + } +if (rc) { +err ("zdecompress32 mismatch, memcmp rc %d\n" , rc); +for (i =0 ; i < (expected_len /4 ); i++) { +printf ("Exp[%d]=0x%08X, Act[%d]=0x%08X\n" , + i, ((uint32_t *)tsk->output)[i], + i, ((uint32_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
@@ -14,11 +14,13 @@ 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);int iaa_zcompress32_multi_task_nodes (struct acctest_context *ctx); +int iaa_zdecompress32_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);void iaa_prep_zcompress32 (struct task *tsk); +void iaa_prep_zdecompress32 (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);
@@ -26,5 +28,6 @@ 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);int task_result_verify_zcompress32 (struct task *tsk,int mismatch_expected); +int task_result_verify_zdecompress32 (struct task *tsk,int mismatch_expected);#endif
test/iaa_prep.c +11 -0
@@ -64,3 +64,14 @@ void iaa_prep_zcompress32(struct task *tsk) tsk->desc->iax_max_dst_size = tsk->iaa_max_dst_size; tsk->comp->status =0 ; } + +void iaa_prep_zdecompress32 (struct task *tsk) +{ +info ("preparing descriptor for zdecompress32\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 +11 -0
@@ -194,6 +194,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_ZDECOMPRESS32 : + rc =iaa_zdecompress32_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 )
@@ -299,6 +309,7 @@ int main(int argc, char *argv[])case IAX_OPCODE_ZCOMPRESS16 :case IAX_OPCODE_ZDECOMPRESS16 :case IAX_OPCODE_ZCOMPRESS32 : +case IAX_OPCODE_ZDECOMPRESS32 : rc =test_zcompress (iaa, buf_size, tflags, opcode, num_desc);if (rc !=ACCTEST_STATUS_OK ) goto error;
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 6/14 accel-config/test: Modify script for executing Zdecompress32 test
In reply to Li ZhangModify test script for passing parameters and executing operation Zdecompress32 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" "0x49" "0x4c"; do +for opcode in "0x4d" "0x49" "0x4c" "0x48"; do test_op $opcode $flag done flag="0x0" echo "Testing with 'block on fault' flag OFF" -for opcode in "0x4d" "0x49" "0x4c"; do +for opcode in "0x4d" "0x49" "0x4c" "0x48"; do test_op $opcode $flag done
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 7/14 accel-config/test: Add function to do Decompress
In reply to Li ZhangAdd new file iaa_compress.c and iaa_compress.h with a function to implement Decompress, it is used to decompress the compressed result from IAA hardware. Add the new files into Makefile for compiler. Add -lz into LDFLAGS for linker.
--- test/Makefile.am | 5 +- test/algorithms/iaa_compress.c | 58 +++++ test/algorithms/iaa_compress.h | 410 +++++++++++++++++++++++++++++++++ 3 files changed, 472 insertions(+), 1 deletion(-) create mode 100644 test/algorithms/iaa_compress.c create mode 100644 test/algorithms/iaa_compress.h
test/Makefile.am +4 -1
@@ -32,11 +32,14 @@ testcore =\ dsa.h \ accfg_test.h +iaa_test_LDFLAGS = -lz + libaccfg_SOURCES = libaccfg.c $(testcore) 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_zcompress.c +iaa_test_SOURCES = iaa_test.c iaa.c iaa_prep.c accel_test.c \ + algorithms/iaa_crc64.c algorithms/iaa_zcompress.c algorithms/iaa_compress.c iaa_test_LDADD = $(LIBACCFG_LIB) $(UUID_LIBS)
test/algorithms/iaa_compress.c new file +58 -0
58 lines not on this page · raw message
test/algorithms/iaa_compress.h new file +410 -0
410 lines not on this page · raw message
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 8/14 accel-config/test: Add macros for IAA Compress register
In reply to Li ZhangAdd macros into idxd.h to describe necessary bits of IAA Operation flag and Compress flag.
--- accfg/idxd.h | 4 ++++ 1 file changed, 4 insertions(+)
accfg/idxd.h +4 -0
@@ -51,6 +51,10 @@ enum idxd_scmd_stat {/* IAX */ #define IDXD_OP_FLAG_RD_SRC2_AECS 0x010000 +#define IDXD_OP_FLAG_WR_SRC2_CMPL 0x040000 + +#define IDXD_COMPRESS_FLAG_EOB_BFINAL 0x000c +#define IDXD_COMPRESS_FLAG_FLUSH_OUTPUT 0x0002/* Opcode */ enum dsa_opcode {
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 9/14 accel-config/test: Add test code of operation Compress
In reply to Li ZhangAdd test code of operation Compress
--- test/iaa.c | 136 ++++++++++++++++++++++++++++++++++++++++++++++++ test/iaa.h | 4 ++ test/iaa_prep.c | 14 +++++ test/iaa_test.c | 65 +++++++++++++++++++++++ 4 files changed, 219 insertions(+)
test/iaa.c +136 -0
@@ -18,6 +18,7 @@#include "iaa.h" #include "algorithms/iaa_crc64.h" #include "algorithms/iaa_zcompress.h" +#include "algorithms/iaa_compress.h" static int init_crc64 (struct task *tsk,int tflags,int opcode,unsigned long src1_xfer_size) {
@@ -153,6 +154,36 @@ static int init_zdecompress32(struct task *tsk, int tflags, int opcode, unsignedreturn ACCTEST_STATUS_OK ; } +static int init_compress (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 (32 , src1_xfer_size); +if (!tsk->src1) +return -ENOMEM ; +memset_pattern (tsk->src1, tsk->pattern, src1_xfer_size); + + tsk->src2 =aligned_alloc (32 ,IAA_COMPRESS_SRC2_SIZE ); +if (!tsk->src2) +return -ENOMEM ; +memset_pattern (tsk->src2,0 ,IAA_COMPRESS_SRC2_SIZE ); + + tsk->dst1 =aligned_alloc (32 ,IAA_COMPRESS_MAX_DEST_SIZE ); +if (!tsk->dst1) +return -ENOMEM ; +memset_pattern (tsk->dst1,0 ,IAA_COMPRESS_MAX_DEST_SIZE ); + + tsk->output =aligned_alloc (32 ,IAA_COMPRESS_MAX_DEST_SIZE ); +if (!tsk->output) +return -ENOMEM ; +memset_pattern (tsk->output,0 ,IAA_COMPRESS_MAX_DEST_SIZE ); + +return ACCTEST_STATUS_OK ; +} +int init_task (struct task *tsk,int tflags,int opcode,unsigned long src1_xfer_size) {int rc =0 ;
@@ -176,6 +207,9 @@ int init_task(struct task *tsk, int tflags, int opcode, unsigned long src1_xfer_case IAX_OPCODE_ZDECOMPRESS32 : rc =init_zdecompress32 (tsk, tflags, opcode, src1_xfer_size);break ; +case IAX_OPCODE_COMPRESS : + rc =init_compress (tsk, tflags, opcode, src1_xfer_size); +break ; }if (rc !=ACCTEST_STATUS_OK ) {
@@ -468,6 +502,62 @@ int iaa_zdecompress32_multi_task_nodes(struct acctest_context *ctx)return ret; } +static int iaa_wait_compress (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 ("compress desc timeout\n" ); +return ACCTEST_STATUS_TIMEOUT ; + } + +return ACCTEST_STATUS_OK ; +} + +int iaa_compress_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 ; + + tsk_node->tsk->dflags |= (IDXD_OP_FLAG_WR_SRC2_CMPL |IDXD_OP_FLAG_RD_SRC2_AECS ); + tsk_node->tsk->iaa_src2_xfer_size =IAA_COMPRESS_AECS_SIZE ; + +memcpy (tsk_node->tsk->src2, (void *)iaa_compress_aecs,IAA_COMPRESS_AECS_SIZE ); + + tsk_node->tsk->iaa_compr_flags = (IDXD_COMPRESS_FLAG_EOB_BFINAL | +IDXD_COMPRESS_FLAG_FLUSH_OUTPUT ); + tsk_node->tsk->iaa_max_dst_size =IAA_COMPRESS_MAX_DEST_SIZE ; + +iaa_prep_compress (tsk_node->tsk); + tsk_node = tsk_node->next; + } + +info ("Submitted all compress 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_compress (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) {
@@ -494,6 +584,9 @@ int iaa_task_result_verify(struct task *tsk, int mismatch_expected)case IAX_OPCODE_ZDECOMPRESS32 : ret =task_result_verify_zdecompress32 (tsk, mismatch_expected);break ; +case IAX_OPCODE_COMPRESS : + ret =task_result_verify_compress (tsk, mismatch_expected); +break ; }if (ret ==ACCTEST_STATUS_OK )
@@ -722,3 +815,46 @@ int task_result_verify_zdecompress32(struct task *tsk, int mismatch_expected)return -ENXIO ; } + +int task_result_verify_compress (struct task *tsk,int mismatch_expected) +{ +int i =0 ; +int rc; +int expected_len; + +if (mismatch_expected) +warn ("invalid arg mismatch_expected for %d\n" , tsk->opcode); + + rc =iaa_do_decompress (tsk->output, tsk->dst1, tsk->comp->iax_output_size, &expected_len); +if (rc) +return -ENXIO ; + rc =memcmp (tsk->src1, tsk->output, expected_len); + +if (!mismatch_expected) { +if (expected_len - tsk->xfer_size) { +err ("Compress mismatch, exp len %d, act len %d\n" , + expected_len, tsk->xfer_size); + +return -ENXIO ; + } +if (rc) { +err ("Compress mismatch, memcmp rc %d\n" , rc); +for (i =0 ; i < (expected_len /4 ); i++) { +printf ("Exp[%d]=0x%04X, Act[%d]=0x%04X\n" , + i, ((uint32_t *)tsk->output)[i], + i, ((uint32_t *)tsk->src1)[i]); + } + +return -ENXIO ; + } +return ACCTEST_STATUS_OK ; + } + +/* mismatch_expected */ +if (rc) { +info ("expected mismatch\n" ); +return ACCTEST_STATUS_OK ; + } + +return -ENXIO ; +}
test/iaa.h +4 -0
@@ -15,12 +15,15 @@ int iaa_zcompress16_multi_task_nodes(struct acctest_context *ctx);int iaa_zdecompress16_multi_task_nodes (struct acctest_context *ctx);int iaa_zcompress32_multi_task_nodes (struct acctest_context *ctx);int iaa_zdecompress32_multi_task_nodes (struct acctest_context *ctx); +int iaa_compress_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);void iaa_prep_zcompress32 (struct task *tsk);void iaa_prep_zdecompress32 (struct task *tsk); +void iaa_prep_compress (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);
@@ -29,5 +32,6 @@ int task_result_verify_zcompress16(struct task *tsk, int mismatch_expected);int task_result_verify_zdecompress16 (struct task *tsk,int mismatch_expected);int task_result_verify_zcompress32 (struct task *tsk,int mismatch_expected);int task_result_verify_zdecompress32 (struct task *tsk,int mismatch_expected); +int task_result_verify_compress (struct task *tsk,int mismatch_expected);#endif
test/iaa_prep.c +14 -0
@@ -75,3 +75,17 @@ void iaa_prep_zdecompress32(struct task *tsk) tsk->desc->iax_max_dst_size = tsk->iaa_max_dst_size; tsk->comp->status =0 ; } + +void iaa_prep_compress (struct task *tsk) +{ +info ("preparing descriptor for compress\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_compr_flags = tsk->iaa_compr_flags; + tsk->desc->iax_src2_addr = (uint64_t )(tsk->src2); + tsk->desc->iax_src2_xfer_size = tsk->iaa_src2_xfer_size; + tsk->desc->iax_max_dst_size = tsk->iaa_max_dst_size; + tsk->comp->status =0 ; +}
test/iaa_test.c +65 -0
77 lines not on this page · raw message
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 10/14 accel-config/test: Modify script for executing Compress test
In reply to Li ZhangModify test script for passing parameters and executing operation Compress 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" "0x49" "0x4c" "0x48"; do +for opcode in "0x4d" "0x49" "0x4c" "0x48" "0x43"; do test_op $opcode $flag done flag="0x0" echo "Testing with 'block on fault' flag OFF" -for opcode in "0x4d" "0x49" "0x4c" "0x48"; do +for opcode in "0x4d" "0x49" "0x4c" "0x48" "0x43"; do test_op $opcode $flag done
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 11/14 accel-config/test: Add macros for IAA Decompress register
In reply to Li ZhangAdd macros into idxd.h to describe necessary bits of IAA Decompress flag.
--- accfg/idxd.h | 6 ++++++ 1 file changed, 6 insertions(+)
accfg/idxd.h +6 -0
@@ -56,6 +56,12 @@ enum idxd_scmd_stat {#define IDXD_COMPRESS_FLAG_EOB_BFINAL 0x000c#define IDXD_COMPRESS_FLAG_FLUSH_OUTPUT 0x0002 +#define IDXD_DECOMPRESS_FLAG_SELECT_EOB_BFINAL 0x0010 +#define IDXD_DECOMPRESS_FLAG_CHECK_EOB 0x0008 +#define IDXD_DECOMPRESS_FLAG_STOP_ON_EOB 0x0004 +#define IDXD_DECOMPRESS_FLAG_FLUSH_OUTPUT 0x0002 +#define IDXD_DECOMPRESS_FLAG_EN_DECOMPRESS 0x0001 +/* Opcode */ enum dsa_opcode {DSA_OPCODE_NOOP =0 ,
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 12/14 accel-config/test: Add element input_size to struct task
In reply to Li ZhangAdd a new element input_size to struct task for Decompress
--- test/accel_test.h | 1 + 1 file changed, 1 insertion(+)
test/accel_test.h +1 -0
@@ -55,6 +55,7 @@ struct task {void *delta1;void *input;void *output; +int input_size;uint64_t pattern;uint64_t pattern2;uint64_t xfer_size;
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 13/14 accel-config/test: Add test code of operation Decompress
In reply to Li ZhangAdd test code of operation Decompress
--- test/algorithms/iaa_compress.h | 3 + test/iaa.c | 182 +++++++++++++++++++++++++++++++++ test/iaa.h | 3 + test/iaa_prep.c | 14 +++ test/iaa_test.c | 11 ++ 5 files changed, 213 insertions(+)
test/algorithms/iaa_compress.h +3 -0
@@ -9,6 +9,9 @@#define IAA_COMPRESS_AECS_SIZE (1568)#define IAA_COMPRESS_SRC2_SIZE (IAA_COMPRESS_AECS_SIZE * 2)#define IAA_COMPRESS_MAX_DEST_SIZE (2097152 * 2) +#define IAA_DECOMPRESS_AECS_SIZE (5376) +#define IAA_DECOMPRESS_SRC2_SIZE (IAA_DECOMPRESS_AECS_SIZE * 2) +#define IAA_DECOMPRESS_MAX_DEST_SIZE (2097152 * 2)static const uint32_t iaa_compress_aecs[IAA_COMPRESS_AECS_SIZE /4 ] = {0x12345678 ,// crc
test/iaa.c +182 -0
203 lines not on this page · raw message
test/iaa.h +3 -0
@@ -16,6 +16,7 @@ int iaa_zdecompress16_multi_task_nodes(struct acctest_context *ctx);int iaa_zcompress32_multi_task_nodes (struct acctest_context *ctx);int iaa_zdecompress32_multi_task_nodes (struct acctest_context *ctx);int iaa_compress_multi_task_nodes (struct acctest_context *ctx); +int iaa_decompress_multi_task_nodes (struct acctest_context *ctx);void iaa_prep_noop (struct task *tsk);void iaa_prep_crc64 (struct task *tsk);
@@ -24,6 +25,7 @@ void iaa_prep_zdecompress16(struct task *tsk);void iaa_prep_zcompress32 (struct task *tsk);void iaa_prep_zdecompress32 (struct task *tsk);void iaa_prep_compress (struct task *tsk); +void iaa_prep_decompress (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);
@@ -33,5 +35,6 @@ int task_result_verify_zdecompress16(struct task *tsk, int mismatch_expected);int task_result_verify_zcompress32 (struct task *tsk,int mismatch_expected);int task_result_verify_zdecompress32 (struct task *tsk,int mismatch_expected);int task_result_verify_compress (struct task *tsk,int mismatch_expected); +int task_result_verify_decompress (struct task *tsk,int mismatch_expected);#endif
test/iaa_prep.c +14 -0
@@ -89,3 +89,17 @@ void iaa_prep_compress(struct task *tsk) tsk->desc->iax_max_dst_size = tsk->iaa_max_dst_size; tsk->comp->status =0 ; } + +void iaa_prep_decompress (struct task *tsk) +{ +info ("preparing descriptor for decompress\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_decompr_flags = tsk->iaa_decompr_flags; + tsk->desc->iax_src2_addr = (uint64_t )(tsk->src2); + tsk->desc->iax_src2_xfer_size = tsk->iaa_src2_xfer_size; + tsk->desc->iax_max_dst_size = tsk->iaa_max_dst_size; + tsk->comp->status =0 ; +}
test/iaa_test.c +11 -0
@@ -263,6 +263,16 @@ static int test_compress(struct acctest_context *ctx, size_t buf_size, int tflagif (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_DECOMPRESS : + rc =iaa_decompress_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 )
@@ -375,6 +385,7 @@ int main(int argc, char *argv[])break ;case IAX_OPCODE_COMPRESS : +case IAX_OPCODE_DECOMPRESS : rc =test_compress (iaa, buf_size, tflags, extra_flags, opcode, num_desc);if (rc !=ACCTEST_STATUS_OK ) goto error;
Signature · 1 line
2.25.1
Li Zhang
PATCH RESEND 14/14 accel-config/test: Modify script for executing Decompress test
In reply to Li ZhangModify test script for passing parameters and executing operation Decompress 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" "0x49" "0x4c" "0x48" "0x43"; do +for opcode in "0x4d" "0x49" "0x4c" "0x48" "0x43" "0x42"; do test_op $opcode $flag done flag="0x0" echo "Testing with 'block on fault' flag OFF" -for opcode in "0x4d" "0x49" "0x4c" "0x48" "0x43"; do +for opcode in "0x4d" "0x49" "0x4c" "0x48" "0x43" "0x42"; do test_op $opcode $flag done
Signature · 1 line
2.25.1