From nobody Mon Dec 1 22:36:15 2025 Received: from hr2.samba.org (hr2.samba.org [144.76.82.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1995C1A23B9; Wed, 26 Nov 2025 11:19:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=144.76.82.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764155991; cv=none; b=Bzi6NdLppUsU4ToIjWEmqWTeFCuJ1JSZfLUt+pmTxbx9fw5rMhBv8QDe8Pf6NT6kz4OzJhxkYiSr+EOsVTibvXmLQnp2y/euj+dLf8JSeKaEAwWNAZAbPfp9Zfx4MgFkqFa59CSwdNNyJOa+D8Ucm7d00tDoAZf/7AlfyS3FAwk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764155991; c=relaxed/simple; bh=g3hn8AjbhMVAx+wCU06zKPVtYRw9XskdtyCrp63n4I4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Xqapl84fCl/5H55UEELgdiE5G+rHospGMj9MG4RiG9PCXVix5Lf2LD2hUNSbuLkk/2MkhO91rjvyYedwmGxqjQKttKtt0w7N8z05GXvDbGwLyvf1F9UcXLbHwOKczTREcV4efxrJO0EYfk3FZ5tnfBSgOIdxhhHlcDwxmIFr3/A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=samba.org; spf=pass smtp.mailfrom=samba.org; dkim=pass (3072-bit key) header.d=samba.org header.i=@samba.org header.b=WQIGuiAF; arc=none smtp.client-ip=144.76.82.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=samba.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samba.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (3072-bit key) header.d=samba.org header.i=@samba.org header.b="WQIGuiAF" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42; h=Message-ID:Date:Cc:To:From; bh=8Gw8eUmrcCieUahIupp42RD4TKbZ1gHNJBT+5hmtk8k=; b=WQIGuiAFdol8RQXtAa4GO+t2cb 1ivw7FA3SmrTyxzaq6BkYUc78UK184SnZ4Zcld7Aar9vGoZ6I1aHYRPeWaoa2Rn3DvNLRN/tNEU6t wZMnfGt62MenU5XW8qgExaqNbthCGObMVFu9WcP9rmV3o3KwPcgl413PHSxihdt/fLkcZ9PRfn0+z wdZjq1u1Cbe8MuBYSB6eZlrQ5G0d1aSYrjsrcR2TkgHIX7/wwBG93p2EuBEpdz8yY7YOaHpl5bUpA aq99/BrfaI1XI0+QYNlw0NaGYsTi5zCCBzrQjj5dWq07hUBNNCi9eNGCSuRgO4Iyd5OL92wyCYLyJ vzu0jPSy0KvtlHsgffe7cfHmmcJUGN+ACMWtDHP/hz/lH2t+17c4RFF6LKCFBD0sBqLBrWvPDX0EK 1nIZ9TbkORTxjaS28PHTmaPVdMRdg1mjtgHx6j6Kv68FYC3fjJwHzb+TY38+2IVu9cRMW+aFXVNBE gxbamThM8YgIyQHVf9jSxY40; Received: from [127.0.0.2] (localhost [127.0.0.1]) by hr2.samba.org with esmtpsa (TLS1.3:ECDHE_SECP256R1__ECDSA_SECP256R1_SHA256__CHACHA20_POLY1305:256) (Exim) id 1vODYn-00FpGv-10; Wed, 26 Nov 2025 11:19:45 +0000 From: Stefan Metzmacher To: io-uring@vger.kernel.org Cc: metze@samba.org, Jens Axboe , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Kuniyuki Iwashima , Willem de Bruijn , netdev@vger.kernel.org, linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] io_uring/net: wire up support for sk->sk_prot->uring_cmd() with SOCKET_URING_OP_PASSTHROUGH_FLAG Date: Wed, 26 Nov 2025 12:19:31 +0100 Message-ID: <20251126111931.1788970-1-metze@samba.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This will allow network protocols to implement async operations instead of using ioctl() syscalls. By using the high bit there's more than enough room for generic calls to be added, but also more than enough for protocols to implement their own specific opcodes. The IPPROTO_SMBDIRECT socket layer [1] I'm currently working on, will use this in future in order to let Samba use efficient RDMA offload. [1] https://git.samba.org/?p=3Dmetze/linux/wip.git;a=3Dshortlog;h=3Drefs/heads/= master-ipproto-smbdirect Cc: Jens Axboe Cc: David S. Miller Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Simon Horman Cc: Kuniyuki Iwashima Cc: Willem de Bruijn Cc: io-uring@vger.kernel.org Cc: netdev@vger.kernel.org Cc: linux-cifs@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Stefan Metzmacher --- This is based on for-6.19/io_uring + the 3 "Introduce getsockname io_uring_cmd" patches from https://lore.kernel.org/io-uring/20251125211806.2673912-1-krisman@suse.de/ as the addition of SOCKET_URING_OP_GETSOCKNAME would conflict with the addition of SOCKET_URING_OP_PASSTHROUGH_FLAG --- include/net/sock.h | 4 ++++ include/uapi/linux/io_uring.h | 7 +++++++ io_uring/cmd_net.c | 2 ++ 3 files changed, 13 insertions(+) diff --git a/include/net/sock.h b/include/net/sock.h index 60bcb13f045c..ffcee4792589 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -98,6 +98,7 @@ typedef struct { struct sock; struct proto; struct net; +struct io_uring_cmd; =20 typedef __u32 __bitwise __portpair; typedef __u64 __bitwise __addrpair; @@ -1272,6 +1273,9 @@ struct proto { =20 int (*ioctl)(struct sock *sk, int cmd, int *karg); + int (*uring_cmd)(struct sock *sk, + struct io_uring_cmd *ioucmd, + unsigned int issue_flags); int (*init)(struct sock *sk); void (*destroy)(struct sock *sk); void (*shutdown)(struct sock *sk, int how); diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h index b5b23c0d5283..62ce6cb7d145 100644 --- a/include/uapi/linux/io_uring.h +++ b/include/uapi/linux/io_uring.h @@ -1010,6 +1010,13 @@ enum io_uring_socket_op { SOCKET_URING_OP_SETSOCKOPT, SOCKET_URING_OP_TX_TIMESTAMP, SOCKET_URING_OP_GETSOCKNAME, + + /* + * This lets the sk->sk_prot->uring_cmd() + * handle it, giving it enough space for + * custom opcodes. + */ + SOCKET_URING_OP_PASSTHROUGH_FLAG =3D 0x80000000 }; =20 /* diff --git a/io_uring/cmd_net.c b/io_uring/cmd_net.c index 5d11caf5509c..964f1764fa67 100644 --- a/io_uring/cmd_net.c +++ b/io_uring/cmd_net.c @@ -182,6 +182,8 @@ int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigne= d int issue_flags) case SOCKET_URING_OP_GETSOCKNAME: return io_uring_cmd_getsockname(sock, cmd, issue_flags); default: + if (cmd->cmd_op & SOCKET_URING_OP_PASSTHROUGH_FLAG && prot->uring_cmd) + return prot->uring_cmd(sk, cmd, issue_flags); return -EOPNOTSUPP; } } --=20 2.43.0