From b7d364ea0ec99dc4ab601727aa1aa62bf770ab3a Mon Sep 17 00:00:00 2001 From: Tao Zeng Date: Mon, 9 Aug 2021 22:31:54 +0800 Subject: [PATCH] crypto: add parameters to control zstd compress level [1/1] PD#SWPL-57667 Problem: ZSTD compress level is fixed Solution: add module parameters to control it. By default, set compress level to 1 Verify: t5d am311 Signed-off-by: Tao Zeng Change-Id: I4c80eb8cd591c8a2197c7781e8afe589f121ffd7 --- crypto/zstd.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crypto/zstd.c b/crypto/zstd.c index 1a3309f066f7..5389cd48a687 100644 --- a/crypto/zstd.c +++ b/crypto/zstd.c @@ -12,10 +12,14 @@ #include #include #include +#include #include - +#ifdef CONFIG_AMLOGIC_MEMORY_OPT +static int zstd_def_level = 1; +#else #define ZSTD_DEF_LEVEL 3 +#endif struct zstd_ctx { ZSTD_CCtx *cctx; @@ -26,7 +30,11 @@ struct zstd_ctx { static ZSTD_parameters zstd_params(void) { +#ifdef CONFIG_AMLOGIC_MEMORY_OPT + return ZSTD_getParams(zstd_def_level, 0, 0); +#else return ZSTD_getParams(ZSTD_DEF_LEVEL, 0, 0); +#endif } static int zstd_comp_init(struct zstd_ctx *ctx) @@ -252,6 +260,9 @@ static void __exit zstd_mod_fini(void) subsys_initcall(zstd_mod_init); module_exit(zstd_mod_fini); +#ifdef CONFIG_AMLOGIC_MEMORY_OPT +module_param_named(zstd_level, zstd_def_level, int, 0644); +#endif MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Zstd Compression Algorithm");