From patchwork Mon Sep 12 04:49:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adit Ranadive X-Patchwork-Id: 9325667 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 ED3186089F for ; Mon, 12 Sep 2016 04:50:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E27B028ACC for ; Mon, 12 Sep 2016 04:50:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D705028B06; Mon, 12 Sep 2016 04:50:37 +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, UPPERCASE_50_75 autolearn=unavailable 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 D5BC428AD7 for ; Mon, 12 Sep 2016 04:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756572AbcILEue (ORCPT ); Mon, 12 Sep 2016 00:50:34 -0400 Received: from ex13-edg-ou-001.vmware.com ([208.91.0.189]:38044 "EHLO EX13-EDG-OU-001.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756253AbcILEu2 (ORCPT ); Mon, 12 Sep 2016 00:50:28 -0400 Received: from sc9-mailhost2.vmware.com (10.113.161.72) by EX13-EDG-OU-001.vmware.com (10.113.208.155) with Microsoft SMTP Server id 15.0.1156.6; Sun, 11 Sep 2016 21:50:16 -0700 Received: from EX13-CAS-008.vmware.com (smtp-inbound.vmware.com [10.113.191.58]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 7FD66B04DB; Sun, 11 Sep 2016 21:50:27 -0700 (PDT) Received: from EX13-CAS-003.vmware.com (10.113.191.53) by EX13-MBX-005.vmware.com (10.113.191.25) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Sun, 11 Sep 2016 21:50:27 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (10.113.170.11) by EX13-CAS-003.vmware.com (10.113.191.53) with Microsoft SMTP Server (TLS) id 15.0.1156.6 via Frontend Transport; Sun, 11 Sep 2016 21:50:26 -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=bA7o2224QWN3KR7eflZfN72tOVGBJHx4Vuy8aQamzJs=; b=C+aTQEq8jVWtu/IE+rpb8+U7k9UDgUr6XpJ30tz5mQOjImtd7tWaQmmTvJB1LfB0LTRI15PFncbhAY/zVkeHzCGU4hSkLYrDhkdHa6B6ubduxnmk+auy3Xzp9q7XLez0pJxExG9sLyfCdWIWmquAi0VwSMl4hSQhi6YzTFT5OOQ= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=vmware.com; Received: from promb-2s-dhcp95-136.eng.vmware.com (208.91.1.34) by BLUPR0501MB836.namprd05.prod.outlook.com (10.141.251.150) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.619.3; Mon, 12 Sep 2016 04:50:22 +0000 From: Adit Ranadive To: , , CC: Adit Ranadive , , , , , , Subject: [PATCH v4 03/16] IB/pvrdma: Add virtual device RDMA structures Date: Sun, 11 Sep 2016 21:49:13 -0700 Message-ID: <1473655766-31628-4-git-send-email-aditr@vmware.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1473655766-31628-1-git-send-email-aditr@vmware.com> References: <1473655766-31628-1-git-send-email-aditr@vmware.com> MIME-Version: 1.0 X-Originating-IP: [208.91.1.34] X-ClientProxiedBy: BY2PR04CA052.namprd04.prod.outlook.com (10.141.249.170) To BLUPR0501MB836.namprd05.prod.outlook.com (10.141.251.150) X-MS-Office365-Filtering-Correlation-Id: 3d5f3c18-78ac-440d-d4d0-08d3dac84e76 X-Microsoft-Exchange-Diagnostics: 1; BLUPR0501MB836; 2:iGLYkkYXdtwrbzDpKlw0iiermRTquOOUvKTpvjIfuFCHVf2Cc2kF7I0a/rlIX8vVR0TryHRe2nQt8V0x1IXZiW1jwHue8vlEt1cWq67lH5GU0mhVvicsdUTXcc0+IeuT3xManI4rjYb8FCQjWR7AuVmOGRIcPncBU0+LaB5X+KiH2SwxVa+57gY+99ds8SQ+; 3:8JrQlgMLgAoMhKviwCQbAQgUck7YgzomgcAtbUsfvHa+XUwDP3R8xuAMO+m3Xxmboic5OZpnUNfsvxNbTibQRXAajbkd1eN/HKDggw0lR33CSpGtM6VKacmfH+TweJpO; 25:gnx1tju2sV8vY0OrSNKsuu55nLIdoXaaWM+XlupOkZH0gs6vVuoyjYtoV6pS3m4lf6KIN/qDGDV5isLIEzxEbHGBEDK2zIGNS0FIKexzyN5xtSgt/EOVvhh8xhSCfQS2HGUfXM08PdU6bByyT8cXxryNJRjnFW2VYPAsSp9FcKQaiH0lR9KfuoeFVjLb+LK5yLayIMZRNWOXJX54Nis8wGEbzJ7dpRo8pHN4mDcV/SvSmMB+Y+MxCcy5YHw0oc00uUIcOSXsTBhggGFbm2YDN9ob8MeCa8YL691J02kvAmUfdzquto4fhspjriMc9nbS112uOlNYTpSHOj9laCV0PowFM/cShDwvY80tBs3+L6d8N9If+xQfJ/LwdQz3XQT5/fIP9KUl/pEyPo6Bap44EvcgsVHw7mQ8SQaTaBk1dwM= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0501MB836; X-LD-Processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; BLUPR0501MB836; 31:xQDZs5ucrHo/uQQxZXBDRctaBDjjex5qUemIrw9Xdv6eBjVgJCIVSndMKGB5OW40q79HLKIBLrOquPX9qV/qxQeMuum8mzCIKMJh4xAwNoDAuNaowHAXT320UAHCbIWvd+ricmCckJV5g5PBhbQHJc/lAO68qCz4bABpzmhzwSorEIRsg2s8PTmvFqKowYl/6oA4oakwHcOT2za3zoPjXQx3UhyIn+RtGsbNQdiBV6E=; 20:HCz1wsMSwRKy5jy53ZhGzSeWMkQcZWLw008mU+meJQlyDIVZujId9kSDn4Egad93ZrWzUywHrOXFWSEkZQTrFPDdQTONtilJNriWK0OltR5FyF0HUEwB3JHh+F4mzAk6EW3kzOSR50EBIrCBf3VTLfvkuomp3z96xCs5lQux58IKGzxQ8jnQFXYhNe6dSCF6talfKiMABfRLBA5qsSsBSJpN6sc5Ina3+4AtYG/ksUE5sybt+scagaHQMCry0rPvsQ/CdfSsR6KGsoMNA7kvBMY4N/pCkVQdOViXkIrWSQzDVORchco/owtYPeQ8JgYbN2ljdWxXxBBpSwtdFl7O/nPmX+hfND4ZCcLHeemvTSy30LxRE9kn+/rT84yrsB1SfRbBqq8G3DYj3NC0SNDtgokJQJ+WeKOuAL8TpJo+USAtFTk5QxZU/l4O/qyuDB05+ug9O2L2ice5Emwf6zjTQoLjv7o3V8POUsN5GCJ/Fcb8ZUP5StZuvBBA5iNguHVa X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:BLUPR0501MB836; BCL:0; PCL:0; RULEID:; SRVR:BLUPR0501MB836; X-Microsoft-Exchange-Diagnostics: 1; BLUPR0501MB836; 4:vaQocj3ddpPahhmJEN0ysXHrmILiCRnJlT8WwOYgPsjWXJR74/PqQF0kDN8uUHsst6Mxe6fjabUY37Vbq1Kh9JODeTG8TX/MJolnQRjyzjqjEHOoDCDfskIIdGNNN9W/yCeDErMlEjvftOFmqBTASzuwYWqp0heM7A7BNKef4Ks624HhXffxNUPH/1OkjmPY/NeOddtm/8F2Tw3d/NQ9Lf3fugeaCYncMjDw+l5mtHb8gCrg1BPR07knmMicwSkpn/GUVW2XWqbAwrOopm2nb0YGV+KZX7/sKq/o3E7lwZqUz5rbpZWznf1cqfe8/77BovlMgr7J09gdu0+s2KnwfeI4cALEuyzmXgXR0K5xaD9zaFbFoy1S6WbFIZPjdbMMbKVMLU/ltxtOzTTK6mf1zEaByWnZ75N4KFthk/iZfaE37zSq4C+In2zhtr8dIoD7 X-Forefront-PRVS: 006339698F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(66066001)(107886002)(4001430100002)(5003940100001)(36756003)(47776003)(189998001)(4001450100002)(87386001)(86362001)(48376002)(2201001)(50466002)(2906002)(50226002)(8676002)(81166006)(586003)(4326007)(7846002)(5660300001)(305945005)(42186005)(76176999)(7736002)(50986999)(6116002)(3846002)(4001520100001)(5001770100001)(19580405001)(33646002)(92566002)(19580395003)(2950100001)(77096005)(229853001)(7099028)(5001760100003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR0501MB836; H:promb-2s-dhcp95-136.eng.vmware.com; FPR:; SPF:None; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR0501MB836; 23:B8uHxS1k5E6HcrwG8DZgzQTY4MzFguwkPYD6tf89?= =?us-ascii?Q?As5XYQNhNO0TWIQks+axx0aDvMskiOQ9gUOhLhJqz8AU6uEo+dmTQByetU4d?= =?us-ascii?Q?lHVWEI3xkKVbzww+1D6Gvsa/TMF+600wglJ0G/BXgnl734eclSduQ35Lor7Y?= =?us-ascii?Q?K5pzipARs4TIx+NVNptnVPyso+1eml3EqCOsiXXokuDLif133nObClnlRCI0?= =?us-ascii?Q?WnJEzAwIUotyNLWqGd6w+TI/G2pO2zXLLC7IKSNivfHiDdb91xfnLfYASglK?= =?us-ascii?Q?7SOhvtalkwWQK7j9fdqOhag/N/P4k1DlKsB8ZOKmN/5smR9Uj33n6qincGuH?= =?us-ascii?Q?plgy3tqtLmEKb9l+r1h6Y5ozbpmoc3uw3G0cSWJTswiw5nLov8xt1YOr5Cis?= =?us-ascii?Q?zkL/z5TYNzRrghn7DCvCS2TJSJbf0q9IGeJ7f6EkN5vGXSUybNIqEMFEQVBk?= =?us-ascii?Q?0ltJfQrk9v/ZczX4JV9HiZKc+IiZWU6sPS+A+C86cLFvG8GsxRO7KwkhzfXU?= =?us-ascii?Q?lppLwRKn+kkH0Zk5iLLHesebjrar1xhky05mUv63LcCRjO2QT3FRtiyDq884?= =?us-ascii?Q?PoLLqiUn52XKXydRcxixVD8qRzK0y7kYKnGEoD0ISguwq50pZLNgEzakNgMz?= =?us-ascii?Q?VkkG0ieuB/HlML1PWoOshjGv7elPob+AuMPBS3zWY5tpOuJNJFE9dZwWe19E?= =?us-ascii?Q?OIJbP5RQys0EXowsyiAL+pYxLWRqw8pZpMTUpPKi6KPmkHYLW8JhUZo4f9Wf?= =?us-ascii?Q?DckX462A3bWZf8RH/iMfKNjA1oz7sEwDN9W02RyoSskeCtp2mEjc/OYx6dED?= =?us-ascii?Q?sTELX3ml3xQix8D2qG4T713Xg21eEYN+rQyP1cDZQLPKO62kDicEV+VXCnep?= =?us-ascii?Q?6x/fJyuQXmmU1OAGFTvy3uIy/4H2/VWqvMz4RMHQcvkGOyPHEe9bLNnVHj+n?= =?us-ascii?Q?Nc002AZmIJEIDQ2+WOmnnnJydGXC5fQN25WqmON8b4ItLqy86eo7bf0j8pGs?= =?us-ascii?Q?gePdb2XqYkDG7dEGVVEX2obJUB1l4KbYQl2DjzgbjxfTz+PsbQCTuavLApoe?= =?us-ascii?Q?OmQkhydtSMGPnzjlPwH1S0Jmpzj5P2ehiiJbxPd9f8eUtx97lQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR0501MB836; 6:6HEHN5JINLd3a4b6mCBdB49oSPST48DEL0T7zMm+9iPQP6PHQRmuO3tUFptqRqqp5TPgX1Iywh9HxdXAVEnc5hh6p2cCbN6nDPGzaljRBqJo2JaLWSsccaiELdegyUCctcS1XW3vinOl07n6OaWU3QziuFZPzmXv0BdBP+MbdwigKcxj/AMEyOujrR97EAB4Bl6icDMsVNspnxTqQaihtIETfLDZ1e++N9Tg7lBVqN128D9R57G4HbHDELsHdUrSQUgY2Y7wtVT+q5ROjSqqCF09zxIMfuU3wrtLOm6befA=; 5:0ahKR4wdD80SPzDkuEfiioSgzc5nn68nOXcdfSPOVqm/f7cR/TI2eR9c/UH1Vl345KF8Nh/fHcT2yVRAMZKQULXNgt71wr2k0lhvBIfmsIPEs/dcVAPkYSBu6NC6w1PhLbDYb94bYIileOAdTVDQKg==; 24:I7nitcwn+l5YUFwy8wcNdRrAeTRdRsdeX8Z7fyLoXmPmpXIULMQzrCGLUpVqO2igL8UR5BTNaAC7oEZceyQ7zweialb0PEV6V+ZMf0IBSug=; 7:KPLQNu7HfNtvk5jNDqielQIt8zQfAMrbblFZJ0+oNpf50wDw266R6ZctuFPoQxzamml3CCmw5ep//71skvNglfP0B5a0AcCRO7XvsKPHS7Iay+tjXakZ+fXl4FnVQOadxE66hT+PrzaJuiMPcWbTkmWV3pBwjop0denjbSsuWdEVb6W39Dowpam+JGaRuot0mSYlRGnB2Bd20IZYPtTH8G4BElXPN6RCUBH4h8EuQIspOvNCSIJZjlDvGF9jPWLA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR0501MB836; 20:0CyFxbPyCKoVOUOpcbPvX6jCxYg5cDhiMcWcwbgfDqQcr6d5A8CQXyrCuI99ytHC9yys7GHJ4r7Ue3VTVAS5DLLIy2tvsmhpsIk8SZZEeFO6BUrKhMFI6S56A/2zzCxw/gT7/vQx4e78TZpIUEonOkr/AuTaFnIyRg8vA8oDgbg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Sep 2016 04:50:22.1987 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0501MB836 Received-SPF: None (EX13-EDG-OU-001.vmware.com: aditr@vmware.com does not designate permitted sender hosts) 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 This patch adds the various Verbs structures that we support in the virtual RDMA device. We have re-mapped the ones from the RDMA core stack to make sure we can maintain compatibility with our backend. Reviewed-by: Jorgen Hansen Reviewed-by: George Zhang Reviewed-by: Aditya Sarwade Reviewed-by: Bryan Tan Signed-off-by: Adit Ranadive --- Changes v3->v4: - Moved the pvrdma_sge struct to pvrdma_uapi.h --- drivers/infiniband/hw/pvrdma/pvrdma_ib_verbs.h | 444 +++++++++++++++++++++++++ 1 file changed, 444 insertions(+) create mode 100644 drivers/infiniband/hw/pvrdma/pvrdma_ib_verbs.h diff --git a/drivers/infiniband/hw/pvrdma/pvrdma_ib_verbs.h b/drivers/infiniband/hw/pvrdma/pvrdma_ib_verbs.h new file mode 100644 index 0000000..105c6ab --- /dev/null +++ b/drivers/infiniband/hw/pvrdma/pvrdma_ib_verbs.h @@ -0,0 +1,444 @@ +/* + * [PLEASE NOTE: VMWARE, INC. ELECTS TO USE AND DISTRIBUTE THIS COMPONENT + * UNDER THE TERMS OF THE OpenIB.org BSD license. THE ORIGINAL LICENSE TERMS + * ARE REPRODUCED BELOW ONLY AS A REFERENCE.] + * + * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved. + * Copyright (c) 2004 Infinicon Corporation. All rights reserved. + * Copyright (c) 2004 Intel Corporation. All rights reserved. + * Copyright (c) 2004 Topspin Corporation. All rights reserved. + * Copyright (c) 2004 Voltaire Corporation. All rights reserved. + * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2005, 2006, 2007 Cisco Systems. All rights reserved. + * Copyright (c) 2015-2016 VMware, Inc. All rights reserved. + * + * This software is available to you under a choice of one of two + * licenses. You may choose to be licensed under the terms of the GNU + * General Public License (GPL) Version 2, available from the file + * COPYING in the main directory of this source tree, or the + * OpenIB.org BSD license below: + * + * 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. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef __PVRDMA_IB_VERBS_H__ +#define __PVRDMA_IB_VERBS_H__ + +#include + +union pvrdma_gid { + __u8 raw[16]; + struct { + __be64 subnet_prefix; + __be64 interface_id; + } global; +}; + +enum pvrdma_link_layer { + PVRDMA_LINK_LAYER_UNSPECIFIED, + PVRDMA_LINK_LAYER_INFINIBAND, + PVRDMA_LINK_LAYER_ETHERNET, +}; + +enum pvrdma_mtu { + PVRDMA_MTU_256 = 1, + PVRDMA_MTU_512 = 2, + PVRDMA_MTU_1024 = 3, + PVRDMA_MTU_2048 = 4, + PVRDMA_MTU_4096 = 5, +}; + +static inline int pvrdma_mtu_enum_to_int(enum pvrdma_mtu mtu) +{ + switch (mtu) { + case PVRDMA_MTU_256: return 256; + case PVRDMA_MTU_512: return 512; + case PVRDMA_MTU_1024: return 1024; + case PVRDMA_MTU_2048: return 2048; + case PVRDMA_MTU_4096: return 4096; + default: return -1; + } +} + +static inline enum pvrdma_mtu pvrdma_mtu_int_to_enum(int mtu) +{ + switch (mtu) { + case 256: return PVRDMA_MTU_256; + case 512: return PVRDMA_MTU_512; + case 1024: return PVRDMA_MTU_1024; + case 2048: return PVRDMA_MTU_2048; + case 4096: + default: return PVRDMA_MTU_4096; + } +} + +enum pvrdma_port_state { + PVRDMA_PORT_NOP = 0, + PVRDMA_PORT_DOWN = 1, + PVRDMA_PORT_INIT = 2, + PVRDMA_PORT_ARMED = 3, + PVRDMA_PORT_ACTIVE = 4, + PVRDMA_PORT_ACTIVE_DEFER = 5, +}; + +enum pvrdma_port_cap_flags { + PVRDMA_PORT_SM = 1 << 1, + PVRDMA_PORT_NOTICE_SUP = 1 << 2, + PVRDMA_PORT_TRAP_SUP = 1 << 3, + PVRDMA_PORT_OPT_IPD_SUP = 1 << 4, + PVRDMA_PORT_AUTO_MIGR_SUP = 1 << 5, + PVRDMA_PORT_SL_MAP_SUP = 1 << 6, + PVRDMA_PORT_MKEY_NVRAM = 1 << 7, + PVRDMA_PORT_PKEY_NVRAM = 1 << 8, + PVRDMA_PORT_LED_INFO_SUP = 1 << 9, + PVRDMA_PORT_SM_DISABLED = 1 << 10, + PVRDMA_PORT_SYS_IMAGE_GUID_SUP = 1 << 11, + PVRDMA_PORT_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12, + PVRDMA_PORT_EXTENDED_SPEEDS_SUP = 1 << 14, + PVRDMA_PORT_CM_SUP = 1 << 16, + PVRDMA_PORT_SNMP_TUNNEL_SUP = 1 << 17, + PVRDMA_PORT_REINIT_SUP = 1 << 18, + PVRDMA_PORT_DEVICE_MGMT_SUP = 1 << 19, + PVRDMA_PORT_VENDOR_CLASS_SUP = 1 << 20, + PVRDMA_PORT_DR_NOTICE_SUP = 1 << 21, + PVRDMA_PORT_CAP_MASK_NOTICE_SUP = 1 << 22, + PVRDMA_PORT_BOOT_MGMT_SUP = 1 << 23, + PVRDMA_PORT_LINK_LATENCY_SUP = 1 << 24, + PVRDMA_PORT_CLIENT_REG_SUP = 1 << 25, + PVRDMA_PORT_IP_BASED_GIDS = 1 << 26, + PVRDMA_PORT_CAP_FLAGS_MAX = PVRDMA_PORT_IP_BASED_GIDS, +}; + +enum pvrdma_port_width { + PVRDMA_WIDTH_1X = 1, + PVRDMA_WIDTH_4X = 2, + PVRDMA_WIDTH_8X = 4, + PVRDMA_WIDTH_12X = 8, +}; + +static inline int pvrdma_width_enum_to_int(enum pvrdma_port_width width) +{ + switch (width) { + case PVRDMA_WIDTH_1X: return 1; + case PVRDMA_WIDTH_4X: return 4; + case PVRDMA_WIDTH_8X: return 8; + case PVRDMA_WIDTH_12X: return 12; + default: return -1; + } +} + +enum pvrdma_port_speed { + PVRDMA_SPEED_SDR = 1, + PVRDMA_SPEED_DDR = 2, + PVRDMA_SPEED_QDR = 4, + PVRDMA_SPEED_FDR10 = 8, + PVRDMA_SPEED_FDR = 16, + PVRDMA_SPEED_EDR = 32, +}; + +struct pvrdma_port_attr { + enum pvrdma_port_state state; + enum pvrdma_mtu max_mtu; + enum pvrdma_mtu active_mtu; + __u32 gid_tbl_len; + __u32 port_cap_flags; + __u32 max_msg_sz; + __u32 bad_pkey_cntr; + __u32 qkey_viol_cntr; + __u16 pkey_tbl_len; + __u16 lid; + __u16 sm_lid; + __u8 lmc; + __u8 max_vl_num; + __u8 sm_sl; + __u8 subnet_timeout; + __u8 init_type_reply; + __u8 active_width; + __u8 active_speed; + __u8 phys_state; + __u8 reserved[2]; +}; + +struct pvrdma_global_route { + union pvrdma_gid dgid; + __u32 flow_label; + __u8 sgid_index; + __u8 hop_limit; + __u8 traffic_class; + __u8 reserved; +}; + +struct pvrdma_grh { + __be32 version_tclass_flow; + __be16 paylen; + __u8 next_hdr; + __u8 hop_limit; + union pvrdma_gid sgid; + union pvrdma_gid dgid; +}; + +enum pvrdma_ah_flags { + PVRDMA_AH_GRH = 1, +}; + +enum pvrdma_rate { + PVRDMA_RATE_PORT_CURRENT = 0, + PVRDMA_RATE_2_5_GBPS = 2, + PVRDMA_RATE_5_GBPS = 5, + PVRDMA_RATE_10_GBPS = 3, + PVRDMA_RATE_20_GBPS = 6, + PVRDMA_RATE_30_GBPS = 4, + PVRDMA_RATE_40_GBPS = 7, + PVRDMA_RATE_60_GBPS = 8, + PVRDMA_RATE_80_GBPS = 9, + PVRDMA_RATE_120_GBPS = 10, + PVRDMA_RATE_14_GBPS = 11, + PVRDMA_RATE_56_GBPS = 12, + PVRDMA_RATE_112_GBPS = 13, + PVRDMA_RATE_168_GBPS = 14, + PVRDMA_RATE_25_GBPS = 15, + PVRDMA_RATE_100_GBPS = 16, + PVRDMA_RATE_200_GBPS = 17, + PVRDMA_RATE_300_GBPS = 18, +}; + +struct pvrdma_ah_attr { + struct pvrdma_global_route grh; + __u16 dlid; + __u16 vlan_id; + __u8 sl; + __u8 src_path_bits; + __u8 static_rate; + __u8 ah_flags; + __u8 port_num; + __u8 dmac[6]; + __u8 reserved; +}; + +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, +}; + +enum pvrdma_cq_notify_flags { + PVRDMA_CQ_SOLICITED = 1 << 0, + PVRDMA_CQ_NEXT_COMP = 1 << 1, + PVRDMA_CQ_SOLICITED_MASK = PVRDMA_CQ_SOLICITED | + PVRDMA_CQ_NEXT_COMP, + PVRDMA_CQ_REPORT_MISSED_EVENTS = 1 << 2, +}; + +struct pvrdma_qp_cap { + __u32 max_send_wr; + __u32 max_recv_wr; + __u32 max_send_sge; + __u32 max_recv_sge; + __u32 max_inline_data; + __u32 reserved; +}; + +enum pvrdma_sig_type { + PVRDMA_SIGNAL_ALL_WR, + PVRDMA_SIGNAL_REQ_WR, +}; + +enum pvrdma_qp_type { + PVRDMA_QPT_SMI, + PVRDMA_QPT_GSI, + PVRDMA_QPT_RC, + PVRDMA_QPT_UC, + PVRDMA_QPT_UD, + PVRDMA_QPT_RAW_IPV6, + PVRDMA_QPT_RAW_ETHERTYPE, + PVRDMA_QPT_RAW_PACKET = 8, + PVRDMA_QPT_XRC_INI = 9, + PVRDMA_QPT_XRC_TGT, + PVRDMA_QPT_MAX, +}; + +enum pvrdma_qp_create_flags { + PVRDMA_QP_CREATE_IPOPVRDMA_UD_LSO = 1 << 0, + PVRDMA_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1, +}; + +enum pvrdma_qp_attr_mask { + PVRDMA_QP_STATE = 1 << 0, + PVRDMA_QP_CUR_STATE = 1 << 1, + PVRDMA_QP_EN_SQD_ASYNC_NOTIFY = 1 << 2, + PVRDMA_QP_ACCESS_FLAGS = 1 << 3, + PVRDMA_QP_PKEY_INDEX = 1 << 4, + PVRDMA_QP_PORT = 1 << 5, + PVRDMA_QP_QKEY = 1 << 6, + PVRDMA_QP_AV = 1 << 7, + PVRDMA_QP_PATH_MTU = 1 << 8, + PVRDMA_QP_TIMEOUT = 1 << 9, + PVRDMA_QP_RETRY_CNT = 1 << 10, + PVRDMA_QP_RNR_RETRY = 1 << 11, + PVRDMA_QP_RQ_PSN = 1 << 12, + PVRDMA_QP_MAX_QP_RD_ATOMIC = 1 << 13, + PVRDMA_QP_ALT_PATH = 1 << 14, + PVRDMA_QP_MIN_RNR_TIMER = 1 << 15, + PVRDMA_QP_SQ_PSN = 1 << 16, + PVRDMA_QP_MAX_DEST_RD_ATOMIC = 1 << 17, + PVRDMA_QP_PATH_MIG_STATE = 1 << 18, + PVRDMA_QP_CAP = 1 << 19, + PVRDMA_QP_DEST_QPN = 1 << 20, + PVRDMA_QP_ATTR_MASK_MAX = PVRDMA_QP_DEST_QPN, +}; + +enum pvrdma_qp_state { + PVRDMA_QPS_RESET, + PVRDMA_QPS_INIT, + PVRDMA_QPS_RTR, + PVRDMA_QPS_RTS, + PVRDMA_QPS_SQD, + PVRDMA_QPS_SQE, + PVRDMA_QPS_ERR, +}; + +enum pvrdma_mig_state { + PVRDMA_MIG_MIGRATED, + PVRDMA_MIG_REARM, + PVRDMA_MIG_ARMED, +}; + +enum pvrdma_mw_type { + PVRDMA_MW_TYPE_1 = 1, + PVRDMA_MW_TYPE_2 = 2, +}; + +struct pvrdma_qp_attr { + enum pvrdma_qp_state qp_state; + enum pvrdma_qp_state cur_qp_state; + enum pvrdma_mtu path_mtu; + enum pvrdma_mig_state path_mig_state; + __u32 qkey; + __u32 rq_psn; + __u32 sq_psn; + __u32 dest_qp_num; + __u32 qp_access_flags; + __u16 pkey_index; + __u16 alt_pkey_index; + __u8 en_sqd_async_notify; + __u8 sq_draining; + __u8 max_rd_atomic; + __u8 max_dest_rd_atomic; + __u8 min_rnr_timer; + __u8 port_num; + __u8 timeout; + __u8 retry_cnt; + __u8 rnr_retry; + __u8 alt_port_num; + __u8 alt_timeout; + __u8 reserved[5]; + struct pvrdma_qp_cap cap; + struct pvrdma_ah_attr ah_attr; + struct pvrdma_ah_attr alt_ah_attr; +}; + +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_send_flags { + PVRDMA_SEND_FENCE = 1 << 0, + PVRDMA_SEND_SIGNALED = 1 << 1, + PVRDMA_SEND_SOLICITED = 1 << 2, + PVRDMA_SEND_INLINE = 1 << 3, + PVRDMA_SEND_IP_CSUM = 1 << 4, + PVRDMA_SEND_FLAGS_MAX = PVRDMA_SEND_IP_CSUM, +}; + +enum pvrdma_access_flags { + PVRDMA_ACCESS_LOCAL_WRITE = 1 << 0, + PVRDMA_ACCESS_REMOTE_WRITE = 1 << 1, + PVRDMA_ACCESS_REMOTE_READ = 1 << 2, + PVRDMA_ACCESS_REMOTE_ATOMIC = 1 << 3, + PVRDMA_ACCESS_MW_BIND = 1 << 4, + PVRDMA_ZERO_BASED = 1 << 5, + PVRDMA_ACCESS_ON_DEMAND = 1 << 6, + PVRDMA_ACCESS_FLAGS_MAX = PVRDMA_ACCESS_ON_DEMAND, +}; + +#endif /* __PVRDMA_IB_VERBS_H__ */