Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a598c6f4 authored by Lijun Ou's avatar Lijun Ou Committed by Doug Ledford
Browse files

IB/hns: Simplify function of pd alloc and qp alloc



Hns_roce_pd_alloc and hns_roce_reserve_range_qp use unnecessary
transformation of parameters. This patch simplify these two
functions.

Signed-off-by: default avatarLijun Ou <oulijun@huawei.com>
Signed-off-by: default avatarDongdong Huang(Donald) <hdd.huang@huawei.com>
Reviewed-by: default avatarWei Hu <xavier.huwei@huawei.com>
Signed-off-by: default avatarSalil Mehta <salil.mehta@huawei.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent ed3e6d01
Loading
Loading
Loading
Loading
+1 −13
Original line number Diff line number Diff line
@@ -35,19 +35,7 @@

static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn)
{
	struct device *dev = &hr_dev->pdev->dev;
	unsigned long pd_number;
	int ret = 0;

	ret = hns_roce_bitmap_alloc(&hr_dev->pd_bitmap, &pd_number);
	if (ret == -1) {
		dev_err(dev, "alloc pdn from pdbitmap failed\n");
		return -ENOMEM;
	}

	*pdn = pd_number;

	return 0;
	return hns_roce_bitmap_alloc(&hr_dev->pd_bitmap, pdn);
}

static void hns_roce_pd_free(struct hns_roce_dev *hr_dev, unsigned long pdn)
+1 −9
Original line number Diff line number Diff line
@@ -112,16 +112,8 @@ static int hns_roce_reserve_range_qp(struct hns_roce_dev *hr_dev, int cnt,
				     int align, unsigned long *base)
{
	struct hns_roce_qp_table *qp_table = &hr_dev->qp_table;
	int ret = 0;
	unsigned long qpn;

	ret = hns_roce_bitmap_alloc_range(&qp_table->bitmap, cnt, align, &qpn);
	if (ret == -1)
		return -ENOMEM;

	*base = qpn;

	return 0;
	return hns_roce_bitmap_alloc_range(&qp_table->bitmap, cnt, align, base);
}

enum hns_roce_qp_state to_hns_roce_state(enum ib_qp_state state)