> -----Original Message-----
> From: Daly, Lee
> Sent: Tuesday, April 17, 2018 2:35 PM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.gua...@intel.com>; Tucker, Greg B
> <greg.b.tuc...@intel.com>; Jain, Deepak K <deepak.k.j...@intel.com>; Trahe,
> Fiona <fiona.tr...@intel.com>; Daly, Lee <lee.d...@intel.com>
> Subject: [PATCH v3 08/11] compress/isal: add ISA-L compression functionality
> 
> Signed-off-by: Lee Daly <lee.d...@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.

Reply via email to