RDMA/hns: Modify pi vlaue when cq overflows
authorYangyang Li <liyangyang20@huawei.com>
Fri, 9 Aug 2019 09:41:01 +0000 (17:41 +0800)
committerDoug Ledford <dledford@redhat.com>
Tue, 13 Aug 2019 16:32:37 +0000 (12:32 -0400)
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 ">".

Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
Link: https://lore.kernel.org/r/1565343666-73193-5-git-send-email-oulijun@huawei.com
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/hw/hns/hns_roce_hw_v2.c

index 7a14f0be501947ce1d1765b8a4fabb61f35e1e9f..e05a6a290a5547b9c3d4cea495e53cc104459f42 100644 (file)
@@ -2407,7 +2407,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;
        }