Lines Matching refs:qpt

307 static void get_map_page(struct rvt_qpn_table *qpt,  in get_map_page()  argument
316 spin_lock(&qpt->lock); in get_map_page()
321 spin_unlock(&qpt->lock); in get_map_page()
328 static int init_qpn_table(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt) in init_qpn_table() argument
337 spin_lock_init(&qpt->lock); in init_qpn_table()
339 qpt->last = rdi->dparms.qpn_start; in init_qpn_table()
340 qpt->incr = rdi->dparms.qpn_inc << rdi->dparms.qos_shift; in init_qpn_table()
350 qpt->nmaps = rdi->dparms.qpn_res_start / RVT_BITS_PER_PAGE; in init_qpn_table()
356 map = &qpt->map[qpt->nmaps]; in init_qpn_table()
362 get_map_page(qpt, map); in init_qpn_table()
372 qpt->nmaps++; in init_qpn_table()
384 static void free_qpn_table(struct rvt_qpn_table *qpt) in free_qpn_table() argument
388 for (i = 0; i < ARRAY_SIZE(qpt->map); i++) in free_qpn_table()
389 free_page((unsigned long)qpt->map[i].page); in free_qpn_table()
516 static inline unsigned mk_qpn(struct rvt_qpn_table *qpt, in mk_qpn() argument
519 return (map - qpt->map) * RVT_BITS_PER_PAGE + off; in mk_qpn()
532 static int alloc_qpn(struct rvt_dev_info *rdi, struct rvt_qpn_table *qpt, in alloc_qpn() argument
542 return rdi->driver_f.alloc_qpn(rdi, qpt, type, port_num); in alloc_qpn()
549 spin_lock(&qpt->lock); in alloc_qpn()
550 if (qpt->flags & n) in alloc_qpn()
553 qpt->flags |= n; in alloc_qpn()
554 spin_unlock(&qpt->lock); in alloc_qpn()
558 qpn = qpt->last + qpt->incr; in alloc_qpn()
560 qpn = qpt->incr | ((qpt->last & 1) ^ 1); in alloc_qpn()
563 map = &qpt->map[qpn / RVT_BITS_PER_PAGE]; in alloc_qpn()
564 max_scan = qpt->nmaps - !offset; in alloc_qpn()
567 get_map_page(qpt, map); in alloc_qpn()
573 qpt->last = qpn; in alloc_qpn()
577 offset += qpt->incr; in alloc_qpn()
582 qpn = mk_qpn(qpt, map, offset); in alloc_qpn()
590 if (qpt->nmaps == RVT_QPNMAP_ENTRIES) in alloc_qpn()
592 map = &qpt->map[qpt->nmaps++]; in alloc_qpn()
594 offset = qpt->incr | (offset & 1); in alloc_qpn()
595 } else if (map < &qpt->map[qpt->nmaps]) { in alloc_qpn()
598 offset = qpt->incr | (offset & 1); in alloc_qpn()
600 map = &qpt->map[0]; in alloc_qpn()
602 offset = qpt->incr | ((offset & 1) ^ 1); in alloc_qpn()
607 qpn = mk_qpn(qpt, map, offset); in alloc_qpn()
987 static void rvt_free_qpn(struct rvt_qpn_table *qpt, u32 qpn) in rvt_free_qpn() argument
994 map = qpt->map + (qpn & RVT_QPN_MASK) / RVT_BITS_PER_PAGE; in rvt_free_qpn()