From d494cb2d8dc32c852afa29374bb2016e9b0a93e5 Mon Sep 17 00:00:00 2001 From: Yangyang Li Date: Wed, 17 Jul 2019 17:15:31 +0800 Subject: [PATCH] RDMA/hns: Modify pi vlaue when cq overflows driver inclusion category: bugfix bugzilla: NA CVE: NA When exiting "for loop", the actual value of pi will be increased by 1, which is compatible with the next calculation. But when pi is equal to "ci + hr_cq-> ib_cq.cqe", the "break" was called and the pi is actual value, it will lead one cqe still existing, so the "==" should be modify to ">". Feature or Bugfix:Bugfix Signed-off-by: Yangyang Li Signed-off-by: liyangyang (M) Reviewed-by: oulijun Reviewed-by: liuyixian Reviewed-by: Yang Yingliang Signed-off-by: Yang Yingliang --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 0aca64f8c445..6b433b453490 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -2781,7 +2781,7 @@ static void __hns_roce_v2_cq_clean(struct hns_roce_cq *hr_cq, u32 qpn, for (prod_index = hr_cq->cons_index; get_sw_cqe_v2(hr_cq, prod_index); ++prod_index) { - if (prod_index == hr_cq->cons_index + hr_cq->ib_cq.cqe) + if (prod_index > hr_cq->cons_index + hr_cq->ib_cq.cqe) break; } -- GitLab