From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?H=C3=A5kon_Bugge?= Subject: Re: [PATCH] IB/mad: Use ID allocator routines to allocate agent number Date: Thu, 31 May 2018 21:54:40 +0200 Message-ID: References: <20180529073808.27735-1-hans.westgaard.ry@oracle.com> <20180529154922.GA18457@ziepe.ca> <20180529164032.GB18457@ziepe.ca> <20180530110216.00000913@dev.mellanox.co.il> <20180530151023.GB30754@ziepe.ca> <20180530220934.GI30754@ziepe.ca> Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20180530220934.GI30754@ziepe.ca> Sender: linux-kernel-owner@vger.kernel.org To: Jason Gunthorpe Cc: Hans Westgaard Ry , jackm , Doug Ledford , Daniel Jurgens , Parav Pandit , Pravin Shedge , OFED mailing list , linux-kernel@vger.kernel.org, Leon Romanovsky List-Id: linux-rdma@vger.kernel.org > On 31 May 2018, at 00:09, Jason Gunthorpe wrote: >=20 > On Wed, May 30, 2018 at 10:07:16PM +0200, H=C3=A5kon Bugge wrote: >>=20 >>=20 >>> On 30 May 2018, at 17:10, Jason Gunthorpe wrote: >>>=20 >>> On Wed, May 30, 2018 at 02:22:56PM +0200, Hans Westgaard Ry wrote: >>>=20 >>>> We came up with this code snippet which we think handles both = preventing >>>> immediate re-use and too big/wrapping... >>>=20 >>> Isn't this basically the same as idr_alloc_cyclic ? >>=20 >> I draw my statement back. The idr_alloc_cyclic() is the family of = idr's that associates a pointer with the bit. Hence, each bit is a bit + = 64b. >>=20 >> That's why we ended up with Hans' pseudo code. >=20 > Okay, fair enough. >=20 > Is it worth adding a ida_get_new_cyclic for this? My initial reaction was "no", but then I found the same cyclic behaviour = in drivers/net/ipvlan/ipvlan_main.c Then in my opinion, it makes sense to create a ida_simple_get_cyclic() Thxs, H=C3=A5kon