[dpdk-dev] [PATCH v1 3/7] compress/octeontx: add xform and stream create support

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Wed Jun 20 00:13:27 CEST 2018



> -----Original Message-----
> From: Shally Verma [mailto:shally.verma at caviumnetworks.com]
> Sent: Tuesday, June 5, 2018 11:35 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>
> Cc: Trahe, Fiona <fiona.trahe at intel.com>; dev at dpdk.org;
> pathreya at caviumnetworks.com; mchalla at caviumnetworks.com; Ashish Gupta
> <ashish.gupta at caviumnetworks.com>; Sunila Sahu
> <sunila.sahu at caviumnetworks.com>
> Subject: [PATCH v1 3/7] compress/octeontx: add xform and stream create
> support
> 
> implement private xform and stream create ops
> 
> Signed-off-by: Ashish Gupta <ashish.gupta at caviumnetworks.com>
> Signed-off-by: Shally Verma <shally.verma at caviumnetworks.com>
> Signed-off-by: Sunila Sahu <sunila.sahu at caviumnetworks.com>
> ---
>  drivers/compress/octeontx/zip_pmd.c | 138
> ++++++++++++++++++++++++++++++++++++
>  drivers/compress/octeontx/zipvf.h   |  29 ++++++++
>  2 files changed, 167 insertions(+)
> 
> diff --git a/drivers/compress/octeontx/zip_pmd.c
> b/drivers/compress/octeontx/zip_pmd.c
> index 3bb7f6896..349114626 100644
> --- a/drivers/compress/octeontx/zip_pmd.c
> +++ b/drivers/compress/octeontx/zip_pmd.c

...

> +static int
> +zip_pmd_stream_create(struct rte_compressdev *dev,
> +		const struct rte_comp_xform *xform, void **stream) {
> +	int ret;
> +	struct zip_stream *strm;
> +
> +	strm = rte_malloc(NULL,
> +			sizeof(struct zip_stream), 0);

Should not this come from a mempool, as there is an option
in the configuration for max number of sessions.


> +	ret = zip_set_stream_parameters(dev, xform, strm);
> +	if (ret < 0) {
> +		ZIP_PMD_ERR("failed configure xform parameters");
> +		rte_free(strm);
> +		return ret;
> +	}
> +	*stream = strm;		
> +	return 0;
> +}
> +
> +static int
> +zip_pmd_stream_free(struct rte_compressdev *dev, void *stream) {
> +	struct zip_vf *vf = (struct zip_vf *) (dev->data->dev_private);
> +	struct zip_stream *z_stream;
> +
> +	if (stream == NULL)
> +		return -1;
> +
> +	z_stream = (struct zip_stream *)stream;
> +	rte_mempool_put_bulk(vf->zip_mp,
> +			     (void *)&(z_stream->bufs[0]),
> +			     MAX_BUFS_PER_STREAM);
> +
> +	/* Zero out the whole structure */
> +	memset(stream, 0, sizeof(struct zip_stream));
> +	rte_free(stream);

I was expecting this stream to be put back into a mempool,
but anyway, there is no need to reset this structure if you are freeing the memory then.




More information about the dev mailing list