libwd/0031-uadk-reduce-the-print-rating-of-specific-logs.patch
2024-11-19 11:51:09 +08:00

127 lines
3.8 KiB
Diff

From c103303271a64066c38ae6ada5d68a789e39949a Mon Sep 17 00:00:00 2001
From: Chenghai Huang <huangchenghai2@huawei.com>
Date: Sat, 12 Oct 2024 11:02:15 +0800
Subject: [PATCH 31/39] uadk - reduce the print rating of specific logs
Reduce the frequency of printing error logs when the status
is 0xe for avoid a large amount of printed information.
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Qi Tao <taoqi10@huawei.com>
---
drv/hisi_comp.c | 11 +++++++++--
v1/drv/hisi_zip_udrv.c | 40 ++++++++++++++++++++++++++++++++++++----
2 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/drv/hisi_comp.c b/drv/hisi_comp.c
index b4c216f..07d8754 100644
--- a/drv/hisi_comp.c
+++ b/drv/hisi_comp.c
@@ -29,6 +29,9 @@
#define ZSTD_MAX_SIZE (1 << 17)
+/* Error status 0xe indicates that dest_avail_out insufficient */
+#define ERR_DSTLEN_OUT 0xe
+
#define swab32(x) \
((((x) & 0x000000ff) << 24) | \
(((x) & 0x0000ff00) << 8) | \
@@ -1039,8 +1042,12 @@ static int parse_zip_sqe(struct hisi_qp *qp, struct hisi_zip_sqe *sqe,
if (unlikely(status != 0 && status != HZ_NEGACOMPRESS &&
status != HZ_CRC_ERR && status != HZ_DECOMP_END)) {
- WD_ERR("bad request(ctx_st = 0x%x, status = 0x%x, algorithm type = %u)!\n",
- ctx_st, status, type);
+ if (status == ERR_DSTLEN_OUT)
+ WD_DEBUG("bad request(ctx_st=0x%x, status=0x%x, algorithm type=%u)!\n",
+ ctx_st, status, type);
+ else
+ WD_ERR("bad request(ctx_st=0x%x, status=0x%x, algorithm type=%u)!\n",
+ ctx_st, status, type);
recv_msg->req.status = WD_IN_EPARA;
}
diff --git a/v1/drv/hisi_zip_udrv.c b/v1/drv/hisi_zip_udrv.c
index 01d76a3..8497ebc 100644
--- a/v1/drv/hisi_zip_udrv.c
+++ b/v1/drv/hisi_zip_udrv.c
@@ -26,6 +26,7 @@
#include <sys/ioctl.h>
#include <sys/epoll.h>
#include <sys/eventfd.h>
+#include <sys/wait.h>
#include <sys/types.h>
#include "v1/wd_util.h"
#include "v1/wd_comp.h"
@@ -57,6 +58,10 @@
#define ZSTD_FREQ_DATA_SIZE 784
#define REPCODE_SIZE 12
+/* Error status 0xe indicates that dest_avail_out insufficient */
+#define ERR_DSTLEN_OUT 0xe
+#define PRINT_TIME_INTERVAL 21600
+
#define CTX_PRIV1_OFFSET 4
#define CTX_PRIV2_OFFSET 8
#define CTX_REPCODE1_OFFSET 12
@@ -95,6 +100,35 @@ struct zip_fill_sqe_ops {
void (*fill_sqe_hw_info)(void *ssqe, struct wcrypto_comp_msg *msg);
};
+static unsigned int g_err_print_enable = 1;
+
+static void zip_err_print_alarm_end(int sig)
+{
+ if (sig == SIGALRM) {
+ g_err_print_enable = 1;
+ alarm(0);
+ }
+}
+
+static void zip_err_print_time_start(void)
+{
+ g_err_print_enable = 0;
+ signal(SIGALRM, zip_err_print_alarm_end);
+ alarm(PRINT_TIME_INTERVAL);
+}
+
+static void zip_err_bd_print(__u16 ctx_st, __u32 status, __u32 type)
+{
+ if (status != ERR_DSTLEN_OUT) {
+ WD_ERR("bad status(ctx_st=0x%x, s=0x%x, t=%u)\n",
+ ctx_st, status, type);
+ } else if (g_err_print_enable == 1) {
+ WD_ERR("bad status(ctx_st=0x%x, s=0x%x, t=%u)\n",
+ ctx_st, status, type);
+ zip_err_print_time_start();
+ }
+}
+
static int fill_zip_comp_alg_v1(struct hisi_zip_sqe *sqe,
struct wcrypto_comp_msg *msg)
{
@@ -274,8 +308,7 @@ int qm_parse_zip_sqe(void *hw_msg, const struct qm_queue_info *info,
if (status != 0 && status != HW_NEGACOMPRESS &&
status != HW_CRC_ERR && status != HW_DECOMP_END) {
- WD_ERR("bad status(ctx_st=0x%x, s=0x%x, t=%u)\n",
- ctx_st, status, type);
+ zip_err_bd_print(ctx_st, status, type);
recv_msg->status = WD_IN_EPARA;
} else {
recv_msg->status = 0;
@@ -707,8 +740,7 @@ int qm_parse_zip_sqe_v3(void *hw_msg, const struct qm_queue_info *info,
return 0;
if (status != 0 && status != HW_NEGACOMPRESS && status != HW_DECOMP_END) {
- WD_ERR("bad status(ctx_st=0x%x, s=0x%x, t=%u)\n",
- ctx_st, status, type);
+ zip_err_bd_print(ctx_st, status, type);
recv_msg->status = WD_IN_EPARA;
} else {
recv_msg->status = 0;
--
2.25.1