Lines Matching refs:qpt
265 static void get_map_page(struct rvt_qpn_table *qpt, in get_map_page() argument
274 spin_lock(&qpt->lock); in get_map_page()
279 spin_unlock(&qpt->lock); in get_map_page()
287 static int init_qpn_table(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt) in init_qpn_table() argument
296 spin_lock_init(&qpt->lock); in init_qpn_table()
298 qpt->last = rdi->dparms.qpn_start; in init_qpn_table()
299 qpt->incr = rdi->dparms.qpn_inc << rdi->dparms.qos_shift; in init_qpn_table()
309 qpt->nmaps = rdi->dparms.qpn_res_start / RVT_BITS_PER_PAGE; in init_qpn_table()
315 map = &qpt->map[qpt->nmaps]; in init_qpn_table()
321 get_map_page(qpt, map); in init_qpn_table()
331 qpt->nmaps++; in init_qpn_table()
343 static void free_qpn_table(struct rvt_qpn_table *qpt) in free_qpn_table() argument
347 for (i = 0; i < ARRAY_SIZE(qpt->map); i++) in free_qpn_table()
348 free_page((unsigned long)qpt->map[i].page); in free_qpn_table()
475 static inline unsigned mk_qpn(struct rvt_qpn_table *qpt, in mk_qpn() argument
478 return (map - qpt->map) * RVT_BITS_PER_PAGE + off; in mk_qpn()
492 static int alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, in alloc_qpn() argument
502 return rdi->driver_f.alloc_qpn(rdi, qpt, type, port_num); in alloc_qpn()
509 spin_lock(&qpt->lock); in alloc_qpn()
510 if (qpt->flags & n) in alloc_qpn()
513 qpt->flags |= n; in alloc_qpn()
514 spin_unlock(&qpt->lock); in alloc_qpn()
518 qpn = qpt->last + qpt->incr; in alloc_qpn()
520 qpn = qpt->incr | ((qpt->last & 1) ^ 1); in alloc_qpn()
523 map = &qpt->map[qpn / RVT_BITS_PER_PAGE]; in alloc_qpn()
524 max_scan = qpt->nmaps - !offset; in alloc_qpn()
527 get_map_page(qpt, map); in alloc_qpn()
533 qpt->last = qpn; in alloc_qpn()
537 offset += qpt->incr; in alloc_qpn()
542 qpn = mk_qpn(qpt, map, offset); in alloc_qpn()
550 if (qpt->nmaps == RVT_QPNMAP_ENTRIES) in alloc_qpn()
552 map = &qpt->map[qpt->nmaps++]; in alloc_qpn()
554 offset = qpt->incr | (offset & 1); in alloc_qpn()
555 } else if (map < &qpt->map[qpt->nmaps]) { in alloc_qpn()
558 offset = qpt->incr | (offset & 1); in alloc_qpn()
560 map = &qpt->map[0]; in alloc_qpn()
562 offset = qpt->incr | ((offset & 1) ^ 1); in alloc_qpn()
567 qpn = mk_qpn(qpt, map, offset); in alloc_qpn()
950 static void rvt_free_qpn(struct rvt_qpn_table *qpt, u32 qpn) in rvt_free_qpn() argument
957 map = qpt->map + (qpn & RVT_QPN_MASK) / RVT_BITS_PER_PAGE; in rvt_free_qpn()