mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
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 <tao.zeng@amlogic.com> Change-Id: I4c80eb8cd591c8a2197c7781e8afe589f121ffd7
This commit is contained in:
@@ -12,10 +12,14 @@
|
||||
#include <linux/net.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/zstd.h>
|
||||
#include <linux/sched/clock.h>
|
||||
#include <crypto/internal/scompress.h>
|
||||
|
||||
|
||||
#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");
|
||||
|
||||
Reference in New Issue
Block a user