[dpdk-dev] [EXT] [PATCH v4 3/6] app/test-compress-perf: add verification test case

Shally Verma shallyv at marvell.com
Sun Jun 30 16:55:13 CEST 2019



> -----Original Message-----
> From: Tomasz Jozwiak <tjozwiakgm at gmail.com>
> Sent: Friday, June 28, 2019 3:56 AM
> To: dev at dpdk.org; fiona.trahe at intel.com; tjozwiakgm at gmail.com; Shally
> Verma <shallyv at marvell.com>; arturx.trybula at intel.com
> Subject: [EXT] [PATCH v4 3/6] app/test-compress-perf: add verification test
> case
> 
> External Email
> 
> ----------------------------------------------------------------------
> From: Tomasz Jozwiak <tomaszx.jozwiak at intel.com>
...

> diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-
> compress-perf/comp_perf_test_verify.c
> index 28a0fe8..c2aab70 100644
> --- a/app/test-compress-perf/comp_perf_test_verify.c
> +++ b/app/test-compress-perf/comp_perf_test_verify.c
> @@ -8,14 +8,48 @@
>  #include <rte_compressdev.h>
> 
>  #include "comp_perf_test_verify.h"
> +#include "comp_perf_test_common.h"
> +
> +void
> +cperf_verify_test_destructor(void *arg) {
> +	if (arg) {
> +		comp_perf_free_memory(&((struct cperf_verify_ctx *)arg)-
> >mem);
> +		rte_free(arg);
> +	}
> +}
> +
> +void *
> +cperf_verify_test_constructor(uint8_t dev_id, uint16_t qp_id,
> +		struct comp_test_data *options)
> +{
> +	struct cperf_verify_ctx *ctx = NULL;
> +
> +	ctx = rte_malloc(NULL, sizeof(struct cperf_verify_ctx), 0);
> +
Better just return from here

> +	if (ctx != NULL) {
> +		ctx->mem.dev_id = dev_id;
> +		ctx->mem.qp_id = qp_id;
> +		ctx->options = options;
> +
> +		if (!comp_perf_allocate_memory(ctx->options, &ctx->mem)
> &&
> +		    !prepare_bufs(ctx->options, &ctx->mem))
> +			return ctx;
What if condition fails on comp_per_allocate_memory(), then it will go to verify_test_destructor(), so comp_perf_free_memory() check if mem != NULL before calling actual free?

> +	}
> +
> +	cperf_verify_test_destructor(ctx);
> +	return NULL;
> +}
> 
>  static int
> -main_loop(struct comp_test_data *test_data, uint8_t level,
> -			enum rte_comp_xform_type type,
> -			uint8_t *output_data_ptr,
> -			size_t *output_data_sz)
> +main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type)

...
> --
> 2.7.4



More information about the dev mailing list