From patchwork Fri Aug 18 16:44:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adit Ranadive X-Patchwork-Id: 9909603 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 E2F5560386 for ; Fri, 18 Aug 2017 16:45:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5A5428CCB for ; Fri, 18 Aug 2017 16:45:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA52428D23; Fri, 18 Aug 2017 16:45:39 +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 1AD8A28D22 for ; Fri, 18 Aug 2017 16:45:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752371AbdHRQpi (ORCPT ); Fri, 18 Aug 2017 12:45:38 -0400 Received: from mail-sn1nam02on0061.outbound.protection.outlook.com ([104.47.36.61]:27840 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751605AbdHRQpg (ORCPT ); Fri, 18 Aug 2017 12:45:36 -0400 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=7jW3eVtcFpIlNyaHhrVFg+XFt2bZ/T74jEoQElUim5A=; b=fD2R6t5+i7lb9KqKZij/i4xeYL283tqaH1NZIaGSwY+TfpgT8xFW090dYSUYIN2Plo91k5rsbhbJEjIuunZtxDvN96dqdiHDa4/52QrhQ8r+yeJVHno7kBUAcD02liSG1JSmrPc3zfNMe27pjAIPegO9isk1DzUuHbfaYsQylgg= Received: from promb-2s-dhcp95-136.eng.vmware.com (208.91.1.34) by DM5PR05MB3516.namprd05.prod.outlook.com (10.174.242.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1362.12; Fri, 18 Aug 2017 16:45:33 +0000 From: Adit Ranadive To: dledford@redhat.com, linux-rdma@vger.kernel.org Cc: Bryan Tan , pv-drivers@vmware.com, Adit Ranadive Subject: [PATCH for-next 1/3] RDMA/vmw_pvrdma: Add RoCEv2 support Date: Fri, 18 Aug 2017 09:44:47 -0700 Message-Id: <2fc08a51ef95d5d56e243238e9821d4d977a3659.1503073950.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: MWHPR15CA0052.namprd15.prod.outlook.com (10.174.254.14) To DM5PR05MB3516.namprd05.prod.outlook.com (10.174.242.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b80ffde8-6bd5-4189-7bc8-08d4e6588bf2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR05MB3516; X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB3516; 3:xhPMpUEDtCaQ4FFnMyrjdfUtuD35IFX52IYvCxarmBLpETDhYMSlDZuSzWG89p6pwHrmhxT1I+9EG3muuTApzfp8nJC69faNoUagiQ9SerBqZutlu6JQM5+vVYwfPr3EyI3bzo7ctZ+aTAfm3s36Ad6Jx6hmpA3rvdKyOmN17lVhE9WMhkqrh8sK2CGQnevWeRgiulOqno9d9LlNV5YM9Sc9cJQfSFWWQgNiHpjMbMBSh62F9I6iIbPiC/B5ucU3; 25:79Cjzomh3pVNCdS08jVTW4CyuilijLnuLVBCMx65PkAipaI8NtUQOefC5bqQ4xj1FDhd0uXDjTEjdaiBP7fIuUk/5lbrSPgfO9PfF51BPoIYrhHvTJn9iSj1G/hYa3W5HdgngBrGI543MpiCxbVT3uqs5nZr/TxcJ1wbM4MjY1hpjddsbuK/LJQifd6xv2dGRzMjYuFYBfY2ROQgAIiX5o67mS/QlfWi/Z+jVy/9E/PMvacTzFjINGgUDQFcwrz0T1LHJLxHpgF07eNdh8RRLEX9cNElba9vPr6bI5PV50/SyfKYZNulJy4IxOkxVNmkQC11/hfrUAZ5O0pGl0iGSw==; 31:Sy8PfSj2GhDlQh01sSOUm4jOJPPHm5qWLwZ8mF6IxZP3hlT/ytkYRTe+uHONVek7ZnjcYTYajeKQZHDEb1ap5jw9/nBA5Yr5c+qIE0D7tSTGXTDlESe+Aoaz00e/+f9FR8H3uX1E90VnQDVgym/ig7ywHXBwkl5hSSQWcSNbXwu2Z9eoGRSw+na+ew5ZgihN0VTuGVd5Mt088nnasCnZaCKZtgkkYTnHG216KXQsKJ0= X-MS-TrafficTypeDiagnostic: DM5PR05MB3516: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=aditr@vmware.com; X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB3516; 20:Tt9RhpLqRhMlOCegumW034Ba4WNf0ibvWddiSANastS8TTBkFwy9eSlGlgvdz/ScI8zoZGYGYxxlfT63wGpqMFNpugZA+Jxa8Pu32yEWG+RMNfVcbQtRQGW8DEmGLjLOVpa+mt82G+mj77BokTllmlFWToOwq39PwwGG50oUxCGRSRSObLwsV2rFN2f9ABSeeRDJdY9+2DC+g5TAtyjQNTjDWF/dhx0SP0hZ84TmXy7hn3YuQOcO1S6komgbJY5hwVleFJ3l38qtrodT08mh/LHNlFakcIIuIuXIfflZcj5iqahECmSL3q7Y4TZEtt4fTmaYt+L39zjcRlKZiaKw1wCF7fd3mhSkuk1oe/7y7okm+kmZJzmN0qJaiNtMO5pXbEAnRTe1AhLqpKQd0jWjYR/WAIE1ZHLTXMOJyx8K+7CnGxU9kYHBKrC1HA2DpY3t1+z3Set34T86NUwJ/UdybzUDWfagasZgzAwg+Z0oD8uT5U5/Yi1K4BbOWW9uMsOY; 4:oj902iS4nfxIz8XxHTntm93uzsAEzNjW0E2J7VxnTtc8021hPllDrIVlWG39OuBJFmLCMiXZB+mHtY3J/uuCPAxiha9beIAOeEmE21YkGb3PPLCRnCDv4+8Vt1dYcq+5TudX5XSsQO5QN4wqFF8/rH+2kFFV6UCR1SkezO2Dsm7goCoe94r1IWn6gKIWI7bZ1965A2ESIKx7COmSAWfs08FX7L7EarX1eNdrH/wf/2RKuHDnaz/754vJ/HCKpog/CFXomx/J96BufBH83HpwMa6wZXW9NLBUhUNJlVldonI= X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6041248)(20161123562025)(20161123560025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR05MB3516; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR05MB3516; X-Forefront-PRVS: 040359335D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(199003)(189002)(66066001)(47776003)(5003940100001)(68736007)(101416001)(6486002)(53936002)(54906002)(305945005)(7736002)(50226002)(97736004)(81166006)(8676002)(189998001)(81156014)(575784001)(86362001)(50466002)(48376002)(33646002)(42186005)(2906002)(118296001)(76176999)(50986999)(36756003)(5660300001)(3846002)(2950100002)(110136004)(6666003)(107886003)(6116002)(106356001)(105586002)(478600001)(25786009)(4326008)(7350300001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR05MB3516; H:promb-2s-dhcp95-136.eng.vmware.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR05MB3516; 23:xgW7W0QZtnG1CPglGcki97kLCH+AcjLn/Ea2MuwQA?= =?us-ascii?Q?xvqS2nYsIqRDGx3BGqHTFCW3sCuymH3uF0FEDLue+TTKP8fBhUjitNBMoFzX?= =?us-ascii?Q?wkCOuiCCz+vAzQC890F/fg9ENjpVSJgHkyXZDOR10Uc3O5LhA5dGG13v78+W?= =?us-ascii?Q?7BB2fjrOhU8f7Ly2I6Yrw7A+ObSQiZMRrd4JwQxwBQmIhy3WNHKNa2picm4W?= =?us-ascii?Q?yg+hUHoI+3gO9tnzb6PmbdLoCE5TrkC8VVhuwnrgnIz9pidnVVmGTNxm1mOJ?= =?us-ascii?Q?5EG+nUpLzt1UG/u6XhSZV6MQjRDX9IZ3N5ovv3o9L5kvyBBl6gj4c4nnI6K0?= =?us-ascii?Q?heeB9ebCDadUmkvFjudV7iX9uR3L6xNCaK/kOZLz2cTMnobp7kCicmzFLMFH?= =?us-ascii?Q?d3se5ySAy2KyHoCNK9mtPKilc3GpnexzzpPIc7VyzD3eeAR7y16GsbqMbK2e?= =?us-ascii?Q?hI2YtrlNSmIzxfvtFRaCsaOykPSUBkdx4nvcApCw9+w6R5AMRPlFS2tXxoDg?= =?us-ascii?Q?S/Oyi7ub/DRojHlu8siz0pO4NuwOrQir6BwN3kO/PQzwPnSDcfBDNwAELXLk?= =?us-ascii?Q?hSv0lMOvcJCTgIvSGxblKkvQOIAzjeP/IEHzQ+c6nx+2V/OqDI6B8MTm6Xvj?= =?us-ascii?Q?GAvHq2Ij/dJRmA6ooCmH+3NkJLmT4Pk14LyhgbPbTGqKAlRMVRTD1UXVfIfB?= =?us-ascii?Q?L2ruvZT8w2VwhYj2Hz0Mly4pryLxH52O2yR2Bh6wkk4zdGiSmWKGmD5N8V06?= =?us-ascii?Q?wsXog7XjWf5syYF5judh9l8DQ42wHcSRUS+TEBPSLBk/eU2Ojgz1x5EKMcUi?= =?us-ascii?Q?VUGjBHXyJvGYJjU2RvIAmgrEJ+/L9EVHnH72X8iqHfizco2TzOMbF8YBMCF2?= =?us-ascii?Q?Bg2+b1jaAp/XxdGGv3K3tXXLhdSetIHAeQmjQsj7JuUmf8Ip8gMN8sYlExWq?= =?us-ascii?Q?YqYBiT7ItU6YhPiCDcRNXePuz1cMwkg3l0kxGnMkaafhfU+47GQjmhZEai0i?= =?us-ascii?Q?+jfh+q/8SzXPLrNK8YqE2RVxCaqITPjg5gRO3eSYlxDqc62PjMf/9pd6zg3t?= =?us-ascii?Q?fGyJMJIQRKdKN/phDNM2xd/x7R4ADM2YitiemzBz/y69dTWd46BZK6WcrmlY?= =?us-ascii?Q?VBvTRbi9bo=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB3516; 6:OEtwy34hulMvJreUOFI+QUN12OJjICIUyXMFOI4KlJCw1kbBfrj6QvVb1wz8LmiWL+cdWKkDYsON489lvwcAZS2WS0t751jR8364s8HC9jy65v31dlTDjYhERgmZ9Re8Uh9sUciefj8kPrM37nPuJiOdhBOkirFiGtn/2plAOpc8AnIRaHcJW6ygs6lczmpPasj9ENooyvaHCBC5LwT6Y/ZPuPvyGqC8BOXNPVPL9Toj1VVMtq/VR5UfWoT+5rvnwPgCLa2GdyBsLAOA2Gm/O0WRP3oxUVxeftY3ZqFIDROEECAtRH/z1NFYWsNPJHy9lzkJI47TznqY7ruUC7VqzA==; 5:B3qQdT88bAiiKgrqW7C6ekjBnz17IdO6GRwUZulM7skkOBJHkqtGmq2i2JZLKB/nME4U1+m+RSyNxHkKkfIjGhmxseKnUhBaRZG0MqvF0Ur5UNPKox+nY80PnJ6f9DsUHmAUGs43Biqyew2D90/sWQ==; 24:JrRW/IlxdLUXkMf88DdwX5fjg/cLd/hfT8ohyD20inoO8IZ83SZFT2YzlRwCUJTWiLzcABEE76mVCRLFLeXGy2TNXpLPOG2vTM+1sARUUds=; 7:jPhECULH1g73ggXXXQu47MsimiXm3UQ58uaYadnzMS80jnz8FUedU3jtS+RQzhbUlY2TlqdS4SA3f2PvSVdq01wCaomJCgbywzctaftJZCaKCSLIvlB700QprpnfKMEYYs7mmMHRHOpMsrLBgy0VHqxMfSqKA89XQYp6w0UL5Q+NqKy3JumqXALyLCuByYyZcYOFUMZp4UbVbzHGI9qogtMpVjtYwEB43hiis3Wk9Zk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR05MB3516; 20:Go9S3D+Rq/5aJ6OTRjUfqalgFbNlE9FBH6hkQRhKfzJkU7dTQdu56YXsZso7qSALCGgKV5iR7H5/h6NLVhZilT/kjkUTA7Oy+lSsPxbmbon1Y3/8zD3/X/f3vefXZhre+wSv4ReyCAiSLOT4jXpc64PP0BYD9bXGHdjEPCPaP78= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2017 16:45:33.5361 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR05MB3516 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 From: Bryan Tan The driver version is bumped for compatibility purposes. Also, send correct GID type during register to device. Acked-by: Jorgen Hansen Acked-by: Aditya Sarwade Signed-off-by: Bryan Tan Signed-off-by: Adit Ranadive --- drivers/infiniband/hw/vmw_pvrdma/pvrdma.h | 2 ++ drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h | 9 +++++++- drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | 25 ++++++++++++++--------- drivers/infiniband/hw/vmw_pvrdma/pvrdma_misc.c | 14 +++++++++++++ 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h index 8e2f0a1..513a182 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma.h @@ -444,6 +444,8 @@ void pvrdma_ah_attr_to_rdma(struct rdma_ah_attr *dst, const struct pvrdma_ah_attr *src); void rdma_ah_attr_to_pvrdma(struct pvrdma_ah_attr *dst, const struct rdma_ah_attr *src); +enum ib_gid_type pvrdma_gid_type_to_ib(u8 gid_type); +u8 ib_gid_type_to_pvrdma(enum ib_gid_type gid_type); int pvrdma_uar_table_init(struct pvrdma_dev *dev); void pvrdma_uar_table_cleanup(struct pvrdma_dev *dev); diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h index 09078cc..71df5d1 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h @@ -50,7 +50,7 @@ #include "pvrdma_verbs.h" -#define PVRDMA_VERSION 17 +#define PVRDMA_VERSION 18 #define PVRDMA_BOARD_ID 1 #define PVRDMA_REV_ID 1 @@ -123,6 +123,13 @@ #define PVRDMA_GID_TYPE_FLAG_ROCE_V1 BIT(0) #define PVRDMA_GID_TYPE_FLAG_ROCE_V2 BIT(1) +/* + * PVRDMA version macros. Some new features require updates to PVRDMA_VERSION. + * These macros allow us to check for different features if necessary. + */ + +#define PVRDMA_VERSION_ROCEV2_SUPPORT 18 + enum pvrdma_pci_resource { PVRDMA_PCI_RESOURCE_MSIX, /* BAR0: MSI-X, MMIO. */ PVRDMA_PCI_RESOURCE_REG, /* BAR1: Registers, MMIO. */ diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c index 7f29e4d..6fd5828 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c @@ -128,10 +128,14 @@ static int pvrdma_init_device(struct pvrdma_dev *dev) static int pvrdma_port_immutable(struct ib_device *ibdev, u8 port_num, struct ib_port_immutable *immutable) { + struct pvrdma_dev *dev = to_vdev(ibdev); struct ib_port_attr attr; int err; - immutable->core_cap_flags = RDMA_CORE_PORT_IBA_ROCE; + if (dev->dsr->caps.gid_types == PVRDMA_GID_TYPE_FLAG_ROCE_V1) + immutable->core_cap_flags |= RDMA_CORE_PORT_IBA_ROCE; + else if (dev->dsr->caps.gid_types == PVRDMA_GID_TYPE_FLAG_ROCE_V2) + immutable->core_cap_flags |= RDMA_CORE_PORT_IBA_ROCE_UDP_ENCAP; err = ib_query_port(ibdev, port_num, &attr); if (err) @@ -569,6 +573,7 @@ static void pvrdma_free_slots(struct pvrdma_dev *dev) static int pvrdma_add_gid_at_index(struct pvrdma_dev *dev, const union ib_gid *gid, + u8 gid_type, int index) { int ret; @@ -586,7 +591,7 @@ static int pvrdma_add_gid_at_index(struct pvrdma_dev *dev, cmd_bind->mtu = ib_mtu_enum_to_int(IB_MTU_1024); cmd_bind->vlan = 0xfff; cmd_bind->index = index; - cmd_bind->gid_type = PVRDMA_GID_TYPE_FLAG_ROCE_V1; + cmd_bind->gid_type = gid_type; ret = pvrdma_cmd_post(dev, &req, NULL, 0); if (ret < 0) { @@ -607,7 +612,9 @@ static int pvrdma_add_gid(struct ib_device *ibdev, { struct pvrdma_dev *dev = to_vdev(ibdev); - return pvrdma_add_gid_at_index(dev, gid, index); + return pvrdma_add_gid_at_index(dev, gid, + ib_gid_type_to_pvrdma(attr->gid_type), + index); } static int pvrdma_del_gid_at_index(struct pvrdma_dev *dev, int index) @@ -822,10 +829,6 @@ static int pvrdma_pci_probe(struct pci_dev *pdev, version = pvrdma_read_reg(dev, PVRDMA_REG_VERSION); dev_info(&pdev->dev, "device version %d, driver version %d\n", version, PVRDMA_VERSION); - if (version < PVRDMA_VERSION) { - dev_err(&pdev->dev, "incompatible device version\n"); - goto err_uar_unmap; - } dev->dsr = dma_alloc_coherent(&pdev->dev, sizeof(*dev->dsr), &dev->dsrbase, GFP_KERNEL); @@ -904,9 +907,11 @@ static int pvrdma_pci_probe(struct pci_dev *pdev, goto err_free_cq_ring; } - /* Currently, the driver only supports RoCE V1. */ - if (!(dev->dsr->caps.gid_types & PVRDMA_GID_TYPE_FLAG_ROCE_V1)) { - dev_err(&pdev->dev, "driver needs RoCE v1 support\n"); + /* PVRDMA supports RoCE V1 or V2. */ + if (version >= PVRDMA_VERSION_ROCEV2_SUPPORT && + !((dev->dsr->caps.gid_types & PVRDMA_GID_TYPE_FLAG_ROCE_V1) || + (dev->dsr->caps.gid_types & PVRDMA_GID_TYPE_FLAG_ROCE_V2))) { + dev_err(&pdev->dev, "driver needs RoCE v1 or v2 support\n"); ret = -EFAULT; goto err_free_cq_ring; } diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_misc.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_misc.c index ec6a4ca..0861e28 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_misc.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_misc.c @@ -303,3 +303,17 @@ void rdma_ah_attr_to_pvrdma(struct pvrdma_ah_attr *dst, dst->port_num = rdma_ah_get_port_num(src); memcpy(&dst->dmac, src->roce.dmac, sizeof(dst->dmac)); } + +enum ib_gid_type pvrdma_gid_type_to_ib(u8 gid_type) +{ + return (gid_type == PVRDMA_GID_TYPE_FLAG_ROCE_V2) ? + IB_GID_TYPE_ROCE_UDP_ENCAP : + IB_GID_TYPE_ROCE; +} + +u8 ib_gid_type_to_pvrdma(enum ib_gid_type gid_type) +{ + return (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) ? + PVRDMA_GID_TYPE_FLAG_ROCE_V2 : + PVRDMA_GID_TYPE_FLAG_ROCE_V1; +}