Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	quic@lists.linux.dev, davem@davemloft.net, kuba@kernel.org,
	Eric Dumazet <edumazet@google.com>,
	Simon Horman <horms@kernel.org>,
	Stefan Metzmacher <metze@samba.org>,
	Moritz Buhl <mbuhl@openbsd.org>,
	Tyler Fanelli <tfanelli@redhat.com>,
	Pengtao He <hepengtao@xiaomi.com>,
	linux-cifs@vger.kernel.org, Steve French <smfrench@gmail.com>,
	Namjae Jeon <linkinjeon@kernel.org>,
	Paulo Alcantara <pc@manguebit.com>, Tom Talpey <tom@talpey.com>,
	kernel-tls-handshake@lists.linux.dev,
	Chuck Lever <chuck.lever@oracle.com>,
	Jeff Layton <jlayton@kernel.org>,
	Benjamin Coddington <bcodding@redhat.com>,
	Steve Dickson <steved@redhat.com>, Hannes Reinecke <hare@suse.de>,
	Alexander Aring <aahringo@redhat.com>,
	David Howells <dhowells@redhat.com>,
	Matthieu Baerts <matttbe@kernel.org>,
	John Ericson <mail@johnericson.me>,
	Cong Wang <xiyou.wangcong@gmail.com>,
	"D . Wythe" <alibuda@linux.alibaba.com>,
	Jason Baron <jbaron@akamai.com>,
	illiliti <illiliti@protonmail.com>,
	Sabrina Dubroca <sd@queasysnail.net>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Daniel Stenberg <daniel@haxx.se>,
	Andy Gospodarek <andrew.gospodarek@broadcom.com>
Subject: Re: [PATCH net-next v3 02/15] net: build socket infrastructure for QUIC protocol
Date: Thu, 25 Sep 2025 17:53:18 +0200	[thread overview]
Message-ID: <ada89946-b0c2-4679-9918-1c89cf2be0c6@redhat.com> (raw)
In-Reply-To: <CADvbK_dxOHmDycm1D3-Ga4YSP7E2S91SQD1bdL+u2s-f+=Bkxg@mail.gmail.com>

