]> git.baikalelectronics.ru Git - kernel.git/commitdiff
RDMA/hns: Fix the size setting error when copying CQE in clean_cq()
authorWenpeng Liang <liangwenpeng@huawei.com>
Mon, 27 Sep 2021 12:55:56 +0000 (20:55 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 27 Sep 2021 17:49:48 +0000 (14:49 -0300)
The size of CQE is different for different versions of hardware, so the
driver needs to specify the size of CQE explicitly.

Fixes: 488e40dc4faf ("RDMA/hns: Add support for CQE in size of 64 Bytes")
Link: https://lore.kernel.org/r/20210927125557.15031-2-liangwenpeng@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hns/hns_roce_hw_v2.c

index a9c00a2e8ebdbb49b7a244c3fbebfffa5ea9f661..d5f3faa1627a41c08224e0fb6fe9c31d8a1e9c13 100644 (file)
@@ -3299,7 +3299,7 @@ static void __hns_roce_v2_cq_clean(struct hns_roce_cq *hr_cq, u32 qpn,
                        dest = get_cqe_v2(hr_cq, (prod_index + nfreed) &
                                          hr_cq->ib_cq.cqe);
                        owner_bit = hr_reg_read(dest, CQE_OWNER);
-                       memcpy(dest, cqe, sizeof(*cqe));
+                       memcpy(dest, cqe, hr_cq->cqe_size);
                        hr_reg_write(dest, CQE_OWNER, owner_bit);
                }
        }