From 71b3726dc748d2c0d17067a8261a956c7898a28c Mon Sep 17 00:00:00 2001 From: cee_mac <2710242656@qq.com> Date: Thu, 23 Nov 2023 16:38:44 +0800 Subject: [PATCH] fix qos level shift in user and kernel Signed-off-by: cee_mac <2710242656@qq.com> --- qos_auth/auth_ctl/qos_ctrl.c | 7 ++----- qos_auth/auth_ctl/qos_ctrl.h | 5 +---- qos_auth/include/qos_ctrl.h | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/qos_auth/auth_ctl/qos_ctrl.c b/qos_auth/auth_ctl/qos_ctrl.c index 1367f86..9f51767 100644 --- a/qos_auth/auth_ctl/qos_ctrl.c +++ b/qos_auth/auth_ctl/qos_ctrl.c @@ -479,9 +479,6 @@ static long ctrl_qos_operation(int abi, void __user *uarg) return ret; } - /* transfer user space qos level to kernel space qos level */ - qos_data.level -= QOS_LEVEL_INTERVAL; - return do_qos_manipulate(&qos_data); } @@ -541,7 +538,7 @@ static inline bool valid_qos_item(struct qos_policy_datas *datas) } /* check user space qos polcicy data, level 0 reserved */ - for (i = 0; i <= NR_QOS; ++i) { + for (i = 0; i < NR_QOS; ++i) { data = &datas->policys[i]; if (!valid_nice(data->nice)) { @@ -593,7 +590,7 @@ static long do_qos_policy_change(struct qos_policy_datas *datas) item = &qos_policy_array[type].levels[i]; /* user space policy params */ - data = &datas->policys[i + QOS_LEVEL_INTERVAL]; + data = &datas->policys[i]; item->nice = data->nice; item->latency_nice = data->latency_nice; diff --git a/qos_auth/auth_ctl/qos_ctrl.h b/qos_auth/auth_ctl/qos_ctrl.h index 301f141..3ca0205 100644 --- a/qos_auth/auth_ctl/qos_ctrl.h +++ b/qos_auth/auth_ctl/qos_ctrl.h @@ -13,11 +13,8 @@ #include -/* qos level interval between user space and kernel space */ -#define QOS_LEVEL_INTERVAL 1 - /* min qos level used in kernel space, begin index for LOOP */ -#define QOS_POLICY_MIN_LEVEL (NO_QOS + QOS_LEVEL_INTERVAL) +#define QOS_POLICY_MIN_LEVEL 0 struct qos_policy_item { int nice; diff --git a/qos_auth/include/qos_ctrl.h b/qos_auth/include/qos_ctrl.h index 0840821..2216b36 100644 --- a/qos_auth/include/qos_ctrl.h +++ b/qos_auth/include/qos_ctrl.h @@ -104,7 +104,7 @@ struct qos_policy_datas { */ int policy_type; unsigned int policy_flag; - struct qos_policy_data policys[NR_QOS + 1]; + struct qos_policy_data policys[NR_QOS]; }; struct auth_struct; -- Gitee