]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | /* SPDX-License-Identifier: BSD-3-Clause |
2 | * Copyright(c) 2018 Cavium Networks | |
3 | */ | |
4 | ||
f67539c2 TL |
5 | #ifndef _ZLIB_PMD_PRIVATE_H_ |
6 | #define _ZLIB_PMD_PRIVATE_H_ | |
11fdf7f2 TL |
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 | ||
f67539c2 | 17 | extern int zlib_logtype_driver; |
11fdf7f2 TL |
18 | #define ZLIB_PMD_LOG(level, fmt, args...) \ |
19 | rte_log(RTE_LOG_ ## level, zlib_logtype_driver, "%s(): "fmt "\n", \ | |
20 | __func__, ##args) | |
21 | ||
22 | #define ZLIB_PMD_INFO(fmt, args...) \ | |
23 | ZLIB_PMD_LOG(INFO, fmt, ## args) | |
24 | #define ZLIB_PMD_ERR(fmt, args...) \ | |
25 | ZLIB_PMD_LOG(ERR, fmt, ## args) | |
26 | #define ZLIB_PMD_WARN(fmt, args...) \ | |
27 | ZLIB_PMD_LOG(WARNING, fmt, ## args) | |
28 | ||
29 | struct zlib_private { | |
30 | struct rte_mempool *mp; | |
31 | }; | |
32 | ||
33 | struct 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 | } __rte_cache_aligned; | |
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 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 | } __rte_cache_aligned; | |
58 | ||
59 | /** ZLIB private xform structure */ | |
60 | struct zlib_priv_xform { | |
61 | struct zlib_stream stream; | |
62 | } __rte_cache_aligned; | |
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 | ||
f67539c2 | 71 | #endif /* _ZLIB_PMD_PRIVATE_H_ */ |