From: Xin Long <lucien.xin@gmail.com>
To: Paolo Abeni <pabeni@redhat.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>,
Thomas Dreibholz <dreibh@simula.no>,
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>,
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 v8 14/15] quic: add packet builder base
Date: Thu, 29 Jan 2026 14:39:36 -0500 [thread overview]
Message-ID: <CADvbK_d9FE+Z72JpdFER65dJ7X19Or_m0sLBPdWOZP9DPbksQA@mail.gmail.com> (raw)
In-Reply-To: <b0045978-ea65-422b-8260-d079b43eb553@redhat.com>
On Thu, Jan 29, 2026 at 11:40 AM Paolo Abeni <pabeni@redhat.com> wrote:
>
> On 1/26/26 3:51 PM, Xin Long wrote:
> > +/* Configure the QUIC packet header and routing based on encryption level and path. */
> > +int quic_packet_config(struct sock *sk, u8 level, u8 path)
> > +{
> > + struct quic_conn_id_set *dest = quic_dest(sk), *source = quic_source(sk);
> > + struct quic_packet *packet = quic_packet(sk);
> > + struct quic_config *c = quic_config(sk);
> > + u32 hlen = QUIC_HLEN;
> > +
> > + /* If packet already has data, no need to reconfigure. */
> > + if (!quic_packet_empty(packet))
> > + return 0;
> > +
> > + packet->ack_eliciting = 0;
> > + packet->frame_len = 0;
> > + packet->ipfragok = 0;
> > + packet->padding = 0;
> > + packet->frames = 0;
> > + hlen += QUIC_PACKET_NUMBER_LEN; /* Packet number length. */
> > + hlen += quic_conn_id_choose(dest, path)->len; /* DCID length. */
> > + if (level) {
> > + hlen += 1; /* Length byte for DCID. */
> > + hlen += 1 + quic_conn_id_active(source)->len; /* Length byte + SCID length. */
> > + if (level == QUIC_CRYPTO_INITIAL) /* Include token for Initial packets. */
> > + hlen += quic_var_len(quic_token(sk)->len) + quic_token(sk)->len;
> > + hlen += QUIC_VERSION_LEN; /* Version length. */
> > + hlen += QUIC_PACKET_LENGTH_LEN; /* Packet length field length. */
> > + /* Allow fragmentation if PLPMTUD is enabled, as it no longer relies on ICMP
> > + * Toobig messages to discover the path MTU.
> > + */
> > + packet->ipfragok = !!c->plpmtud_probe_interval;
> > + }
> > + packet->level = level;
> > + packet->len = (u16)hlen;
> > + packet->overhead = (u8)hlen;
>
> Given the above math, it looks like hlen can never be > 255, but
> possibly a DEBUG_NET_WARN_ON_ONCE() could save from future bug and make
> the code more clear?
>
sounds good.
> > +
> > + if (packet->path != path) { /* If the path changed, update and reset routing cache. */
> > + packet->path = path;
> > + __sk_dst_reset(sk);
> > + }
> > +
> > + /* Perform routing and MSS update for the configured packet. */
> > + if (quic_packet_route(sk) < 0)
> > + return -1;
> > + return 0;
> > +}
> > +
> > +static void quic_packet_encrypt_done(struct sk_buff *skb, int err)
> > +{
> > + /* Free it for now, future patches will implement the actual deferred transmission logic. */
> > + kfree_skb(skb);
> > +}
> > +
> > +/* Coalescing Packets. */
> > +static int quic_packet_bundle(struct sock *sk, struct sk_buff *skb)
> > +{
> > + struct quic_skb_cb *head_cb, *cb = QUIC_SKB_CB(skb);
> > + struct quic_packet *packet = quic_packet(sk);
> > + struct sk_buff *p;
> > +
> > + if (!packet->head) { /* First packet to bundle: initialize the head. */
> > + packet->head = skb;
> > + cb->last = skb;
> > + goto out;
> > + }
> > +
> > + /* If bundling would exceed MSS, flush the current bundle. */
> > + if (packet->head->len + skb->len >= packet->mss[0]) {
> > + quic_packet_flush(sk);
> > + packet->head = skb;
> > + cb->last = skb;
> > + goto out;
>
> The same code is duplicate a few lines above; you could reduce
> duplication jumping to a common label.
>
will add a goto label at the end for this:
init:
packet->head = skb;
cb->last = skb;
goto out;
Thanks.
next prev parent reply other threads:[~2026-01-29 19:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-26 14:50 [PATCH net-next v8 00/15] net: introduce QUIC infrastructure and core subcomponents Xin Long
2026-01-26 14:50 ` [PATCH net-next v8 01/15] net: define IPPROTO_QUIC and SOL_QUIC constants Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 02/15] net: build socket infrastructure for QUIC protocol Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 03/15] quic: provide common utilities and data structures Xin Long
2026-01-29 16:26 ` Paolo Abeni
2026-01-29 19:40 ` Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 04/15] quic: provide family ops for address and protocol Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 05/15] quic: provide quic.h header files for kernel and userspace Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 06/15] quic: add stream management Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 07/15] quic: add connection id management Xin Long
2026-01-29 12:33 ` Paolo Abeni
2026-01-26 14:51 ` [PATCH net-next v8 08/15] quic: add path management Xin Long
2026-01-29 16:20 ` Paolo Abeni
2026-01-29 20:46 ` Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 09/15] quic: add congestion control Xin Long
2026-01-28 16:15 ` [net-next,v8,09/15] " Simon Horman
2026-01-29 19:44 ` Xin Long
2026-02-02 14:40 ` Simon Horman
2026-01-26 14:51 ` [PATCH net-next v8 10/15] quic: add packet number space Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 11/15] quic: add crypto key derivation and installation Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 12/15] quic: add crypto packet encryption and decryption Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 13/15] quic: add timer management Xin Long
2026-01-26 14:51 ` [PATCH net-next v8 14/15] quic: add packet builder base Xin Long
2026-01-29 16:40 ` Paolo Abeni
2026-01-29 19:39 ` Xin Long [this message]
2026-01-26 14:51 ` [PATCH net-next v8 15/15] quic: add packet parser base Xin Long
2026-01-29 16:53 ` Paolo Abeni
2026-01-29 19:37 ` 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=CADvbK_d9FE+Z72JpdFER65dJ7X19Or_m0sLBPdWOZP9DPbksQA@mail.gmail.com \
--to=lucien.xin@gmail.com \
--cc=aahringo@redhat.com \
--cc=alibuda@linux.alibaba.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=chuck.lever@oracle.com \
--cc=daniel@haxx.se \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=dreibh@simula.no \
--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=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=pabeni@redhat.com \
--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