1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2018 Cavium Networks 3 */ 4 5 #ifndef _ZLIB_PMD_PRIVATE_H_ 6 #define _ZLIB_PMD_PRIVATE_H_ 7 8 #include <zlib.h> 9 #include <rte_compressdev.h> 10 #include <rte_compressdev_pmd.h> 11 12 #define COMPRESSDEV_NAME_ZLIB_PMD compress_zlib 13 /**< ZLIB PMD device name */ 14 15 #define DEF_MEM_LEVEL 8 16 17 extern int zlib_logtype_driver; 18 #define RTE_LOGTYPE_ZLIB_DRIVER zlib_logtype_driver 19 #define ZLIB_PMD_LOG(level, ...) \ 20 RTE_LOG_LINE_PREFIX(level, ZLIB_DRIVER, "%s(): ", __func__, __VA_ARGS__) 21 22 #define ZLIB_PMD_INFO(fmt, ...) \ 23 ZLIB_PMD_LOG(INFO, fmt, ## __VA_ARGS__) 24 #define ZLIB_PMD_ERR(fmt, ...) \ 25 ZLIB_PMD_LOG(ERR, fmt, ## __VA_ARGS__) 26 #define ZLIB_PMD_WARN(fmt, ...) \ 27 ZLIB_PMD_LOG(WARNING, fmt, ## __VA_ARGS__) 28 29 struct zlib_private { 30 struct rte_mempool *mp; 31 }; 32 33 struct __rte_cache_aligned zlib_qp { 34 struct rte_ring *processed_pkts; 35 /**< Ring for placing process packets */ 36 struct rte_compressdev_stats qp_stats; 37 /**< Queue pair statistics */ 38 uint16_t id; 39 /**< Queue Pair Identifier */ 40 char name[RTE_COMPRESSDEV_NAME_MAX_LEN]; 41 /**< Unique Queue Pair Name */ 42 }; 43 44 /* Algorithm handler function prototype */ 45 typedef void (*comp_func_t)(struct rte_comp_op *op, z_stream *strm); 46 47 typedef int (*comp_free_t)(z_stream *strm); 48 49 /** ZLIB Stream structure */ 50 struct __rte_cache_aligned zlib_stream { 51 z_stream strm; 52 /**< zlib stream structure */ 53 comp_func_t comp; 54 /**< Operation (compression/decompression) */ 55 comp_free_t free; 56 /**< Free Operation (compression/decompression) */ 57 }; 58 59 /** ZLIB private xform structure */ 60 struct __rte_cache_aligned zlib_priv_xform { 61 struct zlib_stream stream; 62 }; 63 64 int 65 zlib_set_stream_parameters(const struct rte_comp_xform *xform, 66 struct zlib_stream *stream); 67 68 /** Device specific operations function pointer structure */ 69 extern struct rte_compressdev_ops *rte_zlib_pmd_ops; 70 71 #endif /* _ZLIB_PMD_PRIVATE_H_ */ 72