On Thu, 18 Sep 2025 14:32:10 -0600
Sameer Vaze <sv...@qti.qualcomm.com> wrote:

> Adds support to provide predefined dictionaries to zlib. Handles setting
> and getting of dictionaries using zlib apis. Also includes support to
> read dictionary files
> 
> Adds support for passing in and validationg 3GPP PDCP spec defined
> checksums as defined under the Uplink Data Compression(UDC) feature.
> Changes also include functions that do inflate or deflate specfic
> checksum operations.
> 
> Signed-off-by: Sameer Vaze <sv...@qti.qualcomm.com>
> ---
>  drivers/compress/zlib/zlib_pmd.c         | 173 +++++++++++++++++++++--
>  drivers/compress/zlib/zlib_pmd_private.h |   8 ++
>  lib/compressdev/rte_comp.h               |  31 ++++
>  3 files changed, 203 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/compress/zlib/zlib_pmd.c 
> b/drivers/compress/zlib/zlib_pmd.c
> index 92e808e78c..1b1abd72e7 100644
> --- a/drivers/compress/zlib/zlib_pmd.c
> +++ b/drivers/compress/zlib/zlib_pmd.c
> @@ -4,6 +4,7 @@
>  
>  #include <bus_vdev_driver.h>
>  #include <rte_common.h>
> +#include <rte_malloc.h>
>  
>  #include "zlib_pmd_private.h"
>  
> @@ -15,6 +16,120 @@
>               (data = rte_pktmbuf_mtod(mbuf, uint8_t *)),     \
>               (len = rte_pktmbuf_data_len(mbuf)) : 0)
>  
> +#define BOTTOM_NIBBLE_OF_BYTE 0xf
> +#define TOP_NIBBLE_OF_BYTE 0xf0
> +
> +static void
> +process_zlib_deflate_chksum(struct rte_comp_op *op,
> +             z_stream *strm, enum rte_comp_checksum_type chksum)
> +{
> +     uint8_t *dictionary = NULL;

Maybe best to not initialize this. That way if there attempts
to use the variable when still NULL, the compiler can detect
use of uninitialized variable.

> +     uint32_t dictionary_len = 0;
> +     op->status = RTE_COMP_OP_STATUS_SUCCESS;
> +
> +     switch (chksum) {
> +     case RTE_COMP_CHECKSUM_NONE:
> +     case RTE_COMP_CHECKSUM_CRC32:
> +     case RTE_COMP_CHECKSUM_ADLER32:
> +     case RTE_COMP_CHECKSUM_CRC32_ADLER32:
> +             ZLIB_PMD_ERR("Checksum type not supported");
> +             op->status = RTE_COMP_OP_STATUS_INVALID_ARGS;
> +             break;

Why is this different than the default case?

> +     case RTE_COMP_CHECKSUM_3GPP_PDCP_UDC:
> +             dictionary = rte_zmalloc(NULL, DEFLATE_MAX_WINDOW_SIZE, 0);

Is there a requirement that the dictionary be in huge pages.
If not use malloc() since that has better error checking.

Reply via email to