From nobody Sat Nov 01 21:03:59 2025 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4czVhg63Rjz6FCRn for ; Sat, 01 Nov 2025 21:04:19 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4czVhg4Cdcz3cgL for ; Sat, 01 Nov 2025 21:04:19 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-640b2a51750so78230a12.0 for ; Sat, 01 Nov 2025 14:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762031053; x=1762635853; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=15I6xC3S50AeeBukiKYhvEEPZMOXpbZPfNfHlgZNnIE=; b=G+sQIaFCEdMCrslnxcIH1dw9SHP283B6Gv5nYzq+iWUh+QyRh4MxIoR4+1o2OBEjv8 hAcP6CgfuhhPYXZrm/3obtdjqk4X/2aZAOEGqFzS8dK6oa2Vp1IpgwWAypwniN4X8Y9v pcQ0I5VJ2NXHhwdM31QFTPIDk10tzGx13B3wQaoydFUGFL68cX2jJztwABPoG+bm8pST EgSQVxWnbgN2AZP4nVvm1ledDyeXNIEkeB+EYHHRTqNTLcOD80MTjfonkI3aKdy328Kp QyJU7TgIfKDUzyPCqf058D+/Kx9OvSJynOwVk9zcdEOIcTH71WDXsQa7GbbVqvTnmfMw ZMug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762031053; x=1762635853; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=15I6xC3S50AeeBukiKYhvEEPZMOXpbZPfNfHlgZNnIE=; b=iWQsQTuGV+sFs8Bh+3RDmlHOGxaLMr+M4Ue1kimJJbaIyZTzBEye1AsrOVUwLFJfwH cw30Yx+ZsTd8ZmA3/h7fuk3sVtVa6dZg4YQx8E0E8LN4HxriBivuUe0Mdnkf6vKdqERb qwKGKEEvDDfOWaPwBSIA1VIH1kjD0jXj3W3x7c4zzd9Nx/8Y2slJAVaXTkg8asyVbKZN IpfI6PScl35kd4STrAfK4NPdLJKalIMBnbReHpzlw33C/541MGDJy1/l0IDPfZToS8er VuKbzwZ36tKyPOGL3z7wJoUD3RFrjw4Bw8CpudEoVZ7BYuTkmSXZWYwqKBO93zgKcvpI uVHg== X-Gm-Message-State: AOJu0YzW2lhIyXscuv7c8f49wpSUDHKDeQYVy6rOX6ekmT1taUowToKU V1psGiEPhORfu7ZyAsvHLkoryhaKfPrpynQ8F7bwkirCboD68RsyCwgQTYrREOmS0/Rvvt2jHgF KH3psc9JFiRUo/0Sw8Sy1vcBSvhGu3Q== X-Gm-Gg: ASbGnctB/+d1F8KGigSdgzXcRY80SjlZFVIRyM3WOaT258xqLfC2INExCj5cL1mCgsY O8cTs+iuEtSYkFHNHMynGNpqx8Hi3/G+lhCL9jYhJyCOSZ0lofmsPzQx6IPRKGDzUEVYMZGuH4u bGki8zAV3RI9hmWhQou4SBJVIjjsQkuS7lZ/rBozQLSdx5L46wTT1LK5sT7HvK78vDEtX4IuV/J jfaGYoO6LE8AOsJKUCUWtzZfmV7KOLsJ+QCGkilMY1FvlNVq4w1Pt4of3awOxTMZ9Pm5Ru/kiNP kQgBylE+zS7Wetjy45t2CMiD3YM= X-Google-Smtp-Source: AGHT+IEhNwDWs38q03/AgNJjETCzt1oGbraHb4MrffdCazwuEZwDe5sL/S2vuWPre4b+rS+JVXXdYw59vUT/ELG4OcA= X-Received: by 2002:a05:6402:510c:b0:63e:209b:a958 with SMTP id 4fb4d7f45d1cf-64077015d1bmr6967595a12.17.1762031052679; Sat, 01 Nov 2025 14:04:12 -0700 (PDT) List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org MIME-Version: 1.0 References: In-Reply-To: From: Rick Macklem Date: Sat, 1 Nov 2025 14:03:59 -0700 X-Gm-Features: AWmQ_bkPi1yQiL_zxa0imIafOwLqJm0k1R1c-HwsAFX2Rp42oM9jWAwE-uslku4 Message-ID: Subject: Re: RFC: NFS over RDMA To: Konstantin Belousov Cc: FreeBSD CURRENT , Navdeep Parhar , "erj@freebsd.org" , "aehrenberg@nvidia.com" , slavash@nvidia.com, "sreekanth.reddy@broadcom.com" , John Baldwin Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4czVhg4Cdcz3cgL On Sat, Nov 1, 2025 at 1:50=E2=80=AFPM Konstantin Belousov wrote: > > Added Slava Schwartsman. > > On Sat, Nov 01, 2025 at 01:11:02PM -0700, Rick Macklem wrote: > > Hi, > > > > I've had NFS over RDMA on my todo list for a very loonnnggg > > time. I've avoided it because I haven't had a way to test it, > > but I'm now going to start working on it. (A bunch of this work > > is already done for NFS-over-TLS which added code for handling > > M_EXTPG mbufs.) > > > > >From RFC-8166, there appears to be 4 operations the krpc > > needs to do: > > send-rdma - Send on the payload stream (sending messages that > > are kept in order). > > recv-rdma - Receive the above. > > ddp-write - Do a write of DDP data. > > ddp-read - Do a read of DDP data. > > > > So, here is how I see the krpc doing this. > > An NFS write RPC for example: > > - The NFS client code packages the Write RPC XDR as follows: > > - 1 or more mbufs/mbuf_clusters of XDR for the NFS arguments > > that precede the write data. > > - an mbuf that indicates "start of ddp-read". (Maybe use M_PROTO1?) > > - 1 or more M_EXTPG mbugs with page(s) loaded with the data to be > > written. > > - 0 or more mbufs/mbuf_clusters with additional RPC request XDR. > > > > This would be passed to the krpc which would... > > - the mbufs up to "start of ddp" in the payload stream. > > - Would specify a ddp-read for the pages from the M_EXTPG mbufs > > and send that in the payload stream. > > - send the remaining mbufs/mbuf_clusters in the payload stream > > > > The NFS server end would process the received payload stream, > > putting the non-ddp stuff in mbufs/mbuf_clusters. > > It would do the ddp-read of the data into anonymous pages it allocates > > and would associate these with M_EXTPG mbufs. > > It would put any remaining payload stream stuff for the RPC message in > > additional mbufs/mbuf_clusters. > > --> Call the NFS server with the mbuf list for processing. > > - When the NFS server gets to the write data (in M_EXTPG mbufs) > > it would set up a uio/iovec for the pages and call VOP_WRITE(). > > > > Now, the above is straightforward for me, since I know the NFS and > > krpc code fairly well. > > But that is where my expertise ends. > > > > So, what kind of calls do the drivers provide to send and receive > > what RFC-8166 calls the payload stream? > > > > And what kind of calls do the drivers provide to write and read DDP > > chunks? > > > > Also, if the above sounds way off the mark, please let me know. > > What you need is, most likely, the infiniband API or KPI to handle > RDMA. It is driver-independent, same as for ip NFS you use system IP > stack and not call to ethernet drivers. In fact, most likely the > transport used would be not native IB, but IB over UDP (RoCE v2). > > IB verbs, which is the official interface for both kernel and user mode, > are not well documented. An overview is provided by the document > titled "RDMA Aware Networks Programming User Manual", which should > be google-able. Otherwise, the Infiniband specication is the reference. Thanks. I'll look at that. (I notice that the Intel code references somethi= ng they call Linux-OpenIB. Hopefully that looks about the same and the glue needed to support non-Mellanox drivers isn't too difficult?) Btw, if anyone is interested in taking a more active involvement in this, they are more than welcome to do so. (I'm going to be starting where I understand things in the krpc/nfs. I'm not looking forward to porting rxe, but will probably end up there. I have already had one offer w.r.t. access to a lab that includes Mellanox hardware, but I don't know if remote debugging will be practical yet.) rick > > The IB implementation for us is still called OFED for historical reasons, > and it is located in sys/ofed. > > > > > As for testing, I am planning on hacking away at one of the RDMA > > in software drivers in Linux to get it working well enough to use for > > testing. Whatever seems to be easiest to get kinda working. > Yes rxe driver is the sw RoCE v2 implementation. We looked at the > amount of work to port it. Its size is ~12 kLoC, which is compatible > with libibverbs (userspace core infiniband interface). > > > > > Anyhow, any comments would be appreciated, rick > > ps: I did a bunch of cc's trying to get to the people that might know > > how the RDMA drivers work and what calls would do the above for > > them. >