RDMA/hns: Bugfix for incorrect association between dip_idx and dgid
authorJunxian Huang <huangjunxian4@hisilicon.com>
Wed, 25 Aug 2021 09:43:12 +0000 (17:43 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 25 Aug 2021 16:55:30 +0000 (13:55 -0300)
commiteb653eda1e91dd3e7d1d2448d528d033dbfbe78f
tree4e4018f1f4590127fd22e7d5884b2fcb6eb324a0
parent074f315fc54a9ce45559a44ca36d9fa1ee1ea2cd
RDMA/hns: Bugfix for incorrect association between dip_idx and dgid

dip_idx and dgid should be a one-to-one mapping relationship, but when
qp_num loops back to the start number, it may happen that two different
dgid are assiociated to the same dip_idx incorrectly.

One solution is to store the qp_num that is not assigned to dip_idx in an
array. When a dip_idx needs to be allocated to a new dgid, an spare qp_num
is extracted and assigned to dip_idx.

Fixes: f91696f2f053 ("RDMA/hns: Support congestion control type selection according to the FW")
Link: https://lore.kernel.org/r/1629884592-23424-4-git-send-email-liangwenpeng@huawei.com
Signed-off-by: Junxian Huang <huangjunxian4@hisilicon.com>
Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
Signed-off-by: Wenpeng Liang <liangwenpeng@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/hns/hns_roce_device.h
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
drivers/infiniband/hw/hns/hns_roce_main.c
drivers/infiniband/hw/hns/hns_roce_qp.c