GNU Linux-libre 4.19.286-gnu1
[releases.git] / drivers / net / ethernet / chelsio / cxgb4 / cudbg_zlib.h
1 /*
2  *  Copyright (C) 2018 Chelsio Communications.  All rights reserved.
3  *
4  *  This program is free software; you can redistribute it and/or modify it
5  *  under the terms and conditions of the GNU General Public License,
6  *  version 2, as published by the Free Software Foundation.
7  *
8  *  This program is distributed in the hope it will be useful, but WITHOUT
9  *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11  *  more details.
12  *
13  *  The full GNU General Public License is included in this distribution in
14  *  the file called "COPYING".
15  *
16  */
17
18 #ifndef __CUDBG_ZLIB_H__
19 #define __CUDBG_ZLIB_H__
20
21 #include <linux/zlib.h>
22
23 #define CUDBG_ZLIB_COMPRESS_ID 17
24 #define CUDBG_ZLIB_WIN_BITS 12
25 #define CUDBG_ZLIB_MEM_LVL 4
26
27 struct cudbg_compress_hdr {
28         u32 compress_id;
29         u64 decompress_size;
30         u64 compress_size;
31         u64 rsvd[32];
32 };
33
34 static inline int cudbg_get_workspace_size(void)
35 {
36         return zlib_deflate_workspacesize(CUDBG_ZLIB_WIN_BITS,
37                                           CUDBG_ZLIB_MEM_LVL);
38 }
39
40 int cudbg_compress_buff(struct cudbg_init *pdbg_init,
41                         struct cudbg_buffer *pin_buff,
42                         struct cudbg_buffer *pout_buff);
43 #endif /* __CUDBG_ZLIB_H__ */