All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] compress/mlx5: fix level translation in xform API
@ 2021-07-29 14:11 Raja Zidane
  2021-07-31 17:57 ` [dpdk-dev] [EXT] " Akhil Goyal
  2021-08-01  6:13 ` [dpdk-dev] " Matan Azrad
  0 siblings, 2 replies; 4+ messages in thread
From: Raja Zidane @ 2021-07-29 14:11 UTC (permalink / raw)
  To: dev; +Cc: matan, stable

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.

Fixes: 39a2c8715f8f ("compress/mlx5: add transformation operations")
Cc: matan@nvidia.com
Cc: stable@dpdk.org

Signed-off-by: Raja Zidane <rzidane@nvidia.com>
---
 drivers/compress/mlx5/mlx5_compress.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/compress/mlx5/mlx5_compress.c b/drivers/compress/mlx5/mlx5_compress.c
index 5c2b9dc859..883e720ec1 100644
--- a/drivers/compress/mlx5/mlx5_compress.c
+++ b/drivers/compress/mlx5/mlx5_compress.c
@@ -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;
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [EXT] [PATCH] compress/mlx5: fix level translation in xform API
  2021-07-29 14:11 [dpdk-dev] [PATCH] compress/mlx5: fix level translation in xform API Raja Zidane
@ 2021-07-31 17:57 ` Akhil Goyal
  2021-08-01  6:13 ` [dpdk-dev] " Matan Azrad
  1 sibling, 0 replies; 4+ messages in thread
From: Akhil Goyal @ 2021-07-31 17:57 UTC (permalink / raw)
  To: Raja Zidane, dev@dpdk.org, Thomas Monjalon
  Cc: matan@nvidia.com, stable@dpdk.org

> 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.
> 
> Fixes: 39a2c8715f8f ("compress/mlx5: add transformation operations")
> Cc: matan@nvidia.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Raja Zidane <rzidane@nvidia.com>
> ---
This patch is not acked, hence not applied for RC3.
@Thomas Monjalon can you pick it directly if it gets acked?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] compress/mlx5: fix level translation in xform API
  2021-07-29 14:11 [dpdk-dev] [PATCH] compress/mlx5: fix level translation in xform API Raja Zidane
  2021-07-31 17:57 ` [dpdk-dev] [EXT] " Akhil Goyal
@ 2021-08-01  6:13 ` Matan Azrad
  2021-08-03 12:11   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  1 sibling, 1 reply; 4+ messages in thread
From: Matan Azrad @ 2021-08-01  6:13 UTC (permalink / raw)
  To: Raja Zidane, dev@dpdk.org; +Cc: stable@dpdk.org



From: Raja Zidane
> 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.
> 
> Fixes: 39a2c8715f8f ("compress/mlx5: add transformation operations")
> Cc: matan@nvidia.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Raja Zidane <rzidane@nvidia.com>

Congrats on your first patch, Raja!

Acked-by: Matan Azrad <matan@nvidia.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] compress/mlx5: fix level translation in xform API
  2021-08-01  6:13 ` [dpdk-dev] " Matan Azrad
@ 2021-08-03 12:11   ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2021-08-03 12:11 UTC (permalink / raw)
  To: Raja Zidane; +Cc: dev@dpdk.org, stable, Matan Azrad, asafp

01/08/2021 08:13, Matan Azrad:
> From: Raja Zidane
> > 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.
> > 
> > Fixes: 39a2c8715f8f ("compress/mlx5: add transformation operations")
> > Cc: matan@nvidia.com
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Raja Zidane <rzidane@nvidia.com>
> 
> Congrats on your first patch, Raja!

The explanation above is very clear, thank you and
congratulations!

> Acked-by: Matan Azrad <matan@nvidia.com>

Applied, thanks.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-03 12:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 14:11 [dpdk-dev] [PATCH] compress/mlx5: fix level translation in xform API Raja Zidane
2021-07-31 17:57 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-08-01  6:13 ` [dpdk-dev] " Matan Azrad
2021-08-03 12:11   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.