On Mon, Nov 23, 2020 at 09:06:48PM +0800, Weihang Li wrote: > +static int alloc_qpn_with_bankid(struct hns_roce_bank *bank, u8 bankid, > + unsigned long *qpn) > +{ > + int id; > + > + id = ida_alloc_range(&bank->ida, bank->min, bank->max, GFP_KERNEL); > + if (id < 0) { > + id = ida_alloc_range(&bank->ida, bank->rsv_bot, bank->min, > + GFP_KERNEL); Shouldn't this one be bank->max not min? That is the usual way to write a cyclic allocator over this kind of API. See the logic in __xa_alloc_cyclic() Jason