From: Pranjal Shrivastava <praan@google.com>
To: trond.myklebust@hammerspace.com, anna@kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, edumazet@google.com,
pabeni@redhat.com, chuck.lever@oracle.com, jlayton@kernel.org,
tom@talpey.com, okorniev@redhat.com, neil@brown.name,
dai.ngo@oracle.com, linux-nfs@vger.kernel.org,
netdev@vger.kernel.org, Pranjal Shrivastava <praan@google.com>
Subject: [RFC PATCH 1/4] sunrpc: add supports_p2pdma to rpc_xprt_ops
Date: Wed, 1 Apr 2026 19:44:57 +0000 [thread overview]
Message-ID: <20260401194501.2269200-2-praan@google.com> (raw)
In-Reply-To: <20260401194501.2269200-1-praan@google.com>
Add a new transport op, supports_p2pdma, to allow upper layers (such as
NFS) to query whether the underlying RPC transport supports PCI
Peer-to-Peer DMA (P2PDMA).
Since the capability is hardware-dependent. For the RDMA transport,
implement this by querying the underlying InfiniBand device via
ib_dma_pci_p2p_dma_supported() to ensures that P2PDMA is only
attempted when both the transport and the HCA drivers support it.
Signed-off-by: Pranjal Shrivastava <praan@google.com>
---
include/linux/sunrpc/xprt.h | 1 +
net/sunrpc/xprtrdma/transport.c | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index f46d1fb8f71a..e451acd2e047 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -187,6 +187,7 @@ struct rpc_xprt_ops {
void (*bc_free_rqst)(struct rpc_rqst *rqst);
void (*bc_destroy)(struct rpc_xprt *xprt,
unsigned int max_reqs);
+ bool (*supports_p2pdma)(struct rpc_xprt *xprt);
};
/*
diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
index 9a8ce5df83ca..1c1714189a29 100644
--- a/net/sunrpc/xprtrdma/transport.c
+++ b/net/sunrpc/xprtrdma/transport.c
@@ -717,6 +717,14 @@ xprt_rdma_disable_swap(struct rpc_xprt *xprt)
{
}
+static bool
+xprt_rdma_supports_p2pdma(struct rpc_xprt *xprt)
+{
+ struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
+
+ return ib_dma_pci_p2p_dma_supported(r_xprt->rx_ep->re_id->device);
+}
+
/*
* Plumbing for rpc transport switch and kernel module
*/
@@ -742,6 +750,7 @@ static const struct rpc_xprt_ops xprt_rdma_procs = {
.enable_swap = xprt_rdma_enable_swap,
.disable_swap = xprt_rdma_disable_swap,
.inject_disconnect = xprt_rdma_inject_disconnect,
+ .supports_p2pdma = xprt_rdma_supports_p2pdma,
#if defined(CONFIG_SUNRPC_BACKCHANNEL)
.bc_setup = xprt_rdma_bc_setup,
.bc_maxpayload = xprt_rdma_bc_maxpayload,
--
2.53.0.1185.g05d4b7b318-goog
next prev parent reply other threads:[~2026-04-01 19:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 19:44 [RFC PATCH 0/4] nfs: Enable PCI Peer-to-Peer DMA (P2PDMA) support Pranjal Shrivastava
2026-04-01 19:44 ` Pranjal Shrivastava [this message]
2026-04-01 19:44 ` [RFC PATCH 2/4] nfs: add NFS_CAP_P2PDMA and detect transport support Pranjal Shrivastava
2026-04-02 13:11 ` Chuck Lever
2026-04-01 19:44 ` [RFC PATCH 3/4] nfs: make nfs_page pin-aware Pranjal Shrivastava
2026-04-02 5:04 ` Christoph Hellwig
2026-04-01 19:45 ` [RFC PATCH 4/4] nfs: allow P2PDMA in direct I/O path Pranjal Shrivastava
2026-04-02 5:05 ` Christoph Hellwig
2026-04-02 5:07 ` [RFC PATCH 0/4] nfs: Enable PCI Peer-to-Peer DMA (P2PDMA) support Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260401194501.2269200-2-praan@google.com \
--to=praan@google.com \
--cc=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dai.ngo@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jlayton@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=netdev@vger.kernel.org \
--cc=okorniev@redhat.com \
--cc=pabeni@redhat.com \
--cc=tom@talpey.com \
--cc=trond.myklebust@hammerspace.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox