summaryrefslogtreecommitdiff
path: root/lib/zlib_dfltcc/dfltcc.h
diff options
context:
space:
mode:
authorMikhail Zaslonko <zaslonko@linux.ibm.com>2023-01-26 14:14:21 +0100
committerAndrew Morton <akpm@linux-foundation.org>2023-02-02 22:50:08 -0800
commit4cc06c9afbb4dbed007f06450127ab745d6dc450 (patch)
tree7823ab9e830f0d1726d927340e86ef7868ba08da /lib/zlib_dfltcc/dfltcc.h
parent5124a0a549857c4b87173280e192eea24dea72ad (diff)
lib/zlib: adjust offset calculation for dfltcc_state
Patch series "lib/zlib: Set of s390 DFLTCC related patches for kernel zlib". Patches 1-7 represent a set of s390 zlib hardware support (DFLTCC) related fixes and enhancements integrated from zlib-ng repo relevant to kernel zlib (https://github.com/zlib-ng/zlib-ng). Since the official zlib repository never got DFLTCC support code merged, all the patches have been picked from zlib-ng fork (zlib data compression library for the next generation systems). This repo contains new optimizations and fixes not getting implemented into the official zlib repository and falls under the same zlib License. All of the original patches from zlib-ng were authored by Ilya Leoshkevich <iii@linux.ibm.com>. Coding style has been preserved for future maintainability. Patches 1-2 should have no effect for the kernel zlib but make the code closer to zlib-ng for future maintainability. Only Patch 3 touches common zlib_deflate code, other patches are relevant to s390 tree only. Patch 8 is separate and intends to resolve an issue with kernel PPP driver which can use kernel zlib for packet compression. Without this patch PPP decompression can fail due to error code returned by hardware (dfltcc_inflate) and PPP disables zlib compression for further packets. This patch (of 8): This commit is based on: https://github.com/zlib-ng/zlib-ng/commit/d8b67f5 Link: https://lkml.kernel.org/r/20230126131428.1222214-1-zaslonko@linux.ibm.com Link: https://lkml.kernel.org/r/20230126131428.1222214-2-zaslonko@linux.ibm.com Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com> Acked-by: Ilya Leoshkevich <iii@linux.ibm.com> Cc: Heiko Carstens <hca@linux.ibm.com> (s390) Cc: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'lib/zlib_dfltcc/dfltcc.h')
-rw-r--r--lib/zlib_dfltcc/dfltcc.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/zlib_dfltcc/dfltcc.h b/lib/zlib_dfltcc/dfltcc.h
index 2a2fac1d050a..1f63094366e9 100644
--- a/lib/zlib_dfltcc/dfltcc.h
+++ b/lib/zlib_dfltcc/dfltcc.h
@@ -100,8 +100,9 @@ struct dfltcc_state {
char msg[64]; /* Buffer for strm->msg */
};
+#define ALIGN_UP(p, size) (__typeof__(p))(((uintptr_t)(p) + ((size) - 1)) & ~((size) - 1))
/* Resides right after inflate_state or deflate_state */
-#define GET_DFLTCC_STATE(state) ((struct dfltcc_state *)((state) + 1))
+#define GET_DFLTCC_STATE(state) ((struct dfltcc_state *)((char *)(state) + ALIGN_UP(sizeof(*state), 8)))
/* External functions */
int dfltcc_can_deflate(z_streamp strm);