On 9/23/25 5:47 PM, Xin Long wrote:
> On Tue, Sep 23, 2025 at 7:07 AM Paolo Abeni <pabeni@redhat.com> wrote:
>>
>> On 9/19/25 12:34 AM, Xin Long wrote:
>>> This patch lays the groundwork for QUIC socket support in the kernel.
>>> It defines the core structures and protocol hooks needed to create
>>> QUIC sockets, without implementing any protocol behavior at this stage.
>>>
>>> Basic integration is included to allow building the module via
>>> CONFIG_IP_QUIC=m.
>>>
>>> This provides the scaffolding necessary for adding actual QUIC socket
>>> behavior in follow-up patches.
>>>
>>> Signed-off-by: Pengtao He <hepengtao@xiaomi.com>
>>> Signed-off-by: Xin Long <lucien.xin@gmail.com>
>>> ---
>>> v3:
>>>   - Kconfig: add 'default n' for IP_QUIC (reported by Paolo).
>>>   - quic_disconnect(): return -EOPNOTSUPP (suggested by Paolo).
>>>   - quic_init/destroy_sock(): drop local_bh_disable/enable() calls (noted
>>>     by Paolo).
>>>   - sysctl: add alpn_demux option to en/disable ALPN-based demux.
>>>   - SNMP: remove SNMP_MIB_SENTINEL, switch to
>>>     snmp_get_cpu_field_batch_cnt() to align with latest net-next changes.
>>> ---
>>>  net/Kconfig         |   1 +
>>>  net/Makefile        |   1 +
>>>  net/quic/Kconfig    |  36 +++++
>>>  net/quic/Makefile   |   8 +
>>>  net/quic/protocol.c | 379 ++++++++++++++++++++++++++++++++++++++++++++
>>>  net/quic/protocol.h |  56 +++++++
>>>  net/quic/socket.c   | 207 ++++++++++++++++++++++++
>>>  net/quic/socket.h   |  79 +++++++++
>>>  8 files changed, 767 insertions(+)
>>>  create mode 100644 net/quic/Kconfig
>>>  create mode 100644 net/quic/Makefile
>>>  create mode 100644 net/quic/protocol.c
>>>  create mode 100644 net/quic/protocol.h
>>>  create mode 100644 net/quic/socket.c
>>>  create mode 100644 net/quic/socket.h
>>>
>>> diff --git a/net/Kconfig b/net/Kconfig
>>> index d5865cf19799..1205f5b7cf59 100644
>>> --- a/net/Kconfig
>>> +++ b/net/Kconfig
>>> @@ -249,6 +249,7 @@ source "net/bridge/netfilter/Kconfig"
>>>
>>>  endif # if NETFILTER
>>>
>>> +source "net/quic/Kconfig"
>>>  source "net/sctp/Kconfig"
>>>  source "net/rds/Kconfig"
>>>  source "net/tipc/Kconfig"
>>> diff --git a/net/Makefile b/net/Makefile
>>> index aac960c41db6..7c6de28e9aa5 100644
>>> --- a/net/Makefile
>>> +++ b/net/Makefile
>>> @@ -42,6 +42,7 @@ obj-$(CONFIG_PHONET)                += phonet/
>>>  ifneq ($(CONFIG_VLAN_8021Q),)
>>>  obj-y                                += 8021q/
>>>  endif
>>> +obj-$(CONFIG_IP_QUIC)                += quic/
>>>  obj-$(CONFIG_IP_SCTP)                += sctp/
>>>  obj-$(CONFIG_RDS)            += rds/
>>>  obj-$(CONFIG_WIRELESS)               += wireless/
>>> diff --git a/net/quic/Kconfig b/net/quic/Kconfig
>>> new file mode 100644
>>> index 000000000000..1f10a452b3a1
>>> --- /dev/null
>>> +++ b/net/quic/Kconfig
>>> @@ -0,0 +1,36 @@
>>> +# SPDX-License-Identifier: GPL-2.0-or-later
>>> +#
>>> +# QUIC configuration
>>> +#
>>> +
>>> +menuconfig IP_QUIC
>>> +     tristate "QUIC: A UDP-Based Multiplexed and Secure Transport (Experimental)"
>>> +     depends on INET
>>> +     depends on IPV6
>>> +     select CRYPTO
>>> +     select CRYPTO_HMAC
>>> +     select CRYPTO_HKDF
>>> +     select CRYPTO_AES
>>> +     select CRYPTO_GCM
>>> +     select CRYPTO_CCM
>>> +     select CRYPTO_CHACHA20POLY1305
>>> +     select NET_UDP_TUNNEL
>>> +     default n
>>> +     help
>>> +       QUIC: A UDP-Based Multiplexed and Secure Transport
>>> +
>>> +       From rfc9000 <https://www.rfc-editor.org/rfc/rfc9000.html>.
>>> +
>>> +       QUIC provides applications with flow-controlled streams for structured
>>> +       communication, low-latency connection establishment, and network path
>>> +       migration.  QUIC includes security measures that ensure
>>> +       confidentiality, integrity, and availability in a range of deployment
>>> +       circumstances.  Accompanying documents describe the integration of
>>> +       TLS for key negotiation, loss detection, and an exemplary congestion
>>> +       control algorithm.
>>> +
>>> +       To compile this protocol support as a module, choose M here: the
>>> +       module will be called quic. Debug messages are handled by the
>>> +       kernel's dynamic debugging framework.
>>> +
>>> +       If in doubt, say N.
>>> diff --git a/net/quic/Makefile b/net/quic/Makefile
>>> new file mode 100644
>>> index 000000000000..020e4dd133d8
>>> --- /dev/null
>>> +++ b/net/quic/Makefile
>>> @@ -0,0 +1,8 @@
>>> +# SPDX-License-Identifier: GPL-2.0-or-later
>>> +#
>>> +# Makefile for QUIC support code.
>>> +#
>>> +
>>> +obj-$(CONFIG_IP_QUIC) += quic.o
>>> +
>>> +quic-y := protocol.o socket.o
>>> diff --git a/net/quic/protocol.c b/net/quic/protocol.c
>>> new file mode 100644
>>> index 000000000000..f79f43f0c17f
>>> --- /dev/null
>>> +++ b/net/quic/protocol.c
>>> @@ -0,0 +1,379 @@
>>> +// SPDX-License-Identifier: GPL-2.0-or-later
>>> +/* QUIC kernel implementation
>>> + * (C) Copyright Red Hat Corp. 2023
>>> + *
>>> + * This file is part of the QUIC kernel implementation
>>> + *
>>> + * Initialization/cleanup for QUIC protocol support.
>>> + *
>>> + * Written or modified by:
>>> + *    Xin Long <lucien.xin@gmail.com>
>>> + */
>>> +
>>> +#include <net/inet_common.h>
>>> +#include <linux/proc_fs.h>
>>> +#include <net/protocol.h>
>>> +#include <net/rps.h>
>>> +#include <net/tls.h>
>>> +
>>> +#include "socket.h"
>>> +
>>> +static unsigned int quic_net_id __read_mostly;
>>> +
>>> +struct percpu_counter quic_sockets_allocated;
>>> +
>>> +long sysctl_quic_mem[3];
>>> +int sysctl_quic_rmem[3];
>>> +int sysctl_quic_wmem[3];
>>> +int sysctl_quic_alpn_demux;
>>> +
>>> +static int quic_inet_connect(struct socket *sock, struct sockaddr *addr, int addr_len, int flags)
>>> +{
>>> +     struct sock *sk = sock->sk;
>>> +     const struct proto *prot;
>>> +
>>> +     if (addr_len < (int)sizeof(addr->sa_family))
>>> +             return -EINVAL;
>>> +
>>> +     prot = READ_ONCE(sk->sk_prot);
>>
>> Is the above _ONCE() annotation for ADDRFORM's sake? If so it should not
>> be needed (only UDP and TCP sockets are affected).
> I will delete it.
> 
>>
>>> diff --git a/net/quic/socket.h b/net/quic/socket.h
>>> new file mode 100644
>>> index 000000000000..ded8eb2e6a9c
>>> --- /dev/null
>>> +++ b/net/quic/socket.h
>>> @@ -0,0 +1,79 @@
>>> +/* SPDX-License-Identifier: GPL-2.0-or-later */
>>> +/* QUIC kernel implementation
>>> + * (C) Copyright Red Hat Corp. 2023
>>> + *
>>> + * This file is part of the QUIC kernel implementation
>>> + *
>>> + * Written or modified by:
>>> + *    Xin Long <lucien.xin@gmail.com>
>>> + */
>>> +
>>> +#include <net/udp_tunnel.h>
>>> +
>>> +#include "protocol.h"
>>> +
>>> +extern struct proto quic_prot;
>>> +extern struct proto quicv6_prot;
>>> +
>>> +enum quic_state {
>>> +     QUIC_SS_CLOSED          = TCP_CLOSE,
>>> +     QUIC_SS_LISTENING       = TCP_LISTEN,
>>> +     QUIC_SS_ESTABLISHING    = TCP_SYN_RECV,
>>> +     QUIC_SS_ESTABLISHED     = TCP_ESTABLISHED,
>>> +};
>>
>> Any special reason to define protocol-specific states? I guess you could
>> re-use the TCP ones, as other protocols already do.
>>
> I know TIPC and SCTP define the states like this:
> 
> enum {
>         TIPC_LISTEN = TCP_LISTEN,
>         TIPC_ESTABLISHED = TCP_ESTABLISHED,
>         TIPC_OPEN = TCP_CLOSE,
>         TIPC_DISCONNECTING = TCP_CLOSE_WAIT,
>         TIPC_CONNECTING = TCP_SYN_SENT,
> };
> 
> and
> 
> enum sctp_sock_state {
>         SCTP_SS_CLOSED         = TCP_CLOSE,
>         SCTP_SS_LISTENING      = TCP_LISTEN,
>         SCTP_SS_ESTABLISHING   = TCP_SYN_SENT,
>         SCTP_SS_ESTABLISHED    = TCP_ESTABLISHED,
>         SCTP_SS_CLOSING        = TCP_CLOSE_WAIT,
> };
> 
> It should be fine to keep as is, or you have more and better
> examples from other protocols.

IMHO the cost/benfit ratio to re-define the socket state value is in not
enough to justify the additional LoC. I guess it's subjective, but the
patch series is big and anything shrinking it is IMHO a good thing.

/P


  reply	other threads:[~2025-09-25 15:53 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-18 22:34 [PATCH net-next v3 00/15] net: introduce QUIC infrastructure and core subcomponents Xin Long
2025-09-18 22:34 ` [PATCH net-next v3 01/15] net: define IPPROTO_QUIC and SOL_QUIC constants Xin Long
2025-09-18 22:34 ` [PATCH net-next v3 02/15] net: build socket infrastructure for QUIC protocol Xin Long
2025-09-23 11:07   ` Paolo Abeni
2025-09-23 15:47     ` Xin Long
2025-09-25 15:53       ` Paolo Abeni [this message]
2025-09-18 22:34 ` [PATCH net-next v3 03/15] quic: provide common utilities and data structures Xin Long
2025-09-23  9:06   ` Simon Horman
2025-09-23 15:49     ` Xin Long
2025-09-23 11:21   ` Paolo Abeni
2025-09-23 16:06     ` Xin Long
2025-09-25 15:50       ` Paolo Abeni
2025-09-18 22:34 ` [PATCH net-next v3 04/15] quic: provide family ops for address and protocol Xin Long
2025-09-23 11:30   ` Paolo Abeni
2025-09-23 16:15     ` Xin Long
2025-09-18 22:34 ` [PATCH net-next v3 05/15] quic: provide quic.h header files for kernel and userspace Xin Long
2025-09-18 22:34 ` [PATCH net-next v3 06/15] quic: add stream management Xin Long
2025-09-23  9:09   ` Simon Horman
2025-09-23 17:30     ` Xin Long
2025-09-23 13:39   ` Paolo Abeni
2025-09-23 17:57     ` Xin Long
2025-09-25 16:03       ` Paolo Abeni
2025-09-18 22:34 ` [PATCH net-next v3 07/15] quic: add connection id management Xin Long
2025-09-18 22:34 ` [PATCH net-next v3 08/15] quic: add path management Xin Long
2025-09-18 22:34 ` [PATCH net-next v3 09/15] quic: add congestion control Xin Long
2025-09-23 13:55   ` Paolo Abeni
2025-09-23 19:37     ` Xin Long
2025-09-18 22:34 ` [PATCH net-next v3 10/15] quic: add packet number space Xin Long
2025-09-18 22:35 ` [PATCH net-next v3 11/15] quic: add crypto key derivation and installation Xin Long
2025-09-18 22:35 ` [PATCH net-next v3 12/15] quic: add crypto packet encryption and decryption Xin Long
2025-09-18 22:35 ` [PATCH net-next v3 13/15] quic: add timer management Xin Long
2025-09-18 22:35 ` [PATCH net-next v3 14/15] quic: add frame encoder and decoder base Xin Long
2025-09-18 22:35 ` [PATCH net-next v3 15/15] quic: add packet builder and parser base Xin Long
2025-09-19  6:43 ` [PATCH net-next v3 00/15] net: introduce QUIC infrastructure and core subcomponents Hannes Reinecke
2025-09-19 14:41   ` Xin Long

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=ada89946-b0c2-4679-9918-1c89cf2be0c6@redhat.com \
    --to=pabeni@redhat.com \
    --cc=aahringo@redhat.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=bcodding@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=daniel@haxx.se \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=edumazet@google.com \
    --cc=hare@suse.de \
    --cc=hepengtao@xiaomi.com \
    --cc=horms@kernel.org \
    --cc=illiliti@protonmail.com \
    --cc=jbaron@akamai.com \
    --cc=jlayton@kernel.org \
    --cc=kernel-tls-handshake@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=mail@johnericson.me \
    --cc=marcelo.leitner@gmail.com \
    --cc=matttbe@kernel.org \
    --cc=mbuhl@openbsd.org \
    --cc=metze@samba.org \
    --cc=netdev@vger.kernel.org \
    --cc=pc@manguebit.com \
    --cc=quic@lists.linux.dev \
    --cc=sd@queasysnail.net \
    --cc=smfrench@gmail.com \
    --cc=steved@redhat.com \
    --cc=tfanelli@redhat.com \
    --cc=tom@talpey.com \
    --cc=xiyou.wangcong@gmail.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