RDMA/hns: Refactor hns_roce_v2_post_srq_recv()
authorWenpeng Liang <liangwenpeng@huawei.com>
Sat, 30 Jan 2021 08:58:09 +0000 (16:58 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Mon, 8 Feb 2021 23:37:35 +0000 (19:37 -0400)
commit2e07a3d945851f0edc192336b3ac411e806c4da2
treea0596b6144473c73804ac2dba5c7a38707ea7879
parent6b981e2bd9251f4f4d0fe32b1eeb29b0d88813a5
RDMA/hns: Refactor hns_roce_v2_post_srq_recv()

The SRQ in the hns driver consists of the following four parts:

* wqe buf: the buffer to store WQE.

* wqe_idx buf: the cqe of SRQ may be not generated in the order of wqe, so
  the wqe_idx corresponding to the idle WQE needs to be pushed into the
  index queue which is a FIFO, then it instructs the hardware to obtain
  the corresponding WQE.

* bitmap: bitmap is used to generate and release wqe_idx. When the user
  has a new WR, the driver finds the idx of the idle wqe in bitmap. When
  the CQE of wqe is generated, the driver will release the idx.

* wr_id buf: wr_id buf is used to store the user's wr_id, then return it
  to the user when poll_cq verb is invoked.

The process of post SRQ recv is refactored to make preceding code clearer.

Link: https://lore.kernel.org/r/1611997090-48820-12-git-send-email-liweihang@huawei.com
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hns/hns_roce_hw_v2.c