From patchwork Mon Oct 3 02:10:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adit Ranadive X-Patchwork-Id: 9359939 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 4D4C2608A6 for ; Mon, 3 Oct 2016 02:12:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F5F928904 for ; Mon, 3 Oct 2016 02:12:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33D5D28986; Mon, 3 Oct 2016 02:12:03 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 30EBD28977 for ; Mon, 3 Oct 2016 02:12:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751290AbcJCCMB (ORCPT ); Sun, 2 Oct 2016 22:12:01 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:24891 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752156AbcJCCMA (ORCPT ); Sun, 2 Oct 2016 22:12:00 -0400 Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Sun, 2 Oct 2016 19:11:22 -0700 Received: from EX13-CAS-009.vmware.com (ex13-cas-009.vmware.com [10.113.191.61]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id 8AB56404FA; Sun, 2 Oct 2016 19:11:58 -0700 (PDT) Received: from EX13-CAS-004.vmware.com (10.113.191.54) by EX13-MBX-000.vmware.com (10.113.191.20) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Sun, 2 Oct 2016 19:10:58 -0700 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (10.113.170.11) by EX13-CAS-004.vmware.com (10.113.191.54) with Microsoft SMTP Server (TLS) id 15.0.1156.6 via Frontend Transport; Sun, 2 Oct 2016 19:10:58 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onevmw.onmicrosoft.com; s=selector1-vmware-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=HNeUHKaX/Uku+IcTMV/qCLkQMSLjjE8kLZAVllVx8es=; b=Kfgz2+KuGYg+7K3DvJOboFpBOvHnPQVcK0kyMf5hrm0ta7YlLbZZ4Raa+9lqLB9uUWFsCt2Hv2iOHo7B1y9JyCNYVDaSBRrtN+VxXCDh4nZNax4U9Js/ClIKalDmwL3PwxtiK+Asd5BIh0QyzeN+EM1hwyjXeqrjCnICv7bXIWI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aditr@vmware.com; Received: from promb-2s-dhcp95-136.eng.vmware.com (208.91.1.34) by DM2PR0501MB841.namprd05.prod.outlook.com (10.242.115.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.649.6; Mon, 3 Oct 2016 02:10:55 +0000 From: Adit Ranadive To: , , CC: Adit Ranadive , , , , Subject: [PATCH v6 02/16] IB/pvrdma: Add user-level shared functions Date: Sun, 2 Oct 2016 19:10:22 -0700 Message-ID: <515c704574423b16feb4c3d97847156623a8d042.1475458407.git.aditr@vmware.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [208.91.1.34] X-ClientProxiedBy: CY1PR1101CA0039.namprd11.prod.outlook.com (10.169.17.49) To DM2PR0501MB841.namprd05.prod.outlook.com (10.242.115.147) X-MS-Office365-Filtering-Correlation-Id: 796a8f2e-cc75-4bf8-500d-08d3eb32828c X-Microsoft-Exchange-Diagnostics: 1; DM2PR0501MB841; 2:6vWt4yD6KerZbeYvKXQV4wvUg32j+EwFZQOOXwSqUYUQQSQuzi6q33bjvQXDLzeS55DFhaiFkV8m0IgfkEUxe4mfRw20GFu9WQI6AYzzgJakHcY2akWP9s0tJN/Tgs5HjYnGK4hA+vva9y2jJI1YxhZ7c8i92/ASyyhhUVQwSxfv8PNq/dG0qCwQHE/+3pfKj0tUNL6R8gAVWIS01OOzKg==; 3:hOREpcjaEHeP7vuG6kU0TowuExrcmIWQlLd8NbiII/g8LHJT2O9FKCsGmcRXZMocUX8vvXeBq0Jou9YWCW6Ifq88xoL49D+CYS/mVahmE6uXAYu9yCXN1e6X3h/Ko/MdUQTgIXZb1BgaXPX5n24NpQ==; 25:wu545q3RglZH+nkKAaomR14qOZT0QQvKYmkywbVqFqyVzrlaCqz7agDpEvrOOrTQleToNYvMoyRfhBngDKOvysyry6uh5zrY4MokIWWxlKgxGThtoVg2cz+PS7PCes3NCdw9xmBv4QrghF0en2fihwyFvGevq6ksoHxVl3kmVmjPDdwmQ9EJSruqNFtJTqXC2ZYLGS9AR2RwFD+MnjfwshYGHPM1wZuN09IH/bVzUeahRDc9B981wBILYUYctt+ACQsdcUpcZEpecd+GRVIh3inlOEmutB0meKp0Cm+hQ2mwVt2cRGNDpm9DSdch30J0A7Z5Bq6cqw1zf9ofxkjXHJF80ILeT7YVSD5sSmsp19ahIdhELN/kTsojIz6a8IuXxzHLJ9JUR7xGgC8PvX7/9ZXpFTpSevg+7B7awQ0ikgLtS5iihyEKBcYd42sI1gXo X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0501MB841; X-LD-Processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DM2PR0501MB841; 31:eBMrdY4KukyjHaGKlgcCFk9mUYFr73tRR8pI5ovnva5gYtPE5hGdSszjKq6dU66SdLuggmXH98ZyS83xEP2/Cc+xiebmhzeHxLeN+2002qTI/xb3xDTc0IJqOvTdX1kl847otz+O1jp3ZCSZKW3kERi3FSuCA4PYg3yZWANsh9GaHorGV7FXN1BE+YCn1HAleWJZ4EvkzW75JwaQMFwuyRKkVB57KbtmHSPuICMdaKcP86NAfgCiZ/mxAsZo6g7q5vF40hqaJN/G1S651QxHYqY9Mw0DtojtXwBBb5N/WFw=; 20:6slh4m/8kTVpBCDV/HQ5oLNfk71BWwks3LKM+9TrnVLkIWSs/zuyLW2MHFoQIo2vTiD8wpNcmK96PCBfnpd4oxA1J2usR08dyZPtDWnbbeqzvrZpWGxixySLNsnTse0ojCpcscjALAWTo8w8iANpljv2Lyr2EkD1Ju0VS0PF/MH1YiJMDSQcxrWECJfh5cHBpmNlPlh4bub1ZrCEBZ5mI9VcRuPvXjpNfWpJaOqLzueUgDBtBGIDCUrffC4Hdt5nRtsrE7dIq4O1qPQ55eKU6Da1mdPy+7S95/yzzNI1/JRkQooh50qNAjxkoEr0K+APlElj+N8LQLllhzfzEryoPEleLCdRoWJVX1nErqUNHPkNH3TAlBCOEiZs4/BXPO0ENi7wgfwjo7VrNai+VywrGbsRYK5/kGPkwyvz0KXCLODec45Q7SOr/KfTlHKA4QMNP5UcNiHfxWw7kgCgr7ZcsgeHMSq64O+LkHFgCnXtpbOY07Vcem269icgTkuOvqJm X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(61668805478150)(22074186197030)(146099531331640); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001); SRVR:DM2PR0501MB841; BCL:0; PCL:0; RULEID:; SRVR:DM2PR0501MB841; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0501MB841; 4:QqUAFVXnydNO9XKh/BFy+bfLIqPj2h9Sc7aLFuwVgr6z73+BNLjToPB9Cw9VO27XMNDoUqVNfRqsA7vwH9MxPxq5Vz9RqlCpZKIQSbfPQnXIdOE4GPh6UmxvoTer5EJ4xipfLupOXGR3/WxZB1CMDnI91dc+32qrMVJtlNbhA7E5cpPiipcye8CzZVyd6wEv/kyCWhnruDXN61l2MD+fHSwzsW0CHrip6L3l5fn1YBtIQuSQ2DUhadiufH0AlLf1wQEyiWHhf3kjl781JnXhkhmHzfyPdoUUi/v+C38ZXnW7G9PAtDCfmCqSgh2uZNMjrT5WC0Q9Hpm3C88ThVutsJfst/CLLWJFkSIr6zcmo/rI/AWY8FuZsnqPbUtuO83BsqhNFQRdodgEljTT3HzOhiTaBriaah8s/IkLMX9FzPJfWVYSe3Ksx5wXnNG7S1z57AvPErjBd9YjnII9XrugVwht54VFyVNCb1Xsv4sFbgRnM0AIFrViNBulGJqJBQc3H9Hpi+HHRjMMWKEWX2rwnW9UJvY6D+7CIcLz1V6jZZQ= X-Forefront-PRVS: 008421A8FF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(189002)(199003)(97736004)(189998001)(42186005)(19580405001)(47776003)(8676002)(5001770100001)(33646002)(2906002)(19580395003)(15975445007)(77096005)(6862003)(50986999)(76176999)(106356001)(2950100002)(101416001)(5003940100001)(4326007)(5660300001)(107886002)(105586002)(92566002)(7846002)(7736002)(586003)(118296001)(229853001)(68736007)(4001430100002)(305945005)(2201001)(48376002)(6636002)(50466002)(66066001)(86362001)(50226002)(575784001)(6116002)(3846002)(81156014)(6666003)(36756003)(81166006)(7099028)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0501MB841; H:promb-2s-dhcp95-136.eng.vmware.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (EX13-EDG-OU-001.vmware.com: aditr@vmware.com does not designate permitted sender hosts) Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0501MB841; 23:pfrKbNx/zc8cgkPB35EvI1XAl+bBw0/QXFW6mQ7Z?= =?us-ascii?Q?+O+zFebATjiPyP0aiJAnbws5Twdt5+GWHJzEARzRvuRRJFH3fbs613dXVgXP?= =?us-ascii?Q?Rbgn1Sx0mT8ASZStAk04McU48hpH2UvEsqepYrmCipwA8MJUZi4ToK7HBKV8?= =?us-ascii?Q?BSmEJ7WTA4whcrhXLLmIZRJoyRt2B4GMX4MfSCpx5knsQ4bV2E9JYXMIFf7/?= =?us-ascii?Q?xfwob0Ng92PY0zNhnw22qzgdvTbm1UAlgM7Kb9m5VT5LNEwFTz/M+9N/pGJS?= =?us-ascii?Q?kLBA5yXZiqKp75mKfMzD5JcXPc2Qgf+gaWijO40tuSe5p/pc+5Ibc3LlvjEf?= =?us-ascii?Q?0Hl2gqsSSF41yAFlAT83F7/ZnQ+nQarrfoj0F+PRBhz8ml8+lbKSI0qTIPh6?= =?us-ascii?Q?vaCx7fcpNuOrkb20QH+2ce3enwvEH99zAfwLAi5CG/316paJa5WjN9yqhOYQ?= =?us-ascii?Q?Rhl+kbJ3Axr7NT1xL8jBA3aqshPQq8GvXsgRKZ7hZkZksW7x23PoMxRQcf1A?= =?us-ascii?Q?iiVKJyjNFuWMkcNuWpAcG5r8JzO1IsueD5pNdnHAjeQRcpJD9PizBWQ06GuK?= =?us-ascii?Q?XI/OjuV9ZWnhhEy9VGuG1adge3qV9heacgva6cEElEJgZT5hmb8xR0DRKA6X?= =?us-ascii?Q?1GEApWnw15VEYJu/+pyn9NuuJuXJjohK2ANIUsSqV/MKc+27JuCAvol0RQ31?= =?us-ascii?Q?o41iZQfHvRoEZvEKRDHBuPbo/dsDx+vW1/zEyVROENvIQ+busUIMjRQivTsw?= =?us-ascii?Q?XP7SUrFHOtyT0ODVKfyuzeuDl1klsYXspebGEEu0wkY2/d700YhOLIRTuROt?= =?us-ascii?Q?6z2ztJVW90mlIWI1rLUyxGJP7Jb6Ya6V5sX5qQ8tUmN8zEjYp0T0ppMwN53V?= =?us-ascii?Q?i+USgk2i68wA04OEvTrZptq2NZdQy3sJDo9jZQJzi5YIqXgOQnPMZlZfD3F4?= =?us-ascii?Q?/c/JcSPWjYI9iT6LYvLWqVWcmxLFOd5BC0FPeWUy4hi4rB87BPR3dn49TvCe?= =?us-ascii?Q?ReQztmQAP1Y8mNLB7YNtQL9JnoO0QzXzcRSAlbia2HVmcCpvqxiWA1lNrpN3?= =?us-ascii?Q?yg8uYyzk8ZUkUetMOVoHY3dNX+CE0Oe5mTxvcYZ1KepTEo3Q2t0Bs3WTSb8P?= =?us-ascii?Q?R5wP7qYQSJQKs/zjizZ7K/BjhFQ0/gya9CiEG4pII1ss6XGwcBFrU9L5WXGf?= =?us-ascii?Q?o9s2ihqR9J87SV6rXVkr4Dsd6yn+DZ5/mDFmm3Sk14QCFt+evErKayoz78h/?= =?us-ascii?Q?To2xg3LA7jVqj83iik1V7g3nf6XdzD4MCJ4Z1T5KM8kVJ9uCQtNbaOb/6jJg?= =?us-ascii?Q?wg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0501MB841; 6:iPbklXUFweSgTiisKO8bmLZ0WYC79Z2BExZP7z/gCjV8ZFdvbBHdCiF59oAjOrEQ3qwmT5OJrjYZKWPcYLRSZaWgAxJuRnUZ3JxsosFJ6SiQ5124+ClFNfhKx7Zxi4pr+5CpxcFhgkxevim+j4y9YAPLGGnLoyYO1ddL6s0K6PSo+AraZB/Ccx74niG8E9G2AQ2RI44ohq8NOYkXzVEJPI1I2Gs+uHL2zZC7JPVxXmcAvpJ54PhfBYAVIBmNlfM0EHEYMYQaRrLKyU+i6m4yFfBimxNVG8gXUDXFHlxRgP5vWXoFp35jSwm6CFNpXlkN; 5:fEQ0tOzMCQ/OxXu7Q29YYj7QD/XQBP68EOk52JVQ91/43TNpcqQbcDiE473wVeaokBCN9+VnNDQUyii7XoJB9dfeFHTGFFQgzKeWCNqnM+kIk/wVhGsXT+NtZycPSYBW9gwnDtMgAvCU0eqQDo+UajWvo29QHSPAlcdQmS1nD5c=; 24:vQj/o/5nvW7ovPGZPWGfRJvUnGkRdihD43kpkdg1he5GJ5a2q78pUy8B1/Q4sIgWTvEOmOd2hH4/LNPIQCRlhOTqNXfNH1dAFaIY3HW0Y/g=; 7:ETsKdSEzfM+o+VJMtOpyhHOdG2fNifYYax/+0A6ZR6VHMpM8UMH2wMob7fd15UtdBsOY17sDcv0FTk+wwaUPAMQLO+jI6hIKQrqV5TECR0aEO30fE+51vYqPygbINzSYmqQXiFn9fCqG+3vvDXBfkW7nP22Oi5QzIKQWDBxqHVMrA3vXnDkZEmoow2rLSJYxwqWcYpxdH9VjOVo19df4WU5XgiflRLtC/YLYUTumoAeHgi5fBBnSVxLM16S38J5LFWXdP0DegjNfnGhr7lMK7sjut07m3P6drt10RKEdLMqWXY6wTLanvEsfotgbHtzO2CSpbFr ydhjjagJ+GqAveA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM2PR0501MB841; 20:3Uz5DmCgm3WkUMGpDLmu3KtvBgkZ5uLAKx9SJRQR//mdKgDjC92CXXf74LXOE6/fMpFOlbAPRn4DUbNMqZ4YVzzKW6MF63kCrimRVF+SqROddcJlJAKoU2Gk2LsziWxM0SnoRzmoXkQtTMeupvzrCzMrRtL0br77QJ3MGx1qz2M= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2016 02:10:55.1350 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0501MB841 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 We share some common structures with the user-level driver. This patch adds those structures and shared functions to traverse the QP/CQ rings. Reviewed-by: Yuval Shaia Reviewed-by: Jorgen Hansen Reviewed-by: George Zhang Reviewed-by: Aditya Sarwade Reviewed-by: Bryan Tan Signed-off-by: Adit Ranadive --- Changes v5->v6: - Removed the pvrdma-uapi.h file and moved common structures into pvrdma-abi.h. - Moved enums and structs common to user-level and kernel driver into pvrdma-abi.h. - Changed _exp_ to _ex_ for extended structures. Changes v4->v5: - Moved pvrdma_uapi.h and pvrdma_user.h into common UAPI folder. - Renamed to pvrdma-uapi.h and pvrdma-abi.h respectively. - Prefixed unsigned vars with __. Changes v3->v4: - Moved pvrdma_sge into pvrdma_uapi.h --- include/uapi/rdma/Kbuild | 2 + include/uapi/rdma/pvrdma-abi.h | 289 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 291 insertions(+) create mode 100644 include/uapi/rdma/pvrdma-abi.h diff --git a/include/uapi/rdma/Kbuild b/include/uapi/rdma/Kbuild index ac62908..04357ba 100644 --- a/include/uapi/rdma/Kbuild +++ b/include/uapi/rdma/Kbuild @@ -8,3 +8,5 @@ header-y += rdma_netlink.h header-y += rdma_user_cm.h header-y += hfi/ header-y += rdma_user_rxe.h +header-y += pvrdma-abi.h +header-y += pvrdma-uapi.h diff --git a/include/uapi/rdma/pvrdma-abi.h b/include/uapi/rdma/pvrdma-abi.h new file mode 100644 index 0000000..5ca0e91 --- /dev/null +++ b/include/uapi/rdma/pvrdma-abi.h @@ -0,0 +1,289 @@ +/* + * Copyright (c) 2012-2016 VMware, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of EITHER the GNU General Public License + * version 2 as published by the Free Software Foundation or the BSD + * 2-Clause License. This program is distributed in the hope that it + * will be useful, but WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License version 2 for more details at + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html. + * + * You should have received a copy of the GNU General Public License + * along with this program available in the file COPYING in the main + * directory of this source tree. + * + * The BSD 2-Clause License + * + * Redistribution and use in source and binary forms, with or + * without modification, are permitted provided that the following + * conditions are met: + * + * - Redistributions of source code must retain the above + * copyright notice, this list of conditions and the following + * disclaimer. + * + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __PVRDMA_ABI_H__ +#define __PVRDMA_ABI_H__ + +#include + +#define PVRDMA_UVERBS_ABI_VERSION 3 /* ABI Version. */ +#define PVRDMA_UAR_HANDLE_MASK 0x00FFFFFF /* Bottom 24 bits. */ +#define PVRDMA_UAR_QP_OFFSET 0 /* QP doorbell. */ +#define PVRDMA_UAR_QP_SEND BIT(30) /* Send bit. */ +#define PVRDMA_UAR_QP_RECV BIT(31) /* Recv bit. */ +#define PVRDMA_UAR_CQ_OFFSET 4 /* CQ doorbell. */ +#define PVRDMA_UAR_CQ_ARM_SOL BIT(29) /* Arm solicited bit. */ +#define PVRDMA_UAR_CQ_ARM BIT(30) /* Arm bit. */ +#define PVRDMA_UAR_CQ_POLL BIT(31) /* Poll bit. */ + +enum pvrdma_wr_opcode { + PVRDMA_WR_RDMA_WRITE, + PVRDMA_WR_RDMA_WRITE_WITH_IMM, + PVRDMA_WR_SEND, + PVRDMA_WR_SEND_WITH_IMM, + PVRDMA_WR_RDMA_READ, + PVRDMA_WR_ATOMIC_CMP_AND_SWP, + PVRDMA_WR_ATOMIC_FETCH_AND_ADD, + PVRDMA_WR_LSO, + PVRDMA_WR_SEND_WITH_INV, + PVRDMA_WR_RDMA_READ_WITH_INV, + PVRDMA_WR_LOCAL_INV, + PVRDMA_WR_FAST_REG_MR, + PVRDMA_WR_MASKED_ATOMIC_CMP_AND_SWP, + PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD, + PVRDMA_WR_BIND_MW, + PVRDMA_WR_REG_SIG_MR, +}; + +enum pvrdma_wc_status { + PVRDMA_WC_SUCCESS, + PVRDMA_WC_LOC_LEN_ERR, + PVRDMA_WC_LOC_QP_OP_ERR, + PVRDMA_WC_LOC_EEC_OP_ERR, + PVRDMA_WC_LOC_PROT_ERR, + PVRDMA_WC_WR_FLUSH_ERR, + PVRDMA_WC_MW_BIND_ERR, + PVRDMA_WC_BAD_RESP_ERR, + PVRDMA_WC_LOC_ACCESS_ERR, + PVRDMA_WC_REM_INV_REQ_ERR, + PVRDMA_WC_REM_ACCESS_ERR, + PVRDMA_WC_REM_OP_ERR, + PVRDMA_WC_RETRY_EXC_ERR, + PVRDMA_WC_RNR_RETRY_EXC_ERR, + PVRDMA_WC_LOC_RDD_VIOL_ERR, + PVRDMA_WC_REM_INV_RD_REQ_ERR, + PVRDMA_WC_REM_ABORT_ERR, + PVRDMA_WC_INV_EECN_ERR, + PVRDMA_WC_INV_EEC_STATE_ERR, + PVRDMA_WC_FATAL_ERR, + PVRDMA_WC_RESP_TIMEOUT_ERR, + PVRDMA_WC_GENERAL_ERR, +}; + +enum pvrdma_wc_opcode { + PVRDMA_WC_SEND, + PVRDMA_WC_RDMA_WRITE, + PVRDMA_WC_RDMA_READ, + PVRDMA_WC_COMP_SWAP, + PVRDMA_WC_FETCH_ADD, + PVRDMA_WC_BIND_MW, + PVRDMA_WC_LSO, + PVRDMA_WC_LOCAL_INV, + PVRDMA_WC_FAST_REG_MR, + PVRDMA_WC_MASKED_COMP_SWAP, + PVRDMA_WC_MASKED_FETCH_ADD, + PVRDMA_WC_RECV = 1 << 7, + PVRDMA_WC_RECV_RDMA_WITH_IMM, +}; + +enum pvrdma_wc_flags { + PVRDMA_WC_GRH = 1 << 0, + PVRDMA_WC_WITH_IMM = 1 << 1, + PVRDMA_WC_WITH_INVALIDATE = 1 << 2, + PVRDMA_WC_IP_CSUM_OK = 1 << 3, + PVRDMA_WC_WITH_SMAC = 1 << 4, + PVRDMA_WC_WITH_VLAN = 1 << 5, + PVRDMA_WC_FLAGS_MAX = PVRDMA_WC_WITH_VLAN, +}; + +struct pvrdma_alloc_ucontext_resp { + __u32 qp_tab_size; + __u32 reserved; +}; + +struct pvrdma_alloc_pd_resp { + __u32 pdn; + __u32 reserved; +}; + +struct pvrdma_create_cq { + __u64 buf_addr; + __u32 buf_size; + __u32 reserved; +}; + +struct pvrdma_create_cq_resp { + __u32 cqn; + __u32 reserved; +}; + +struct pvrdma_resize_cq { + __u64 buf_addr; + __u32 buf_size; + __u32 reserved; +}; + +struct pvrdma_create_srq { + __u64 buf_addr; +}; + +struct pvrdma_create_srq_resp { + __u32 srqn; + __u32 reserved; +}; + +struct pvrdma_create_qp { + __u64 rbuf_addr; + __u64 sbuf_addr; + __u32 rbuf_size; + __u32 sbuf_size; + __u64 qp_addr; +}; + +/* PVRDMA masked atomic compare and swap */ +struct pvrdma_ex_cmp_swap { + __u64 swap_val; + __u64 compare_val; + __u64 swap_mask; + __u64 compare_mask; +}; + +/* PVRDMA masked atomic fetch and add */ +struct pvrdma_ex_fetch_add { + __u64 add_val; + __u64 field_boundary; +}; + +/* PVRDMA address vector. */ +struct pvrdma_av { + __u32 port_pd; + __u32 sl_tclass_flowlabel; + __u8 dgid[16]; + __u8 src_path_bits; + __u8 gid_index; + __u8 stat_rate; + __u8 hop_limit; + __u8 dmac[6]; + __u8 reserved[6]; +}; + +/* PVRDMA scatter/gather entry */ +struct pvrdma_sge { + __u64 addr; + __u32 length; + __u32 lkey; +}; + +/* PVRDMA receive queue work request */ +struct pvrdma_rq_wqe_hdr { + __u64 wr_id; /* wr id */ + __u32 num_sge; /* size of s/g array */ + __u32 total_len; /* reserved */ +}; +/* Use pvrdma_sge (ib_sge) for receive queue s/g array elements. */ + +/* PVRDMA send queue work request */ +struct pvrdma_sq_wqe_hdr { + __u64 wr_id; /* wr id */ + __u32 num_sge; /* size of s/g array */ + __u32 total_len; /* reserved */ + __u32 opcode; /* operation type */ + __u32 send_flags; /* wr flags */ + union { + __u32 imm_data; + __u32 invalidate_rkey; + } ex; + __u32 reserved; + union { + struct { + __u64 remote_addr; + __u32 rkey; + __u8 reserved[4]; + } rdma; + struct { + __u64 remote_addr; + __u64 compare_add; + __u64 swap; + __u32 rkey; + __u32 reserved; + } atomic; + struct { + __u64 remote_addr; + __u32 log_arg_sz; + __u32 rkey; + union { + struct pvrdma_ex_cmp_swap cmp_swap; + struct pvrdma_ex_fetch_add fetch_add; + } wr_data; + } masked_atomics; + struct { + __u64 iova_start; + __u64 pl_pdir_dma; + __u32 page_shift; + __u32 page_list_len; + __u32 length; + __u32 access_flags; + __u32 rkey; + } fast_reg; + struct { + __u32 remote_qpn; + __u32 remote_qkey; + struct pvrdma_av av; + } ud; + } wr; +}; +/* Use pvrdma_sge (ib_sge) for send queue s/g array elements. */ + +/* Completion queue element. */ +struct pvrdma_cqe { + __u64 wr_id; + __u64 qp; + __u32 opcode; + __u32 status; + __u32 byte_len; + __u32 imm_data; + __u32 src_qp; + __u32 wc_flags; + __u32 vendor_err; + __u16 pkey_index; + __u16 slid; + __u8 sl; + __u8 dlid_path_bits; + __u8 port_num; + __u8 smac[6]; + __u8 reserved2[7]; /* Pad to next power of 2 (64). */ +}; + +#endif /* __PVRDMA_ABI_H__ */