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 Oct 16, 2024
1 parent 98613d3 commit 5d8f8f3
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 @@ -218,7 +218,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 @@ -235,7 +235,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 Expand Up @@ -386,7 +386,7 @@ uadk_compress_probe(struct rte_vdev_device *vdev)
struct uacce_dev *udev;
const char *name;

udev = wd_get_accel_dev("deflate");
udev = wd_get_accel_dev("zlib");
if (!udev)
return -ENODEV;

Expand Down

0 comments on commit 5d8f8f3

Please sign in to comment.