From patchwork Wed Mar 14 19:09:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Wise X-Patchwork-Id: 10283391 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 21F21602BD for ; Wed, 14 Mar 2018 19:09:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F7A6285EC for ; Wed, 14 Mar 2018 19:09:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01EAA285F2; Wed, 14 Mar 2018 19:09:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A311285EC for ; Wed, 14 Mar 2018 19:09:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751440AbeCNTJR (ORCPT ); Wed, 14 Mar 2018 15:09:17 -0400 Received: from opengridcomputing.com ([70.118.0.34]:38335 "EHLO smtp.opengridcomputing.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751467AbeCNTJR (ORCPT ); Wed, 14 Mar 2018 15:09:17 -0400 Received: from CODY (cody.ogc.int [10.10.0.239]) by smtp.opengridcomputing.com (Postfix) with ESMTPSA id 9838B29EA1; Wed, 14 Mar 2018 14:09:16 -0500 (CDT) From: "Steve Wise" To: "'Leon Romanovsky'" Cc: "'Jason Gunthorpe'" , , References: <70bcad28319c90ce1699cce1a52fc80350fd5bb8.1521046858.git.swise@opengridcomputing.com> <20180314173353.GA1080@mtr-leonro.local> <20180314174212.GH1175@mellanox.com> <035301d3bbbe$552b7c90$ff8275b0$@opengridcomputing.com> <20180314184947.GC1080@mtr-leonro.local> In-Reply-To: <20180314184947.GC1080@mtr-leonro.local> Subject: RE: [PATCH RFC rdma-next 1/2] RDMA/nldev: add provider-specific resource tracking Date: Wed, 14 Mar 2018 14:09:21 -0500 Message-ID: <03e401d3bbc7$f552d9d0$dff88d70$@opengridcomputing.com> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHrdxQGSr+NoR5WZZ+pbOh1ZvsvxQHOqIuxA1Se6aoCvQorYgHY92kFAvTjvpqjOzAqEA== Content-Language: en-us X-Antivirus: AVG (VPS 180314-2, 03/14/2018), Outbound message X-Antivirus-Status: Clean Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP > On Wed, Mar 14, 2018 at 01:00:27PM -0500, Steve Wise wrote: > > > On Wed, Mar 14, 2018 at 07:33:53PM +0200, Leon Romanovsky wrote: > > > > On Tue, Mar 13, 2018 at 10:30:32AM -0700, Steve Wise wrote: > > > > > Each provider can register a "fill entry" function with the restrack > > core. > > > > > This function will be called when filling out a resource, allowing the > > > > > provider to add provider-specific details. The details consist of a > > > > > table of nested attributes, that are in the form of "key, value" > > tuple. > > > > > The key nlattr must be strings, and the value nlattr can be one of > > > > > provider attributes that are generic, but typed, allowing the > > nlmessage > > > > > to ve validated. Currently the types include string, s32, u32, x32, > > s64, > > > > > u64, and x64. The inclusion of x, s, and u variants for numeric > > attributes > > > > > allows the user tool to print the number in the desired format. > > > > > > > > > > More attrs can be defined as they become needed by providers. > > > > > > > > > > Signed-off-by: Steve Wise > > > > > drivers/infiniband/core/nldev.c | 40 > > > ++++++++++++++++++++++++++++++++++++++++ > > > > > include/rdma/restrack.h | 10 ++++++++++ > > > > > include/uapi/rdma/rdma_netlink.h | 17 +++++++++++++++++ > > > > > 3 files changed, 67 insertions(+) > > > > > > > > > > diff --git a/drivers/infiniband/core/nldev.c > > b/drivers/infiniband/core/nldev.c > > > > > index 192084c..933df61 100644 > > > > > +++ b/drivers/infiniband/core/nldev.c > > > > > @@ -95,8 +95,28 @@ > > > > > [RDMA_NLDEV_ATTR_RES_PD_ENTRY] = { .type = > > > NLA_NESTED }, > > > > > [RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY] = { .type = NLA_U32 }, > > > > > [RDMA_NLDEV_ATTR_RES_UNSAFE_GLOBAL_RKEY] = { .type = > > > NLA_U32 }, > > > > > + [RDMA_NLDEV_ATTR_PROVIDER] = { .type = > > > NLA_NESTED }, > > > > > + [RDMA_NLDEV_ATTR_PROVIDER_ENTRY] = { .type = > > > NLA_NESTED }, > > > > > + [RDMA_NLDEV_ATTR_PROVIDER_STRING] = { .type = > > > NLA_NUL_STRING, > > > > > + .len = > > > RDMA_NLDEV_ATTR_PROVIDER_STRLEN }, > > > > > + [RDMA_NLDEV_ATTR_PROVIDER_D32] = { .type = > NLA_S32 }, > > > > > + [RDMA_NLDEV_ATTR_PROVIDER_U32] = { .type = > NLA_U32 }, > > > > > + [RDMA_NLDEV_ATTR_PROVIDER_X32] = { .type = > NLA_U32 }, > > > > > + [RDMA_NLDEV_ATTR_PROVIDER_D64] = { .type = > NLA_S64 }, > > > > > + [RDMA_NLDEV_ATTR_PROVIDER_U64] = { .type = > NLA_U64 }, > > > > > + [RDMA_NLDEV_ATTR_PROVIDER_X64] = { .type = > NLA_U64 }, > > > > > + [RDMA_NLDEV_ATTR_PAD] = { }, > > > > > > > > RDMA_NLDEV_ATTR_PAD ???? > > > > > > This was supposed to have been done earlier.. > > > > > > > It wasn't clear whether we needed it. Leon sez 0 is fine. > > > > > Seperate patch please, and change every caller of nla_put_u64_64bit to > > > use the new constant. > > > > > > > Yea ok. > > > > > And I think it has to be 0 for ABI compat, doesn't it? > > > > > > > I guess so, since 0 was used originally. > > Yes, we are using 0, which is equal to RDMA_NLDEV_ATTR_UNSPEC. > > All zeros can be replaced for clarity, but from ABI perspective we are > fine. > Will this work? [root@stevo1 linux]# git diff --- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h index 351139c..84b3f63 100644 --- a/include/uapi/rdma/rdma_netlink.h +++ b/include/uapi/rdma/rdma_netlink.h @@ -253,6 +253,9 @@ enum rdma_nldev_attr { /* don't change the order or add anything between, this is ABI! */ RDMA_NLDEV_ATTR_UNSPEC, + /* Pad attribute for 64b alignment */ + RDMA_NLDEV_ATTR_PAD = RDMA_NLDEV_ATTR_UNSPEC, + /* Identifier for ib_device */ RDMA_NLDEV_ATTR_DEV_INDEX, /* u32 */