[dpdk-dev] [PATCH v3 08/11] compress/isal: add ISA-L compression functionality

De Lara Guarch, Pablo pablo.de.lara.guarch at intel.com
Tue Apr 24 12:05:34 CEST 2018



> -----Original Message-----
> From: Daly, Lee
> Sent: Tuesday, April 17, 2018 2:35 PM
> To: dev at dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>; Tucker, Greg B
> <greg.b.tucker at intel.com>; Jain, Deepak K <deepak.k.jain at intel.com>; Trahe,
> Fiona <fiona.trahe at intel.com>; Daly, Lee <lee.daly at intel.com>
> Subject: [PATCH v3 08/11] compress/isal: add ISA-L compression functionality
> 
> Signed-off-by: Lee Daly <lee.daly at intel.com>
> ---
>  drivers/compress/isal/isal_compress_pmd.c         | 108

...

> +/* Stateless Compression Function */
> +static int
> +process_isal_deflate(struct rte_comp_op *op, struct isal_comp_qp *qp,
> +		struct isal_priv_xform *priv_xform)
> +{
> +	int ret = 0;
> +	op->status = RTE_COMP_OP_STATUS_SUCCESS;
> +
> +	/* Required due to init clearing level_buf */
> +	uint8_t *temp_level_buf = qp->stream->level_buf;
> +
> +	/* Initialize compression stream */
> +	isal_deflate_stateless_init(qp->stream);
> +
> +	qp->stream->level_buf = temp_level_buf;
> +
> +	qp->stream->flush = NO_FLUSH;
> +
> +	/* Set op checksum, none by default */
> +	if (priv_xform->compress.chksum == RTE_COMP_CHECKSUM_CRC32)
> +		qp->stream->gzip_flag = IGZIP_GZIP;
> +	else if (priv_xform->compress.chksum ==
> RTE_COMP_CHECKSUM_ADLER32)
> +		qp->stream->gzip_flag = IGZIP_ZLIB;
> +
> +	/* set op level & intermediate level buffer */
> +	if (priv_xform->compress.level == RTE_COMP_ISAL_LEVEL_ZERO) {
> +		qp->stream->level = ISAL_DEF_MIN_LEVEL;
> +		qp->stream->level_buf_size = ISAL_DEF_LVL0_DEFAULT;
> +	} else if (priv_xform->compress.level == RTE_COMP_ISAL_LEVEL_ONE) {
> +		qp->stream->level = RTE_COMP_ISAL_LEVEL_ONE;
> +		qp->stream->level_buf_size = ISAL_DEF_LVL1_DEFAULT;
> +	} else if (priv_xform->compress.level == RTE_COMP_ISAL_LEVEL_TWO)
> {
> +		qp->stream->level = RTE_COMP_ISAL_LEVEL_TWO;
> +		qp->stream->level_buf_size = ISAL_DEF_LVL2_DEFAULT;
> +	} else {
> +		qp->stream->level = ISAL_DEF_MAX_LEVEL;
> +		qp->stream->level_buf_size = ISAL_DEF_LVL3_DEFAULT;
> +	}

Better to store directly "level", "level_buf_size" and "gzip_flag" in priv_xform,
and setting them when creating it. That way, you save these branches
in data path.



More information about the dev mailing list