Lines Matching refs:hr_dev
36 void hns_roce_init_pd_table(struct hns_roce_dev *hr_dev) in hns_roce_init_pd_table() argument
38 struct hns_roce_ida *pd_ida = &hr_dev->pd_ida; in hns_roce_init_pd_table()
41 pd_ida->max = hr_dev->caps.num_pds - 1; in hns_roce_init_pd_table()
42 pd_ida->min = hr_dev->caps.reserved_pds; in hns_roce_init_pd_table()
48 struct hns_roce_dev *hr_dev = to_hr_dev(ib_dev); in hns_roce_alloc_pd() local
49 struct hns_roce_ida *pd_ida = &hr_dev->pd_ida; in hns_roce_alloc_pd()
78 struct hns_roce_dev *hr_dev = to_hr_dev(pd->device); in hns_roce_dealloc_pd() local
80 ida_free(&hr_dev->pd_ida.ida, (int)to_hr_pd(pd)->pdn); in hns_roce_dealloc_pd()
85 int hns_roce_uar_alloc(struct hns_roce_dev *hr_dev, struct hns_roce_uar *uar) in hns_roce_uar_alloc() argument
87 struct hns_roce_ida *uar_ida = &hr_dev->uar_ida; in hns_roce_uar_alloc()
94 ibdev_err(&hr_dev->ib_dev, "failed to alloc uar id(%d).\n", id); in hns_roce_uar_alloc()
99 if (uar->logic_idx > 0 && hr_dev->caps.phy_num_uars > 1) in hns_roce_uar_alloc()
101 (hr_dev->caps.phy_num_uars - 1) + 1; in hns_roce_uar_alloc()
105 uar->pfn = ((pci_resource_start(hr_dev->pci_dev, 2)) >> PAGE_SHIFT); in hns_roce_uar_alloc()
106 if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_DIRECT_WQE) in hns_roce_uar_alloc()
107 hr_dev->dwqe_page = pci_resource_start(hr_dev->pci_dev, 4); in hns_roce_uar_alloc()
112 void hns_roce_init_uar_table(struct hns_roce_dev *hr_dev) in hns_roce_init_uar_table() argument
114 struct hns_roce_ida *uar_ida = &hr_dev->uar_ida; in hns_roce_init_uar_table()
117 uar_ida->max = hr_dev->caps.num_uars - 1; in hns_roce_init_uar_table()
118 uar_ida->min = hr_dev->caps.reserved_uars; in hns_roce_init_uar_table()
121 static int hns_roce_xrcd_alloc(struct hns_roce_dev *hr_dev, u32 *xrcdn) in hns_roce_xrcd_alloc() argument
123 struct hns_roce_ida *xrcd_ida = &hr_dev->xrcd_ida; in hns_roce_xrcd_alloc()
129 ibdev_err(&hr_dev->ib_dev, "failed to alloc xrcdn(%d).\n", id); in hns_roce_xrcd_alloc()
137 void hns_roce_init_xrcd_table(struct hns_roce_dev *hr_dev) in hns_roce_init_xrcd_table() argument
139 struct hns_roce_ida *xrcd_ida = &hr_dev->xrcd_ida; in hns_roce_init_xrcd_table()
142 xrcd_ida->max = hr_dev->caps.num_xrcds - 1; in hns_roce_init_xrcd_table()
143 xrcd_ida->min = hr_dev->caps.reserved_xrcds; in hns_roce_init_xrcd_table()
148 struct hns_roce_dev *hr_dev = to_hr_dev(ib_xrcd->device); in hns_roce_alloc_xrcd() local
152 if (!(hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_XRC)) in hns_roce_alloc_xrcd()
155 ret = hns_roce_xrcd_alloc(hr_dev, &xrcd->xrcdn); in hns_roce_alloc_xrcd()
164 struct hns_roce_dev *hr_dev = to_hr_dev(ib_xrcd->device); in hns_roce_dealloc_xrcd() local
167 ida_free(&hr_dev->xrcd_ida.ida, (int)xrcdn); in hns_roce_dealloc_xrcd()