All of lore.kernel.org
 help / color / mirror / Atom feed
From: "De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
To: "Kovacevic, Marko" <marko.kovacevic@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "akhil.goyal@nxp.com" <akhil.goyal@nxp.com>
Subject: Re: [PATCH v4 2/3] test/compress: add out of space test
Date: Wed, 16 Jan 2019 17:16:22 +0000	[thread overview]
Message-ID: <E115CCD9D858EF4F90C690B0DCB4D897803664CF@irsmsx112.ger.corp.intel.com> (raw)
In-Reply-To: <20190111165253.14001-3-marko.kovacevic@intel.com>

Hi Marko,

Minor comments.

> -----Original Message-----
> From: Kovacevic, Marko
> Sent: Friday, January 11, 2019 4:53 PM
> To: dev@dpdk.org
> Cc: akhil.goyal@nxp.com; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; Kovacevic
> Subject: [PATCH v4 2/3] test/compress: add out of space test
> 
> This patch adds new out of space testcase to check that the destination
> mbuf is smaller than required for the output of compression to ensure the
> driver doesn't crash and returns the valid error case.
> 
> Signed-off-by: Kovacevic, Marko <marko.kovacevic@intel.com>
> Acked-by: Lee Daly <lee.daly@intel.com>
> Acked-by: Fiona Trahe <fiona.trahe@intel.com>
> 
> ---
> v4:
>   Added Acks
> V3:
>   Made requested changes(Pablo)
> 
> ---
>  test/test/test_compressdev.c | 178
> +++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 165 insertions(+), 13 deletions(-)
> 
> diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c
> index 20895fc..1e41113 100644
> --- a/test/test/test_compressdev.c
> +++ b/test/test/test_compressdev.c
> @@ -42,6 +42,8 @@
>  #define GZIP_HEADER_SIZE 10
>  #define GZIP_TRAILER_SIZE 8
> 
> +#define OUT_OF_SPACE_BUF 1
> +
>  const char *
>  huffman_type_strings[] = {
>  	[RTE_COMP_HUFFMAN_DEFAULT]	= "PMD default",
> @@ -81,6 +83,7 @@ struct test_data_params {
>  	enum rte_comp_op_type state;
>  	unsigned int sgl;
>  	enum zlib_direction zlib_dir;
> +	unsigned int out_of_space;
>  };
> 
>  static struct comp_testsuite_params testsuite_params = { 0 }; @@ -677,6
> +680,7 @@ test_deflate_comp_decomp(const struct interim_data_params
> *int_data,
>  	unsigned int num_xforms = int_data->num_xforms;
>  	enum rte_comp_op_type state = test_data->state;
>  	unsigned int sgl = test_data->sgl;
> +	unsigned int out_of_space = test_data->out_of_space;
>  	enum zlib_direction zlib_dir = test_data->zlib_dir;
>  	int ret_status = -1;
>  	int ret;
> @@ -693,6 +697,12 @@ test_deflate_comp_decomp(const struct
> interim_data_params *int_data,
>  	unsigned int i;
>  	struct rte_mempool *buf_pool;
>  	uint32_t data_size;
> +	/* Compressing with CompressDev */
> +	unsigned int oos_zlib_decompress =
> +			(zlib_dir == ZLIB_NONE || zlib_dir ==
> ZLIB_DECOMPRESS);
> +	/* Decompressing with CompressDev */
> +	unsigned int oos_zlib_compress =
> +			(zlib_dir == ZLIB_NONE || zlib_dir ==
> ZLIB_COMPRESS);
>  	const struct rte_compressdev_capabilities *capa =
>  		rte_compressdev_capability_get(0,
> RTE_COMP_ALGO_DEFLATE);
>  	char *contig_buf = NULL;
> @@ -749,8 +759,12 @@ test_deflate_comp_decomp(const struct
> interim_data_params *int_data,
> 
>  	if (sgl) {
>  		for (i = 0; i < num_bufs; i++) {
> -			data_size = strlen(test_bufs[i]) *
> -				COMPRESS_BUF_SIZE_RATIO;
> +			if (out_of_space == 1 && oos_zlib_decompress) {
> +				data_size = OUT_OF_SPACE_BUF;
> +			} else {
> +				(data_size = strlen(test_bufs[i]) *
> +					COMPRESS_BUF_SIZE_RATIO);

No need for the parenthesis around this statement (plus, no need for the curly braces).


> +			}
>  			if (prepare_sgl_bufs(NULL, comp_bufs[i],
>  					data_size,
>  					ts_params->small_mbuf_pool,
> @@ -761,8 +775,12 @@ test_deflate_comp_decomp(const struct
> interim_data_params *int_data,
> 
>  	} else {
>  		for (i = 0; i < num_bufs; i++) {
> -			data_size = strlen(test_bufs[i]) *
> -				COMPRESS_BUF_SIZE_RATIO;
> +			if (out_of_space == 1 && oos_zlib_decompress) {
> +				data_size = OUT_OF_SPACE_BUF;
> +			} else {
> +				(data_size = strlen(test_bufs[i]) *
> +					COMPRESS_BUF_SIZE_RATIO);

Same here.

> +			}
>  			rte_pktmbuf_append(comp_bufs[i], data_size);
>  		}
>  	}
> @@ -928,6 +946,18 @@ test_deflate_comp_decomp(const struct
> interim_data_params *int_data,
>  	 * compress operation information is needed for the decompression
> stage)
>  	 */
>  	for (i = 0; i < num_bufs; i++) {
> +		if (out_of_space && oos_zlib_decompress) {
> +			if (ops_processed[i]->status !=
> +
> 	RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED) {

Better to add an extra tab here, even though you cross the 80 char limit.

> +				ret_status = -1;
> +
> +				RTE_LOG(ERR, USER1,
> +				"Out of Space operation was not
> successful\n");

I would reword this to something more clear, like:
Operation without expected out of space status error.
Also, make these changes in the decompression side of the function (code below).
Apart from this:

Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

  reply	other threads:[~2019-01-16 17:16 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14 15:33 [PATCH v1 1/2] test/compress: add out of space test Marko Kovacevic
2018-12-14 15:33 ` [PATCH v1 2/2] test/compress: add varied buffer input/outputs Marko Kovacevic
2018-12-14 15:56   ` Daly, Lee
2018-12-14 15:55 ` [PATCH v1 1/2] test/compress: add out of space test Daly, Lee
2018-12-20 14:58 ` [PATCH v2 " Marko Kovacevic
2018-12-20 14:58   ` [PATCH v2 2/2] test/compress: add varied buffer input/outputs Marko Kovacevic
2018-12-21  0:44     ` Trahe, Fiona
2019-01-09 17:02     ` De Lara Guarch, Pablo
2018-12-21  0:41   ` [PATCH v2 1/2] test/compress: add out of space test Trahe, Fiona
2019-01-09 16:47   ` De Lara Guarch, Pablo
2019-01-11 15:08   ` [PATCH v3 0/3] Compression Unit Tests Kovacevic, Marko
2019-01-11 15:08     ` [PATCH v3 1/3] test/compress: refactor main test function Kovacevic, Marko
2019-01-11 16:52       ` [PATCH v4 0/3] Compression Unit Tests Kovacevic, Marko
2019-01-11 16:52         ` [PATCH v4 1/3] test/compress: refactor main test function Kovacevic, Marko
2019-01-17 10:19           ` [PATCH v5 0/3] Compression Unit Tests Kovacevic, Marko
2019-01-17 10:19             ` [PATCH v5 1/3] test/compress: refactor main test function Kovacevic, Marko
2019-01-17 10:19             ` [PATCH v5 2/3] test/compress: add out of space test Kovacevic, Marko
2019-01-17 10:19             ` [PATCH v5 3/3] test/compress: add varied buffer input/outputs Kovacevic, Marko
2019-01-18  0:06             ` [PATCH v5 0/3] Compression Unit Tests Thomas Monjalon
2019-01-11 16:52         ` [PATCH v4 2/3] test/compress: add out of space test Kovacevic, Marko
2019-01-16 17:16           ` De Lara Guarch, Pablo [this message]
2019-01-11 16:52         ` [PATCH v4 3/3] test/compress: add varied buffer input/outputs Kovacevic, Marko
2019-01-16 17:21           ` De Lara Guarch, Pablo
2019-01-11 15:08     ` [PATCH v3 2/3] test/compress: add out of space test Kovacevic, Marko
2019-01-11 15:09     ` [PATCH v3 3/3] test/compress: add varied buffer input/outputs Kovacevic, Marko

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=E115CCD9D858EF4F90C690B0DCB4D897803664CF@irsmsx112.ger.corp.intel.com \
    --to=pablo.de.lara.guarch@intel.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=marko.kovacevic@intel.com \
    /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.