Skip to content

Commit

Permalink
test_compressdev: hack for zlib
Browse files Browse the repository at this point in the history
Kunpeng920 only support zlib not deflate
Add window_bits hack temporarily
zlib's window is positive while deflate's window is negative

Signed-off-by: Zhangfei Gao <[email protected]>
  • Loading branch information
zhangfeigao committed Dec 11, 2024
1 parent bea9eeb commit d1e4f0e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions app/test/test_compressdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ compress_zlib(struct rte_comp_op *op,
else if (xform->compress.chksum == RTE_COMP_CHECKSUM_CRC32)
window_bits = ZLIB_CRC_CHECKSUM_WINDOW_BITS;

// hack for zlib
window_bits = 15;

comp_level = xform->compress.level;

if (comp_level != RTE_COMP_LEVEL_NONE)
Expand Down Expand Up @@ -593,6 +596,9 @@ decompress_zlib(struct rte_comp_op *op,
* When doing raw DEFLATE, this number will be negative.
*/
window_bits = -(xform->decompress.window_size);

// hack for zlib
window_bits = 15;
ret = inflateInit2(&stream, window_bits);

if (ret != Z_OK) {
Expand Down
6 changes: 3 additions & 3 deletions drivers/compress/uadk/uadk_compress_pmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "uadk_compress_pmd_private.h"

#define UADK_CIPHER_DEF_CTXS 2
static char alg_name[8] = "deflate";
static char alg_name[8] = "zlib";

static const struct
rte_compressdev_capabilities uadk_compress_pmd_capabilities[] = {
Expand Down Expand Up @@ -254,7 +254,7 @@ uadk_compress_pmd_xform_create(struct rte_compressdev *dev __rte_unused,
case RTE_COMP_ALGO_NULL:
break;
case RTE_COMP_ALGO_DEFLATE:
setup.alg_type = WD_DEFLATE;
setup.alg_type = WD_ZLIB;
setup.win_sz = WD_COMP_WS_8K;
setup.comp_lv = WD_COMP_L8;
setup.op_type = WD_DIR_COMPRESS;
Expand All @@ -271,7 +271,7 @@ uadk_compress_pmd_xform_create(struct rte_compressdev *dev __rte_unused,
case RTE_COMP_ALGO_NULL:
break;
case RTE_COMP_ALGO_DEFLATE:
setup.alg_type = WD_DEFLATE;
setup.alg_type = WD_ZLIB;
setup.comp_lv = WD_COMP_L8;
setup.op_type = WD_DIR_DECOMPRESS;
param.type = setup.op_type;
Expand Down

0 comments on commit d1e4f0e

Please sign in to comment.