All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akhil Goyal <gakhil@marvell.com>
To: Michael Baum <michaelba@nvidia.com>, "dev@dpdk.org" <dev@dpdk.org>
Cc: Matan Azrad <matan@nvidia.com>,
	Ashish Gupta <ashishg@marvell.com>,
	Fiona Trahe <fiona.trahe@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>
Subject: RE: [EXT] [PATCH v3 3/4] app/test-compress-perf: add algo option
Date: Mon, 13 Feb 2023 07:29:25 +0000	[thread overview]
Message-ID: <CO6PR18MB44841AE01EBE91B9844BE800D8DD9@CO6PR18MB4484.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20230213061140.2157499-4-michaelba@nvidia.com>

> Add a command line option `algo` to select the compress algorithm
> supported by the compress API: null (DMA), deflate and lzs.
> 
> Default for deflate.
> 
> Signed-off-by: Matan Azrad <matan@nvidia.com>
> Signed-off-by: Michael Baum <michaelba@nvidia.com>
> ---
>  app/test-compress-perf/comp_perf_options.h    |  2 +
>  .../comp_perf_options_parse.c                 | 40 ++++++++++++++++++-
>  .../comp_perf_test_cyclecount.c               |  4 +-
>  .../comp_perf_test_throughput.c               |  4 +-
>  .../comp_perf_test_verify.c                   |  4 +-
>  app/test-compress-perf/main.c                 | 38 +++++++++++-------
>  doc/guides/rel_notes/release_23_03.rst        |  4 ++
>  doc/guides/tools/comp_perf.rst                |  2 +
>  8 files changed, 76 insertions(+), 22 deletions(-)
> 
> diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-
> perf/comp_perf_options.h
> index d00b299247..5e5227a700 100644
> --- a/app/test-compress-perf/comp_perf_options.h
> +++ b/app/test-compress-perf/comp_perf_options.h
> @@ -63,6 +63,8 @@ struct comp_test_data {
> 
>  	enum rte_comp_huffman huffman_enc;
>  	enum comp_operation test_op;
> +	enum rte_comp_algorithm test_algo;
> +
>  	int window_sz;
>  	struct range_list level_lst;
>  	uint8_t level;
> diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-
> compress-perf/comp_perf_options_parse.c
> index 7a992bf43e..97ddff87ef 100644
> --- a/app/test-compress-perf/comp_perf_options_parse.c
> +++ b/app/test-compress-perf/comp_perf_options_parse.c
> @@ -25,6 +25,7 @@
>  #define CPERF_MAX_SGL_SEGS	("max-num-sgl-segs")
>  #define CPERF_NUM_ITER		("num-iter")
>  #define CPERF_OPTYPE		("operation")
> +#define CPERF_ALGO		("algo")
>  #define CPERF_HUFFMAN_ENC	("huffman-enc")
>  #define CPERF_LEVEL		("compress-level")
>  #define CPERF_WINDOW_SIZE	("window-sz")
> @@ -56,6 +57,8 @@ usage(char *progname)
>  		"		compressed/decompressed (default: 10000)\n"
>  		" --operation [comp/decomp/comp_and_decomp]: perform
> test on\n"
>  		"		compression, decompression or both
> operations\n"
> +		" --algo [null/deflate/lzs]: perform test on algorithm\n"
> +		"		null(DMA), deflate or lzs (default: deflate)\n"

Since LZ4 is also supported now, is it not good to add that also in this patch?

>  		" --huffman-enc [fixed/dynamic/default]: Huffman encoding\n"
>  		"		(default: dynamic)\n"
>  		" --compress-level N: compression level, which could be a single
> value, list or range\n"
> @@ -470,6 +473,36 @@ parse_op_type(struct comp_test_data *test_data,
> const char *arg)
>  	return 0;
>  }
> 
> +static int
> +parse_algo(struct comp_test_data *test_data, const char *arg)
> +{
> +	struct name_id_map algo_namemap[] = {
> +		{
> +			"null",
> +			RTE_COMP_ALGO_NULL
> +		},
> +		{
> +			"deflate",
> +			RTE_COMP_ALGO_DEFLATE
> +		},
> +		{
> +			"lzs",
> +			RTE_COMP_ALGO_LZS
> +		}
> +	};
> +
> +	int id = get_str_key_id_mapping(algo_namemap,
> +			RTE_DIM(algo_namemap), arg);
> +	if (id < 0) {
> +		RTE_LOG(ERR, USER1, "Invalid algorithm specified\n");
> +		return -1;
> +	}
> +
> +	test_data->test_algo = (enum rte_comp_algorithm)id;
> +
> +	return 0;
> +}
> +
>  static int
>  parse_huffman_enc(struct comp_test_data *test_data, const char *arg)
>  {
> @@ -491,7 +524,7 @@ parse_huffman_enc(struct comp_test_data *test_data,
> const char *arg)
>  	int id = get_str_key_id_mapping(huffman_namemap,
>  			RTE_DIM(huffman_namemap), arg);
>  	if (id < 0) {
> -		RTE_LOG(ERR, USER1, "Invalid Huffmane encoding
> specified\n");
> +		RTE_LOG(ERR, USER1, "Invalid Huffman encoding specified\n");

This change is not related to this patch.
Should be a separate patch and should be backported.

>  		return -1;
>  	}
> 
> @@ -507,7 +540,7 @@ parse_level(struct comp_test_data *test_data, const
> char *arg)
> 
>  	/*
>  	 * Try parsing the argument as a range, if it fails,
> -	 * arse it as a list
> +	 * parse it as a list

Same here.

>  	 */
>  	if (parse_range(arg, &test_data->level_lst.min,
>  			&test_data->level_lst.max,
> @@ -572,6 +605,7 @@ static struct option lgopts[] = {
>  	{ CPERF_MAX_SGL_SEGS, required_argument, 0, 0},
>  	{ CPERF_NUM_ITER, required_argument, 0, 0 },
>  	{ CPERF_OPTYPE,	required_argument, 0, 0 },
> +	{ CPERF_ALGO, required_argument, 0, 0 },
>  	{ CPERF_HUFFMAN_ENC, required_argument, 0, 0 },
>  	{ CPERF_LEVEL, required_argument, 0, 0 },
>  	{ CPERF_WINDOW_SIZE, required_argument, 0, 0 },
> @@ -594,6 +628,7 @@ comp_perf_opts_parse_long(int opt_idx, struct
> comp_test_data *test_data)
>  		{ CPERF_MAX_SGL_SEGS,	parse_max_num_sgl_segs },
>  		{ CPERF_NUM_ITER,	parse_num_iter },
>  		{ CPERF_OPTYPE,		parse_op_type },
> +		{ CPERF_ALGO,		parse_algo },
>  		{ CPERF_HUFFMAN_ENC,	parse_huffman_enc },
>  		{ CPERF_LEVEL,		parse_level },
>  		{ CPERF_WINDOW_SIZE,	parse_window_sz },
> @@ -649,6 +684,7 @@ comp_perf_options_default(struct comp_test_data
> *test_data)
>  	test_data->num_iter = 10000;
>  	test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC;
>  	test_data->test_op = COMPRESS_DECOMPRESS;
> +	test_data->test_algo = RTE_COMP_ALGO_DEFLATE;
>  	test_data->window_sz = -1;
>  	test_data->level_lst.min = RTE_COMP_LEVEL_MIN;
>  	test_data->level_lst.max = RTE_COMP_LEVEL_MAX;
> diff --git a/app/test-compress-perf/comp_perf_test_cyclecount.c b/app/test-
> compress-perf/comp_perf_test_cyclecount.c
> index ce6c4d7605..81c3d30038 100644
> --- a/app/test-compress-perf/comp_perf_test_cyclecount.c
> +++ b/app/test-compress-perf/comp_perf_test_cyclecount.c
> @@ -193,7 +193,7 @@ main_loop(struct cperf_cyclecount_ctx *ctx, enum
> rte_comp_xform_type type)
>  		xform = (struct rte_comp_xform) {
>  			.type = RTE_COMP_COMPRESS,
>  			.compress = {
> -				.algo = RTE_COMP_ALGO_DEFLATE,
> +				.algo = test_data->test_algo,
>  				.deflate.huffman = test_data->huffman_enc,
>  				.level = test_data->level,
>  				.window_size = test_data->window_sz,
> @@ -208,7 +208,7 @@ main_loop(struct cperf_cyclecount_ctx *ctx, enum
> rte_comp_xform_type type)
>  		xform = (struct rte_comp_xform) {
>  			.type = RTE_COMP_DECOMPRESS,
>  			.decompress = {
> -				.algo = RTE_COMP_ALGO_DEFLATE,
> +				.algo = test_data->test_algo,
>  				.chksum = RTE_COMP_CHECKSUM_NONE,
>  				.window_size = test_data->window_sz,
>  				.hash_algo = RTE_COMP_HASH_ALGO_NONE
> diff --git a/app/test-compress-perf/comp_perf_test_throughput.c b/app/test-
> compress-perf/comp_perf_test_throughput.c
> index c9f8237626..2545ee9925 100644
> --- a/app/test-compress-perf/comp_perf_test_throughput.c
> +++ b/app/test-compress-perf/comp_perf_test_throughput.c
> @@ -84,7 +84,7 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum
> rte_comp_xform_type type)
>  		xform = (struct rte_comp_xform) {
>  			.type = RTE_COMP_COMPRESS,
>  			.compress = {
> -				.algo = RTE_COMP_ALGO_DEFLATE,
> +				.algo = test_data->test_algo,
>  				.deflate.huffman = test_data->huffman_enc,
>  				.level = test_data->level,
>  				.window_size = test_data->window_sz,
> @@ -99,7 +99,7 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum
> rte_comp_xform_type type)
>  		xform = (struct rte_comp_xform) {
>  			.type = RTE_COMP_DECOMPRESS,
>  			.decompress = {
> -				.algo = RTE_COMP_ALGO_DEFLATE,
> +				.algo = test_data->test_algo,
>  				.chksum = RTE_COMP_CHECKSUM_NONE,
>  				.window_size = test_data->window_sz,
>  				.hash_algo = RTE_COMP_HASH_ALGO_NONE
> diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-
> compress-perf/comp_perf_test_verify.c
> index 7d6b6abecd..88f4f41851 100644
> --- a/app/test-compress-perf/comp_perf_test_verify.c
> +++ b/app/test-compress-perf/comp_perf_test_verify.c
> @@ -87,7 +87,7 @@ main_loop(struct cperf_verify_ctx *ctx, enum
> rte_comp_xform_type type)
>  		xform = (struct rte_comp_xform) {
>  			.type = RTE_COMP_COMPRESS,
>  			.compress = {
> -				.algo = RTE_COMP_ALGO_DEFLATE,
> +				.algo = test_data->test_algo,
>  				.deflate.huffman = test_data->huffman_enc,
>  				.level = test_data->level,
>  				.window_size = test_data->window_sz,
> @@ -104,7 +104,7 @@ main_loop(struct cperf_verify_ctx *ctx, enum
> rte_comp_xform_type type)
>  		xform = (struct rte_comp_xform) {
>  			.type = RTE_COMP_DECOMPRESS,
>  			.decompress = {
> -				.algo = RTE_COMP_ALGO_DEFLATE,
> +				.algo = test_data->test_algo,
>  				.chksum = RTE_COMP_CHECKSUM_NONE,
>  				.window_size = test_data->window_sz,
>  				.hash_algo = RTE_COMP_HASH_ALGO_NONE
> diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c
> index bbb4c7917b..d049527ba1 100644
> --- a/app/test-compress-perf/main.c
> +++ b/app/test-compress-perf/main.c
> @@ -57,29 +57,39 @@ comp_perf_check_capabilities(struct comp_test_data
> *test_data, uint8_t cdev_id)
>  {
>  	const struct rte_compressdev_capabilities *cap;
> 
> -	cap = rte_compressdev_capability_get(cdev_id,
> -					     RTE_COMP_ALGO_DEFLATE);
> +	cap = rte_compressdev_capability_get(cdev_id, test_data->test_algo);
> 
>  	if (cap == NULL) {
>  		RTE_LOG(ERR, USER1,
> -			"Compress device does not support DEFLATE\n");
> +			"Compress device does not support %u algorithm\n",
> +			test_data->test_algo);
>  		return -1;
>  	}
> 
>  	uint64_t comp_flags = cap->comp_feature_flags;
> 
> -	/* Huffman encoding */
> -	if (test_data->huffman_enc == RTE_COMP_HUFFMAN_FIXED &&
> -			(comp_flags & RTE_COMP_FF_HUFFMAN_FIXED) == 0)
> {
> -		RTE_LOG(ERR, USER1,
> -			"Compress device does not supported Fixed
> Huffman\n");
> -		return -1;
> -	}
> +	/* Algorithm type */
> +	switch (test_data->test_algo) {
> +	case RTE_COMP_ALGO_DEFLATE:
> +		/* Huffman encoding */
> +		if (test_data->huffman_enc == RTE_COMP_HUFFMAN_FIXED
> &&
> +		    (comp_flags & RTE_COMP_FF_HUFFMAN_FIXED) == 0) {
> +			RTE_LOG(ERR, USER1,
> +				"Compress device does not supported Fixed
> Huffman\n");
> +			return -1;
> +		}
> 
> -	if (test_data->huffman_enc == RTE_COMP_HUFFMAN_DYNAMIC &&
> -			(comp_flags & RTE_COMP_FF_HUFFMAN_DYNAMIC)
> == 0) {
> -		RTE_LOG(ERR, USER1,
> -			"Compress device does not supported Dynamic
> Huffman\n");
> +		if (test_data->huffman_enc ==
> RTE_COMP_HUFFMAN_DYNAMIC &&
> +		    (comp_flags & RTE_COMP_FF_HUFFMAN_DYNAMIC) == 0) {
> +			RTE_LOG(ERR, USER1,
> +				"Compress device does not supported Dynamic
> Huffman\n");
> +			return -1;
> +		}
> +		break;
> +	case RTE_COMP_ALGO_LZS:
> +	case RTE_COMP_ALGO_NULL:
> +		break;
> +	default:
>  		return -1;
>  	}
> 
> diff --git a/doc/guides/rel_notes/release_23_03.rst
> b/doc/guides/rel_notes/release_23_03.rst
> index b2a8c921b9..6aa3f31246 100644
> --- a/doc/guides/rel_notes/release_23_03.rst
> +++ b/doc/guides/rel_notes/release_23_03.rst
> @@ -116,6 +116,10 @@ New Features
> 
>    Enable the application options for testing only compress and only decompress.
> 
> +* **Added algo option in test-compress-perf.**
> +
> +  Added support for testing other algorithms except for DEFLAT.
> +

This patch is only adding a new option to the test app.
I believe release notes are not needed.


> 
>  Removed Items
>  -------------
> diff --git a/doc/guides/tools/comp_perf.rst b/doc/guides/tools/comp_perf.rst
> index 9d2f4dbe4a..cf9035cc23 100644
> --- a/doc/guides/tools/comp_perf.rst
> +++ b/doc/guides/tools/comp_perf.rst
> @@ -84,6 +84,8 @@ Application Options
> 
>   ``--operation [comp/decomp/comp_and_decomp]``: perform test on
> compression, decompression or both operations
> 
> + ``--algo [null/deflate/lzs]`` : perform test on algorithm null(DMA), Deflate or lzs
> (default: Deflate)
> +
>   ``--huffman-enc [fixed/dynamic/default]``: Huffman encoding (default:
> dynamic)
> 
>   ``--compress-level N``: compression level, which could be a single value, list or
> range (default: range between 1 and 9)
> --
> 2.25.1


  reply	other threads:[~2023-02-13  7:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-09  7:45 [PATCH 0/4] compressdev: add LZ4 support Michael Baum
2023-01-09  7:45 ` [PATCH 1/4] compressdev: add LZ4 algorithm support Michael Baum
2023-01-30 18:35   ` [EXT] " Akhil Goyal
2023-01-30 20:36     ` Michael Baum
2023-01-31  6:29       ` Akhil Goyal
2023-01-09  7:45 ` [PATCH 2/4] app/test-compress-perf: allow test single compress operation Michael Baum
2023-01-09  7:45 ` [PATCH 3/4] app/test-compress-perf: add algo option Michael Baum
2023-01-09  7:45 ` [PATCH 4/4] app/test-compress-perf: add LZ4 support Michael Baum
2023-02-02  9:13 ` [PATCH v2 0/4] compressdev: " Michael Baum
2023-02-02  9:13   ` [PATCH v2 1/4] compressdev: add LZ4 algorithm support Michael Baum
2023-02-05 17:20     ` [EXT] " Akhil Goyal
2023-02-02  9:13   ` [PATCH v2 2/4] app/test-compress-perf: allow test single compress operation Michael Baum
2023-02-02  9:13   ` [PATCH v2 3/4] app/test-compress-perf: add algo option Michael Baum
2023-02-02  9:13   ` [PATCH v2 4/4] app/test-compress-perf: add LZ4 support Michael Baum
2023-02-13  6:11   ` [PATCH v3 0/4] compressdev: " Michael Baum
2023-02-13  6:11     ` [PATCH v3 1/4] compressdev: add LZ4 algorithm support Michael Baum
2023-02-13  6:11     ` [PATCH v3 2/4] app/test-compress-perf: allow test single compress operation Michael Baum
2023-02-13  7:23       ` [EXT] " Akhil Goyal
2023-02-14 16:37         ` Michael Baum
2023-02-13  6:11     ` [PATCH v3 3/4] app/test-compress-perf: add algo option Michael Baum
2023-02-13  7:29       ` Akhil Goyal [this message]
2023-02-14 16:32         ` [EXT] " Michael Baum
2023-02-13  6:11     ` [PATCH v3 4/4] app/test-compress-perf: add LZ4 support Michael Baum
2023-02-13 15:47     ` [PATCH v3 0/4] compressdev: " Zhang, Fan
2023-02-13 15:56       ` Michael Baum
2023-02-14 17:40     ` [PATCH v4 " Michael Baum
2023-02-14 17:40       ` [PATCH v4 1/4] compressdev: add LZ4 algorithm support Michael Baum
2023-02-14 17:40       ` [PATCH v4 2/4] app/test-compress-perf: fix some typos Michael Baum
2023-02-14 17:40       ` [PATCH v4 3/4] app/test-compress-perf: fix missing test single compress op Michael Baum
2023-02-14 17:40       ` [PATCH v4 4/4] app/test-compress-perf: add algo option Michael Baum
2023-02-16  8:01       ` [EXT] [PATCH v4 0/4] compressdev: add LZ4 support Akhil Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO6PR18MB44841AE01EBE91B9844BE800D8DD9@CO6PR18MB4484.namprd18.prod.outlook.com \
    --to=gakhil@marvell.com \
    --cc=ashishg@marvell.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=matan@nvidia.com \
    --cc=michaelba@nvidia.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.