[{"id":3674487,"web_url":"http://patchwork.ozlabs.org/comment/3674487/","msgid":"<CAH2r5mvR_ZVaNKVC+5Y-g-UZkH3FAbV39U28Pz2MjUUSVUNnMQ@mail.gmail.com>","list_archive_url":null,"date":"2026-04-07T21:18:44","subject":"Re: [PATCH 0/8] smb: add kernel internal IPPROTO_SMBDIRECT","submitter":{"id":510,"url":"http://patchwork.ozlabs.org/api/people/510/","name":"Steve French","email":"smfrench@gmail.com"},"content":"merged the first 4 into smb3-kernel ksmbd-for-next\n\nOn Tue, Apr 7, 2026 at 9:47 AM Stefan Metzmacher <metze@samba.org> wrote:\n>\n> Hi,\n>\n> as the work to unify the smbdirect code\n> between cifs.ko and ksmbd.ko into an smbdirect.ko\n> is in linux-next for a while this is the next\n> step to also share the code with userspace\n> e.g. Samba as client and server.\n>\n> The SMBDIRECT protocol, defined in [MS-SMBD] by Microsoft.\n> It is used as wrapper around RDMA in order to provide a transport for SMB3,\n> but Microsoft also uses it as transport for other protocols.\n>\n> SMBDIRECT works over Infiniband, RoCE and iWarp.  RoCEv2 is based on IP/UDP\n> and iWarp is based on IP/TCP, so these use IP addresses natively.\n> Infiniband and RoCEv1 require IPOIB in order to be used for SMBDIRECT.\n>\n> So instead of adding a PF_SMBDIRECT, which would only use AF_INET[6],\n> we use IPPROTO_SMBDIRECT instead, this uses a number not\n> allocated from IANA, as it would not appear in an IP header.\n>\n> This is similar to IPPROTO_SMC, IPPROTO_MPTCP and IPPROTO_QUIC,\n> which are linux specific values for the socket() syscall.\n>\n>   socket(AF_INET, SOCK_STREAM, IPPROTO_SMBDIRECT);\n>   socket(AF_INET6, SOCK_STREAM, IPPROTO_SMBDIRECT);\n>\n> This will allow the existing smbdirect code used by\n> cifs.ko and ksmbd.ko to be moved behind the socket layer [1],\n> so that there's less special handling. Only sock_sendmsg()\n> sock_recvmsg() are used, so that the main stream handling\n> is done all the same for tcp, smbdirect and later also quic.\n>\n> The special RDMA read/write handling will be via direct\n> function calls as they are currently done for the in kernel\n> consumers.\n>\n> As a start __sock_create(kern=0)/sk->sk_kern_sock == 0 will\n> still cause a -EPROTONOSUPPORT. So only in kernel consumers\n> will be supported for now.\n>\n> For now the core smbdirect code still supports both\n> modes, direct calls in indirect via the socket layer.\n> The core code uses if (sc->sk.sk_family) as indication\n> for the new socket mode. Once cifs.ko and ksmbd.ko\n> are converted we can remove the old mode slowly,\n> but I'll deferr that to a future patchset.\n>\n> There's still a way to go in order to make this\n> as generic as tcp and quic e.g. adding MSG_SPLICE_PAGES support or\n> splice_read/read_sock/read_skb.\n>\n> But it's a good start, which will make changes much easier.\n>\n> This patchset is based on top of the smbdirect.ko patches\n> in ksmbd-for-next and it's also based on netdev-next\n> because it needs this commit from there:\n> 8341c989ac77d712c7d6e2bce29e8a4bcb2eeae4\n> \"net: remove addr_len argument of recvmsg() handlers\"\n>\n> Patches 1-4 are some preparation fixes for the\n> existing smbdirect.ko patchset. We may\n> squash them into the existing patches before\n> sending them to Linus. But for now I kept\n> them separately. I also don't cc the network and rdma\n> people on these...\n>\n> Patch 5 defines IPPROTO_SMBDIRECT and SOL_SMBDIRECT\n> constants (and also reserve the number 288 for SOL_QUIC\n> as applications are already using that and we don't\n> want to conflict)\n>\n> Patch 6 adds basic IPPROTO_SMBDIRECT layering\n> on top of the existing smbdirect code.\n> This is just enough in order to let cifs.ko\n> and ksmbd.ko use it in the following commits,\n> so userspace still sees -EPROTONOSUPPORT.\n>\n> Patch 7 converts cifs.ko to use IPPROTO_SMBDIRECT\n> as much as currently possible.\n> Using sock_sendmsg is not yet possible, because of the\n> tcp_sock_set_cork usage, but that will change in future.\n>\n> Patch 8 converts ksmbd.ko to use IPPROTO_SMBDIRECT.\n>\n> Because of the need for netdev-next commit\n> 8341c989ac77d712c7d6e2bce29e8a4bcb2eeae4\n> \"net: remove addr_len argument of recvmsg() handlers\"\n> it's a bit tricky to prepare something that would not\n> cause problems in linux-next.\n>\n> We could merge in netdev-next completely,\n> but I saw commit 00f03539e3d97af925abf42992d8c46167d54243\n> in next-20260406, indicates some resolved conflicts\n> with (at least) the rdma tree, which comes\n> just before netdev-next, while ksmbd-for-next is merged\n> before all of them. So merging netdev-next into\n> ksmbd-for-next changes the order of netdev-next vs. rdma.\n>\n> Or we add a new branch smbdirect-for-next that's\n> merged into linux-next after netdev-next.\n>\n> Or a bit hacky but likely easier, ksmbd-for-next\n> just cherry-picks 8341c989ac77d712c7d6e2bce29e8a4bcb2eeae4\n> \"net: remove addr_len argument of recvmsg() handlers\"\n> and that cherry picked commit is reverted as\n> last commit in ksmbd-for-next, or only in linux-next\n> right before netdev-next is merged.\n>\n> For now I have the patches in a branch with a\n> cherry picked version of the needed commit only, see\n> for-7.1/ipproto-smbdirect-20260407-v1 at commit:\n> e1972e6f1fda9842c5724b7daf4a2aa7779901a5\n> git fetch https://git.samba.org/metze/linux/wip.git for-7.1/ipproto-smbdirect-20260407-v1\n> https://git.samba.org/?p=metze/linux/wip.git;a=shortlog;h=refs/heads/for-7.1/ipproto-smbdirect-20260407-v1\n>\n> It would be great to get this somehow into linux-next soon :-)\n>\n> Stefan Metzmacher (8):\n>   smb: smbdirect: change\n>     smbdirect_socket_parameters.{initiator_depth,responder_resources} to\n>     __u16\n>   smb: smbdirect: fix copyright header of smbdirect.h\n>   smb: smbdirect: fix the logic in smbdirect_socket_destroy_sync()\n>     without an error\n>   smb: smbdirect: let smbdirect_connection_deregister_mr_io unlock while\n>     waiting\n>   net: define IPPROTO_SMBDIRECT and SOL_SMBDIRECT constants\n>   smb: smbdirect: add in kernel only support for IPPROTO_SMBDIRECT\n>   smb: client: make use of IPPROTO_SMBDIRECT sockets\n>   smb: server: make use of IPPROTO_SMBDIRECT sockets\n>\n>  fs/smb/client/cifs_debug.c                    |    2 +-\n>  fs/smb/client/cifsfs.c                        |    2 +-\n>  fs/smb/client/cifsglob.h                      |    7 +-\n>  fs/smb/client/connect.c                       |  123 +-\n>  fs/smb/client/file.c                          |    8 +-\n>  fs/smb/client/sess.c                          |    4 +-\n>  fs/smb/client/smb2ops.c                       |    8 +-\n>  fs/smb/client/smb2pdu.c                       |   10 +-\n>  fs/smb/client/smbdirect.c                     |  275 +--\n>  fs/smb/client/smbdirect.h                     |   27 +-\n>  fs/smb/client/transport.c                     |    2 +-\n>  fs/smb/common/smbdirect/Makefile              |    1 +\n>  fs/smb/common/smbdirect/smbdirect.h           |   69 +-\n>  fs/smb/common/smbdirect/smbdirect_accept.c    |   14 +-\n>  .../common/smbdirect/smbdirect_connection.c   |   58 +\n>  fs/smb/common/smbdirect/smbdirect_devices.c   |    2 +-\n>  fs/smb/common/smbdirect/smbdirect_internal.h  |   59 +-\n>  fs/smb/common/smbdirect/smbdirect_listen.c    |   49 +-\n>  fs/smb/common/smbdirect/smbdirect_main.c      |   45 +\n>  fs/smb/common/smbdirect/smbdirect_mr.c        |   18 +\n>  fs/smb/common/smbdirect/smbdirect_proto.c     | 1549 +++++++++++++++++\n>  fs/smb/common/smbdirect/smbdirect_public.h    |    3 +\n>  fs/smb/common/smbdirect/smbdirect_rw.c        |   29 +-\n>  fs/smb/common/smbdirect/smbdirect_socket.c    |  180 +-\n>  fs/smb/common/smbdirect/smbdirect_socket.h    |   26 +-\n>  fs/smb/server/transport_rdma.c                |  119 +-\n>  include/linux/socket.h                        |    2 +\n>  include/uapi/linux/in.h                       |    2 +\n>  28 files changed, 2320 insertions(+), 373 deletions(-)\n>  create mode 100644 fs/smb/common/smbdirect/smbdirect_proto.c\n>\n> --\n> 2.43.0\n>","headers":{"Return-Path":"\n <linux-cifs+bounces-10703-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-cifs@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=G/kTL+SO;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10703-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"G/kTL+SO\"","smtp.subspace.kernel.org;\n arc=pass smtp.client-ip=209.85.219.54","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fqzcH3ngHz1xv0\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 07:19:59 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id CB03E3004635\n\tfor <incoming@patchwork.ozlabs.org>; Tue,  7 Apr 2026 21:18:58 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 2988037C901;\n\tTue,  7 Apr 2026 21:18:58 +0000 (UTC)","from mail-qv1-f54.google.com (mail-qv1-f54.google.com\n [209.85.219.54])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F3A837BE73\n\tfor <linux-cifs@vger.kernel.org>; Tue,  7 Apr 2026 21:18:56 +0000 (UTC)","by mail-qv1-f54.google.com with SMTP id\n 6a1803df08f44-8a049a767c3so3296816d6.1\n        for <linux-cifs@vger.kernel.org>;\n Tue, 07 Apr 2026 14:18:56 -0700 (PDT)"],"ARC-Seal":["i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1775596738; cv=pass;\n b=jJbp1gev5e06ITPsL/QGqTeIA0Gb07bRKw7uGo+976PImj/VtDOHNxUi9AvhH7q1k9cnRPH8R7MWtfrc8B0vwvnkjFaygCkc5hQW8lu2uv3YLaICZFgYHKcv9epoNuV6xHLwNk9M4a+yIf2H2oY/MXz3ALWbhcjrii5+gbQryQg=","i=1; a=rsa-sha256; t=1775596735; cv=none;\n        d=google.com; s=arc-20240605;\n        b=N0WKLgPg4IYG00lhN78I+Af9CU8Vw3F0aXz+Rls+lrEF6+lzCv1VKd4bB/Yfw9PPpQ\n         l4zOApxUpaYW2twwxEOyiLBc1q7zP8Z+vPBLLrmH5pZIpvHIe78iuWY3Y2p8B3yg2ary\n         P10r1vApYBQpq6nrSGuAQ3hLIdVAJ3ZDS0rh5vsI0jG1KbWS5FKBrMYnfDG98RkGRw2r\n         zAJJJqAmb7Q9qRCv7H9tGiTB13fwyUekJ9BybdGT+SNl+lIcxi8TCv46EPTGJwU1VPIu\n         h2TaD9JjPfzlBPm44eza6jvlQ0HOHfOiKIB38Qe91uhAN8Ez+9nvlw67WAITJMDaCsw8\n         MY0g=="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1775596738; c=relaxed/simple;\n\tbh=S6tbRAzFg3MeQeTC/AMFAR2X1AQ6Sye+eMi6WllNgqk=;\n\th=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:\n\t To:Cc:Content-Type;\n b=BN+x5tf9F8mc5rj+4WWLd1AkQi/1r7j+12Q8D6aL2LWTO1UjKy/fzoRunJ6ZLWza7Dc6TN13UWoAlhj9pjkMI/Ie20fjdz16FqCu+IIVfhq3A46b9yOXIsj/qbNxXc8MIvRzFupbCiK6hFCrJPUY9nM/GCKLe2R6JdCE0GEiPxY=","i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n        h=content-transfer-encoding:cc:to:subject:message-id:date:from\n         :in-reply-to:references:mime-version:dkim-signature;\n        bh=AtDfCZKTY+IaeLMBmY9EmFTthg85aBiWG8xwPx5A83A=;\n        fh=k8A5KmGMZwD8/RM6EeDoUs58OVXODEITR5IjaOzlLIs=;\n        b=T07rn9z4SooGMFYoqJm68OryFxDvYGLmytEBUoXZLolU8aolPTd1FNruTVQKD6t/FG\n         n9SIsIom+aIzrR9i9CJ4JOH/wu67QWeF6XVtoOECengLtU4S+GuqM5EW5+mZcWyIR9J+\n         DtRkVncxMv2nME62Doe6qLG2Y+5DXV5OaaPE+Yy4ZVQddAUqI5OQl2E1C8ARA2LSFsBB\n         pXsqOOvYP1dFVafqhCnPaIJ6TEUkof4QbmonQBmbGxBoORt9cMktyXYn0a9/9EyW81/s\n         poS5PMyd6PViU+pfucgjFeSW57pR2N5DgYzoGsJADz+1nfsGOgKeIX9BGErPMOE31ifz\n         WDPQ==;\n        darn=vger.kernel.org"],"ARC-Authentication-Results":["i=2; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=G/kTL+SO; arc=pass smtp.client-ip=209.85.219.54","i=1; mx.google.com; arc=none"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1775596735; x=1776201535;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:cc:to:subject:message-id:date:from\n         :in-reply-to:references:mime-version:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=AtDfCZKTY+IaeLMBmY9EmFTthg85aBiWG8xwPx5A83A=;\n        b=G/kTL+SOOQrXHk0FC7iGqO/k/oO7jzxosL2IV/yD2jnRsS5Mtpi5yzmpIA+LN8V1p0\n         r808Wv4sWSlt+paWCn+7lvOpqd5CqOd6BP7sGrWfTn3vmF8LnwJuzckWup13xjgDEghD\n         DbCCitPlEeDewcJe7RydJePtLFbp/e3PMNcoJpwZl64vbcv7aYKLYFys1oddw7s4/IzA\n         XMtHbgYmi48HdUDtr8uwVDdstf56O1zIcpoB669ag+AL6KaQDtpHmycxsf8KYYbrwka7\n         lFfN4JOkmj6h+7/Frl+BwhFzzPBZkeSrsUO7F+7/hI24PNZDeMlq1oQXpqlwGC6GneE4\n         HbuA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1775596735; x=1776201535;\n        h=content-transfer-encoding:cc:to:subject:message-id:date:from\n         :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=AtDfCZKTY+IaeLMBmY9EmFTthg85aBiWG8xwPx5A83A=;\n        b=MhoouvvXIlU4nIzLqSuDV6QbzdXDLfPO9kPrCK37Fi5foDLBetGhU1e8gXXDwlVJTa\n         FuT/7Fv7CX1n3Xma5mG87lhBhXoIjwWsCBYdCr+ZefytZ5Nvp8R1OfPMHOamp1SQUeJh\n         MYakQjiw+6hUBY7dPhhVDDoPc83WyZy+5bSFg3LBvjUhILC03qFjTu6dWxq0MrqVsnh8\n         xJWmB7wndJl69nbjjrhZuVqkRRpAxGuVIurhh8BB0m7f4yEjE36ptPHwZuqc8P/+680W\n         bdOBuqkM1o4NFRNvT4RoviiqzXhyuSD2hsulCSb7alrljNkfkeHLpNEPlSPD6KxKMvgz\n         ojXQ==","X-Gm-Message-State":"AOJu0YyNnkLWVbDUs/FDdx9RJvq2IOguPiVyZDJP49fXmf08jrGpK6m8\n\tPUTBJL3FL2L9jjYC9xeBTU5nytz0fsmgqGOJYITeaSqEPknu/WXERHe7CXc/hQlt+47CdkxVqBx\n\tkShf1HmNsbRvoJ86pwH77z3X5Dtlgwk8=","X-Gm-Gg":"AeBDieubD4lugEZoALxo+Bhvs+k15TEuLUfZg8MUQU5f0tae3xBGHQxPIwNHcelNG4Q\n\tMrsvUO+KutKsQ5MGajbCufp9MPa+DHm7r8+SMIEKZsufE+B7CS+TdnFJnU7wclj+NQ2OsVuYx3N\n\tjJRrVvXse+v2ElsE/ksov3WlQobVf91f/+fxHeGI9FQER54c9Nxu+cliQXzj1S/Zf/m5FbVZEAk\n\tu+Y0O3F4tp5AhNUGOkUnId/P/gXCainSo81kuCkCm+3m0LSagKQzLTBLTGAw+urXPUwd+bY7U5E\n\tl8v+hUMBjfqurIydMlOStP/xXEHl91m0DasX9TfiOZejpO6AT08GMRkjHce4ztAH2Cf7NHLqC/x\n\tK1nxL4+sVmceOsPtGOoZAUSZ7QnLcCwEzJojk7DxOQCLSpcfJeLAXoLC7CymRTXs=","X-Received":"by 2002:ad4:5ce8:0:b0:89c:4bba:1a93 with SMTP id\n 6a1803df08f44-8a703365784mr253792856d6.5.1775596735345; Tue, 07 Apr 2026\n 14:18:55 -0700 (PDT)","Precedence":"bulk","X-Mailing-List":"linux-cifs@vger.kernel.org","List-Id":"<linux-cifs.vger.kernel.org>","List-Subscribe":"<mailto:linux-cifs+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-cifs+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","References":"<cover.1775571957.git.metze@samba.org>","In-Reply-To":"<cover.1775571957.git.metze@samba.org>","From":"Steve French <smfrench@gmail.com>","Date":"Tue, 7 Apr 2026 16:18:44 -0500","X-Gm-Features":"AQROBzB6Yld8UuN4npSuWr9ACQ2pYlmn8Fwib8wPVlNW8GVvQnEYxNySzkbOOyc","Message-ID":"\n <CAH2r5mvR_ZVaNKVC+5Y-g-UZkH3FAbV39U28Pz2MjUUSVUNnMQ@mail.gmail.com>","Subject":"Re: [PATCH 0/8] smb: add kernel internal IPPROTO_SMBDIRECT","To":"Stefan Metzmacher <metze@samba.org>","Cc":"linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,\n\tTom Talpey <tom@talpey.com>, Long Li <longli@microsoft.com>,\n\tNamjae Jeon <linkinjeon@kernel.org>, David Howells <dhowells@redhat.com>,\n\tHenrique Carvalho <henrique.carvalho@suse.com>,\n \"David S . Miller\" <davem@davemloft.net>,\n\tEric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>,\n Paolo Abeni <pabeni@redhat.com>,\n\tSimon Horman <horms@kernel.org>, Kuniyuki Iwashima <kuniyu@google.com>,\n\tWillem de Bruijn <willemb@google.com>, netdev@vger.kernel.org,\n\tXin Long <lucien.xin@gmail.com>, quic@lists.linux.dev,\n linux-rdma@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org, Mark Brown <broonie@kernel.org>,\n\tlinux-next@vger.kernel.org","Content-Type":"text/plain; charset=\"UTF-8\"","Content-Transfer-Encoding":"quoted-printable"}}]