compress/mlx5: fix level translation in xform API
PATCH 1/1 compress/mlx5: fix level translation in xform API
Compression Level is interpreted by each PMD differently. However, lower numbers give faster compression
at the expense of compression ratio, while higher numbers may give better compression ratios but are likely slower. The level affects the block size, which affects performance, the bigger the block, the faster the compression is.
The problem was that higher levels caused bigger blocks:
size = min_block_size - 1 + level.
the solution is to reverse the above:
size = max_block_size + 1 - level.
--- drivers/compress/mlx5/mlx5_compress.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/compress/mlx5/mlx5_compress.c +12 -5
@@ -316,12 +316,19 @@ mlx5_compress_xform_create(struct rte_compressdev *dev, size /=MLX5_GGA_COMP_WIN_SIZE_UNITS ; xfrm->gga_ctrl1 +=RTE_MIN (rte_log2_u32 (size),MLX5_COMP_MAX_WIN_SIZE_CONF ) << -WQE_GGA_COMP_WIN_SIZE_OFFSET ; -if (xform->compress.level ==RTE_COMP_LEVEL_PMD_DEFAULT ) +WQE_GGA_COMP_WIN_SIZE_OFFSET ; +switch (xform->compress.level) { +case RTE_COMP_LEVEL_PMD_DEFAULT : size =MLX5_GGA_COMP_LOG_BLOCK_SIZE_MAX ; -else - size = priv->min_block_size -1 + - xform->compress.level; +break ; +case RTE_COMP_LEVEL_MAX : + size = priv->min_block_size; +break ; +default : + size =RTE_MAX (MLX5_GGA_COMP_LOG_BLOCK_SIZE_MAX + +1 - xform->compress.level, + priv->min_block_size); + } xfrm->gga_ctrl1 +=RTE_MIN (size,MLX5_GGA_COMP_LOG_BLOCK_SIZE_MAX ) <<WQE_GGA_COMP_BLOCK_SIZE_OFFSET ;
Signature · 1 line
2.27.0
Quoted 13 lines
Compression Level is interpreted by each PMD differently. However, lower numbers give faster compression
at the expense of compression ratio, while higher numbers may give better compression ratios but are likely slower. The level affects the block size, which affects performance, the bigger the block, the faster the compression is.The problem was that higher levels caused bigger blocks:
size =min_block_size- 1 + level.the solution is to reverse the above:
size =max_block_size+ 1 - level.
Quoted 6 lines
Fixes 39a2c8715f8f ("compress/mlx5: add transformation operations")Signed-off-by Raja Zidane <[email protected]>---
This patch is not acked, hence not applied for RC3. @Thomas Monjalon can you pick it directly if it gets acked?
From: Raja Zidane
Quoted 10 lines
Compression Level is interpreted by each PMD differently. However, lower numbers give faster compression at the expense of compression ratio, while higher numbers may give better compression ratios but are likely slower.
The level affects the block size, which affects performance, the bigger the block, the faster the compression is.The problem was that higher levels caused bigger blocks:
size =min_block_size- 1 + level.
Quoted 8 lines
the solution is to reverse the above:
size =max_block_size+ 1 - level.Fixes 39a2c8715f8f ("compress/mlx5: add transformation operations")Signed-off-by Raja Zidane <[email protected]>
Congrats on your first patch, Raja!
Thomas Monjalon
Applied01/08/2021 08:13, Matan Azrad:
Quoted 14 lines
From: Raja Zidane
Quoted 13 lines
Compression Level is interpreted by each PMD differently. However, lower numbers give faster compression at the expense of compression ratio, while higher numbers may give better compression ratios but are likely slower.
The level affects the block size, which affects performance, the bigger the block, the faster the compression is.The problem was that higher levels caused bigger blocks:
size =min_block_size- 1 + level.the solution is to reverse the above:
size =max_block_size+ 1 - level.
Quoted 7 lines
Quoted 5 lines
Fixes 39a2c8715f8f ("compress/mlx5: add transformation operations")Signed-off-by Raja Zidane <[email protected]>Congrats on your first patch, Raja!
The explanation above is very clear, thank you and congratulations!
Quoted 1 line
Acked-by Matan Azrad <[email protected]>
Applied, thanks.