Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: hisilicon/qm - restore original qos values

When the new qos valus setting fails, restore to
the original qos values.

Fixes: 72b010dc33b9 ("crypto: hisilicon/qm - supports writing QoS int the host")
Signed-off-by: nieweiqiang <nieweiqiang@huawei.com>
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

nieweiqiang and committed by
Herbert Xu
e7066160 7fc25ed2

+13 -1
+13 -1
drivers/crypto/hisilicon/qm.c
··· 3678 3678 static int qm_func_shaper_enable(struct hisi_qm *qm, u32 fun_index, u32 qos) 3679 3679 { 3680 3680 struct device *dev = &qm->pdev->dev; 3681 + struct qm_shaper_factor t_factor; 3681 3682 u32 ir = qos * QM_QOS_RATE; 3682 3683 int ret, total_vfs, i; 3683 3684 ··· 3686 3685 if (fun_index > total_vfs) 3687 3686 return -EINVAL; 3688 3687 3688 + memcpy(&t_factor, &qm->factor[fun_index], sizeof(t_factor)); 3689 3689 qm->factor[fun_index].func_qos = qos; 3690 3690 3691 3691 ret = qm_get_shaper_para(ir, &qm->factor[fun_index]); ··· 3700 3698 ret = qm_set_vft_common(qm, SHAPER_VFT, fun_index, i, 1); 3701 3699 if (ret) { 3702 3700 dev_err(dev, "type: %d, failed to set shaper vft!\n", i); 3703 - return -EINVAL; 3701 + goto back_func_qos; 3704 3702 } 3705 3703 } 3706 3704 3707 3705 return 0; 3706 + 3707 + back_func_qos: 3708 + memcpy(&qm->factor[fun_index], &t_factor, sizeof(t_factor)); 3709 + for (i--; i >= ALG_TYPE_0; i--) { 3710 + ret = qm_set_vft_common(qm, SHAPER_VFT, fun_index, i, 1); 3711 + if (ret) 3712 + dev_err(dev, "failed to restore shaper vft during rollback!\n"); 3713 + } 3714 + 3715 + return -EINVAL; 3708 3716 } 3709 3717 3710 3718 static u32 qm_get_shaper_vft_qos(struct hisi_qm *qm, u32 fun_index)