提交 047b9b2a 编写于 作者: L liulongfang 提交者: Xie XiuQi

ACC: HPRE&ZIP: qm current_q limit num modify

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

Exclusion divided by zero operation

Feature or Bugfix:Bugfix
Signed-off-by: Nliulongfang <liulongfang@huawei.com>
Reviewed-by: Nwangzhou <wangzhou1@hisilicon.com>
Signed-off-by: Nlingmingqiang <lingmingqiang@huawei.com>
Reviewed-by: Nlingmingqiang <lingmingqiang@huawei.com>
Reviewed-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 7a8808dc
......@@ -475,15 +475,18 @@ static int current_qm_write(struct hpre_debugfs_file *file, u32 val)
if (val > ctrl->num_vfs)
return -EINVAL;
/* According PF or VF Dev ID to calculation the curr_qm_qp_num */
vfq_num = (qm->ctrl_q_num - qm->qp_num) / ctrl->num_vfs;
/* According PF or VF Dev ID to calculation curr_qm_qp_num and store */
if (val == 0) {
qm->debug.curr_qm_qp_num = qm->qp_num;
} else if (val == ctrl->num_vfs) {
qm->debug.curr_qm_qp_num = qm->ctrl_q_num - qm->qp_num -
(ctrl->num_vfs - 1) * vfq_num;
} else {
qm->debug.curr_qm_qp_num = vfq_num;
vfq_num = (qm->ctrl_q_num - qm->qp_num) / ctrl->num_vfs;
if (val == ctrl->num_vfs) {
qm->debug.curr_qm_qp_num =
qm->ctrl_q_num - qm->qp_num -
(ctrl->num_vfs - 1) * vfq_num;
} else {
qm->debug.curr_qm_qp_num = vfq_num;
}
}
writel(val, qm->io_base + QM_DFX_MB_CNT_VF);
......
......@@ -484,15 +484,18 @@ static int current_qm_write(struct ctrl_debug_file *file, u32 val)
if (val > ctrl->num_vfs)
return -EINVAL;
/* According PF or VF Dev ID to calculation the curr_qm_qp_num */
vfq_num = (qm->ctrl_q_num - qm->qp_num) / ctrl->num_vfs;
/* According PF or VF Dev ID to calculation curr_qm_qp_num and store */
if (val == 0) {
qm->debug.curr_qm_qp_num = qm->qp_num;
} else if (val == ctrl->num_vfs) {
qm->debug.curr_qm_qp_num = qm->ctrl_q_num - qm->qp_num -
(ctrl->num_vfs - 1) * vfq_num;
} else {
qm->debug.curr_qm_qp_num = vfq_num;
vfq_num = (qm->ctrl_q_num - qm->qp_num) / ctrl->num_vfs;
if (val == ctrl->num_vfs) {
qm->debug.curr_qm_qp_num =
qm->ctrl_q_num - qm->qp_num -
(ctrl->num_vfs - 1) * vfq_num;
} else {
qm->debug.curr_qm_qp_num = vfq_num;
}
}
writel(val, qm->io_base + QM_DFX_MB_CNT_VF);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册