lkml.org 
[lkml]   [2018]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] IB/mad: Use ID allocator routines to allocate agent number
From
Date


> On 31 May 2018, at 00:09, Jason Gunthorpe <jgg@ziepe.ca> wrote:
>
> On Wed, May 30, 2018 at 10:07:16PM +0200, Håkon Bugge wrote:
>>
>>
>>> On 30 May 2018, at 17:10, Jason Gunthorpe <jgg@ziepe.ca> wrote:
>>>
>>> On Wed, May 30, 2018 at 02:22:56PM +0200, Hans Westgaard Ry wrote:
>>>
>>>> We came up with this code snippet which we think handles both preventing
>>>> immediate re-use and too big/wrapping...
>>>
>>> Isn't this basically the same as idr_alloc_cyclic ?
>>
>> 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.
>>
>> That's why we ended up with Hans' pseudo code.
>
> Okay, fair enough.
>
> 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åkon

\
 
 \ /
  Last update: 2018-05-31 21:55    [W:0.055 / U:2.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site