1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  *  Copyright (C) 2018 Chelsio Communications.  All rights reserved.
4  */
5 
6 #ifndef __CUDBG_ZLIB_H__
7 #define __CUDBG_ZLIB_H__
8 
9 #include <linux/zlib.h>
10 
11 #define CUDBG_ZLIB_COMPRESS_ID 17
12 #define CUDBG_ZLIB_WIN_BITS 12
13 #define CUDBG_ZLIB_MEM_LVL 4
14 
15 struct cudbg_compress_hdr {
16 	u32 compress_id;
17 	u64 decompress_size;
18 	u64 compress_size;
19 	u64 rsvd[32];
20 };
21 
cudbg_get_workspace_size(void)22 static inline int cudbg_get_workspace_size(void)
23 {
24 	return zlib_deflate_workspacesize(CUDBG_ZLIB_WIN_BITS,
25 					  CUDBG_ZLIB_MEM_LVL);
26 }
27 
28 int cudbg_compress_buff(struct cudbg_init *pdbg_init,
29 			struct cudbg_buffer *pin_buff,
30 			struct cudbg_buffer *pout_buff);
31 #endif /* __CUDBG_ZLIB_H__ */
32