xref: /dpdk/drivers/compress/nitrox/nitrox_comp_reqmgr.h (revision 6ea6bcdd7081b0712812046cb4d21a8994273fbd)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2024 Marvell.
3  */
4 
5 #ifndef _NITROX_COMP_REQMGR_H_
6 #define _NITROX_COMP_REQMGR_H_
7 
8 struct nitrox_softreq;
9 
10 enum nitrox_comp_op {
11 	NITROX_COMP_OP_DECOMPRESS,
12 	NITROX_COMP_OP_COMPRESS,
13 };
14 
15 enum nitrox_comp_algo {
16 	NITROX_COMP_ALGO_DEFLATE_DEFAULT,
17 	NITROX_COMP_ALGO_DEFLATE_DYNHUFF,
18 	NITROX_COMP_ALGO_DEFLATE_FIXEDHUFF,
19 	NITROX_COMP_ALGO_LZS,
20 };
21 
22 enum nitrox_comp_level {
23 	NITROX_COMP_LEVEL_BEST,
24 	NITROX_COMP_LEVEL_MEDIUM,
25 	NITROX_COMP_LEVEL_LOWER,
26 	NITROX_COMP_LEVEL_LOWEST,
27 };
28 
29 enum nitrox_chksum_type {
30 	NITROX_CHKSUM_TYPE_CRC32,
31 	NITROX_CHKSUM_TYPE_ADLER32,
32 	NITROX_CHKSUM_TYPE_NONE,
33 };
34 
35 struct nitrox_comp_xform {
36 	enum nitrox_comp_op op;
37 	enum nitrox_comp_algo algo;
38 	enum nitrox_comp_level level;
39 	enum nitrox_chksum_type chksum_type;
40 	uint8_t *context;
41 	uint8_t *history_window;
42 	uint32_t chksum;
43 	uint16_t window_size;
44 	uint16_t hlen;
45 	uint8_t exn;
46 	uint8_t exbits;
47 	bool bf;
48 };
49 
50 int nitrox_process_comp_req(struct rte_comp_op *op, struct nitrox_softreq *sr);
51 int nitrox_check_comp_req(struct nitrox_softreq *sr, struct rte_comp_op **op);
52 void *nitrox_comp_instr_addr(struct nitrox_softreq *sr);
53 struct rte_mempool *nitrox_comp_req_pool_create(struct rte_compressdev *cdev,
54 					       uint32_t nobjs, uint16_t qp_id,
55 					       int socket_id);
56 void nitrox_comp_req_pool_free(struct rte_mempool *mp);
57 
58 #endif /* _NITROX_COMP_REQMGR_H_ */
59