From patchwork Mon Dec 31 06:23:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devesh Sharma X-Patchwork-Id: 10745319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7FFA13A4 for ; Mon, 31 Dec 2018 06:23:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A40DA289B4 for ; Mon, 31 Dec 2018 06:23:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9399828A0D; Mon, 31 Dec 2018 06:23:55 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 35DB9289B4 for ; Mon, 31 Dec 2018 06:23:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726988AbeLaGXz (ORCPT ); Mon, 31 Dec 2018 01:23:55 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:42346 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726401AbeLaGXy (ORCPT ); Mon, 31 Dec 2018 01:23:54 -0500 Received: by mail-ed1-f65.google.com with SMTP id y20so21890834edw.9 for ; Sun, 30 Dec 2018 22:23:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wciV/4Xk4dqcqn+Y/eZNL9fnsz7eOJCjN7PhMFRyjok=; b=EbI5OqDdifpfaFmuNnmcprHhcVAvmny2I7CNf6A48gHQ8xR+WjanmoFvXLrykoEQbS hqYyb7lRZro+G+4Z3TKxTGwh4Y5jpQLLHfCMIBUrVEKg4TUIXIAsnGXWUDziWtCFj6yA KgBcJf/S6Lxxycwh6OqngZ+qpBNT/0RXEVvQ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wciV/4Xk4dqcqn+Y/eZNL9fnsz7eOJCjN7PhMFRyjok=; b=H2LmC0nV62K+9QUt0H+3fIhZFtxNG+5XK2GG3qqQKVjXfkkVcTe9jZtIFkU8/q166A /fuM0mhOWjtW9uh0eY83Oq3AiRXir54DPn7Ul8/ySWvk59RGV8wpiqBsR8oiv8/Yx5qd P2nzClRO+TMauV8RFKPsTZ2+Qicxvu9WhVr+h36zs6OHx1tda//24TUZHSqsslYb1swZ vPZT0GySUigxpxibizgoJRlVVUlUI1v1lGDrNq+w4CupBWztcfhIhwRrapIgYCaEPCSx R5jEmq0dtnGv03qbQw36Dwk6n1yDzt7wECgIYOX5MjAlSj3Hiy6X/bN0C4qihng9nVBv Z7Pg== X-Gm-Message-State: AJcUukfZtxck1QHwo1QaSEe0izJoBvp/7q6bf1kehNZb0ZdKUwD0rdES UMmlCnl5/l35hZzq4ZjXVaxayQneNws= X-Google-Smtp-Source: ALg8bN5EMlvh9VfuzMs+ZnOCWOlVQhjzcnfcA7t2C51IEa6kArMZGsSYZ/Xiyjjd+6ZBfnPaGKok0g== X-Received: by 2002:a17:906:6252:: with SMTP id u18-v6mr5534988ejl.210.1546237431967; Sun, 30 Dec 2018 22:23:51 -0800 (PST) Received: from neo00-el73.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id v20sm17747849edm.29.2018.12.30.22.23.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 30 Dec 2018 22:23:51 -0800 (PST) From: Devesh Sharma To: linux-rdma@vger.kernel.org Cc: dledford@redhat.com, jgg@mellanox.com, Devesh Sharma Subject: [for-next 6/7] RDMA/bnxt_re: Update kernel user abi to pass chip context Date: Mon, 31 Dec 2018 01:23:18 -0500 Message-Id: <1546237399-16234-7-git-send-email-devesh.sharma@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1546237399-16234-1-git-send-email-devesh.sharma@broadcom.com> References: <1546237399-16234-1-git-send-email-devesh.sharma@broadcom.com> 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 User space verbs provider library would need chip context. Changing the ABI to add chip version details in structure. Furthermore, changing the kernel driver ucontext allocation code to initializ the abi structure with appropriate values. Signed-off-by: Devesh Sharma --- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 12 +++++++++--- include/uapi/rdma/bnxt_re-abi.h | 9 ++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c index 7a09ca7..3bec789 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -3693,9 +3693,10 @@ struct ib_ucontext *bnxt_re_alloc_ucontext(struct ib_device *ibdev, struct ib_udata *udata) { struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev); + struct bnxt_qplib_dev_attr *dev_attr = &rdev->dev_attr; struct bnxt_re_uctx_resp resp; struct bnxt_re_ucontext *uctx; - struct bnxt_qplib_dev_attr *dev_attr = &rdev->dev_attr; + u32 chip_met_rev_num = 0; int rc; dev_dbg(rdev_to_dev(rdev), "ABI version requested %d", @@ -3720,8 +3721,13 @@ struct ib_ucontext *bnxt_re_alloc_ucontext(struct ib_device *ibdev, } spin_lock_init(&uctx->sh_lock); - resp.dev_id = rdev->en_dev->pdev->devfn; /*Temp, Use idr_alloc instead*/ - resp.max_qp = rdev->qplib_ctx.qpc_count; + chip_met_rev_num = rdev->chip_ctx->chip_num; + chip_met_rev_num |= ((u32)rdev->chip_ctx->chip_rev & 0xFF) << + BNXT_RE_CHIP_ID0_CHIP_REV_SFT; + chip_met_rev_num |= ((u32)rdev->chip_ctx->chip_metal & 0xFF) << + BNXT_RE_CHIP_ID0_CHIP_MET_SFT; + resp.chip_id0 = chip_met_rev_num; + resp.chip_id1 = 0; /* future extension of chip info */ resp.pg_size = PAGE_SIZE; resp.cqe_sz = sizeof(struct cq_base); resp.max_cqd = dev_attr->max_cq_wqes; diff --git a/include/uapi/rdma/bnxt_re-abi.h b/include/uapi/rdma/bnxt_re-abi.h index a7a6111..c62b106 100644 --- a/include/uapi/rdma/bnxt_re-abi.h +++ b/include/uapi/rdma/bnxt_re-abi.h @@ -42,11 +42,14 @@ #include -#define BNXT_RE_ABI_VERSION 1 +#define BNXT_RE_ABI_VERSION 2 +#define BNXT_RE_CHIP_ID0_CHIP_NUM_SFT 0x00 +#define BNXT_RE_CHIP_ID0_CHIP_REV_SFT 0x10 +#define BNXT_RE_CHIP_ID0_CHIP_MET_SFT 0x18 struct bnxt_re_uctx_resp { - __u32 dev_id; - __u32 max_qp; + __u32 chip_id0; + __u32 chip_id1; __u32 pg_size; __u32 cqe_sz; __u32 max_cqd;