Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp981678imm; Thu, 31 May 2018 12:55:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIx4dnzQcnfIgiFiWUZ9hQRjChS16nvgOGpUlNI9jmlg4PTY7e/sb6XvQGDWm/xFRknjlYw X-Received: by 2002:a63:4384:: with SMTP id q126-v6mr6449522pga.294.1527796532342; Thu, 31 May 2018 12:55:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527796532; cv=none; d=google.com; s=arc-20160816; b=Drzd9XQCLsMd+rT9fcJPu44/SlalRrbq/T+Q4pMchI/JOxQTUMfCRXXgjczBj9QJH7 BXbnzw/t5tWjFj+UKyZxWgNVTUmJFgoJqYIVkCmdrR3hISfO3X27+lwTarOOnc9eD0TI 1pB3EXCvPAKTXaGjYy0ikSFqsxoc/4b8MjH2fHvJj2qqOvwzlm3ePvALMVJpTbTBC0xB nQtquMOwdbF0vAmFLHnWPgZIlVXuQY7yrIL9NVGDyZOmrmlDWwLbBwpJYZXQrPZPQ7qI OMKWQLa7gs4z47i6SrKh880z4IoVTrLM313WrDPmCdtfwzfNNVkpnVuNf8fw1fN12jdQ DQNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=RovoB7Sa1rZjKTa2lknD7ZJxdApyAxwXgU+Qjl+kpYA=; b=mx6eSAOLdDuwaWN+DMMWZR5TGgP2ZxB6Wor2XXTB5Hu4cEkV3Usq+5MJzOWJXXdPcY ImsLWgeSx+cWSvNwEsjNq5J+3Jlv5ux+eejqZOqebSqKUESvVchBVG9Ko24wmUXSBexd qeL2JCJY1WBsjS4I06pyjFeH5OOe1kdHVjbdP6/DAJ7EpF+bd8498nb6Erc70sSY8tS8 LcSv3yahnv1blrL3sNyUEWcD97mcNLHYp+Ar6s1eRuaZRimyYAlm7HkSZyLHpF9Azgda 8kPKm4hHRtMd5nDiJPR+e31QYEXOu7TXyNdFAWnTvyKZ1SeFpC1XsDHkDExFJ7MOrhE6 1NzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=H+zGgwGu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a16-v6si10792296pgd.380.2018.05.31.12.55.15; Thu, 31 May 2018 12:55:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=H+zGgwGu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754249AbeEaTyH (ORCPT + 99 others); Thu, 31 May 2018 15:54:07 -0400 Received: from aserp2120.oracle.com ([141.146.126.78]:51382 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754222AbeEaTyD (ORCPT ); Thu, 31 May 2018 15:54:03 -0400 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4VJoVkl071972; Thu, 31 May 2018 19:53:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=content-type : mime-version : subject : from : in-reply-to : date : cc : content-transfer-encoding : message-id : references : to; s=corp-2017-10-26; bh=RovoB7Sa1rZjKTa2lknD7ZJxdApyAxwXgU+Qjl+kpYA=; b=H+zGgwGu/J8dwkogETTt5nxmDCsicNfAf3fqVq20D4bsRReW/heWr2k32BWYXdEc2mPV i7z0BE/Bc82NN0aLaqjk/a3MTyp/2IUwkMFNJhch4DC+Z1f+/6mDHPb8+J0xIAYp5UcI ysLKR5wbx6YN0LDVTm5T94S4wBmcoBTcXNQkqFXi4MAAbQR1haellEq5efvFmeKHdXBa GzrgpBRCWZGk9qPp2EhklbilwCbJhja1nFZ01XJpCPAkFbcjnvBJCsUS5XaaPfcqxj+8 78XURgF0PEAN6XdfP5TfcmvMPOSXm47oDXazn9URho94gYhoyxJ+mSgcUObPAxoI6lpK MQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2120.oracle.com with ESMTP id 2janje0jhe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 May 2018 19:53:44 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w4VJrgqR002863 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 31 May 2018 19:53:42 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w4VJrfXM009318; Thu, 31 May 2018 19:53:41 GMT Received: from dhcp-10-65-158-193.vpn.oracle.com (/10.65.158.193) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 31 May 2018 12:53:41 -0700 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [PATCH] IB/mad: Use ID allocator routines to allocate agent number From: =?utf-8?Q?H=C3=A5kon_Bugge?= In-Reply-To: <20180530220934.GI30754@ziepe.ca> Date: Thu, 31 May 2018 21:54:40 +0200 Cc: Hans Westgaard Ry , jackm , Doug Ledford , Daniel Jurgens , Parav Pandit , Pravin Shedge , OFED mailing list , linux-kernel@vger.kernel.org, Leon Romanovsky Content-Transfer-Encoding: quoted-printable 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> To: Jason Gunthorpe X-Mailer: Apple Mail (2.3445.6.18) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8910 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=1 suspectscore=3 malwarescore=0 phishscore=0 bulkscore=0 spamscore=1 mlxscore=1 mlxlogscore=187 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1805310220 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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