From b7f646e8b285e0813820300a6d83865d131b27f5 Mon Sep 17 00:00:00 2001 From: Olasoji Date: Thu, 23 Oct 2025 14:46:58 -0700 Subject: [PATCH 1/5] Adds test to validate log_stats_samples config Signed-off-by: Olasoji --- tests/zlib_accel_test.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/zlib_accel_test.cpp b/tests/zlib_accel_test.cpp index 6d66f9c..33d024a 100644 --- a/tests/zlib_accel_test.cpp +++ b/tests/zlib_accel_test.cpp @@ -1231,6 +1231,7 @@ void CreateAndWriteTempConfigFile(const char* file_path) { temp_file << "use_zlib_compress=!0222\n"; temp_file << "use_zlib_uncompress=AB23\n"; temp_file << "log_level=10\n"; + temp_file << "log_stats_samples=4294967296\n"; temp_file.close(); } @@ -1243,6 +1244,7 @@ TEST_F(ConfigLoaderTest, LoadInvalidConfig) { uint32_t DEFAULT_ZLIB_COMPRESS = GetConfig(USE_ZLIB_COMPRESS); uint32_t DEFAULT_ZLIB_UNCOMPRESS = GetConfig(USE_ZLIB_UNCOMPRESS); uint32_t DEFAULT_LOG_LEVEL = GetConfig(LOG_LEVEL); + uint32_t DEFAULT_LOG_STATS_SAMPLES = GetConfig(LOG_STATS_SAMPLES); CreateAndWriteTempConfigFile("/tmp/invalid_config"); EXPECT_TRUE(LoadConfigFile(file_content, "/tmp/invalid_config")); @@ -1253,6 +1255,7 @@ TEST_F(ConfigLoaderTest, LoadInvalidConfig) { EXPECT_EQ(GetConfig(USE_ZLIB_COMPRESS), DEFAULT_ZLIB_COMPRESS); EXPECT_EQ(GetConfig(USE_ZLIB_UNCOMPRESS), DEFAULT_ZLIB_UNCOMPRESS); EXPECT_EQ(GetConfig(LOG_LEVEL), DEFAULT_LOG_LEVEL); + EXPECT_EQ(GetConfig(LOG_STATS_SAMPLES), DEFAULT_LOG_STATS_SAMPLES); std::remove("/tmp/invalid_config"); // Restore config from official config file LoadConfigFile(file_content); From db531ffb6db578628a824b90fbe685dcc6ad0e41 Mon Sep 17 00:00:00 2001 From: Olasoji Date: Wed, 17 Dec 2025 16:01:34 -0800 Subject: [PATCH 2/5] Reduces excessive error logging in QAT mode Signed-off-by: Olasoji --- qat.cpp | 1 + qat.h | 2 ++ zlib_accel.cpp | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/qat.cpp b/qat.cpp index 2ef4c0c..d5bc57e 100644 --- a/qat.cpp +++ b/qat.cpp @@ -100,6 +100,7 @@ void QATJob::Init(QzSessionPtr &qzSession, CompressedFormat format, } // Initialize QAT hardware + qzSetLogLevel(LOG_NONE); int status = qzInit(session.get(), 0); if (status != QZ_OK && status != QZ_DUPLICATE) { Log(LogLevel::LOG_ERROR, "qzInit() failure Line ", __LINE__, " session ", diff --git a/qat.h b/qat.h index 3a04045..f81285e 100644 --- a/qat.h +++ b/qat.h @@ -14,6 +14,8 @@ #define VISIBLE_FOR_TESTING __attribute__((visibility("default"))) +inline constexpr unsigned int QAT_DEST_BUFFER_MIN_SIZE = 512; + inline constexpr unsigned int QAT_HW_BUFF_SZ = QZ_HW_BUFF_MAX_SZ; class QATJob { diff --git a/zlib_accel.cpp b/zlib_accel.cpp index e260841..018f7e1 100644 --- a/zlib_accel.cpp +++ b/zlib_accel.cpp @@ -297,6 +297,7 @@ int ZEXPORT deflate(z_streamp strm, int flush) { #ifdef USE_QAT qat_available = configs[USE_QAT_COMPRESS] && + output_len >= QAT_DEST_BUFFER_MIN_SIZE && SupportedOptionsQAT(deflate_settings->window_bits, input_len); #endif @@ -1352,7 +1353,6 @@ int ZEXPORT gzeof(gzFile file) { GzipFile* gz = gzip_files.Get(file); return gz->reached_eof; } - #if defined(__clang__) #pragma clang attribute pop #endif From 5d513a4659e427d39a2d419dc645763abb0b36c7 Mon Sep 17 00:00:00 2001 From: Olasoji Date: Wed, 17 Dec 2025 16:05:22 -0800 Subject: [PATCH 3/5] Bugfix for the log stream Signed-off-by: Olasoji --- logging.h | 1 + 1 file changed, 1 insertion(+) diff --git a/logging.h b/logging.h index 7b74d9f..b5e8301 100644 --- a/logging.h +++ b/logging.h @@ -61,6 +61,7 @@ inline void Log(LogLevel level, Args&&... args) { } std::ostream& stream = GetLogStream(); + stream << std::dec; switch (level) { case LogLevel::LOG_ERROR: stream << "Error: "; From 9aff4f8c50af5b3bd3ae92c24af17848a8338ccd Mon Sep 17 00:00:00 2001 From: Olasoji Date: Wed, 17 Dec 2025 16:07:54 -0800 Subject: [PATCH 4/5] Treats QPL_STS_MORE_OUTPUT_NEEDED as a non error condition for IAA Signed-off-by: Olasoji --- iaa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iaa.cpp b/iaa.cpp index 1ec6fe2..2e0ca66 100644 --- a/iaa.cpp +++ b/iaa.cpp @@ -218,7 +218,7 @@ int UncompressIAA(uint8_t* input, uint32_t* input_length, uint8_t* output, job->dictionary = nullptr; qpl_status status = qpl_execute_job(job); - if (status != QPL_STS_OK) { + if (status != QPL_STS_OK && status != QPL_STS_MORE_OUTPUT_NEEDED) { Log(LogLevel::LOG_ERROR, "UncompressIAA() Line ", __LINE__, " qpl_execute_job status ", status, "\n"); return 1; From 806ce1dd91df3e071b1f1108a5b54a61754e70d0 Mon Sep 17 00:00:00 2001 From: Olasoji Date: Thu, 18 Dec 2025 11:11:30 -0800 Subject: [PATCH 5/5] Fixed formatting Signed-off-by: Olasoji --- zlib_accel.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/zlib_accel.cpp b/zlib_accel.cpp index 018f7e1..72c5105 100644 --- a/zlib_accel.cpp +++ b/zlib_accel.cpp @@ -296,8 +296,7 @@ int ZEXPORT deflate(z_streamp strm, int flush) { #endif #ifdef USE_QAT qat_available = - configs[USE_QAT_COMPRESS] && - output_len >= QAT_DEST_BUFFER_MIN_SIZE && + configs[USE_QAT_COMPRESS] && output_len >= QAT_DEST_BUFFER_MIN_SIZE && SupportedOptionsQAT(deflate_settings->window_bits, input_len); #endif