Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp237846pxb; Tue, 7 Sep 2021 23:23:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqALjYBEBEFEuxzSV1oPVU0HVZoPKGxKkj+B1OYpN43ycILTt3vbzIVNc3Z26+0xqCn6zN X-Received: by 2002:a17:907:7697:: with SMTP id jv23mr2357278ejc.451.1631082197018; Tue, 07 Sep 2021 23:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631082197; cv=none; d=google.com; s=arc-20160816; b=lCuGs3ZA9lRHAmokc56Eh2rGswij+BCkT1qT8wpJlt8yOw8XOIyl1lRe7MPPamiZu+ qm24ibK9AkBnJGGdciyzFL2Jb3e0sZds8zQNCUJcZ2eyZG1eLbhfQp1VvkDR4zOprc84 xDP9UjuZJi7NKK+WglqT+VguxmE7fHNB1+sRW7nlw8OK9PxhHaYTVE56OeZ9THd07hyf dG2R82nNQ+lZNgH9ThXqNjxQ/TpryFypCeZBdwjY5XfxYODUwmr8IvHvhxDdLRvLwfSW QIbZV5ib1C26fKpyoEC5DNMd8aKdWTHVnBjxdEuVV4yR6krUGC3Cx5CPYxbrHaBZZfw/ v/lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=suw2T1e6kwJIDG8V4tApESOsygFx+IuCL+NR4/bwr/Q=; b=AuGf2jikM4E5exaIf5mjXqiRP5dllRVS2Bu52bXpZdlCm4fbzNwxR+VmQzF8u1B8QN VysBG3WG65ZZdcd2o5tUnYHU1LHQhWx80jWGrdyv662waknqQotWynUB6DCS9uglQmCv L250T/4ZrfO744fQV3xaUrB/60XWs7A/Xs4dKMTNVHQHDNsOH4O2yfXcAEz2Oy8sPaSF rt9Bc5duYq1efzEYuAknM8+x7Z7H/i6ADMAdaErQQzxXEx9n0OPvHBB68o14FyMksOGO RfPacCEY2qCgsFyFCAXpBZz6SpIHZEpK320+ojfA5TH2l86l+ze2f7T5AdEMupurZWcG bjzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@igel-co-jp.20150623.gappssmtp.com header.s=20150623 header.b="P9/D4sYU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs18si1119895ejb.674.2021.09.07.23.22.52; Tue, 07 Sep 2021 23:23:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@igel-co-jp.20150623.gappssmtp.com header.s=20150623 header.b="P9/D4sYU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347594AbhIHGWO (ORCPT + 99 others); Wed, 8 Sep 2021 02:22:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347664AbhIHGWL (ORCPT ); Wed, 8 Sep 2021 02:22:11 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5587C061575 for ; Tue, 7 Sep 2021 23:21:03 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id bg1so632890plb.13 for ; Tue, 07 Sep 2021 23:21:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=suw2T1e6kwJIDG8V4tApESOsygFx+IuCL+NR4/bwr/Q=; b=P9/D4sYU90Q6PzfXGlRkM3n//Hlb/mW8cGUKYXc1L1Hxz9bx1v7F73qb+3f8u75DJs eN+UY0Hx7p/Th+a/HZS3Dysl47z/dyzPWFZXHRy8xTUI+H8v1euniYs6jFv8czVwNaZo Sy8wgXEM06htydtSXgk8VFxu4EEe6iKupN4dym9TthvTMi7TOkFcMrkK9aG1cFD+xVaL TbPordUMdZctjs6kHM6l9JYQXPzfm0c+2zkzmQn/gU4W0BUL3s28DlLBjCpb08bezQUd KrvyQIHCy6djZZz9iDeDUgfSNmN4q3fRAPsmurXXt014srIxeERCSwtLkTgmdYTjJsDf pk/g== 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; bh=suw2T1e6kwJIDG8V4tApESOsygFx+IuCL+NR4/bwr/Q=; b=nkn5llZsXI5WCtCOUYLIYWsevXl98GS3esGZ7bu3U8x3H2RKWCXo69cttLsR/Yt8EQ 7modc0cmv1vQZHYdyD7TsxbJkyxWcgPEVNfpww4M6Dtg7vtNeeTleS5jo2/Qy0zxmM90 9XaBkiVdEshsGDAIsUFSkI+XXYLcPG3leqzWi101VjtaDvPrcGzvPTe1jnij7WxupC1B bHPTOcZfXHDpfu++1aCUnZDNh7txwYVogEKjcslqogslM6tcWebVtrfvaYLX2yyUTOrp 7o4uECBR/IUkDYwVIG1b7Yn+ef5sD6Y7HPV97eMW8UicpRaa990SvHRVe5K0k9tur+Nc +4fg== X-Gm-Message-State: AOAM533XsubrvSMyCZcjxUwk2JabqK/1igrl46/uNO6OYH5bt/0uTruQ 5ff67JS6c/Q/vryr2ua+DNw8Cw== X-Received: by 2002:a17:902:7806:b0:138:1eee:c010 with SMTP id p6-20020a170902780600b001381eeec010mr1691037pll.20.1631082063411; Tue, 07 Sep 2021 23:21:03 -0700 (PDT) Received: from tyrell.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id l9sm657297pjz.55.2021.09.07.23.21.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Sep 2021 23:21:02 -0700 (PDT) From: Shunsuke Mie To: Zhu Yanjun Cc: =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher , Daniel Vetter , Doug Ledford , Jason Gunthorpe , Jianxin Xiong , Leon Romanovsky , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Shunsuke Mie , dhobsong@igel.co.jp, taki@igel.co.jp, etom@igel.co.jp Subject: [RFC PATCH] Providers/rxe: Add dma-buf support Date: Wed, 8 Sep 2021 15:20:49 +0900 Message-Id: <20210908062049.70699-1-mie@igel.co.jp> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is the user space counter-part of the kernel patch set to add dma-buf support to the RXE driver. Implement a new provider method for dma-buf base memory registration. Pull request at GitHub: https://github.com/linux-rdma/rdma-core/pull/1055 Signed-off-by: Shunsuke Mie --- providers/rxe/rxe.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c index 3c3ea8bb..0e6b1ecd 100644 --- a/providers/rxe/rxe.c +++ b/providers/rxe/rxe.c @@ -239,6 +239,25 @@ static struct ibv_mr *rxe_reg_mr(struct ibv_pd *pd, void *addr, size_t length, return &vmr->ibv_mr; } +static struct ibv_mr* rxe_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset, size_t length, + uint64_t iova, int fd, int access) +{ + struct verbs_mr *vmr; + int ret; + + vmr = malloc(sizeof (*vmr)); + if (!vmr) + return NULL; + + ret = ibv_cmd_reg_dmabuf_mr(pd, offset, length, iova, fd, access, vmr); + if (ret) { + free(vmr); + return NULL; + } + + return &vmr->ibv_mr; +} + static int rxe_dereg_mr(struct verbs_mr *vmr) { int ret; @@ -1706,6 +1725,7 @@ static const struct verbs_context_ops rxe_ctx_ops = { .alloc_pd = rxe_alloc_pd, .dealloc_pd = rxe_dealloc_pd, .reg_mr = rxe_reg_mr, + .reg_dmabuf_mr = rxe_reg_dmabuf_mr, .dereg_mr = rxe_dereg_mr, .alloc_mw = rxe_alloc_mw, .dealloc_mw = rxe_dealloc_mw, -- 2.17.1