Hi Marko,

Minor comments.

> -----Original Message-----
> From: Kovacevic, Marko
> Sent: Friday, January 11, 2019 4:53 PM
> To: dev@dpdk.org
> Cc: akhil.go...@nxp.com; De Lara Guarch, Pablo
> <pablo.de.lara.gua...@intel.com>; Kovacevic, Marko
> <marko.kovace...@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.kovace...@intel.com>
> Acked-by: Lee Daly <lee.d...@intel.com>
> Acked-by: Fiona Trahe <fiona.tr...@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.gua...@intel.com>

Reply via email to