18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  Copyright (C) 2018 Chelsio Communications.  All rights reserved.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __CUDBG_ZLIB_H__
78c2ecf20Sopenharmony_ci#define __CUDBG_ZLIB_H__
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/zlib.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define CUDBG_ZLIB_COMPRESS_ID 17
128c2ecf20Sopenharmony_ci#define CUDBG_ZLIB_WIN_BITS 12
138c2ecf20Sopenharmony_ci#define CUDBG_ZLIB_MEM_LVL 4
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cistruct cudbg_compress_hdr {
168c2ecf20Sopenharmony_ci	u32 compress_id;
178c2ecf20Sopenharmony_ci	u64 decompress_size;
188c2ecf20Sopenharmony_ci	u64 compress_size;
198c2ecf20Sopenharmony_ci	u64 rsvd[32];
208c2ecf20Sopenharmony_ci};
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cistatic inline int cudbg_get_workspace_size(void)
238c2ecf20Sopenharmony_ci{
248c2ecf20Sopenharmony_ci	return zlib_deflate_workspacesize(CUDBG_ZLIB_WIN_BITS,
258c2ecf20Sopenharmony_ci					  CUDBG_ZLIB_MEM_LVL);
268c2ecf20Sopenharmony_ci}
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciint cudbg_compress_buff(struct cudbg_init *pdbg_init,
298c2ecf20Sopenharmony_ci			struct cudbg_buffer *pin_buff,
308c2ecf20Sopenharmony_ci			struct cudbg_buffer *pout_buff);
318c2ecf20Sopenharmony_ci#endif /* __CUDBG_ZLIB_H__ */
32